replicad-pantograph 0.10.2 → 0.11.0

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.
@@ -5,17 +5,17 @@ var Me = (r) => {
5
5
  throw TypeError(r);
6
6
  };
7
7
  var Be = (r, s, t) => s in r ? Oe(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
8
- var q$2 = (r, s, t) => Be(r, typeof s != "symbol" ? s + "" : s, t), oe$1 = (r, s, t) => s.has(r) || Me("Cannot " + t);
9
- var ht$2 = (r, s, t) => (oe$1(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le$1 = (r, s, t) => s.has(r) ? Me("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), Dt$1 = (r, s, t, e) => (oe$1(r, s, "write to private field"), s.set(r, t), t), he = (r, s, t) => (oe$1(r, s, "access private method"), t);
10
- function zt(r, s, t, e) {
8
+ var q$1 = (r, s, t) => Be(r, typeof s != "symbol" ? s + "" : s, t), oe$1 = (r, s, t) => s.has(r) || Me("Cannot " + t);
9
+ var ht$3 = (r, s, t) => (oe$1(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le$1 = (r, s, t) => s.has(r) ? Me("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), Dt$2 = (r, s, t, e) => (oe$1(r, s, "write to private field"), s.set(r, t), t), he = (r, s, t) => (oe$1(r, s, "access private method"), t);
10
+ function zt$1(r, s, t, e) {
11
11
  return r <= e && s >= t;
12
12
  }
13
13
  let mt$1 = class mt {
14
14
  constructor(s = 1 / 0, t = 1 / 0, e = -1 / 0, n = -1 / 0) {
15
- q$2(this, "xMin");
16
- q$2(this, "yMin");
17
- q$2(this, "xMax");
18
- q$2(this, "yMax");
15
+ q$1(this, "xMin");
16
+ q$1(this, "yMin");
17
+ q$1(this, "xMax");
18
+ q$1(this, "yMax");
19
19
  this.xMin = s, this.yMin = t, this.xMax = e, this.yMax = n;
20
20
  }
21
21
  get width() {
@@ -37,10 +37,10 @@ let mt$1 = class mt {
37
37
  }
38
38
  contains(s) {
39
39
  const [t, e] = s;
40
- return zt(this.xMin, this.xMax, t, t) && zt(this.yMin, this.yMax, e, e);
40
+ return zt$1(this.xMin, this.xMax, t, t) && zt$1(this.yMin, this.yMax, e, e);
41
41
  }
42
42
  overlaps(s) {
43
- return zt(this.xMin, this.xMax, s.xMin, s.xMax) && zt(this.yMin, this.yMax, s.yMin, s.yMax);
43
+ return zt$1(this.xMin, this.xMax, s.xMin, s.xMax) && zt$1(this.yMin, this.yMax, s.yMin, s.yMax);
44
44
  }
45
45
  addPoint(s) {
46
46
  const [t, e] = s;
@@ -85,21 +85,21 @@ function Te(r, s = 1e-9) {
85
85
  ).values()
86
86
  );
87
87
  }
88
- const fe$1 = Math.PI / 180, Ue = 180 / Math.PI, Z$1 = (r) => `[${r[0]}, ${r[1]}]`, Y$2 = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it$3 = ([r, s], [t, e]) => [r + t, s + e], Q$2 = ([r, s], [t, e]) => [r - t, s - e], It$2 = ([r, s]) => r * r + s * s, an$1 = ([r, s]) => Math.sqrt(It$2([r, s])), nt$2 = ([r, s], t) => [r * t, s * t], Rt$1 = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J$3 = (r, s = [0, 0]) => Math.sqrt(Rt$1(r, s));
89
- function St$2([r, s], [t, e]) {
88
+ const fe$1 = Math.PI / 180, Ue = 180 / Math.PI, Z$2 = (r) => `[${r[0]}, ${r[1]}]`, Y$3 = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it$2 = ([r, s], [t, e]) => [r + t, s + e], Q$2 = ([r, s], [t, e]) => [r - t, s - e], It$1 = ([r, s]) => r * r + s * s, an = ([r, s]) => Math.sqrt(It$1([r, s])), nt$2 = ([r, s], t) => [r * t, s * t], Rt$2 = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J$3 = (r, s = [0, 0]) => Math.sqrt(Rt$2(r, s));
89
+ function St$1([r, s], [t, e]) {
90
90
  return r * e - s * t;
91
91
  }
92
92
  function Pe([r, s], [t, e]) {
93
93
  return r * t + s * e;
94
94
  }
95
- function un$1([r, s], [t, e] = [0, 0]) {
95
+ function un([r, s], [t, e] = [0, 0]) {
96
96
  return Math.atan2(e * r - s * t, r * t + s * e);
97
97
  }
98
98
  function H$1([r, s]) {
99
99
  const t = J$3([r, s]);
100
100
  return [r / t, s / t];
101
101
  }
102
- function Tt(r, s) {
102
+ function Tt$1(r, s) {
103
103
  const t = Math.cos(s) * r, e = Math.sin(s) * r;
104
104
  return [t, e];
105
105
  }
@@ -111,7 +111,7 @@ function We(r) {
111
111
  return [s, t];
112
112
  }
113
113
  function Ie(r, s, t = 1e-9) {
114
- const e = St$2(r, s), n = It$2(r), i = It$2(s);
114
+ const e = St$1(r, s), n = It$1(r), i = It$1(s);
115
115
  return e * e < n * i * t * t;
116
116
  }
117
117
  function tt$3(r) {
@@ -121,9 +121,9 @@ function Qt$1(r) {
121
121
  return [r[1], -r[0]];
122
122
  }
123
123
  function Qe(r, s, t) {
124
- return Y$2(t, r) || Ie(Q$2(t, r), s);
124
+ return Y$3(t, r) || Ie(Q$2(t, r), s);
125
125
  }
126
- const Mt$2 = (r, s) => {
126
+ const Mt$1 = (r, s) => {
127
127
  const [t, e, n, i, o, l, h, a, u] = r, [c, g, d, w, p, P, f, M, E] = s;
128
128
  return [
129
129
  t * c + e * w + n * f,
@@ -155,7 +155,7 @@ const Mt$2 = (r, s) => {
155
155
  };
156
156
  let et$4 = class et {
157
157
  constructor(s) {
158
- q$2(this, "_matrix", [1, 0, 0, 0, 1, 0, 0, 0, 1]);
158
+ q$1(this, "_matrix", [1, 0, 0, 0, 1, 0, 0, 0, 1]);
159
159
  s && (this._matrix = [...s]);
160
160
  }
161
161
  clone() {
@@ -168,27 +168,27 @@ let et$4 = class et {
168
168
  return this._matrix = Ge(this._matrix), this;
169
169
  }
170
170
  translate(s, t) {
171
- return this._matrix = Mt$2([1, 0, s, 0, 1, t, 0, 0, 1], this._matrix), this;
171
+ return this._matrix = Mt$1([1, 0, s, 0, 1, t, 0, 0, 1], this._matrix), this;
172
172
  }
173
173
  rotate(s, t) {
174
174
  const e = Math.cos(s), n = Math.sin(s), i = [e, -n, 0, n, e, 0, 0, 0, 1];
175
- return t && this.translate(-t[0], -t[1]), this._matrix = Mt$2(i, this._matrix), t && this.translate(t[0], t[1]), this;
175
+ return t && this.translate(-t[0], -t[1]), this._matrix = Mt$1(i, this._matrix), t && this.translate(t[0], t[1]), this;
176
176
  }
177
177
  mirrorX() {
178
- return this._matrix = Mt$2([1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), this;
178
+ return this._matrix = Mt$1([1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), this;
179
179
  }
180
180
  mirrorY() {
181
- return this._matrix = Mt$2([-1, 0, 0, 0, 1, 0, 0, 0, 1], this._matrix), this;
181
+ return this._matrix = Mt$1([-1, 0, 0, 0, 1, 0, 0, 0, 1], this._matrix), this;
182
182
  }
183
183
  mirrorLine(s, t) {
184
184
  const [e, n] = s, i = Math.atan2(n, e);
185
185
  return t && this.translate(-t[0], -t[1]), this.rotate(-i), this.mirrorX(), this.rotate(i), t && this.translate(t[0], t[1]), this;
186
186
  }
187
187
  mirrorCenter(s) {
188
- return s && this.translate(-s[0], -s[1]), this._matrix = Mt$2([-1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), s && this.translate(s[0], s[1]), this;
188
+ return s && this.translate(-s[0], -s[1]), this._matrix = Mt$1([-1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), s && this.translate(s[0], s[1]), this;
189
189
  }
190
190
  scale(s, t) {
191
- return t && this.translate(-t[0], -t[1]), this._matrix = Mt$2([s, 0, 0, 0, s, 0, 0, 0, 1], this._matrix), t && this.translate(t[0], t[1]), this;
191
+ return t && this.translate(-t[0], -t[1]), this._matrix = Mt$1([s, 0, 0, 0, s, 0, 0, 0, 1], this._matrix), t && this.translate(t[0], t[1]), this;
192
192
  }
193
193
  transform(s) {
194
194
  const [t, e] = s, [n, i, o, l, h, a] = this._matrix;
@@ -244,14 +244,14 @@ class Ze {
244
244
  return s === "x" ? e.mirrorX() : s === "y" ? e.mirrorY() : e.mirrorLine(s, t), this.transform(e);
245
245
  }
246
246
  }
247
- let xt$1 = class xt extends Ze {
247
+ let xt$2 = class xt extends Ze {
248
248
  constructor(t, e) {
249
249
  super();
250
- q$2(this, "precision", 1e-9);
250
+ q$1(this, "precision", 1e-9);
251
251
  this.firstPoint = t, this.lastPoint = e, this.firstPoint = t, this.lastPoint = e;
252
252
  }
253
253
  get repr() {
254
- return `${this.segmentType} ${Z$1(this.firstPoint)} - ${Z$1(
254
+ return `${this.segmentType} ${Z$2(this.firstPoint)} - ${Z$2(
255
255
  this.lastPoint
256
256
  )}`;
257
257
  }
@@ -262,27 +262,27 @@ let xt$1 = class xt extends Ze {
262
262
  return this.repr;
263
263
  }
264
264
  };
265
- let at$3 = class at extends xt$1 {
265
+ let at$3 = class at extends xt$2 {
266
266
  constructor() {
267
267
  super(...arguments);
268
- q$2(this, "segmentType", "LINE");
269
- q$2(this, "_V", null);
270
- q$2(this, "_slope", null);
271
- q$2(this, "_yIntercept", null);
272
- q$2(this, "_boundingBox", null);
268
+ q$1(this, "segmentType", "LINE");
269
+ q$1(this, "_V", null);
270
+ q$1(this, "_slope", null);
271
+ q$1(this, "_yIntercept", null);
272
+ q$1(this, "_boundingBox", null);
273
273
  }
274
274
  isValidParameter(t) {
275
275
  const e = this.length * this.precision;
276
276
  return t >= -e && 1 - t >= -e;
277
277
  }
278
278
  paramPoint(t) {
279
- return it$3(this.firstPoint, nt$2(this.V, t));
279
+ return it$2(this.firstPoint, nt$2(this.V, t));
280
280
  }
281
281
  get length() {
282
282
  return J$3(this.firstPoint, this.lastPoint);
283
283
  }
284
284
  get squareLength() {
285
- return Rt$1(this.firstPoint, this.lastPoint);
285
+ return Rt$2(this.firstPoint, this.lastPoint);
286
286
  }
287
287
  get V() {
288
288
  return this._V === null && (this._V = Q$2(this.lastPoint, this.firstPoint)), this._V;
@@ -298,10 +298,10 @@ let at$3 = class at extends xt$1 {
298
298
  return this._yIntercept === null && (this._yIntercept = this.firstPoint[1] - this.slope * this.firstPoint[0]), this._yIntercept;
299
299
  }
300
300
  get midPoint() {
301
- return it$3(this.firstPoint, nt$2(this.V, 0.5));
301
+ return it$2(this.firstPoint, nt$2(this.V, 0.5));
302
302
  }
303
303
  isSame(t) {
304
- return t instanceof at ? Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) : !1;
304
+ return t instanceof at ? Y$3(this.firstPoint, t.firstPoint) && Y$3(this.lastPoint, t.lastPoint) || Y$3(this.lastPoint, t.firstPoint) && Y$3(this.firstPoint, t.lastPoint) : !1;
305
305
  }
306
306
  clone() {
307
307
  return new at(this.firstPoint, this.lastPoint);
@@ -327,7 +327,7 @@ let at$3 = class at extends xt$1 {
327
327
  return J$3(t, i);
328
328
  }
329
329
  isOnSegment(t) {
330
- if (Y$2(t, this.firstPoint, this.precision)) return !0;
330
+ if (Y$3(t, this.firstPoint, this.precision)) return !0;
331
331
  const e = Q$2(t, this.firstPoint);
332
332
  if (!Ie(this.V, e)) return !1;
333
333
  const n = Pe(e, this.V) / this.squareLength;
@@ -356,7 +356,7 @@ let at$3 = class at extends xt$1 {
356
356
  Array.isArray(t[0]) ? e = t : e = [t], e.forEach((a) => {
357
357
  if (!this.isOnSegment(a))
358
358
  throw new Error(
359
- `Point ${Z$1(a)} is not on segment ${this.repr}`
359
+ `Point ${Z$2(a)} is not on segment ${this.repr}`
360
360
  );
361
361
  });
362
362
  const n = [this.firstPoint, ...e, this.lastPoint], i = Te(n), o = this.lastPoint[0] - this.firstPoint[0];
@@ -387,16 +387,16 @@ function Zt(r, s, t, e = 1e-9) {
387
387
  return t && (n = -n), n < 0 && (n += 2 * Math.PI), n > 2 * Math.PI - e ? 0 : n;
388
388
  }
389
389
  const me = (r, s, t) => {
390
- const e = St$2(r.V, s.V), n = It$2(r.V), i = It$2(s.V), o = t ? t * t : r.precision * s.precision;
390
+ const e = St$1(r.V, s.V), n = It$1(r.V), i = It$1(s.V), o = t ? t * t : r.precision * s.precision;
391
391
  if (e * e < n * i * o)
392
392
  return "parallel";
393
- const l = Q$2(s.firstPoint, r.firstPoint), h = St$2(l, s.V) / e, a = St$2(l, r.V) / e;
393
+ const l = Q$2(s.firstPoint, r.firstPoint), h = St$1(l, s.V) / e, a = St$1(l, r.V) / e;
394
394
  return {
395
395
  intersectionParam1: h,
396
396
  intersectionParam2: a
397
397
  };
398
398
  };
399
- function cn$1(r, s, t = !1, e) {
399
+ function cn(r, s, t = !1, e) {
400
400
  const n = me(r, s, e);
401
401
  if (n === "parallel") {
402
402
  if (!t) return null;
@@ -419,37 +419,37 @@ function cn$1(r, s, t = !1, e) {
419
419
  const { intersectionParam1: i, intersectionParam2: o } = n;
420
420
  return !r.isValidParameter(i) || !s.isValidParameter(o) ? null : r.paramPoint(i);
421
421
  }
422
- const Ot$1 = (r, s) => {
422
+ const Ot$2 = (r, s) => {
423
423
  const t = Q$2(r, s);
424
424
  return We(t);
425
425
  };
426
- let ct$3 = class ct extends xt$1 {
426
+ let ct$3 = class ct extends xt$2 {
427
427
  constructor(t, e, n, i = !1, { ignoreChecks: o = !1 } = {}) {
428
428
  super(t, e);
429
- q$2(this, "segmentType", "ARC");
430
- q$2(this, "center");
431
- q$2(this, "clockwise");
432
- q$2(this, "_coefficients", null);
433
- q$2(this, "_angularLength", null);
434
- q$2(this, "_radius", null);
435
- q$2(this, "_firstAngle", null);
436
- q$2(this, "_lastAngle", null);
437
- q$2(this, "_boundingBox", null);
429
+ q$1(this, "segmentType", "ARC");
430
+ q$1(this, "center");
431
+ q$1(this, "clockwise");
432
+ q$1(this, "_coefficients", null);
433
+ q$1(this, "_angularLength", null);
434
+ q$1(this, "_radius", null);
435
+ q$1(this, "_firstAngle", null);
436
+ q$1(this, "_lastAngle", null);
437
+ q$1(this, "_boundingBox", null);
438
438
  if (this.center = n, this.clockwise = i, !o) {
439
- if (Y$2(t, e))
439
+ if (Y$3(t, e))
440
440
  throw new Error("Invalid arc, cannot be a full circle");
441
441
  if (Math.abs(this.radius - J$3(this.lastPoint, this.center)) > this.precision)
442
442
  throw new Error(
443
- `Invalid arc, radius does not match between ${Z$1(
443
+ `Invalid arc, radius does not match between ${Z$2(
444
444
  t
445
- )} and ${Z$1(e)}} (center ${Z$1(n)})`
445
+ )} and ${Z$2(e)}} (center ${Z$2(n)})`
446
446
  );
447
447
  }
448
448
  }
449
449
  get info() {
450
- return `ARC(${Z$1(this.firstPoint)}, ${Z$1(
450
+ return `ARC(${Z$2(this.firstPoint)}, ${Z$2(
451
451
  this.lastPoint
452
- )}, ${Z$1(this.center)}, ${this.clockwise ? "CW" : "CCW"})`;
452
+ )}, ${Z$2(this.center)}, ${this.clockwise ? "CW" : "CCW"})`;
453
453
  }
454
454
  get coefficients() {
455
455
  if (this._coefficients === null) {
@@ -479,24 +479,24 @@ let ct$3 = class ct extends xt$1 {
479
479
  )), this._angularLength;
480
480
  }
481
481
  paramPoint(t) {
482
- return it$3(
482
+ return it$2(
483
483
  this.center,
484
- Tt(
484
+ Tt$1(
485
485
  this.radius,
486
486
  this.firstAngle + t * this.angularLength * (this.clockwise ? -1 : 1)
487
487
  )
488
488
  );
489
489
  }
490
490
  pointToParam(t) {
491
- const [e, n] = Ot$1(t, this.center);
491
+ const [e, n] = Ot$2(t, this.center);
492
492
  if (Math.abs(e - this.radius) > this.precision)
493
493
  throw new Error(
494
- `Point ${Z$1(t)} is not on segment ${this.repr}`
494
+ `Point ${Z$2(t)} is not on segment ${this.repr}`
495
495
  );
496
496
  const i = this.angleToParam(n);
497
497
  if (!this.isValidParameter(i))
498
498
  throw new Error(
499
- `Point ${Z$1(t)} is not on segment ${this.repr}`
499
+ `Point ${Z$2(t)} is not on segment ${this.repr}`
500
500
  );
501
501
  return i;
502
502
  }
@@ -527,7 +527,7 @@ let ct$3 = class ct extends xt$1 {
527
527
  return this.paramPoint(0.5);
528
528
  }
529
529
  isSame(t) {
530
- return !(t instanceof ct) || !Y$2(this.center, t.center) ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
530
+ return !(t instanceof ct) || !Y$3(this.center, t.center) ? !1 : Y$3(this.firstPoint, t.firstPoint) && Y$3(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y$3(this.lastPoint, t.firstPoint) && Y$3(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
531
531
  }
532
532
  clone() {
533
533
  return new ct(
@@ -558,18 +558,18 @@ let ct$3 = class ct extends xt$1 {
558
558
  return this._boundingBox;
559
559
  }
560
560
  distanceFrom(t) {
561
- const [e, n] = Ot$1(t, this.center);
561
+ const [e, n] = Ot$2(t, this.center);
562
562
  return this.isValidParameter(this.angleToParam(n)) ? Math.abs(e - this.radius) : Math.sqrt(
563
563
  Math.min(
564
- Rt$1(t, this.firstPoint),
565
- Rt$1(t, this.lastPoint)
564
+ Rt$2(t, this.firstPoint),
565
+ Rt$2(t, this.lastPoint)
566
566
  )
567
567
  );
568
568
  }
569
569
  isOnSegment(t) {
570
- if (Y$2(t, this.firstPoint) || Y$2(t, this.lastPoint))
570
+ if (Y$3(t, this.firstPoint) || Y$3(t, this.lastPoint))
571
571
  return !0;
572
- const [e, n] = Ot$1(t, this.center);
572
+ const [e, n] = Ot$2(t, this.center);
573
573
  if (Math.abs(e - this.radius) > this.precision) return !1;
574
574
  const i = this.angleToParam(n);
575
575
  return this.isValidParameter(i);
@@ -579,21 +579,21 @@ let ct$3 = class ct extends xt$1 {
579
579
  return this.clockwise ? [-i, -o] : [i, o];
580
580
  }
581
581
  tangentAt(t) {
582
- const [e, n] = Ot$1(t, this.center);
582
+ const [e, n] = Ot$2(t, this.center);
583
583
  if (Math.abs(e - this.radius) > this.precision)
584
584
  throw new Error("Point is not on the arc");
585
585
  const i = this.angleToParam(n);
586
586
  if (!this.isValidParameter(i))
587
587
  throw new Error("Point is not on the arc");
588
- const o = Tt(1, n);
588
+ const o = Tt$1(1, n);
589
589
  return (this.clockwise ? Qt$1 : tt$3)(H$1(o));
590
590
  }
591
591
  get tangentAtFirstPoint() {
592
- const t = Tt(1, this.firstAngle);
592
+ const t = Tt$1(1, this.firstAngle);
593
593
  return (this.clockwise ? Qt$1 : tt$3)(H$1(t));
594
594
  }
595
595
  get tangentAtLastPoint() {
596
- const t = Tt(1, this.lastAngle);
596
+ const t = Tt$1(1, this.lastAngle);
597
597
  return (this.clockwise ? Qt$1 : tt$3)(H$1(t));
598
598
  }
599
599
  splitAt(t) {
@@ -629,21 +629,21 @@ let ct$3 = class ct extends xt$1 {
629
629
  );
630
630
  }
631
631
  };
632
- function fn$1(r, s, t) {
632
+ function fn(r, s, t) {
633
633
  const e = new at$3(s, r), n = new at$3(s, t), i = tt$3(e.tangentAtFirstPoint), o = tt$3(n.tangentAtLastPoint), l = me(
634
634
  { firstPoint: e.midPoint, V: i, precision: 1e-9 },
635
635
  { firstPoint: n.midPoint, V: o, precision: 1e-9 }
636
636
  );
637
637
  if (l === "parallel")
638
638
  throw new Error("Cannot create an arc from three colinear points");
639
- const h = St$2(
639
+ const h = St$1(
640
640
  Q$2(r, s),
641
641
  Q$2(t, s)
642
642
  ) > 0;
643
643
  return new ct$3(
644
644
  r,
645
645
  t,
646
- it$3(e.midPoint, nt$2(i, l.intersectionParam1)),
646
+ it$2(e.midPoint, nt$2(i, l.intersectionParam1)),
647
647
  h,
648
648
  { ignoreChecks: !0 }
649
649
  );
@@ -659,21 +659,21 @@ function mn$2(r, s, t) {
659
659
  );
660
660
  if (i === "parallel")
661
661
  throw new Error("Cannot create an arc from three colinear points");
662
- const o = it$3(
662
+ const o = it$2(
663
663
  e.midPoint,
664
664
  nt$2(n, i.intersectionParam1)
665
- ), l = St$2(
665
+ ), l = St$1(
666
666
  Q$2(o, r),
667
- Q$2(o, it$3(r, t))
667
+ Q$2(o, it$2(r, t))
668
668
  ) < 0;
669
669
  return new ct$3(r, s, o, l, {
670
670
  ignoreChecks: !0
671
671
  });
672
672
  }
673
- const be = 1e-21, Bt$1 = 1.618034;
673
+ const be = 1e-21, Bt$2 = 1.618034;
674
674
  function Ee(r, s = 0, t = 1, e = 110, n = 1e3) {
675
675
  let i, o, l, h, a, u, c, g, d, w, p, P, f;
676
- for (o = r(s), l = r(t), o < l && ([s, t] = [t, s], [o, l] = [l, o]), f = t + Bt$1 * (t - s), h = r(f), a = 3, c = 0; h < l; ) {
676
+ for (o = r(s), l = r(t), o < l && ([s, t] = [t, s], [o, l] = [l, o]), f = t + Bt$2 * (t - s), h = r(f), a = 3, c = 0; h < l; ) {
677
677
  if (g = (t - s) * (l - h), d = (t - f) * (l - o), w = d - g, Math.abs(w) < be ? i = 2 * be : i = 2 * w, p = t - ((t - f) * d - (t - s) * g) / i, P = t + e * (f - t), c > n)
678
678
  throw new Error("Too many iterations.");
679
679
  if (c += 1, (p - f) * (t - p) > 0) {
@@ -681,9 +681,9 @@ function Ee(r, s = 0, t = 1, e = 110, n = 1e3) {
681
681
  return s = t, t = p, o = l, l = u, [s, t, f, o, l, h, a];
682
682
  if (u > l)
683
683
  return f = p, h = u, [s, t, f, o, l, h, a];
684
- p = f + Bt$1 * (f - t), u = r(p), a += 1;
684
+ p = f + Bt$2 * (f - t), u = r(p), a += 1;
685
685
  } else
686
- (p - P) * (P - f) >= 0 ? (p = P, u = r(p), a += 1) : (p - P) * (f - p) > 0 ? (u = r(p), a += 1, u < h && (t = f, f = p, p = f + Bt$1 * (f - t), l = h, h = u, u = r(p), a += 1)) : (p = f + Bt$1 * (f - t), u = r(p), a += 1);
686
+ (p - P) * (P - f) >= 0 ? (p = P, u = r(p), a += 1) : (p - P) * (f - p) > 0 ? (u = r(p), a += 1, u < h && (t = f, f = p, p = f + Bt$2 * (f - t), l = h, h = u, u = r(p), a += 1)) : (p = f + Bt$2 * (f - t), u = r(p), a += 1);
687
687
  s = t, t = f, f = p, o = l, l = h, h = u;
688
688
  }
689
689
  return [s, t, f, o, l, h, a];
@@ -691,11 +691,11 @@ function Ee(r, s = 0, t = 1, e = 110, n = 1e3) {
691
691
  const _e = 0.381966, Ke = 1e-11;
692
692
  class He {
693
693
  constructor(s, t = 148e-10, e = 500) {
694
- q$2(this, "xmin");
695
- q$2(this, "fval");
696
- q$2(this, "iter");
697
- q$2(this, "funcalls");
698
- q$2(this, "brack");
694
+ q$1(this, "xmin");
695
+ q$1(this, "fval");
696
+ q$1(this, "iter");
697
+ q$1(this, "funcalls");
698
+ q$1(this, "brack");
699
699
  this.func = s, this.tol = t, this.maxiter = e, this.func = s, this.tol = t, this.maxiter = e, this.xmin = 1 / 0, this.fval = 1 / 0, this.iter = 0, this.funcalls = 0, this.brack = null;
700
700
  }
701
701
  setBracket(s = null) {
@@ -850,7 +850,7 @@ const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
850
850
  }, Symbol.toStringTag, { value: "Module" })), ls = /* @__PURE__ */ qe(os);
851
851
  Object.defineProperty($$1, "__esModule", { value: !0 });
852
852
  var st$3 = ss, je = ls;
853
- const Ut$1 = " ".repeat(2), Fe = " ".repeat(4);
853
+ const Ut$2 = " ".repeat(2), Fe = " ".repeat(4);
854
854
  function hs() {
855
855
  return xe(this);
856
856
  }
@@ -862,11 +862,11 @@ function xe(r, s = {}) {
862
862
  padMinus: i = "auto"
863
863
  } = s;
864
864
  return `${r.constructor.name} {
865
- ${Ut$1}[
865
+ ${Ut$2}[
866
866
  ${Fe}${as(r, t, e, n, i)}
867
- ${Ut$1}]
868
- ${Ut$1}rows: ${r.rows}
869
- ${Ut$1}columns: ${r.columns}
867
+ ${Ut$2}]
868
+ ${Ut$2}rows: ${r.rows}
869
+ ${Ut$2}columns: ${r.columns}
870
870
  }`;
871
871
  }
872
872
  function as(r, s, t, e, n) {
@@ -1299,12 +1299,12 @@ function cs(r, s) {
1299
1299
  return this;
1300
1300
  };
1301
1301
  }
1302
- function ot$4(r, s, t) {
1302
+ function ot$3(r, s, t) {
1303
1303
  let e = t ? r.rows : r.rows - 1;
1304
1304
  if (s < 0 || s > e)
1305
1305
  throw new RangeError("Row index out of range");
1306
1306
  }
1307
- function lt$3(r, s, t) {
1307
+ function lt$4(r, s, t) {
1308
1308
  let e = t ? r.columns : r.columns - 1;
1309
1309
  if (s < 0 || s > e)
1310
1310
  throw new RangeError("Column index out of range");
@@ -1316,7 +1316,7 @@ function Pt$2(r, s) {
1316
1316
  );
1317
1317
  return s;
1318
1318
  }
1319
- function bt$2(r, s) {
1319
+ function bt$1(r, s) {
1320
1320
  if (s.to1DArray && (s = s.to1DArray()), s.length !== r.rows)
1321
1321
  throw new RangeError("vector size must be the same as the number of rows");
1322
1322
  return s;
@@ -1483,39 +1483,39 @@ function Ts(r, s) {
1483
1483
  for (let e = 0; e < r.columns; e++)
1484
1484
  r.set(t, e, r.get(t, e) / s);
1485
1485
  }
1486
- let V$1 = class V {
1486
+ let V$2 = class V {
1487
1487
  static from1DArray(s, t, e) {
1488
1488
  if (s * t !== e.length)
1489
1489
  throw new RangeError("data length does not match given dimensions");
1490
- let i = new _$3(s, t);
1490
+ let i = new _$2(s, t);
1491
1491
  for (let o = 0; o < s; o++)
1492
1492
  for (let l = 0; l < t; l++)
1493
1493
  i.set(o, l, e[o * t + l]);
1494
1494
  return i;
1495
1495
  }
1496
1496
  static rowVector(s) {
1497
- let t = new _$3(1, s.length);
1497
+ let t = new _$2(1, s.length);
1498
1498
  for (let e = 0; e < s.length; e++)
1499
1499
  t.set(0, e, s[e]);
1500
1500
  return t;
1501
1501
  }
1502
1502
  static columnVector(s) {
1503
- let t = new _$3(s.length, 1);
1503
+ let t = new _$2(s.length, 1);
1504
1504
  for (let e = 0; e < s.length; e++)
1505
1505
  t.set(e, 0, s[e]);
1506
1506
  return t;
1507
1507
  }
1508
1508
  static zeros(s, t) {
1509
- return new _$3(s, t);
1509
+ return new _$2(s, t);
1510
1510
  }
1511
1511
  static ones(s, t) {
1512
- return new _$3(s, t).fill(1);
1512
+ return new _$2(s, t).fill(1);
1513
1513
  }
1514
1514
  static rand(s, t, e = {}) {
1515
1515
  if (typeof e != "object")
1516
1516
  throw new TypeError("options must be an object");
1517
1517
  const { random: n = Math.random } = e;
1518
- let i = new _$3(s, t);
1518
+ let i = new _$2(s, t);
1519
1519
  for (let o = 0; o < s; o++)
1520
1520
  for (let l = 0; l < t; l++)
1521
1521
  i.set(o, l, n());
@@ -1528,7 +1528,7 @@ let V$1 = class V {
1528
1528
  if (!Number.isInteger(n)) throw new TypeError("min must be an integer");
1529
1529
  if (!Number.isInteger(i)) throw new TypeError("max must be an integer");
1530
1530
  if (n >= i) throw new RangeError("min must be smaller than max");
1531
- let l = i - n, h = new _$3(s, t);
1531
+ let l = i - n, h = new _$2(s, t);
1532
1532
  for (let a = 0; a < s; a++)
1533
1533
  for (let u = 0; u < t; u++) {
1534
1534
  let c = n + Math.round(o() * l);
@@ -1553,7 +1553,7 @@ let V$1 = class V {
1553
1553
  }
1554
1554
  static min(s, t) {
1555
1555
  s = this.checkMatrix(s), t = this.checkMatrix(t);
1556
- let e = s.rows, n = s.columns, i = new _$3(e, n);
1556
+ let e = s.rows, n = s.columns, i = new _$2(e, n);
1557
1557
  for (let o = 0; o < e; o++)
1558
1558
  for (let l = 0; l < n; l++)
1559
1559
  i.set(o, l, Math.min(s.get(o, l), t.get(o, l)));
@@ -1568,7 +1568,7 @@ let V$1 = class V {
1568
1568
  return i;
1569
1569
  }
1570
1570
  static checkMatrix(s) {
1571
- return V.isMatrix(s) ? s : new _$3(s);
1571
+ return V.isMatrix(s) ? s : new _$2(s);
1572
1572
  }
1573
1573
  static isMatrix(s) {
1574
1574
  return s != null && s.klass === "Matrix";
@@ -1712,7 +1712,7 @@ let V$1 = class V {
1712
1712
  throw new TypeError("rows must be a positive integer");
1713
1713
  if (!Number.isInteger(e) || e <= 0)
1714
1714
  throw new TypeError("columns must be a positive integer");
1715
- let n = new _$3(this.rows * t, this.columns * e);
1715
+ let n = new _$2(this.rows * t, this.columns * e);
1716
1716
  for (let i = 0; i < t; i++)
1717
1717
  for (let o = 0; o < e; o++)
1718
1718
  n.setSubMatrix(this, this.rows * i, this.columns * o);
@@ -1728,23 +1728,23 @@ let V$1 = class V {
1728
1728
  return this.mulS(-1);
1729
1729
  }
1730
1730
  getRow(s) {
1731
- ot$4(this, s);
1731
+ ot$3(this, s);
1732
1732
  let t = [];
1733
1733
  for (let e = 0; e < this.columns; e++)
1734
1734
  t.push(this.get(s, e));
1735
1735
  return t;
1736
1736
  }
1737
1737
  getRowVector(s) {
1738
- return _$3.rowVector(this.getRow(s));
1738
+ return _$2.rowVector(this.getRow(s));
1739
1739
  }
1740
1740
  setRow(s, t) {
1741
- ot$4(this, s), t = Pt$2(this, t);
1741
+ ot$3(this, s), t = Pt$2(this, t);
1742
1742
  for (let e = 0; e < this.columns; e++)
1743
1743
  this.set(s, e, t[e]);
1744
1744
  return this;
1745
1745
  }
1746
1746
  swapRows(s, t) {
1747
- ot$4(this, s), ot$4(this, t);
1747
+ ot$3(this, s), ot$3(this, t);
1748
1748
  for (let e = 0; e < this.columns; e++) {
1749
1749
  let n = this.get(s, e);
1750
1750
  this.set(s, e, this.get(t, e)), this.set(t, e, n);
@@ -1752,23 +1752,23 @@ let V$1 = class V {
1752
1752
  return this;
1753
1753
  }
1754
1754
  getColumn(s) {
1755
- lt$3(this, s);
1755
+ lt$4(this, s);
1756
1756
  let t = [];
1757
1757
  for (let e = 0; e < this.rows; e++)
1758
1758
  t.push(this.get(e, s));
1759
1759
  return t;
1760
1760
  }
1761
1761
  getColumnVector(s) {
1762
- return _$3.columnVector(this.getColumn(s));
1762
+ return _$2.columnVector(this.getColumn(s));
1763
1763
  }
1764
1764
  setColumn(s, t) {
1765
- lt$3(this, s), t = bt$2(this, t);
1765
+ lt$4(this, s), t = bt$1(this, t);
1766
1766
  for (let e = 0; e < this.rows; e++)
1767
1767
  this.set(e, s, t[e]);
1768
1768
  return this;
1769
1769
  }
1770
1770
  swapColumns(s, t) {
1771
- lt$3(this, s), lt$3(this, t);
1771
+ lt$4(this, s), lt$4(this, t);
1772
1772
  for (let e = 0; e < this.rows; e++) {
1773
1773
  let n = this.get(e, s);
1774
1774
  this.set(e, s, this.get(e, t)), this.set(e, t, n);
@@ -1804,41 +1804,41 @@ let V$1 = class V {
1804
1804
  return this;
1805
1805
  }
1806
1806
  addColumnVector(s) {
1807
- s = bt$2(this, s);
1807
+ s = bt$1(this, s);
1808
1808
  for (let t = 0; t < this.rows; t++)
1809
1809
  for (let e = 0; e < this.columns; e++)
1810
1810
  this.set(t, e, this.get(t, e) + s[t]);
1811
1811
  return this;
1812
1812
  }
1813
1813
  subColumnVector(s) {
1814
- s = bt$2(this, s);
1814
+ s = bt$1(this, s);
1815
1815
  for (let t = 0; t < this.rows; t++)
1816
1816
  for (let e = 0; e < this.columns; e++)
1817
1817
  this.set(t, e, this.get(t, e) - s[t]);
1818
1818
  return this;
1819
1819
  }
1820
1820
  mulColumnVector(s) {
1821
- s = bt$2(this, s);
1821
+ s = bt$1(this, s);
1822
1822
  for (let t = 0; t < this.rows; t++)
1823
1823
  for (let e = 0; e < this.columns; e++)
1824
1824
  this.set(t, e, this.get(t, e) * s[t]);
1825
1825
  return this;
1826
1826
  }
1827
1827
  divColumnVector(s) {
1828
- s = bt$2(this, s);
1828
+ s = bt$1(this, s);
1829
1829
  for (let t = 0; t < this.rows; t++)
1830
1830
  for (let e = 0; e < this.columns; e++)
1831
1831
  this.set(t, e, this.get(t, e) / s[t]);
1832
1832
  return this;
1833
1833
  }
1834
1834
  mulRow(s, t) {
1835
- ot$4(this, s);
1835
+ ot$3(this, s);
1836
1836
  for (let e = 0; e < this.columns; e++)
1837
1837
  this.set(s, e, this.get(s, e) * t);
1838
1838
  return this;
1839
1839
  }
1840
1840
  mulColumn(s, t) {
1841
- lt$3(this, s);
1841
+ lt$4(this, s);
1842
1842
  for (let e = 0; e < this.rows; e++)
1843
1843
  this.set(e, s, this.get(e, s) * t);
1844
1844
  return this;
@@ -1918,7 +1918,7 @@ let V$1 = class V {
1918
1918
  return t;
1919
1919
  }
1920
1920
  maxRow(s) {
1921
- if (ot$4(this, s), this.isEmpty())
1921
+ if (ot$3(this, s), this.isEmpty())
1922
1922
  return NaN;
1923
1923
  let t = this.get(s, 0);
1924
1924
  for (let e = 1; e < this.columns; e++)
@@ -1926,14 +1926,14 @@ let V$1 = class V {
1926
1926
  return t;
1927
1927
  }
1928
1928
  maxRowIndex(s) {
1929
- ot$4(this, s), yt$2(this);
1929
+ ot$3(this, s), yt$2(this);
1930
1930
  let t = this.get(s, 0), e = [s, 0];
1931
1931
  for (let n = 1; n < this.columns; n++)
1932
1932
  this.get(s, n) > t && (t = this.get(s, n), e[1] = n);
1933
1933
  return e;
1934
1934
  }
1935
1935
  minRow(s) {
1936
- if (ot$4(this, s), this.isEmpty())
1936
+ if (ot$3(this, s), this.isEmpty())
1937
1937
  return NaN;
1938
1938
  let t = this.get(s, 0);
1939
1939
  for (let e = 1; e < this.columns; e++)
@@ -1941,14 +1941,14 @@ let V$1 = class V {
1941
1941
  return t;
1942
1942
  }
1943
1943
  minRowIndex(s) {
1944
- ot$4(this, s), yt$2(this);
1944
+ ot$3(this, s), yt$2(this);
1945
1945
  let t = this.get(s, 0), e = [s, 0];
1946
1946
  for (let n = 1; n < this.columns; n++)
1947
1947
  this.get(s, n) < t && (t = this.get(s, n), e[1] = n);
1948
1948
  return e;
1949
1949
  }
1950
1950
  maxColumn(s) {
1951
- if (lt$3(this, s), this.isEmpty())
1951
+ if (lt$4(this, s), this.isEmpty())
1952
1952
  return NaN;
1953
1953
  let t = this.get(0, s);
1954
1954
  for (let e = 1; e < this.rows; e++)
@@ -1956,14 +1956,14 @@ let V$1 = class V {
1956
1956
  return t;
1957
1957
  }
1958
1958
  maxColumnIndex(s) {
1959
- lt$3(this, s), yt$2(this);
1959
+ lt$4(this, s), yt$2(this);
1960
1960
  let t = this.get(0, s), e = [0, s];
1961
1961
  for (let n = 1; n < this.rows; n++)
1962
1962
  this.get(n, s) > t && (t = this.get(n, s), e[0] = n);
1963
1963
  return e;
1964
1964
  }
1965
1965
  minColumn(s) {
1966
- if (lt$3(this, s), this.isEmpty())
1966
+ if (lt$4(this, s), this.isEmpty())
1967
1967
  return NaN;
1968
1968
  let t = this.get(0, s);
1969
1969
  for (let e = 1; e < this.rows; e++)
@@ -1971,7 +1971,7 @@ let V$1 = class V {
1971
1971
  return t;
1972
1972
  }
1973
1973
  minColumnIndex(s) {
1974
- lt$3(this, s), yt$2(this);
1974
+ lt$4(this, s), yt$2(this);
1975
1975
  let t = this.get(0, s), e = [0, s];
1976
1976
  for (let n = 1; n < this.rows; n++)
1977
1977
  this.get(n, s) < t && (t = this.get(n, s), e[0] = n);
@@ -2011,8 +2011,8 @@ let V$1 = class V {
2011
2011
  return e;
2012
2012
  }
2013
2013
  mmul(s) {
2014
- s = _$3.checkMatrix(s);
2015
- let t = this.rows, e = this.columns, n = s.columns, i = new _$3(t, n), o = new Float64Array(e);
2014
+ s = _$2.checkMatrix(s);
2015
+ let t = this.rows, e = this.columns, n = s.columns, i = new _$2(t, n), o = new Float64Array(e);
2016
2016
  for (let l = 0; l < n; l++) {
2017
2017
  for (let h = 0; h < e; h++)
2018
2018
  o[h] = s.get(h, l);
@@ -2030,25 +2030,25 @@ let V$1 = class V {
2030
2030
  throw new RangeError("Matrix must be square");
2031
2031
  if (!Number.isInteger(s) || s < 0)
2032
2032
  throw new RangeError("Exponent must be a non-negative integer");
2033
- let t = _$3.eye(this.rows), e = this;
2033
+ let t = _$2.eye(this.rows), e = this;
2034
2034
  for (let n = s; n > 1; n /= 2)
2035
2035
  n & 1 && (t = t.mmul(e)), e = e.mmul(e);
2036
2036
  return t;
2037
2037
  }
2038
2038
  strassen2x2(s) {
2039
- s = _$3.checkMatrix(s);
2040
- let t = new _$3(2, 2);
2039
+ s = _$2.checkMatrix(s);
2040
+ let t = new _$2(2, 2);
2041
2041
  const e = this.get(0, 0), n = s.get(0, 0), i = this.get(0, 1), o = s.get(0, 1), l = this.get(1, 0), h = s.get(1, 0), a = this.get(1, 1), u = s.get(1, 1), c = (e + a) * (n + u), g = (l + a) * n, d = e * (o - u), w = a * (h - n), p = (e + i) * u, P = (l - e) * (n + o), f = (i - a) * (h + u), M = c + w - p + f, E = d + p, R = g + w, v = c - g + d + P;
2042
2042
  return t.set(0, 0, M), t.set(0, 1, E), t.set(1, 0, R), t.set(1, 1, v), t;
2043
2043
  }
2044
2044
  strassen3x3(s) {
2045
- s = _$3.checkMatrix(s);
2046
- let t = new _$3(3, 3);
2045
+ s = _$2.checkMatrix(s);
2046
+ let t = new _$2(3, 3);
2047
2047
  const e = this.get(0, 0), n = this.get(0, 1), i = this.get(0, 2), o = this.get(1, 0), l = this.get(1, 1), h = this.get(1, 2), a = this.get(2, 0), u = this.get(2, 1), c = this.get(2, 2), g = s.get(0, 0), d = s.get(0, 1), w = s.get(0, 2), p = s.get(1, 0), P = s.get(1, 1), f = s.get(1, 2), M = s.get(2, 0), E = s.get(2, 1), R = s.get(2, 2), v = (e + n + i - o - l - u - c) * P, L = (e - o) * (-d + P), S = l * (-g + d + p - P - f - M + R), k = (-e + o + l) * (g - d + P), D = (o + l) * (-g + d), m = e * g, b = (-e + a + u) * (g - w + f), j = (-e + a) * (w - f), y = (a + u) * (-g + w), C = (e + n + i - l - h - a - u) * f, F = u * (-g + w + p - P - f - M + E), I = (-i + u + c) * (P + M - E), B = (i - c) * (P - E), x = i * M, N = (u + c) * (-M + E), A = (-i + l + h) * (f + M - R), O = (i - h) * (f - R), U = (l + h) * (-M + R), T = n * p, z = h * E, X = o * w, G = a * d, W = c * R, se = m + x + T, ne = v + k + D + m + I + x + N, ie = m + b + y + C + x + A + U, re = L + S + k + m + x + A + O, At = L + k + D + m + z, Vt = x + A + O + U + X, Nt = m + b + j + F + I + B + x, $t = I + B + x + N + G, Lt = m + b + j + y + W;
2048
2048
  return t.set(0, 0, se), t.set(0, 1, ne), t.set(0, 2, ie), t.set(1, 0, re), t.set(1, 1, At), t.set(1, 2, Vt), t.set(2, 0, Nt), t.set(2, 1, $t), t.set(2, 2, Lt), t;
2049
2049
  }
2050
2050
  mmulStrassen(s) {
2051
- s = _$3.checkMatrix(s);
2051
+ s = _$2.checkMatrix(s);
2052
2052
  let t = this.clone(), e = t.rows, n = t.columns, i = s.rows, o = s.columns;
2053
2053
  n !== i && console.warn(
2054
2054
  `Multiplying ${e} x ${n} and ${i} x ${o} matrix: dimensions do not match.`
@@ -2099,7 +2099,7 @@ let V$1 = class V {
2099
2099
  if (!Number.isFinite(t)) throw new TypeError("min must be a number");
2100
2100
  if (!Number.isFinite(e)) throw new TypeError("max must be a number");
2101
2101
  if (t >= e) throw new RangeError("min must be smaller than max");
2102
- let n = new _$3(this.rows, this.columns);
2102
+ let n = new _$2(this.rows, this.columns);
2103
2103
  for (let i = 0; i < this.rows; i++) {
2104
2104
  const o = this.getRow(i);
2105
2105
  o.length > 0 && je(o, { min: t, max: e, output: o }), n.setRow(i, o);
@@ -2113,7 +2113,7 @@ let V$1 = class V {
2113
2113
  if (!Number.isFinite(t)) throw new TypeError("min must be a number");
2114
2114
  if (!Number.isFinite(e)) throw new TypeError("max must be a number");
2115
2115
  if (t >= e) throw new RangeError("min must be smaller than max");
2116
- let n = new _$3(this.rows, this.columns);
2116
+ let n = new _$2(this.rows, this.columns);
2117
2117
  for (let i = 0; i < this.columns; i++) {
2118
2118
  const o = this.getColumn(i);
2119
2119
  o.length && je(o, {
@@ -2143,8 +2143,8 @@ let V$1 = class V {
2143
2143
  return this;
2144
2144
  }
2145
2145
  kroneckerProduct(s) {
2146
- s = _$3.checkMatrix(s);
2147
- let t = this.rows, e = this.columns, n = s.rows, i = s.columns, o = new _$3(t * n, e * i);
2146
+ s = _$2.checkMatrix(s);
2147
+ let t = this.rows, e = this.columns, n = s.rows, i = s.columns, o = new _$2(t * n, e * i);
2148
2148
  for (let l = 0; l < t; l++)
2149
2149
  for (let h = 0; h < e; h++)
2150
2150
  for (let a = 0; a < n; a++)
@@ -2153,13 +2153,13 @@ let V$1 = class V {
2153
2153
  return o;
2154
2154
  }
2155
2155
  kroneckerSum(s) {
2156
- if (s = _$3.checkMatrix(s), !this.isSquare() || !s.isSquare())
2156
+ if (s = _$2.checkMatrix(s), !this.isSquare() || !s.isSquare())
2157
2157
  throw new Error("Kronecker Sum needs two Square Matrices");
2158
- let t = this.rows, e = s.rows, n = this.kroneckerProduct(_$3.eye(e, e)), i = _$3.eye(t, t).kroneckerProduct(s);
2158
+ let t = this.rows, e = s.rows, n = this.kroneckerProduct(_$2.eye(e, e)), i = _$2.eye(t, t).kroneckerProduct(s);
2159
2159
  return n.add(i);
2160
2160
  }
2161
2161
  transpose() {
2162
- let s = new _$3(this.columns, this.rows);
2162
+ let s = new _$2(this.columns, this.rows);
2163
2163
  for (let t = 0; t < this.rows; t++)
2164
2164
  for (let e = 0; e < this.columns; e++)
2165
2165
  s.set(e, t, this.get(t, e));
@@ -2177,7 +2177,7 @@ let V$1 = class V {
2177
2177
  }
2178
2178
  subMatrix(s, t, e, n) {
2179
2179
  ae$1(this, s, t, e, n);
2180
- let i = new _$3(
2180
+ let i = new _$2(
2181
2181
  t - s + 1,
2182
2182
  n - e + 1
2183
2183
  );
@@ -2189,7 +2189,7 @@ let V$1 = class V {
2189
2189
  subMatrixRow(s, t, e) {
2190
2190
  if (t === void 0 && (t = 0), e === void 0 && (e = this.columns - 1), t > e || t < 0 || t >= this.columns || e < 0 || e >= this.columns)
2191
2191
  throw new RangeError("Argument out of range");
2192
- let n = new _$3(s.length, e - t + 1);
2192
+ let n = new _$2(s.length, e - t + 1);
2193
2193
  for (let i = 0; i < s.length; i++)
2194
2194
  for (let o = t; o <= e; o++) {
2195
2195
  if (s[i] < 0 || s[i] >= this.rows)
@@ -2201,7 +2201,7 @@ let V$1 = class V {
2201
2201
  subMatrixColumn(s, t, e) {
2202
2202
  if (t === void 0 && (t = 0), e === void 0 && (e = this.rows - 1), t > e || t < 0 || t >= this.rows || e < 0 || e >= this.rows)
2203
2203
  throw new RangeError("Argument out of range");
2204
- let n = new _$3(e - t + 1, s.length);
2204
+ let n = new _$2(e - t + 1, s.length);
2205
2205
  for (let i = 0; i < s.length; i++)
2206
2206
  for (let o = t; o <= e; o++) {
2207
2207
  if (s[i] < 0 || s[i] >= this.columns)
@@ -2211,7 +2211,7 @@ let V$1 = class V {
2211
2211
  return n;
2212
2212
  }
2213
2213
  setSubMatrix(s, t, e) {
2214
- if (s = _$3.checkMatrix(s), s.isEmpty())
2214
+ if (s = _$2.checkMatrix(s), s.isEmpty())
2215
2215
  return this;
2216
2216
  let n = t + s.rows - 1, i = e + s.columns - 1;
2217
2217
  ae$1(this, t, n, e, i);
@@ -2222,7 +2222,7 @@ let V$1 = class V {
2222
2222
  }
2223
2223
  selection(s, t) {
2224
2224
  ge(this, s), we(this, t);
2225
- let e = new _$3(s.length, t.length);
2225
+ let e = new _$2(s.length, t.length);
2226
2226
  for (let n = 0; n < s.length; n++) {
2227
2227
  let i = s[n];
2228
2228
  for (let o = 0; o < t.length; o++) {
@@ -2239,7 +2239,7 @@ let V$1 = class V {
2239
2239
  return t;
2240
2240
  }
2241
2241
  clone() {
2242
- return this.constructor.copy(this, new _$3(this.rows, this.columns));
2242
+ return this.constructor.copy(this, new _$2(this.rows, this.columns));
2243
2243
  }
2244
2244
  /**
2245
2245
  * @template {AbstractMatrix} M
@@ -2411,34 +2411,34 @@ let V$1 = class V {
2411
2411
  yield this.get(s, t);
2412
2412
  }
2413
2413
  };
2414
- V$1.prototype.klass = "Matrix";
2415
- typeof Symbol < "u" && (V$1.prototype[Symbol.for("nodejs.util.inspect.custom")] = hs);
2414
+ V$2.prototype.klass = "Matrix";
2415
+ typeof Symbol < "u" && (V$2.prototype[Symbol.for("nodejs.util.inspect.custom")] = hs);
2416
2416
  function ke(r, s) {
2417
2417
  return r - s;
2418
2418
  }
2419
2419
  function Is(r) {
2420
2420
  return r.every((s) => typeof s == "number");
2421
2421
  }
2422
- V$1.random = V$1.rand;
2423
- V$1.randomInt = V$1.randInt;
2424
- V$1.diagonal = V$1.diag;
2425
- V$1.prototype.diagonal = V$1.prototype.diag;
2426
- V$1.identity = V$1.eye;
2427
- V$1.prototype.negate = V$1.prototype.neg;
2428
- V$1.prototype.tensorProduct = V$1.prototype.kroneckerProduct;
2429
- var Ft$1, ue$1, dt$1;
2430
- let _$3 = (dt$1 = class extends V$1 {
2422
+ V$2.random = V$2.rand;
2423
+ V$2.randomInt = V$2.randInt;
2424
+ V$2.diagonal = V$2.diag;
2425
+ V$2.prototype.diagonal = V$2.prototype.diag;
2426
+ V$2.identity = V$2.eye;
2427
+ V$2.prototype.negate = V$2.prototype.neg;
2428
+ V$2.prototype.tensorProduct = V$2.prototype.kroneckerProduct;
2429
+ var Ft$2, ue$1, dt$2;
2430
+ let _$2 = (dt$2 = class extends V$2 {
2431
2431
  constructor(t, e) {
2432
2432
  super();
2433
- le$1(this, Ft$1);
2433
+ le$1(this, Ft$2);
2434
2434
  /**
2435
2435
  * @type {Float64Array[]}
2436
2436
  */
2437
- q$2(this, "data");
2438
- if (dt$1.isMatrix(t))
2439
- he(this, Ft$1, ue$1).call(this, t.rows, t.columns), dt$1.copy(t, this);
2437
+ q$1(this, "data");
2438
+ if (dt$2.isMatrix(t))
2439
+ he(this, Ft$2, ue$1).call(this, t.rows, t.columns), dt$2.copy(t, this);
2440
2440
  else if (Number.isInteger(t) && t >= 0)
2441
- he(this, Ft$1, ue$1).call(this, t, e);
2441
+ he(this, Ft$2, ue$1).call(this, t, e);
2442
2442
  else if (st$3.isAnyArray(t)) {
2443
2443
  const n = t;
2444
2444
  if (t = n.length, e = t ? n[0].length : 0, typeof e != "number")
@@ -2466,13 +2466,13 @@ let _$3 = (dt$1 = class extends V$1 {
2466
2466
  return this.data[t][e];
2467
2467
  }
2468
2468
  removeRow(t) {
2469
- return ot$4(this, t), this.data.splice(t, 1), this.rows -= 1, this;
2469
+ return ot$3(this, t), this.data.splice(t, 1), this.rows -= 1, this;
2470
2470
  }
2471
2471
  addRow(t, e) {
2472
- return e === void 0 && (e = t, t = this.rows), ot$4(this, t, !0), e = Float64Array.from(Pt$2(this, e)), this.data.splice(t, 0, e), this.rows += 1, this;
2472
+ return e === void 0 && (e = t, t = this.rows), ot$3(this, t, !0), e = Float64Array.from(Pt$2(this, e)), this.data.splice(t, 0, e), this.rows += 1, this;
2473
2473
  }
2474
2474
  removeColumn(t) {
2475
- lt$3(this, t);
2475
+ lt$4(this, t);
2476
2476
  for (let e = 0; e < this.rows; e++) {
2477
2477
  const n = new Float64Array(this.columns - 1);
2478
2478
  for (let i = 0; i < t; i++)
@@ -2484,7 +2484,7 @@ let _$3 = (dt$1 = class extends V$1 {
2484
2484
  return this.columns -= 1, this;
2485
2485
  }
2486
2486
  addColumn(t, e) {
2487
- typeof e > "u" && (e = t, t = this.columns), lt$3(this, t, !0), e = bt$2(this, e);
2487
+ typeof e > "u" && (e = t, t = this.columns), lt$4(this, t, !0), e = bt$1(this, e);
2488
2488
  for (let n = 0; n < this.rows; n++) {
2489
2489
  const i = new Float64Array(this.columns + 1);
2490
2490
  let o = 0;
@@ -2496,7 +2496,7 @@ let _$3 = (dt$1 = class extends V$1 {
2496
2496
  }
2497
2497
  return this.columns += 1, this;
2498
2498
  }
2499
- }, Ft$1 = new WeakSet(), /**
2499
+ }, Ft$2 = new WeakSet(), /**
2500
2500
  * Init an empty matrix
2501
2501
  * @param {number} nRows
2502
2502
  * @param {number} nColumns
@@ -2508,10 +2508,10 @@ ue$1 = function(t, e) {
2508
2508
  else
2509
2509
  throw new TypeError("nColumns must be a positive integer");
2510
2510
  this.rows = t, this.columns = e;
2511
- }, dt$1);
2512
- cs(V$1, _$3);
2511
+ }, dt$2);
2512
+ cs(V$2, _$2);
2513
2513
  var K$3;
2514
- const Jt = class Jt extends V$1 {
2514
+ const Jt = class Jt extends V$2 {
2515
2515
  /**
2516
2516
  * @param {number | AbstractMatrix | ArrayLike<ArrayLike<number>>} diagonalSize
2517
2517
  * @return {this}
@@ -2520,26 +2520,26 @@ const Jt = class Jt extends V$1 {
2520
2520
  super();
2521
2521
  /** @type {Matrix} */
2522
2522
  le$1(this, K$3);
2523
- if (_$3.isMatrix(t)) {
2523
+ if (_$2.isMatrix(t)) {
2524
2524
  if (!t.isSymmetric())
2525
2525
  throw new TypeError("not symmetric data");
2526
- Dt$1(this, K$3, _$3.copy(
2526
+ Dt$2(this, K$3, _$2.copy(
2527
2527
  t,
2528
- new _$3(t.rows, t.rows)
2528
+ new _$2(t.rows, t.rows)
2529
2529
  ));
2530
2530
  } else if (Number.isInteger(t) && t >= 0)
2531
- Dt$1(this, K$3, new _$3(t, t));
2532
- else if (Dt$1(this, K$3, new _$3(t)), !this.isSymmetric())
2531
+ Dt$2(this, K$3, new _$2(t, t));
2532
+ else if (Dt$2(this, K$3, new _$2(t)), !this.isSymmetric())
2533
2533
  throw new TypeError("not symmetric data");
2534
2534
  }
2535
2535
  get size() {
2536
- return ht$2(this, K$3).size;
2536
+ return ht$3(this, K$3).size;
2537
2537
  }
2538
2538
  get rows() {
2539
- return ht$2(this, K$3).rows;
2539
+ return ht$3(this, K$3).rows;
2540
2540
  }
2541
2541
  get columns() {
2542
- return ht$2(this, K$3).columns;
2542
+ return ht$3(this, K$3).columns;
2543
2543
  }
2544
2544
  get diagonalSize() {
2545
2545
  return this.rows;
@@ -2552,7 +2552,7 @@ const Jt = class Jt extends V$1 {
2552
2552
  * @returns {boolean}
2553
2553
  */
2554
2554
  static isSymmetricMatrix(t) {
2555
- return _$3.isMatrix(t) && t.klassType === "SymmetricMatrix";
2555
+ return _$2.isMatrix(t) && t.klassType === "SymmetricMatrix";
2556
2556
  }
2557
2557
  /**
2558
2558
  * @param diagonalSize
@@ -2575,21 +2575,21 @@ const Jt = class Jt extends V$1 {
2575
2575
  return t;
2576
2576
  }
2577
2577
  toMatrix() {
2578
- return new _$3(this);
2578
+ return new _$2(this);
2579
2579
  }
2580
2580
  get(t, e) {
2581
- return ht$2(this, K$3).get(t, e);
2581
+ return ht$3(this, K$3).get(t, e);
2582
2582
  }
2583
2583
  set(t, e, n) {
2584
- return ht$2(this, K$3).set(t, e, n), ht$2(this, K$3).set(e, t, n), this;
2584
+ return ht$3(this, K$3).set(t, e, n), ht$3(this, K$3).set(e, t, n), this;
2585
2585
  }
2586
2586
  removeCross(t) {
2587
- return ht$2(this, K$3).removeRow(t), ht$2(this, K$3).removeColumn(t), this;
2587
+ return ht$3(this, K$3).removeRow(t), ht$3(this, K$3).removeColumn(t), this;
2588
2588
  }
2589
2589
  addCross(t, e) {
2590
2590
  e === void 0 && (e = t, t = this.diagonalSize);
2591
2591
  const n = e.slice();
2592
- return n.splice(t, 1), ht$2(this, K$3).addRow(t, n), ht$2(this, K$3).addColumn(t, e), this;
2592
+ return n.splice(t, 1), ht$3(this, K$3).addRow(t, n), ht$3(this, K$3).addColumn(t, e), this;
2593
2593
  }
2594
2594
  /**
2595
2595
  * @param {Mask[]} mask
@@ -2670,9 +2670,9 @@ const Jt = class Jt extends V$1 {
2670
2670
  }
2671
2671
  };
2672
2672
  K$3 = new WeakMap();
2673
- let pt$1 = Jt;
2674
- pt$1.prototype.klassType = "SymmetricMatrix";
2675
- let te$1 = class te extends pt$1 {
2673
+ let pt$2 = Jt;
2674
+ pt$2.prototype.klassType = "SymmetricMatrix";
2675
+ let te$2 = class te extends pt$2 {
2676
2676
  /**
2677
2677
  * not the same as matrix.isSymmetric()
2678
2678
  * Here is to check if it's instanceof SymmetricMatrix without bundling issues
@@ -2681,7 +2681,7 @@ let te$1 = class te extends pt$1 {
2681
2681
  * @returns {boolean}
2682
2682
  */
2683
2683
  static isDistanceMatrix(s) {
2684
- return pt$1.isSymmetricMatrix(s) && s.klassSubType === "DistanceMatrix";
2684
+ return pt$2.isSymmetricMatrix(s) && s.klassSubType === "DistanceMatrix";
2685
2685
  }
2686
2686
  constructor(s) {
2687
2687
  if (super(s), !this.isDistance())
@@ -2694,7 +2694,7 @@ let te$1 = class te extends pt$1 {
2694
2694
  return t === void 0 && (t = s, s = this.diagonalSize), t = t.slice(), t[s] = 0, super.addCross(s, t);
2695
2695
  }
2696
2696
  toSymmetricMatrix() {
2697
- return new pt$1(this);
2697
+ return new pt$2(this);
2698
2698
  }
2699
2699
  clone() {
2700
2700
  const s = new te(this.diagonalSize);
@@ -2747,15 +2747,15 @@ let te$1 = class te extends pt$1 {
2747
2747
  return n;
2748
2748
  }
2749
2749
  };
2750
- te$1.prototype.klassSubType = "DistanceMatrix";
2751
- let ft$2 = class ft extends V$1 {
2750
+ te$2.prototype.klassSubType = "DistanceMatrix";
2751
+ let ft$2 = class ft extends V$2 {
2752
2752
  constructor(s, t, e) {
2753
2753
  super(), this.matrix = s, this.rows = t, this.columns = e;
2754
2754
  }
2755
2755
  };
2756
2756
  class Cs extends ft$2 {
2757
2757
  constructor(s, t) {
2758
- lt$3(s, t), super(s, s.rows, 1), this.column = t;
2758
+ lt$4(s, t), super(s, s.rows, 1), this.column = t;
2759
2759
  }
2760
2760
  set(s, t, e) {
2761
2761
  return this.matrix.set(s, this.column, e), this;
@@ -2799,7 +2799,7 @@ class xs extends ft$2 {
2799
2799
  }
2800
2800
  class As extends ft$2 {
2801
2801
  constructor(s, t) {
2802
- ot$4(s, t), super(s, 1, s.columns), this.row = t;
2802
+ ot$3(s, t), super(s, 1, s.columns), this.row = t;
2803
2803
  }
2804
2804
  set(s, t, e) {
2805
2805
  return this.matrix.set(this.row, t, e), this;
@@ -2866,7 +2866,7 @@ class $s extends ft$2 {
2866
2866
  return this.matrix.get(t, s);
2867
2867
  }
2868
2868
  }
2869
- class Ae extends V$1 {
2869
+ class Ae extends V$2 {
2870
2870
  constructor(s, t = {}) {
2871
2871
  const { rows: e = 1 } = t;
2872
2872
  if (s.length % e !== 0)
@@ -2885,7 +2885,7 @@ class Ae extends V$1 {
2885
2885
  return s * this.columns + t;
2886
2886
  }
2887
2887
  }
2888
- let rt$4 = class rt extends V$1 {
2888
+ let rt$4 = class rt extends V$2 {
2889
2889
  constructor(s) {
2890
2890
  super(), this.data = s, this.rows = s.length, this.columns = s[0].length;
2891
2891
  }
@@ -2901,7 +2901,7 @@ function Ls(r, s) {
2901
2901
  return r[0] && st$3.isAnyArray(r[0]) ? new rt$4(r) : new Ae(r, s);
2902
2902
  throw new Error("the argument is not an array");
2903
2903
  }
2904
- let ee$1 = class ee {
2904
+ let ee$2 = class ee {
2905
2905
  constructor(s) {
2906
2906
  s = rt$4.checkMatrix(s);
2907
2907
  let t = s.clone(), e = t.rows, n = t.columns, i = new Float64Array(e), o = 1, l, h, a, u, c, g, d, w, p;
@@ -2936,7 +2936,7 @@ let ee$1 = class ee {
2936
2936
  return !1;
2937
2937
  }
2938
2938
  solve(s) {
2939
- s = _$3.checkMatrix(s);
2939
+ s = _$2.checkMatrix(s);
2940
2940
  let t = this.LU;
2941
2941
  if (t.rows !== s.rows)
2942
2942
  throw new Error("Invalid matrix dimensions");
@@ -2966,14 +2966,14 @@ let ee$1 = class ee {
2966
2966
  return t;
2967
2967
  }
2968
2968
  get lowerTriangularMatrix() {
2969
- let s = this.LU, t = s.rows, e = s.columns, n = new _$3(t, e);
2969
+ let s = this.LU, t = s.rows, e = s.columns, n = new _$2(t, e);
2970
2970
  for (let i = 0; i < t; i++)
2971
2971
  for (let o = 0; o < e; o++)
2972
2972
  i > o ? n.set(i, o, s.get(i, o)) : i === o ? n.set(i, o, 1) : n.set(i, o, 0);
2973
2973
  return n;
2974
2974
  }
2975
2975
  get upperTriangularMatrix() {
2976
- let s = this.LU, t = s.rows, e = s.columns, n = new _$3(t, e);
2976
+ let s = this.LU, t = s.rows, e = s.columns, n = new _$2(t, e);
2977
2977
  for (let i = 0; i < t; i++)
2978
2978
  for (let o = 0; o < e; o++)
2979
2979
  i <= o ? n.set(i, o, s.get(i, o)) : n.set(i, o, 0);
@@ -2983,7 +2983,7 @@ let ee$1 = class ee {
2983
2983
  return Array.from(this.pivotVector);
2984
2984
  }
2985
2985
  };
2986
- function ut(r, s) {
2986
+ function ut$1(r, s) {
2987
2987
  let t = 0;
2988
2988
  return Math.abs(r) > Math.abs(s) ? (t = s / r, Math.abs(r) * Math.sqrt(1 + t * t)) : s !== 0 ? (t = r / s, Math.abs(s) * Math.sqrt(1 + t * t)) : 0;
2989
2989
  }
@@ -2994,7 +2994,7 @@ class pe {
2994
2994
  for (h = 0; h < n; h++) {
2995
2995
  let u = 0;
2996
2996
  for (o = h; o < e; o++)
2997
- u = ut(u, t.get(o, h));
2997
+ u = ut$1(u, t.get(o, h));
2998
2998
  if (u !== 0) {
2999
2999
  for (t.get(h, h) < 0 && (u = -u), o = h; o < e; o++)
3000
3000
  t.set(o, h, t.get(o, h) / u);
@@ -3010,7 +3010,7 @@ class pe {
3010
3010
  this.QR = t, this.Rdiag = i;
3011
3011
  }
3012
3012
  solve(s) {
3013
- s = _$3.checkMatrix(s);
3013
+ s = _$2.checkMatrix(s);
3014
3014
  let t = this.QR, e = t.rows;
3015
3015
  if (s.rows !== e)
3016
3016
  throw new Error("Matrix row dimensions must agree");
@@ -3041,14 +3041,14 @@ class pe {
3041
3041
  return !0;
3042
3042
  }
3043
3043
  get upperTriangularMatrix() {
3044
- let s = this.QR, t = s.columns, e = new _$3(t, t), n, i;
3044
+ let s = this.QR, t = s.columns, e = new _$2(t, t), n, i;
3045
3045
  for (n = 0; n < t; n++)
3046
3046
  for (i = 0; i < t; i++)
3047
3047
  n < i ? e.set(n, i, s.get(n, i)) : n === i ? e.set(n, i, this.Rdiag[n]) : e.set(n, i, 0);
3048
3048
  return e;
3049
3049
  }
3050
3050
  get orthogonalMatrix() {
3051
- let s = this.QR, t = s.rows, e = s.columns, n = new _$3(t, e), i, o, l, h;
3051
+ let s = this.QR, t = s.rows, e = s.columns, n = new _$2(t, e), i, o, l, h;
3052
3052
  for (l = e - 1; l >= 0; l--) {
3053
3053
  for (i = 0; i < t; i++)
3054
3054
  n.set(i, l, 0);
@@ -3063,7 +3063,7 @@ class pe {
3063
3063
  return n;
3064
3064
  }
3065
3065
  }
3066
- let vt$2 = class vt {
3066
+ let vt$1 = class vt {
3067
3067
  constructor(s, t = {}) {
3068
3068
  if (s = rt$4.checkMatrix(s), s.isEmpty())
3069
3069
  throw new Error("Matrix must be non-empty");
@@ -3086,14 +3086,14 @@ let vt$2 = class vt {
3086
3086
  }
3087
3087
  else
3088
3088
  c = s.clone();
3089
- let g = Math.min(e, n), d = Math.min(e + 1, n), w = new Float64Array(d), p = new _$3(e, g), P = new _$3(n, n), f = new Float64Array(n), M = new Float64Array(e), E = new Float64Array(d);
3089
+ let g = Math.min(e, n), d = Math.min(e + 1, n), w = new Float64Array(d), p = new _$2(e, g), P = new _$2(n, n), f = new Float64Array(n), M = new Float64Array(e), E = new Float64Array(d);
3090
3090
  for (let m = 0; m < d; m++) E[m] = m;
3091
3091
  let R = Math.min(e - 1, n), v = Math.max(0, Math.min(n - 2, e)), L = Math.max(R, v);
3092
3092
  for (let m = 0; m < L; m++) {
3093
3093
  if (m < R) {
3094
3094
  w[m] = 0;
3095
3095
  for (let b = m; b < e; b++)
3096
- w[m] = ut(w[m], c.get(b, m));
3096
+ w[m] = ut$1(w[m], c.get(b, m));
3097
3097
  if (w[m] !== 0) {
3098
3098
  c.get(m, m) < 0 && (w[m] = -w[m]);
3099
3099
  for (let b = m; b < e; b++)
@@ -3119,7 +3119,7 @@ let vt$2 = class vt {
3119
3119
  if (m < v) {
3120
3120
  f[m] = 0;
3121
3121
  for (let b = m + 1; b < n; b++)
3122
- f[m] = ut(f[m], f[b]);
3122
+ f[m] = ut$1(f[m], f[b]);
3123
3123
  if (f[m] !== 0) {
3124
3124
  f[m + 1] < 0 && (f[m] = 0 - f[m]);
3125
3125
  for (let b = m + 1; b < n; b++)
@@ -3214,7 +3214,7 @@ let vt$2 = class vt {
3214
3214
  let j = f[S - 2];
3215
3215
  f[S - 2] = 0;
3216
3216
  for (let y = S - 2; y >= m; y--) {
3217
- let C = ut(w[y], j), F = w[y] / C, I = j / C;
3217
+ let C = ut$1(w[y], j), F = w[y] / C, I = j / C;
3218
3218
  if (w[y] = C, y !== m && (j = -I * f[y - 1], f[y - 1] = F * f[y - 1]), a)
3219
3219
  for (let B = 0; B < n; B++)
3220
3220
  C = F * P.get(B, y) + I * P.get(B, S - 1), P.set(B, S - 1, -I * P.get(B, y) + F * P.get(B, S - 1)), P.set(B, y, C);
@@ -3225,7 +3225,7 @@ let vt$2 = class vt {
3225
3225
  let j = f[m - 1];
3226
3226
  f[m - 1] = 0;
3227
3227
  for (let y = m; y < S; y++) {
3228
- let C = ut(w[y], j), F = w[y] / C, I = j / C;
3228
+ let C = ut$1(w[y], j), F = w[y] / C, I = j / C;
3229
3229
  if (w[y] = C, j = -I * f[y], f[y] = F * f[y], h)
3230
3230
  for (let B = 0; B < e; B++)
3231
3231
  C = F * p.get(B, y) + I * p.get(B, m - 1), p.set(B, m - 1, -I * p.get(B, y) + F * p.get(B, m - 1)), p.set(B, y, C);
@@ -3244,13 +3244,13 @@ let vt$2 = class vt {
3244
3244
  (x !== 0 || N !== 0) && (x < 0 ? A = 0 - Math.sqrt(x * x + N) : A = Math.sqrt(x * x + N), A = N / (x + A));
3245
3245
  let O = (I + y) * (I - y) + A, U = I * B;
3246
3246
  for (let T = m; T < S - 1; T++) {
3247
- let z = ut(O, U);
3247
+ let z = ut$1(O, U);
3248
3248
  z === 0 && (z = Number.MIN_VALUE);
3249
3249
  let X = O / z, G = U / z;
3250
3250
  if (T !== m && (f[T - 1] = z), O = X * w[T] + G * f[T], f[T] = X * f[T] - G * w[T], U = G * w[T + 1], w[T + 1] = X * w[T + 1], a)
3251
3251
  for (let W = 0; W < n; W++)
3252
3252
  z = X * P.get(W, T) + G * P.get(W, T + 1), P.set(W, T + 1, -G * P.get(W, T) + X * P.get(W, T + 1)), P.set(W, T, z);
3253
- if (z = ut(O, U), z === 0 && (z = Number.MIN_VALUE), X = O / z, G = U / z, w[T] = z, O = X * f[T] + G * w[T + 1], w[T + 1] = -G * f[T] + X * w[T + 1], U = G * f[T + 1], f[T + 1] = X * f[T + 1], h && T < e - 1)
3253
+ if (z = ut$1(O, U), z === 0 && (z = Number.MIN_VALUE), X = O / z, G = U / z, w[T] = z, O = X * f[T] + G * w[T + 1], w[T + 1] = -G * f[T] + X * w[T + 1], U = G * f[T + 1], f[T + 1] = X * f[T + 1], h && T < e - 1)
3254
3254
  for (let W = 0; W < e; W++)
3255
3255
  z = X * p.get(W, T) + G * p.get(W, T + 1), p.set(W, T + 1, -G * p.get(W, T) + X * p.get(W, T + 1)), p.set(W, T, z);
3256
3256
  }
@@ -3283,10 +3283,10 @@ let vt$2 = class vt {
3283
3283
  this.m = e, this.n = n, this.s = w, this.U = p, this.V = P;
3284
3284
  }
3285
3285
  solve(s) {
3286
- let t = s, e = this.threshold, n = this.s.length, i = _$3.zeros(n, n);
3286
+ let t = s, e = this.threshold, n = this.s.length, i = _$2.zeros(n, n);
3287
3287
  for (let g = 0; g < n; g++)
3288
3288
  Math.abs(this.s[g]) <= e ? i.set(g, g, 0) : i.set(g, g, 1 / this.s[g]);
3289
- let o = this.U, l = this.rightSingularVectors, h = l.mmul(i), a = l.rows, u = o.rows, c = _$3.zeros(a, u);
3289
+ let o = this.U, l = this.rightSingularVectors, h = l.mmul(i), a = l.rows, u = o.rows, c = _$2.zeros(a, u);
3290
3290
  for (let g = 0; g < a; g++)
3291
3291
  for (let d = 0; d < u; d++) {
3292
3292
  let w = 0;
@@ -3297,14 +3297,14 @@ let vt$2 = class vt {
3297
3297
  return c.mmul(t);
3298
3298
  }
3299
3299
  solveForDiagonal(s) {
3300
- return this.solve(_$3.diag(s));
3300
+ return this.solve(_$2.diag(s));
3301
3301
  }
3302
3302
  inverse() {
3303
- let s = this.V, t = this.threshold, e = s.rows, n = s.columns, i = new _$3(e, this.s.length);
3303
+ let s = this.V, t = this.threshold, e = s.rows, n = s.columns, i = new _$2(e, this.s.length);
3304
3304
  for (let u = 0; u < e; u++)
3305
3305
  for (let c = 0; c < n; c++)
3306
3306
  Math.abs(this.s[c]) > t && i.set(u, c, s.get(u, c) / this.s[c]);
3307
- let o = this.U, l = o.rows, h = o.columns, a = new _$3(e, l);
3307
+ let o = this.U, l = o.rows, h = o.columns, a = new _$2(e, l);
3308
3308
  for (let u = 0; u < e; u++)
3309
3309
  for (let c = 0; c < l; c++) {
3310
3310
  let g = 0;
@@ -3339,17 +3339,17 @@ let vt$2 = class vt {
3339
3339
  return this.V;
3340
3340
  }
3341
3341
  get diagonalMatrix() {
3342
- return _$3.diag(this.s);
3342
+ return _$2.diag(this.s);
3343
3343
  }
3344
3344
  };
3345
3345
  function Ds(r, s = !1) {
3346
- return r = rt$4.checkMatrix(r), s ? new vt$2(r).inverse() : Ve(r, _$3.eye(r.rows));
3346
+ return r = rt$4.checkMatrix(r), s ? new vt$1(r).inverse() : Ve(r, _$2.eye(r.rows));
3347
3347
  }
3348
3348
  function Ve(r, s, t = !1) {
3349
- return r = rt$4.checkMatrix(r), s = rt$4.checkMatrix(s), t ? new vt$2(r).solve(s) : r.isSquare() ? new ee$1(r).solve(s) : new pe(r).solve(s);
3349
+ return r = rt$4.checkMatrix(r), s = rt$4.checkMatrix(s), t ? new vt$1(r).solve(s) : r.isSquare() ? new ee$2(r).solve(s) : new pe(r).solve(s);
3350
3350
  }
3351
3351
  function Xt$1(r) {
3352
- if (r = _$3.checkMatrix(r), r.isSquare()) {
3352
+ if (r = _$2.checkMatrix(r), r.isSquare()) {
3353
3353
  if (r.columns === 0)
3354
3354
  return 1;
3355
3355
  let s, t, e, n;
@@ -3359,7 +3359,7 @@ function Xt$1(r) {
3359
3359
  let i, o, l;
3360
3360
  return i = new Gt$1(r, [1, 2], [1, 2]), o = new Gt$1(r, [1, 2], [0, 2]), l = new Gt$1(r, [1, 2], [0, 1]), s = r.get(0, 0), t = r.get(0, 1), e = r.get(0, 2), s * Xt$1(i) - t * Xt$1(o) + e * Xt$1(l);
3361
3361
  } else
3362
- return new ee$1(r).determinant;
3362
+ return new ee$2(r).determinant;
3363
3363
  } else
3364
3364
  throw Error("determinant can only be calculated for a square matrix");
3365
3365
  }
@@ -3381,10 +3381,10 @@ function Os(r, s, t, e = 1e-9, n = 1e-9) {
3381
3381
  }
3382
3382
  function Bs(r, s = {}) {
3383
3383
  const { thresholdValue: t = 1e-9, thresholdError: e = 1e-9 } = s;
3384
- r = _$3.checkMatrix(r);
3385
- let n = r.rows, i = new _$3(n, n);
3384
+ r = _$2.checkMatrix(r);
3385
+ let n = r.rows, i = new _$2(n, n);
3386
3386
  for (let o = 0; o < n; o++) {
3387
- let l = _$3.columnVector(r.getRow(o)), h = r.subMatrixRow(zs(n, o)).transpose(), u = new vt$2(h).solve(l), c = _$3.sub(l, h.mmul(u)).abs().max();
3387
+ let l = _$2.columnVector(r.getRow(o)), h = r.subMatrixRow(zs(n, o)).transpose(), u = new vt$1(h).solve(l), c = _$2.sub(l, h.mmul(u)).abs().max();
3388
3388
  i.setRow(
3389
3389
  o,
3390
3390
  Os(c, u, o, t, e)
@@ -3393,17 +3393,17 @@ function Bs(r, s = {}) {
3393
3393
  return i;
3394
3394
  }
3395
3395
  function Us(r, s = Number.EPSILON) {
3396
- if (r = _$3.checkMatrix(r), r.isEmpty())
3396
+ if (r = _$2.checkMatrix(r), r.isEmpty())
3397
3397
  return r.transpose();
3398
- let t = new vt$2(r, { autoTranspose: !0 }), e = t.leftSingularVectors, n = t.rightSingularVectors, i = t.diagonal;
3398
+ let t = new vt$1(r, { autoTranspose: !0 }), e = t.leftSingularVectors, n = t.rightSingularVectors, i = t.diagonal;
3399
3399
  for (let o = 0; o < i.length; o++)
3400
3400
  Math.abs(i[o]) > s ? i[o] = 1 / i[o] : i[o] = 0;
3401
- return n.mmul(_$3.diag(i).mmul(e.transpose()));
3401
+ return n.mmul(_$2.diag(i).mmul(e.transpose()));
3402
3402
  }
3403
3403
  function Ys(r, s = r, t = {}) {
3404
- r = new _$3(r);
3404
+ r = new _$2(r);
3405
3405
  let e = !1;
3406
- if (typeof s == "object" && !_$3.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$3(s), r.rows !== s.rows)
3406
+ if (typeof s == "object" && !_$2.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$2(s), r.rows !== s.rows)
3407
3407
  throw new TypeError("Both matrices must have the same number of rows");
3408
3408
  const { center: n = !0 } = t;
3409
3409
  n && (r = r.center("column"), e || (s = s.center("column")));
@@ -3414,9 +3414,9 @@ function Ys(r, s = r, t = {}) {
3414
3414
  return i;
3415
3415
  }
3416
3416
  function Ws(r, s = r, t = {}) {
3417
- r = new _$3(r);
3417
+ r = new _$2(r);
3418
3418
  let e = !1;
3419
- if (typeof s == "object" && !_$3.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$3(s), r.rows !== s.rows)
3419
+ if (typeof s == "object" && !_$2.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$2(s), r.rows !== s.rows)
3420
3420
  throw new TypeError("Both matrices must have the same number of rows");
3421
3421
  const { center: n = !0, scale: i = !0 } = t;
3422
3422
  n && (r.center("column"), e || s.center("column")), i && (r.scale("column"), e || s.scale("column"));
@@ -3437,14 +3437,14 @@ let Ne = class {
3437
3437
  throw new Error("Matrix is not a square matrix");
3438
3438
  if (s.isEmpty())
3439
3439
  throw new Error("Matrix must be non-empty");
3440
- let n = s.columns, i = new _$3(n, n), o = new Float64Array(n), l = new Float64Array(n), h = s, a, u, c = !1;
3440
+ let n = s.columns, i = new _$2(n, n), o = new Float64Array(n), l = new Float64Array(n), h = s, a, u, c = !1;
3441
3441
  if (e ? c = !0 : c = s.isSymmetric(), c) {
3442
3442
  for (a = 0; a < n; a++)
3443
3443
  for (u = 0; u < n; u++)
3444
3444
  i.set(a, u, h.get(a, u));
3445
3445
  Qs(n, l, o, i), Gs(n, l, o, i);
3446
3446
  } else {
3447
- let g = new _$3(n, n), d = new Float64Array(n);
3447
+ let g = new _$2(n, n), d = new Float64Array(n);
3448
3448
  for (u = 0; u < n; u++)
3449
3449
  for (a = 0; a < n; a++)
3450
3450
  g.set(a, u, h.get(a, u));
@@ -3462,7 +3462,7 @@ let Ne = class {
3462
3462
  return this.V;
3463
3463
  }
3464
3464
  get diagonalMatrix() {
3465
- let s = this.n, t = this.e, e = this.d, n = new _$3(s, s), i, o;
3465
+ let s = this.n, t = this.e, e = this.d, n = new _$2(s, s), i, o;
3466
3466
  for (i = 0; i < s; i++) {
3467
3467
  for (o = 0; o < s; o++)
3468
3468
  n.set(i, o, 0);
@@ -3532,10 +3532,10 @@ function Gs(r, s, t, e) {
3532
3532
  u++;
3533
3533
  if (u > a)
3534
3534
  do {
3535
- for (n = t[a], c = (t[a + 1] - n) / (2 * s[a]), g = ut(c, 1), c < 0 && (g = -g), t[a] = s[a] / (c + g), t[a + 1] = s[a] * (c + g), d = t[a + 1], i = n - t[a], o = a + 2; o < r; o++)
3535
+ for (n = t[a], c = (t[a + 1] - n) / (2 * s[a]), g = ut$1(c, 1), c < 0 && (g = -g), t[a] = s[a] / (c + g), t[a + 1] = s[a] * (c + g), d = t[a + 1], i = n - t[a], o = a + 2; o < r; o++)
3536
3536
  t[o] -= i;
3537
3537
  for (R = R + i, c = t[u], w = 1, p = w, P = w, f = s[a + 1], M = 0, E = 0, o = u - 1; o >= a; o--)
3538
- for (P = p, p = w, E = M, n = w * s[o], i = w * c, g = ut(c, s[o]), s[o + 1] = M * g, M = s[o] / g, w = c / g, c = w * t[o] - M * n, t[o + 1] = i + M * (w * n + M * t[o]), h = 0; h < r; h++)
3538
+ for (P = p, p = w, E = M, n = w * s[o], i = w * c, g = ut$1(c, s[o]), s[o + 1] = M * g, M = s[o] / g, w = c / g, c = w * t[o] - M * n, t[o + 1] = i + M * (w * n + M * t[o]), h = 0; h < r; h++)
3539
3539
  i = e.get(h, o + 1), e.set(h, o + 1, M * e.get(h, o) + w * i), e.set(h, o, w * e.get(h, o) - M * i);
3540
3540
  c = -M * E * P * f * s[a] / d, s[a] = M * c, t[a] = w * c;
3541
3541
  } while (Math.abs(s[a]) > L * v);
@@ -3698,7 +3698,7 @@ class $e {
3698
3698
  constructor(s) {
3699
3699
  if (s = rt$4.checkMatrix(s), !s.isSymmetric())
3700
3700
  throw new Error("Matrix is not symmetric");
3701
- let t = s, e = t.rows, n = new _$3(e, e), i = !0, o, l, h;
3701
+ let t = s, e = t.rows, n = new _$2(e, e), i = !0, o, l, h;
3702
3702
  for (l = 0; l < e; l++) {
3703
3703
  let a = 0;
3704
3704
  for (h = 0; h < l; h++) {
@@ -3752,7 +3752,7 @@ class Le {
3752
3752
  } = t;
3753
3753
  let l;
3754
3754
  if (e) {
3755
- if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$3.columnVector(e) : e = rt$4.checkMatrix(e), e.rows !== s.rows)
3755
+ if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$2.columnVector(e) : e = rt$4.checkMatrix(e), e.rows !== s.rows)
3756
3756
  throw new Error("Y should have the same number of rows as X");
3757
3757
  l = e.getColumnVector(0);
3758
3758
  } else
@@ -3771,15 +3771,15 @@ class Le {
3771
3771
  this.w = c.transpose(), this.s = a.transpose().mmul(a).sqrt(), n ? this.t = a.clone().div(this.s.get(0, 0)) : this.t = a, this.xResidual = s.sub(a.mmul(c.transpose()));
3772
3772
  }
3773
3773
  }
3774
- $$1.AbstractMatrix = V$1;
3774
+ $$1.AbstractMatrix = V$2;
3775
3775
  $$1.CHO = $e;
3776
3776
  $$1.CholeskyDecomposition = $e;
3777
- $$1.DistanceMatrix = te$1;
3777
+ $$1.DistanceMatrix = te$2;
3778
3778
  $$1.EVD = Ne;
3779
3779
  var Js = $$1.EigenvalueDecomposition = Ne;
3780
- $$1.LU = ee$1;
3781
- $$1.LuDecomposition = ee$1;
3782
- var De = $$1.Matrix = _$3;
3780
+ $$1.LU = ee$2;
3781
+ $$1.LuDecomposition = ee$2;
3782
+ var De = $$1.Matrix = _$2;
3783
3783
  $$1.MatrixColumnSelectionView = qs;
3784
3784
  $$1.MatrixColumnView = Cs;
3785
3785
  $$1.MatrixFlipColumnView = Fs;
@@ -3793,14 +3793,14 @@ $$1.NIPALS = Le;
3793
3793
  $$1.Nipals = Le;
3794
3794
  $$1.QR = pe;
3795
3795
  $$1.QrDecomposition = pe;
3796
- $$1.SVD = vt$2;
3797
- $$1.SingularValueDecomposition = vt$2;
3798
- $$1.SymmetricMatrix = pt$1;
3796
+ $$1.SVD = vt$1;
3797
+ $$1.SingularValueDecomposition = vt$1;
3798
+ $$1.SymmetricMatrix = pt$2;
3799
3799
  $$1.WrapperMatrix1D = Ae;
3800
3800
  $$1.WrapperMatrix2D = rt$4;
3801
3801
  $$1.correlation = Ws;
3802
3802
  $$1.covariance = Ys;
3803
- var Re = $$1.default = _$3;
3803
+ var Re = $$1.default = _$2;
3804
3804
  $$1.determinant = Xt$1;
3805
3805
  $$1.inverse = Ds;
3806
3806
  $$1.linearDependencies = Bs;
@@ -3822,7 +3822,7 @@ function qt(r, s, t) {
3822
3822
  return [];
3823
3823
  if (i == 0)
3824
3824
  return [-0.5 * n];
3825
- o = -0.5 * (n + kt$1(Math.sqrt(i), n));
3825
+ o = -0.5 * (n + kt$2(Math.sqrt(i), n));
3826
3826
  } else
3827
3827
  o = -n;
3828
3828
  const l = e / o;
@@ -3837,7 +3837,7 @@ function ze(r, s, t, e) {
3837
3837
  const g = Math.sqrt(-0.25 * u), d = -0.5 * c;
3838
3838
  return [Math.cbrt(d + g) + Math.cbrt(d - g) - n];
3839
3839
  } else if (u == 0) {
3840
- const g = kt$1(Math.sqrt(-l), c);
3840
+ const g = kt$2(Math.sqrt(-l), c);
3841
3841
  return [g - n, -2 * g - n];
3842
3842
  } else {
3843
3843
  const g = Math.atan2(Math.sqrt(u), -c) / 3, d = Math.cos(g), w = Math.sin(g) * Math.sqrt(3), p = 0.5 * (-d + w), P = 0.5 * (-d - w), f = 2 * Math.sqrt(-l);
@@ -3866,7 +3866,7 @@ function wn$2(r, s, t, e, n) {
3866
3866
  }
3867
3867
  return [];
3868
3868
  }
3869
- function gt$1(r, s) {
3869
+ function gt$2(r, s) {
3870
3870
  return s == 0 ? Math.abs(r) : Math.abs((r - s) / s);
3871
3871
  }
3872
3872
  function ve(r, s, t, e, n) {
@@ -3883,13 +3883,13 @@ function ve(r, s, t, e, n) {
3883
3883
  }
3884
3884
  function tn(r, s, t, e, n) {
3885
3885
  function i(x, N, A, O) {
3886
- const U = gt$1(x + A, r), T = gt$1(N + x * A + O, s), z = gt$1(N * A + x * O, t);
3886
+ const U = gt$2(x + A, r), T = gt$2(N + x * A + O, s), z = gt$2(N * A + x * O, t);
3887
3887
  return U + T + z;
3888
3888
  }
3889
3889
  function o(x, N, A, O) {
3890
- return i(x, N, A, O) + gt$1(N * O, e);
3890
+ return i(x, N, A, O) + gt$2(N * O, e);
3891
3891
  }
3892
- const l = 9 * r * r - 24 * s, h = l >= 0 ? -2 * s / (3 * r + kt$1(Math.sqrt(l), r)) : -0.25 * r, a = r + 4 * h, u = s + 3 * h * (r + 2 * h), c = t + h * (2 * s + h * (3 * r + 4 * h)), g = e + h * (t + h * (s + h * (r + h)));
3892
+ const l = 9 * r * r - 24 * s, h = l >= 0 ? -2 * s / (3 * r + kt$2(Math.sqrt(l), r)) : -0.25 * r, a = r + 4 * h, u = s + 3 * h * (r + 2 * h), c = t + h * (2 * s + h * (3 * r + 4 * h)), g = e + h * (t + h * (s + h * (r + h)));
3893
3893
  let d = 0, w = 0;
3894
3894
  const p = 349e100;
3895
3895
  if (n) {
@@ -3904,7 +3904,7 @@ function tn(r, s, t, e, n) {
3904
3904
  const f = r * 0.5, M = 1 / 6 * s + 0.5 * P, E = t - r * M, R = 2 / 3 * s - P - f * f, v = 0.5 * E / R, L = 2 * (e - M * M) / E, S = 0.5 * E / L;
3905
3905
  let k = 0, D = 0, m = 0;
3906
3906
  for (let x = 0; x < 3; x++) {
3907
- const N = x == 1 ? S : R, A = x == 0 ? v : L, O = gt$1(N + f * f + 2 * M, s), U = gt$1(2 * (N * A + f * M), t), T = gt$1(N * A * A + M * M, e), z = O + U + T;
3907
+ const N = x == 1 ? S : R, A = x == 0 ? v : L, O = gt$2(N + f * f + 2 * M, s), U = gt$2(2 * (N * A + f * M), t), T = gt$2(N * A * A + M * M, e), z = O + U + T;
3908
3908
  (x == 0 || z < m) && (k = N, D = A, m = z);
3909
3909
  }
3910
3910
  const b = k, j = D;
@@ -3954,10 +3954,10 @@ function en$1(r, s) {
3954
3954
  r > 0 ? n = 0 : n = Math.sqrt(-r);
3955
3955
  else if (i !== null ? i < 0 : e * e < t * t * t) {
3956
3956
  const a = i !== null ? e / t / Math.sqrt(t) : e / Math.sqrt(t * t * t);
3957
- n = -2 * Math.sqrt(t) * kt$1(Math.cos(Math.acos(Math.abs(a)) * (1 / 3)), a);
3957
+ n = -2 * Math.sqrt(t) * kt$2(Math.cos(Math.acos(Math.abs(a)) * (1 / 3)), a);
3958
3958
  } else {
3959
3959
  let a;
3960
- i !== null ? Math.abs(t) < Math.abs(e) ? a = -e * (1 + Math.sqrt(i)) : a = -e - kt$1(Math.sqrt(Math.abs(t)) * t * Math.sqrt(i), e) : a = Math.cbrt(-e - kt$1(Math.sqrt(e * e - t * t * t), e));
3960
+ i !== null ? Math.abs(t) < Math.abs(e) ? a = -e * (1 + Math.sqrt(i)) : a = -e - kt$2(Math.sqrt(Math.abs(t)) * t * Math.sqrt(i), e) : a = Math.cbrt(-e - kt$2(Math.sqrt(e * e - t * t * t), e));
3961
3961
  const u = a == 0 ? 0 : t / a;
3962
3962
  n = a + u;
3963
3963
  }
@@ -3977,13 +3977,13 @@ function en$1(r, s) {
3977
3977
  }
3978
3978
  return o;
3979
3979
  }
3980
- function kt$1(r, s) {
3980
+ function kt$2(r, s) {
3981
3981
  const t = Math.abs(r);
3982
3982
  return s < 0 ? -t : t;
3983
3983
  }
3984
- function sn$1(r, s = 1e-9) {
3984
+ function sn(r, s = 1e-9) {
3985
3985
  if (r[r.length - 1] == 0)
3986
- return sn$1(r.slice(0, -1), s);
3986
+ return sn(r.slice(0, -1), s);
3987
3987
  const t = new Hs([
3988
3988
  r.slice(0, -1).reverse().map((n) => -n / r[r.length - 1]),
3989
3989
  ...Array.from({ length: r.length - 2 }, (n, i) => {
@@ -3996,24 +3996,24 @@ function sn$1(r, s = 1e-9) {
3996
3996
  );
3997
3997
  }
3998
3998
  const nn$1 = (r, s, t) => [r[0] * (1 - t) + s[0] * t, r[1] * (1 - t) + s[1] * t];
3999
- function rn$1(r) {
3999
+ function rn(r) {
4000
4000
  const s = [];
4001
4001
  for (let t = 0; t < r.length - 1; t++)
4002
4002
  s.push([r[t], r[t + 1]]);
4003
4003
  return s;
4004
4004
  }
4005
4005
  function de$1(r, s) {
4006
- const t = rn$1(r).map(([e, n]) => nn$1(e, n, s));
4006
+ const t = rn(r).map(([e, n]) => nn$1(e, n, s));
4007
4007
  return r.length === 2 ? [t] : [...de$1(t, s), t];
4008
4008
  }
4009
- let Et$1 = class Et extends xt$1 {
4009
+ let Et$1 = class Et extends xt$2 {
4010
4010
  constructor(t, e, n, i) {
4011
4011
  super(t, e);
4012
- q$2(this, "segmentType", "CUBIC_BEZIER");
4013
- q$2(this, "firstControlPoint");
4014
- q$2(this, "lastControlPoint");
4015
- q$2(this, "_boundingBox", null);
4016
- q$2(this, "_polynomialCoefficients", null);
4012
+ q$1(this, "segmentType", "CUBIC_BEZIER");
4013
+ q$1(this, "firstControlPoint");
4014
+ q$1(this, "lastControlPoint");
4015
+ q$1(this, "_boundingBox", null);
4016
+ q$1(this, "_polynomialCoefficients", null);
4017
4017
  this.firstControlPoint = n, this.lastControlPoint = i;
4018
4018
  }
4019
4019
  get midPoint() {
@@ -4067,10 +4067,10 @@ let Et$1 = class Et extends xt$1 {
4067
4067
  );
4068
4068
  }
4069
4069
  isSame(t) {
4070
- return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.firstControlPoint, t.firstControlPoint) && Y$2(this.lastControlPoint, t.lastControlPoint);
4070
+ return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$3(this.firstPoint, t.firstPoint) && Y$3(this.lastPoint, t.lastPoint) && Y$3(this.firstControlPoint, t.firstControlPoint) && Y$3(this.lastControlPoint, t.lastControlPoint);
4071
4071
  }
4072
4072
  distanceFrom(t) {
4073
- const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
4073
+ const n = Ce((i) => Rt$2(this.paramPoint(i), t), this.precision);
4074
4074
  return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
4075
4075
  J$3(this.firstPoint, t),
4076
4076
  J$3(this.lastPoint, t)
@@ -4094,8 +4094,8 @@ let Et$1 = class Et extends xt$1 {
4094
4094
  ];
4095
4095
  }
4096
4096
  secondDerivativeAt(t) {
4097
- const e = it$3(this.firstPoint, this.lastControlPoint), n = nt$2(this.firstControlPoint, 2), i = it$3(this.firstControlPoint, this.lastPoint), o = nt$2(this.lastControlPoint, 2), l = nt$2(Q$2(e, n), 6 * (1 - t)), h = nt$2(Q$2(i, o), 6 * t);
4098
- return it$3(l, h);
4097
+ const e = it$2(this.firstPoint, this.lastControlPoint), n = nt$2(this.firstControlPoint, 2), i = it$2(this.firstControlPoint, this.lastPoint), o = nt$2(this.lastControlPoint, 2), l = nt$2(Q$2(e, n), 6 * (1 - t)), h = nt$2(Q$2(i, o), 6 * t);
4098
+ return it$2(l, h);
4099
4099
  }
4100
4100
  tangentAt(t) {
4101
4101
  const e = this.pointToParam(t);
@@ -4203,8 +4203,8 @@ let Et$1 = class Et extends xt$1 {
4203
4203
  return ze(e - t, n, i, o).filter((l) => l >= -this.precision && l <= 1 + this.precision);
4204
4204
  }
4205
4205
  pointToParam(t) {
4206
- if (Y$2(t, this.firstPoint, this.precision)) return 0;
4207
- if (Y$2(t, this.lastPoint, this.precision)) return 1;
4206
+ if (Y$3(t, this.firstPoint, this.precision)) return 0;
4207
+ if (Y$3(t, this.lastPoint, this.precision)) return 1;
4208
4208
  const e = this.paramsAtY(t[1]);
4209
4209
  if (e.length === 0)
4210
4210
  throw new Error("Point is not on the curve");
@@ -4214,32 +4214,32 @@ let Et$1 = class Et extends xt$1 {
4214
4214
  return i;
4215
4215
  }
4216
4216
  };
4217
- let jt$1 = class jt extends xt$1 {
4217
+ let jt$1 = class jt extends xt$2 {
4218
4218
  constructor(t, e, n, i, o, l, h = !1, {
4219
4219
  ignoreChecks: a = !1,
4220
4220
  angleUnits: u = "deg"
4221
4221
  } = {}) {
4222
4222
  super(t, e);
4223
- q$2(this, "segmentType", "ELLIPSE_ARC");
4223
+ q$1(this, "segmentType", "ELLIPSE_ARC");
4224
4224
  // I would need to do some more work to improve the precision that I can have
4225
4225
  // on an ellipse with intersection algorithms
4226
- q$2(this, "precision", 1e-6);
4227
- q$2(this, "majorRadius");
4228
- q$2(this, "minorRadius");
4229
- q$2(this, "center");
4230
- q$2(this, "tiltAngle");
4231
- q$2(this, "clockwise");
4232
- q$2(this, "_coefficients", null);
4233
- q$2(this, "_boundingBox");
4234
- q$2(this, "_linearExentricity");
4235
- q$2(this, "_exentricity");
4236
- q$2(this, "_focals");
4237
- q$2(this, "_ellipseReferenceFrameTransform");
4238
- q$2(this, "_reverseEllipseReferenceFrameTransform");
4239
- q$2(this, "_rotateFromEllipseReferenceFrame");
4240
- q$2(this, "_firstAngle");
4241
- q$2(this, "_lastAngle");
4242
- q$2(this, "_deltaAngle");
4226
+ q$1(this, "precision", 1e-6);
4227
+ q$1(this, "majorRadius");
4228
+ q$1(this, "minorRadius");
4229
+ q$1(this, "center");
4230
+ q$1(this, "tiltAngle");
4231
+ q$1(this, "clockwise");
4232
+ q$1(this, "_coefficients", null);
4233
+ q$1(this, "_boundingBox");
4234
+ q$1(this, "_linearExentricity");
4235
+ q$1(this, "_exentricity");
4236
+ q$1(this, "_focals");
4237
+ q$1(this, "_ellipseReferenceFrameTransform");
4238
+ q$1(this, "_reverseEllipseReferenceFrameTransform");
4239
+ q$1(this, "_rotateFromEllipseReferenceFrame");
4240
+ q$1(this, "_firstAngle");
4241
+ q$1(this, "_lastAngle");
4242
+ q$1(this, "_deltaAngle");
4243
4243
  this.center = n;
4244
4244
  const c = i >= o;
4245
4245
  this.majorRadius = c ? i : o, this.minorRadius = c ? o : i;
@@ -4247,17 +4247,17 @@ let jt$1 = class jt extends xt$1 {
4247
4247
  if (this.tiltAngle = wt$2(
4248
4248
  c ? g : g + Math.PI / 2
4249
4249
  ), this.clockwise = h, !a) {
4250
- if (Y$2(t, e))
4250
+ if (Y$3(t, e))
4251
4251
  throw new Error("Invalid arc, cannot be a full circle");
4252
4252
  if (!this.isPointOnEllipse(t))
4253
4253
  throw new Error(
4254
- `First point ${Z$1(
4254
+ `First point ${Z$2(
4255
4255
  t
4256
4256
  )} not on the ellipse defined by ${this.info}`
4257
4257
  );
4258
4258
  if (!this.isPointOnEllipse(e))
4259
4259
  throw new Error(
4260
- `Last point ${Z$1(e)} not on the ellipse defined by ${this.info}`
4260
+ `Last point ${Z$2(e)} not on the ellipse defined by ${this.info}`
4261
4261
  );
4262
4262
  if (Math.abs(this.majorRadius - this.minorRadius) < this.precision)
4263
4263
  throw new Error(
@@ -4280,9 +4280,9 @@ let jt$1 = class jt extends xt$1 {
4280
4280
  return this._coefficients;
4281
4281
  }
4282
4282
  get info() {
4283
- return `ELLIPSE_ARC(${Z$1(this.firstPoint)}, ${Z$1(
4283
+ return `ELLIPSE_ARC(${Z$2(this.firstPoint)}, ${Z$2(
4284
4284
  this.lastPoint
4285
- )}, ${Z$1(this.center)}, ${this.majorRadius}, ${this.minorRadius}, ${this.tiltAngle * Ue}, ${this.clockwise ? "CW" : "CCW"})`;
4285
+ )}, ${Z$2(this.center)}, ${this.majorRadius}, ${this.minorRadius}, ${this.tiltAngle * Ue}, ${this.clockwise ? "CW" : "CCW"})`;
4286
4286
  }
4287
4287
  reverse() {
4288
4288
  return new jt(
@@ -4335,14 +4335,14 @@ let jt$1 = class jt extends xt$1 {
4335
4335
  if (this._focals === void 0) {
4336
4336
  const t = this.majorAxis;
4337
4337
  this._focals = [
4338
- it$3(this.center, nt$2(t, this.linearExentricity)),
4339
- it$3(this.center, nt$2(t, -this.linearExentricity))
4338
+ it$2(this.center, nt$2(t, this.linearExentricity)),
4339
+ it$2(this.center, nt$2(t, -this.linearExentricity))
4340
4340
  ];
4341
4341
  }
4342
4342
  return this._focals;
4343
4343
  }
4344
4344
  get majorAxis() {
4345
- return Tt(1, this.tiltAngle);
4345
+ return Tt$1(1, this.tiltAngle);
4346
4346
  }
4347
4347
  paramPoint(t) {
4348
4348
  const e = this.firstAngle + t * this.deltaAngle * (this.clockwise ? -1 : 1);
@@ -4354,12 +4354,12 @@ let jt$1 = class jt extends xt$1 {
4354
4354
  pointToParam(t) {
4355
4355
  if (!this.isPointOnEllipse(t))
4356
4356
  throw new Error(
4357
- `Point ${Z$1(t)} not on the ellipse defined by ${this.repr}`
4357
+ `Point ${Z$2(t)} not on the ellipse defined by ${this.repr}`
4358
4358
  );
4359
4359
  const e = this.thetaToParam(this.pointTheta(t));
4360
4360
  if (!this.isValidParameter(e))
4361
4361
  throw new Error(
4362
- `Point ${Z$1(t)} is not on segment ${this.repr}`
4362
+ `Point ${Z$2(t)} is not on segment ${this.repr}`
4363
4363
  );
4364
4364
  return e;
4365
4365
  }
@@ -4370,7 +4370,7 @@ let jt$1 = class jt extends xt$1 {
4370
4370
  return 1 - t >= -this.precision && t >= -this.precision;
4371
4371
  }
4372
4372
  isSame(t) {
4373
- return Y$2(this.center, t.center) && Math.abs(this.majorRadius - t.majorRadius) < this.precision && Math.abs(this.minorRadius - t.minorRadius) < this.precision && (Math.abs(this.tiltAngle - t.tiltAngle) < this.precision || Math.abs(Math.abs(this.tiltAngle - t.tiltAngle) - Math.PI) < this.precision) && (Y$2(this.firstPoint, t.firstPoint) && this.clockwise === t.clockwise || Y$2(this.firstPoint, t.lastPoint) && this.clockwise !== t.clockwise);
4373
+ return Y$3(this.center, t.center) && Math.abs(this.majorRadius - t.majorRadius) < this.precision && Math.abs(this.minorRadius - t.minorRadius) < this.precision && (Math.abs(this.tiltAngle - t.tiltAngle) < this.precision || Math.abs(Math.abs(this.tiltAngle - t.tiltAngle) - Math.PI) < this.precision) && (Y$3(this.firstPoint, t.firstPoint) && this.clockwise === t.clockwise || Y$3(this.firstPoint, t.lastPoint) && this.clockwise !== t.clockwise);
4374
4374
  }
4375
4375
  pointTheta(t) {
4376
4376
  const e = this.ellipseReferenceFrameTransform.transform(t), n = Math.atan2(
@@ -4391,11 +4391,11 @@ let jt$1 = class jt extends xt$1 {
4391
4391
  }
4392
4392
  distanceFrom(t) {
4393
4393
  let e;
4394
- if (Y$2(t, this.center) ? e = it$3(
4394
+ if (Y$3(t, this.center) ? e = it$2(
4395
4395
  this.center,
4396
4396
  nt$2(tt$3(this.majorAxis), this.minorRadius)
4397
4397
  ) : e = this.reverseEllipseReferenceFrameTransform.transform(
4398
- ln$1(
4398
+ ln(
4399
4399
  this.majorRadius,
4400
4400
  this.minorRadius,
4401
4401
  this.ellipseReferenceFrameTransform.transform(t)
@@ -4501,7 +4501,7 @@ let jt$1 = class jt extends xt$1 {
4501
4501
  }
4502
4502
  };
4503
4503
  function pn$1(r, s, t, e, n, i, o) {
4504
- const { center: l, rx: h, ry: a } = on$1(
4504
+ const { center: l, rx: h, ry: a } = on(
4505
4505
  r,
4506
4506
  s,
4507
4507
  t,
@@ -4512,7 +4512,7 @@ function pn$1(r, s, t, e, n, i, o) {
4512
4512
  );
4513
4513
  return Math.abs(h - a) < 1e-9 ? new ct$3(r, s, l, o) : new jt$1(r, s, l, h, a, n, o);
4514
4514
  }
4515
- function on$1([r, s], [t, e], n, i, o, l, h) {
4515
+ function on([r, s], [t, e], n, i, o, l, h) {
4516
4516
  if (n < 0 && (n = -n), i < 0 && (i = -i), n == 0 || i == 0)
4517
4517
  throw Error("rx and ry can not be 0");
4518
4518
  const a = Math.sin(o), u = Math.cos(o), c = (r - t) / 2, g = (s - e) / 2, d = (r + t) / 2, w = (s + e) / 2, p = u * c + a * g, P = u * g - a * c, f = p * p / (n * n) + P * P / (i * i);
@@ -4529,7 +4529,7 @@ function on$1([r, s], [t, e], n, i, o, l, h) {
4529
4529
  ry: i
4530
4530
  };
4531
4531
  }
4532
- function ln$1(r, s, t) {
4532
+ function ln(r, s, t) {
4533
4533
  const e = Math.abs(t[0]), n = Math.abs(t[1]);
4534
4534
  let i = 0.707, o = 0.707;
4535
4535
  const l = r, h = s;
@@ -4541,13 +4541,13 @@ function ln$1(r, s, t) {
4541
4541
  }
4542
4542
  return [l * i * Math.sign(t[0]), h * o * Math.sign(t[1])];
4543
4543
  }
4544
- let _t$1 = class _t extends xt$1 {
4544
+ let _t$1 = class _t extends xt$2 {
4545
4545
  constructor(t, e, n) {
4546
4546
  super(t, e);
4547
- q$2(this, "segmentType", "QUADRATIC_BEZIER");
4548
- q$2(this, "controlPoint");
4549
- q$2(this, "_boundingBox", null);
4550
- q$2(this, "_polynomialCoefficients", null);
4547
+ q$1(this, "segmentType", "QUADRATIC_BEZIER");
4548
+ q$1(this, "controlPoint");
4549
+ q$1(this, "_boundingBox", null);
4550
+ q$1(this, "_polynomialCoefficients", null);
4551
4551
  this.controlPoint = n;
4552
4552
  }
4553
4553
  get midPoint() {
@@ -4592,10 +4592,10 @@ let _t$1 = class _t extends xt$1 {
4592
4592
  );
4593
4593
  }
4594
4594
  isSame(t) {
4595
- return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.controlPoint, t.controlPoint);
4595
+ return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$3(this.firstPoint, t.firstPoint) && Y$3(this.lastPoint, t.lastPoint) && Y$3(this.controlPoint, t.controlPoint);
4596
4596
  }
4597
4597
  distanceFrom(t) {
4598
- const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
4598
+ const n = Ce((i) => Rt$2(this.paramPoint(i), t), this.precision);
4599
4599
  return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
4600
4600
  J$3(this.firstPoint, t),
4601
4601
  J$3(this.lastPoint, t)
@@ -4621,7 +4621,7 @@ let _t$1 = class _t extends xt$1 {
4621
4621
  secondDerivativeAt(t) {
4622
4622
  return nt$2(
4623
4623
  Q$2(
4624
- it$3(this.firstPoint, this.lastPoint),
4624
+ it$2(this.firstPoint, this.lastPoint),
4625
4625
  nt$2(this.controlPoint, 2)
4626
4626
  ),
4627
4627
  2
@@ -4737,7 +4737,7 @@ let _t$1 = class _t extends xt$1 {
4737
4737
 
4738
4738
  var nn = Object.defineProperty;
4739
4739
  var en = (t, n, e) => n in t ? nn(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
4740
- var C = (t, n, e) => en(t, typeof n != "symbol" ? n + "" : n, e);
4740
+ var C$1 = (t, n, e) => en(t, typeof n != "symbol" ? n + "" : n, e);
4741
4741
  function dn$1(t, n) {
4742
4742
  const e = Q$2(n, t.firstPoint), s = Pe(e, t.V) / t.squareLength;
4743
4743
  return t.paramPoint(s);
@@ -4751,9 +4751,9 @@ function K$2(t, n, e) {
4751
4751
  }
4752
4752
  const l = [], r = Math.sqrt(
4753
4753
  n.radius * n.radius - o * o
4754
- ), u = t.tangentAtFirstPoint, a = it$3(i, nt$2(u, r));
4754
+ ), u = t.tangentAtFirstPoint, a = it$2(i, nt$2(u, r));
4755
4755
  t.isOnSegment(a) && n.isOnSegment(a) && l.push(a);
4756
- const f = it$3(i, nt$2(u, -r));
4756
+ const f = it$2(i, nt$2(u, -r));
4757
4757
  return t.isOnSegment(f) && n.isOnSegment(f) && l.push(f), l;
4758
4758
  }
4759
4759
  const mn$1 = (t) => {
@@ -4779,7 +4779,7 @@ const mn$1 = (t) => {
4779
4779
  if (e.length === 2)
4780
4780
  return t.isSame(mn$1(n)) ? [] : [new ct$3(e[0], e[1], t.center, t.clockwise)];
4781
4781
  if (e.length === 3) {
4782
- const s = Y$2(e[0], n.lastPoint) || Y$2(e[0], n.firstPoint) ? 1 : 0;
4782
+ const s = Y$3(e[0], n.lastPoint) || Y$3(e[0], n.firstPoint) ? 1 : 0;
4783
4783
  return [
4784
4784
  new ct$3(
4785
4785
  e[0 + s],
@@ -4795,7 +4795,7 @@ const mn$1 = (t) => {
4795
4795
  ];
4796
4796
  throw new Error("Bug in the arc arc overlap algorithm");
4797
4797
  };
4798
- function Dt(t, n, e = !1, s) {
4798
+ function Dt$1(t, n, e = !1, s) {
4799
4799
  const i = s || t.precision, o = J$3(t.center, n.center), l = t.radius + n.radius;
4800
4800
  if (o > l + i)
4801
4801
  return [];
@@ -4810,18 +4810,18 @@ function Dt(t, n, e = !1, s) {
4810
4810
  a || // circles are inside each other
4811
4811
  Math.abs(o - r) < i
4812
4812
  ) {
4813
- const g = a || t.radius > n.radius ? 1 : -1, w = it$3(
4813
+ const g = a || t.radius > n.radius ? 1 : -1, w = it$2(
4814
4814
  t.center,
4815
4815
  nt$2(u, g * t.radius)
4816
4816
  );
4817
4817
  return t.isOnSegment(w) && n.isOnSegment(w) ? [w] : [];
4818
4818
  }
4819
- const f = t.radius * t.radius / (2 * o) - n.radius * n.radius / (2 * o) + o / 2, c = it$3(
4819
+ const f = t.radius * t.radius / (2 * o) - n.radius * n.radius / (2 * o) + o / 2, c = it$2(
4820
4820
  t.center,
4821
4821
  nt$2(u, f)
4822
4822
  ), h = Math.sqrt(
4823
4823
  t.radius * t.radius - f * f
4824
- ), p = tt$3(u), d = it$3(c, nt$2(p, h)), m = it$3(c, nt$2(p, -h)), x = [];
4824
+ ), p = tt$3(u), d = it$2(c, nt$2(p, h)), m = it$2(c, nt$2(p, -h)), x = [];
4825
4825
  return t.isOnSegment(d) && n.isOnSegment(d) && x.push(d), t.isOnSegment(m) && n.isOnSegment(m) && x.push(m), x;
4826
4826
  }
4827
4827
  function st$2(t, n, e = 1e-9) {
@@ -4853,14 +4853,14 @@ function st$2(t, n, e = 1e-9) {
4853
4853
  ];
4854
4854
  return c([m, x]);
4855
4855
  }
4856
- function Rt(t, n) {
4856
+ function Rt$1(t, n) {
4857
4857
  const e = Math.max(t.precision, n.precision), s = t.coefficients, i = s.x2, o = s.xy, l = s.y2, r = s.x, u = s.y, a = s.c, f = n.coefficients, c = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, x = f.c, g = {
4858
4858
  z0: a * i * d * d + i * i * x * x - r * i * d * x + c * c * a * a - 2 * i * x * c * a - r * d * c * a + c * r * r * x,
4859
4859
  z1: m * r * r * c - x * d * i * o - 2 * i * x * c * u - a * c * h * r + 2 * d * h * i * a + 2 * m * x * i * i + d * d * i * u - m * d * i * r - 2 * i * m * c * a - a * c * d * o + 2 * a * u * c * c - x * h * i * r - u * c * d * r + 2 * x * o * c * r,
4860
4860
  z2: m * m * i * i + 2 * p * x * i * i - u * c * d * o + x * c * o * o - u * c * h * r - x * h * i * o - 2 * i * m * c * u + 2 * d * h * i * u - p * d * i * r - 2 * i * p * c * a + h * h * i * a + 2 * m * o * c * r + u * u * c * c - l * c * d * r - m * h * i * r + 2 * a * l * c * c - a * c * h * o + p * r * r * c + d * d * i * l - m * d * i * o - 2 * i * x * c * l,
4861
4861
  z3: -2 * i * c * l * m + m * c * o * o + 2 * p * o * c * r - l * c * h * r + h * h * i * u - m * h * i * o - 2 * i * p * c * u - u * c * h * o - p * h * i * r + 2 * m * p * i * i + 2 * u * l * c * c - l * c * d * o + 2 * d * h * i * l - p * d * i * o,
4862
4862
  z4: i * i * p * p - 2 * i * p * c * l + c * c * l * l - o * i * h * p - o * h * c * l + o * o * c * p + l * i * h * h
4863
- }, F = sn$1(
4863
+ }, F = sn(
4864
4864
  [g.z0, g.z1, g.z2, g.z3, g.z4],
4865
4865
  e
4866
4866
  ).flatMap((y) => {
@@ -4878,8 +4878,8 @@ function Rt(t, n) {
4878
4878
  });
4879
4879
  return Te(F, e);
4880
4880
  }
4881
- function gt(t, n) {
4882
- return Rt(t, n).filter((s) => t.isOnSegment(s) && n.isOnSegment(s));
4881
+ function gt$1(t, n) {
4882
+ return Rt$1(t, n).filter((s) => t.isOnSegment(s) && n.isOnSegment(s));
4883
4883
  }
4884
4884
  const Pn$1 = (t) => {
4885
4885
  const {
@@ -4931,7 +4931,7 @@ const Pn$1 = (t) => {
4931
4931
  if (s.length === 2)
4932
4932
  return t.isSame(Pn$1(n)) ? [] : [e(s[0], s[1])];
4933
4933
  if (s.length === 3) {
4934
- const i = Y$2(s[0], n.lastPoint) || Y$2(s[0], n.firstPoint) ? 1 : 0;
4934
+ const i = Y$3(s[0], n.lastPoint) || Y$3(s[0], n.firstPoint) ? 1 : 0;
4935
4935
  return [e(s[0 + i], s[1 + i])];
4936
4936
  } else if (s.length === 4)
4937
4937
  return [e(s[0], s[1]), e(s[2], s[3])];
@@ -4939,7 +4939,7 @@ const Pn$1 = (t) => {
4939
4939
  };
4940
4940
  function xn$1(t, n, e = !1) {
4941
4941
  const s = Math.max(t.precision, n.precision);
4942
- return Y$2(t.center, n.center) && Math.abs(t.majorRadius - n.majorRadius) < s && Math.abs(t.minorRadius - n.minorRadius) < s && (Math.abs(t.tiltAngle - n.tiltAngle) < s || Math.abs(Math.abs(t.tiltAngle - n.tiltAngle) - Math.PI) < s) ? e ? wn$1(t, n) : [] : Rt(t, n).filter((l) => t.isOnSegment(l) && n.isOnSegment(l));
4942
+ return Y$3(t.center, n.center) && Math.abs(t.majorRadius - n.majorRadius) < s && Math.abs(t.minorRadius - n.minorRadius) < s && (Math.abs(t.tiltAngle - n.tiltAngle) < s || Math.abs(Math.abs(t.tiltAngle - n.tiltAngle) - Math.PI) < s) ? e ? wn$1(t, n) : [] : Rt$1(t, n).filter((l) => t.isOnSegment(l) && n.isOnSegment(l));
4943
4943
  }
4944
4944
  function Pt$1(t, n) {
4945
4945
  const [e, s] = t.firstPoint, [i, o] = t.lastPoint, l = new et$4().translate(-e, -s).rotate(-Math.atan2(o - s, i - e)), r = l.clone().inverse(), u = n.transform(l);
@@ -4949,7 +4949,7 @@ const Sn$1 = (t, n = 1e-9) => {
4949
4949
  let e = t;
4950
4950
  return Math.abs(t) < n && (e = 0), e.toFixed(-Math.log10(n));
4951
4951
  };
4952
- function Vt(t, n = 1e-9) {
4952
+ function Vt$1(t, n = 1e-9) {
4953
4953
  return Array.from(
4954
4954
  new Map(t.map((e) => [Sn$1(e, n), e])).values()
4955
4955
  );
@@ -4959,20 +4959,20 @@ const yn$1 = (t, n) => {
4959
4959
  return [q, H, Wt, Jt, Kt, Zt, tn];
4960
4960
  };
4961
4961
  function wt$1(t, n) {
4962
- const e = Math.max(t.precision, n.precision), s = yn$1(t, n), i = sn$1(s, e).filter((o) => o >= -n.precision && o <= 1 + n.precision);
4963
- return Vt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
4962
+ const e = Math.max(t.precision, n.precision), s = yn$1(t, n), i = sn(s, e).filter((o) => o >= -n.precision && o <= 1 + n.precision);
4963
+ return Vt$1(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
4964
4964
  }
4965
4965
  const bn$1 = (t, n) => {
4966
4966
  const [[e, s, i], [o, l, r]] = n.polynomialCoefficients, u = t.coefficients, a = u.x2, f = u.xy, c = u.y2, h = u.x, p = u.y, d = u.c, m = e * e, x = s * s, g = i * i, w = o * o, F = l * l, y = r * r, R = a * m + f * e * o + c * w + h * e + p * o + d, T = 2 * a * e * s + f * e * l + f * s * o + 2 * c * o * l + h * s + p * l, L = 2 * a * e * i + a * x + f * e * r + f * s * l + f * i * o + 2 * c * o * r + c * F + h * i + p * r, j = 2 * a * s * i + f * s * r + f * i * l + 2 * c * l * r, q = a * g + f * i * r + c * y;
4967
4967
  return [R, T, L, j, q];
4968
4968
  };
4969
- function xt(t, n) {
4969
+ function xt$1(t, n) {
4970
4970
  const e = Math.max(t.precision, n.precision), s = bn$1(t, n), i = wn$2(...s).filter((o) => o >= -n.precision && o <= 1 + n.precision);
4971
- return Vt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
4971
+ return Vt$1(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
4972
4972
  }
4973
4973
  function E(t, { firstPoint: n, lastPoint: e }, s = 1e-9) {
4974
4974
  const i = Q$2(e, n);
4975
- return Math.abs(i[0]) < s ? i[1] > 0 ? n[0] - t[0] : t[0] - n[0] : Math.abs(i[1]) < s ? i[0] > 0 ? t[1] - n[1] : n[1] - t[1] : St$2(i, Q$2(t, n)) / an$1(i);
4975
+ return Math.abs(i[0]) < s ? i[1] > 0 ? n[0] - t[0] : t[0] - n[0] : Math.abs(i[1]) < s ? i[0] > 0 ? t[1] - n[1] : n[1] - t[1] : St$1(i, Q$2(t, n)) / an(i);
4976
4976
  }
4977
4977
  let ct$2 = class ct {
4978
4978
  constructor(n, e, s, i) {
@@ -5001,15 +5001,15 @@ function An$1(t) {
5001
5001
  Math.max(0, n / 2)
5002
5002
  );
5003
5003
  }
5004
- function En(t) {
5004
+ function En$1(t) {
5005
5005
  if (t instanceof Et$1)
5006
5006
  return In$1(t);
5007
5007
  if (t instanceof _t$1)
5008
5008
  return An$1(t);
5009
5009
  throw new Error("Not implemented");
5010
5010
  }
5011
- function Fn(t) {
5012
- const n = t.paramPoint(0.5), e = tt$3(Q$2(n, t.firstPoint)), s = it$3(n, e), i = {
5011
+ function Fn$1(t) {
5012
+ const n = t.paramPoint(0.5), e = tt$3(Q$2(n, t.firstPoint)), s = it$2(n, e), i = {
5013
5013
  firstPoint: n,
5014
5014
  lastPoint: s
5015
5015
  }, o = [
@@ -5026,7 +5026,7 @@ function Fn(t) {
5026
5026
  Math.max(...o)
5027
5027
  );
5028
5028
  }
5029
- function St$1(t, n) {
5029
+ function St(t, n) {
5030
5030
  const e = [];
5031
5031
  for (let s = 1; s < t.length; s++) {
5032
5032
  const i = t[s];
@@ -5044,7 +5044,7 @@ function St$1(t, n) {
5044
5044
  }
5045
5045
  return e;
5046
5046
  }
5047
- let Y$1 = class Y {
5047
+ let Y$2 = class Y {
5048
5048
  constructor(n, e) {
5049
5049
  this.from = n, this.to = e;
5050
5050
  }
@@ -5055,9 +5055,9 @@ let Y$1 = class Y {
5055
5055
  return this.from === "start" ? this.to === "end" ? n : n.splitAtParameters([this.to])[0] : this.to === "end" ? n.splitAtParameters([this.from])[1] : n.splitAtParameters([this.from, this.to])[1];
5056
5056
  }
5057
5057
  };
5058
- function vn(t, n) {
5058
+ function vn$1(t, n) {
5059
5059
  if (t instanceof Et$1)
5060
- return new kn([
5060
+ return new kn$1([
5061
5061
  E(t.firstPoint, n),
5062
5062
  E(t.firstControlPoint, n),
5063
5063
  E(t.lastControlPoint, n),
@@ -5073,8 +5073,8 @@ function vn(t, n) {
5073
5073
  }
5074
5074
  let Bn$1 = class Bn {
5075
5075
  constructor(n) {
5076
- C(this, "topHull", []);
5077
- C(this, "bottomHull", []);
5076
+ C$1(this, "topHull", []);
5077
+ C$1(this, "bottomHull", []);
5078
5078
  this.distances = n;
5079
5079
  const [e, s, i] = n, o = [0, e], l = [1 / 2, s], r = [1, i], u = i - e, a = e;
5080
5080
  s - (u * (1 / 2) + a) > 0 ? (this.topHull = [o, l, r], this.bottomHull = [o, r]) : (this.topHull = [o, r], this.bottomHull = [o, l, r]);
@@ -5086,10 +5086,10 @@ let Bn$1 = class Bn {
5086
5086
  return this.distances[2];
5087
5087
  }
5088
5088
  };
5089
- class kn {
5089
+ let kn$1 = class kn {
5090
5090
  constructor(n) {
5091
- C(this, "topHull", []);
5092
- C(this, "bottomHull", []);
5091
+ C$1(this, "topHull", []);
5092
+ C$1(this, "bottomHull", []);
5093
5093
  this.distances = n;
5094
5094
  const [e, s, i, o] = n, l = [0, e], r = [1 / 3, s], u = [2 / 3, i], a = [1, o], f = o - e, c = e, h = s - (f * (1 / 3) + c), p = i - (f * (2 / 3) + c);
5095
5095
  let d = null, m = null;
@@ -5107,53 +5107,53 @@ class kn {
5107
5107
  get endDistance() {
5108
5108
  return this.distances[3];
5109
5109
  }
5110
- }
5110
+ };
5111
5111
  function yt$1(t, n) {
5112
- const e = vn(n, t), s = St$1(
5112
+ const e = vn$1(n, t), s = St(
5113
5113
  e.topHull,
5114
5114
  t.negativeThickness
5115
- ), i = St$1(
5115
+ ), i = St(
5116
5116
  e.bottomHull,
5117
5117
  t.positiveThickness
5118
5118
  ), o = e.endDistance >= t.negativeThickness && e.endDistance <= t.positiveThickness;
5119
5119
  if (!s.length && !i.length)
5120
- return o ? new Y$1("start", "end") : null;
5120
+ return o ? new Y$2("start", "end") : null;
5121
5121
  if (s.length === 1 && i.length === 1)
5122
- return new Y$1(s[0], i[0]);
5122
+ return new Y$2(s[0], i[0]);
5123
5123
  if (s.length === 2 && i.length === 2)
5124
5124
  throw new Error(
5125
5125
  "Bug in the clipping algorithm, unexpected number of crossing points"
5126
5126
  );
5127
5127
  const l = s.length ? s : i;
5128
- return l.length === 2 ? new Y$1(l[0], l[1]) : o ? new Y$1(l[0], "end") : new Y$1("start", l[0]);
5128
+ return l.length === 2 ? new Y$2(l[0], l[1]) : o ? new Y$2(l[0], "end") : new Y$2("start", l[0]);
5129
5129
  }
5130
- function bt$1(t, n) {
5131
- const e = En(t), s = yt$1(e, n);
5130
+ function bt(t, n) {
5131
+ const e = En$1(t), s = yt$1(e, n);
5132
5132
  if (!s)
5133
5133
  return null;
5134
- const i = Fn(t), o = yt$1(
5134
+ const i = Fn$1(t), o = yt$1(
5135
5135
  i,
5136
5136
  n
5137
5137
  );
5138
5138
  return o ? s.size > o.size ? o.clipCurve(n) : s.clipCurve(n) : null;
5139
5139
  }
5140
- const W$3 = (t) => t instanceof _t$1 ? It$2(Q$2(t.controlPoint, t.firstPoint)) + It$2(Q$2(t.controlPoint, t.lastPoint)) : It$2(Q$2(t.firstControlPoint, t.firstPoint)) + It$2(Q$2(t.lastControlPoint, t.firstControlPoint)) + It$2(Q$2(t.lastControlPoint, t.lastPoint));
5140
+ const W$2 = (t) => t instanceof _t$1 ? It$1(Q$2(t.controlPoint, t.firstPoint)) + It$1(Q$2(t.controlPoint, t.lastPoint)) : It$1(Q$2(t.firstControlPoint, t.firstPoint)) + It$1(Q$2(t.lastControlPoint, t.firstControlPoint)) + It$1(Q$2(t.lastControlPoint, t.lastPoint));
5141
5141
  function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
5142
5142
  const i = Math.max(e * e, Number.EPSILON * 10);
5143
- let o = t, l = n, r = W$3(o), u = W$3(l);
5143
+ let o = t, l = n, r = W$2(o), u = W$2(l);
5144
5144
  for (let a = 0; a < s; a++) {
5145
- const f = r > i ? bt$1(l, o) : o;
5145
+ const f = r > i ? bt(l, o) : o;
5146
5146
  if (!f) return [];
5147
- const c = W$3(f), h = u > i ? bt$1(f, l) : l;
5147
+ const c = W$2(f), h = u > i ? bt(f, l) : l;
5148
5148
  if (!h) return [];
5149
- const p = W$3(h);
5149
+ const p = W$2(h);
5150
5150
  if (c <= i && p <= i)
5151
5151
  return [
5152
5152
  f.boundingBox.intersection(h.boundingBox).center
5153
5153
  ];
5154
- if (Y$2(f.firstPoint, f.lastPoint) && h.isOnSegment(f.firstPoint))
5154
+ if (Y$3(f.firstPoint, f.lastPoint) && h.isOnSegment(f.firstPoint))
5155
5155
  return [f.firstPoint];
5156
- if (Y$2(h.firstPoint, h.lastPoint) && f.isOnSegment(h.firstPoint))
5156
+ if (Y$3(h.firstPoint, h.lastPoint) && f.isOnSegment(h.firstPoint))
5157
5157
  return [h.firstPoint];
5158
5158
  if (c > 0.8 * r && p > 0.8 * u)
5159
5159
  if (c / r > p / u) {
@@ -5205,11 +5205,11 @@ function On$1(t, n) {
5205
5205
  if (e.length === 2)
5206
5206
  return [t.splitAt(e)[1]];
5207
5207
  if (e.length === 3)
5208
- return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
5208
+ return Y$3(e[0], t.firstPoint) && Y$3(e[1], t.lastPoint) ? [t] : [n];
5209
5209
  if (e.length === 4)
5210
5210
  return [t];
5211
5211
  }
5212
- function _n(t, n, e = !1) {
5212
+ function _n$1(t, n, e = !1) {
5213
5213
  const s = Math.max(t.precision, n.precision);
5214
5214
  if (e) {
5215
5215
  const i = On$1(t, n);
@@ -5232,11 +5232,11 @@ function Tn$1(t, n) {
5232
5232
  if (e.length === 2)
5233
5233
  return [t.splitAt(e)[1]];
5234
5234
  if (e.length === 3)
5235
- return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
5235
+ return Y$3(e[0], t.firstPoint) && Y$3(e[1], t.lastPoint) ? [t] : [n];
5236
5236
  if (e.length === 4)
5237
5237
  return [t];
5238
5238
  }
5239
- function Ln(t, n, e = !1) {
5239
+ function Ln$1(t, n, e = !1) {
5240
5240
  const s = Math.max(t.precision, n.precision);
5241
5241
  if (e) {
5242
5242
  const i = Tn$1(t, n);
@@ -5247,7 +5247,7 @@ function Ln(t, n, e = !1) {
5247
5247
  }
5248
5248
  function de(t, n, e) {
5249
5249
  if (t instanceof at$3 && n instanceof at$3) {
5250
- const s = cn$1(
5250
+ const s = cn(
5251
5251
  t,
5252
5252
  n,
5253
5253
  !1,
@@ -5260,12 +5260,12 @@ function de(t, n, e) {
5260
5260
  if (t instanceof ct$3 && n instanceof at$3)
5261
5261
  return K$2(n, t, e);
5262
5262
  if (t instanceof ct$3 && n instanceof ct$3)
5263
- return Dt(t, n, !1, e);
5263
+ return Dt$1(t, n, !1, e);
5264
5264
  throw new Error("Not implemented");
5265
5265
  }
5266
- function Z(t, n, e) {
5266
+ function Z$1(t, n, e) {
5267
5267
  if (t instanceof at$3 && n instanceof at$3) {
5268
- const s = cn$1(
5268
+ const s = cn(
5269
5269
  t,
5270
5270
  n,
5271
5271
  !0,
@@ -5284,7 +5284,7 @@ function Z(t, n, e) {
5284
5284
  return { intersections: s, overlaps: [], count: s.length };
5285
5285
  }
5286
5286
  if (t instanceof ct$3 && n instanceof ct$3) {
5287
- const s = Dt(
5287
+ const s = Dt$1(
5288
5288
  t,
5289
5289
  n,
5290
5290
  !0,
@@ -5317,11 +5317,11 @@ function Z(t, n, e) {
5317
5317
  return { intersections: s, overlaps: [], count: s.length };
5318
5318
  }
5319
5319
  if (t instanceof ct$3 && n instanceof jt$1) {
5320
- const s = gt(t, n);
5320
+ const s = gt$1(t, n);
5321
5321
  return { intersections: s, overlaps: [], count: s.length };
5322
5322
  }
5323
5323
  if (n instanceof ct$3 && t instanceof jt$1) {
5324
- const s = gt(n, t);
5324
+ const s = gt$1(n, t);
5325
5325
  return { intersections: s, overlaps: [], count: s.length };
5326
5326
  }
5327
5327
  if (t instanceof jt$1 && n instanceof jt$1) {
@@ -5349,11 +5349,11 @@ function Z(t, n, e) {
5349
5349
  return { intersections: s, overlaps: [], count: s.length };
5350
5350
  }
5351
5351
  if ((t instanceof ct$3 || t instanceof jt$1) && n instanceof _t$1) {
5352
- const s = xt(t, n);
5352
+ const s = xt$1(t, n);
5353
5353
  return { intersections: s, overlaps: [], count: s.length };
5354
5354
  }
5355
5355
  if ((n instanceof ct$3 || n instanceof jt$1) && t instanceof _t$1) {
5356
- const s = xt(n, t);
5356
+ const s = xt$1(n, t);
5357
5357
  return { intersections: s, overlaps: [], count: s.length };
5358
5358
  }
5359
5359
  if ((t instanceof ct$3 || t instanceof jt$1) && n instanceof Et$1) {
@@ -5365,7 +5365,7 @@ function Z(t, n, e) {
5365
5365
  return { intersections: s, overlaps: [], count: s.length };
5366
5366
  }
5367
5367
  if (t instanceof _t$1 && n instanceof _t$1) {
5368
- const s = Ln(
5368
+ const s = Ln$1(
5369
5369
  t,
5370
5370
  n
5371
5371
  );
@@ -5384,7 +5384,7 @@ function Z(t, n, e) {
5384
5384
  return { intersections: s, overlaps: [], count: s.length };
5385
5385
  }
5386
5386
  if (t instanceof Et$1 && n instanceof Et$1) {
5387
- const s = _n(
5387
+ const s = _n$1(
5388
5388
  t,
5389
5389
  n
5390
5390
  );
@@ -5407,15 +5407,15 @@ function Nt(t) {
5407
5407
  n.push([e, s]);
5408
5408
  return n;
5409
5409
  }
5410
- function* it$2(t) {
5410
+ function* it$1(t) {
5411
5411
  for (const [n, e] of Nt(t.length))
5412
5412
  n !== e && (yield [t[n], t[e]]);
5413
5413
  }
5414
- class Ut extends Ze {
5414
+ let Ut$1 = class Ut extends Ze {
5415
5415
  constructor(e, { ignoreChecks: s = !1 } = {}) {
5416
5416
  super();
5417
- C(this, "segments");
5418
- C(this, "_boundingBox", null);
5417
+ C$1(this, "segments");
5418
+ C$1(this, "_boundingBox", null);
5419
5419
  s || jt(e), this.segments = e;
5420
5420
  }
5421
5421
  get repr() {
@@ -5441,12 +5441,12 @@ class Ut extends Ze {
5441
5441
  intersects(e) {
5442
5442
  return this.boundingBox.overlaps(e.boundingBox) ? this.segments.some(
5443
5443
  (s) => e.segments.some(
5444
- (i) => Z(s, i).count > 0
5444
+ (i) => Z$1(s, i).count > 0
5445
5445
  )
5446
5446
  ) : !1;
5447
5447
  }
5448
5448
  overlappingSegments(e) {
5449
- return this.segments.flatMap((s) => e.segments.flatMap((i) => s.boundingBox.overlaps(i.boundingBox) ? Z(s, i).overlaps : []));
5449
+ return this.segments.flatMap((s) => e.segments.flatMap((i) => s.boundingBox.overlaps(i.boundingBox) ? Z$1(s, i).overlaps : []));
5450
5450
  }
5451
5451
  get boundingBox() {
5452
5452
  if (this._boundingBox === null) {
@@ -5460,31 +5460,31 @@ class Ut extends Ze {
5460
5460
  [Symbol.for("nodejs.util.inspect.custom")]() {
5461
5461
  return this.repr;
5462
5462
  }
5463
- }
5463
+ };
5464
5464
  function qn(t, n = "Stroke") {
5465
5465
  Nt(t.length).forEach(
5466
5466
  ([e, s]) => {
5467
5467
  if (e === s) return;
5468
- const i = t[e], o = t[s], l = Z(i, o), r = Math.max(i.precision, o.precision);
5468
+ const i = t[e], o = t[s], l = Z$1(i, o), r = Math.max(i.precision, o.precision);
5469
5469
  if (l.count !== 0) {
5470
5470
  if (l.count === 1 && !l.overlaps.length) {
5471
5471
  const u = e - s, a = l.intersections[0];
5472
- if (u === 1 && Y$2(i.firstPoint, a, r) || u === -1 && Y$2(i.lastPoint, a, r) || u === t.length - 1 && Y$2(i.lastPoint, a, r) && Y$2(o.firstPoint, a, r) || -u === t.length - 1 && Y$2(i.firstPoint, a, r) && Y$2(o.lastPoint, a, r))
5472
+ if (u === 1 && Y$3(i.firstPoint, a, r) || u === -1 && Y$3(i.lastPoint, a, r) || u === t.length - 1 && Y$3(i.lastPoint, a, r) && Y$3(o.firstPoint, a, r) || -u === t.length - 1 && Y$3(i.firstPoint, a, r) && Y$3(o.lastPoint, a, r))
5473
5473
  return;
5474
5474
  }
5475
- if (!(l.count === 2 && t.length === 2 && (Y$2(
5475
+ if (!(l.count === 2 && t.length === 2 && (Y$3(
5476
5476
  i.firstPoint,
5477
5477
  l.intersections[0],
5478
5478
  r
5479
- ) && Y$2(
5479
+ ) && Y$3(
5480
5480
  i.lastPoint,
5481
5481
  l.intersections[1],
5482
5482
  r
5483
- ) || Y$2(
5483
+ ) || Y$3(
5484
5484
  i.firstPoint,
5485
5485
  l.intersections[1],
5486
5486
  r
5487
- ) && Y$2(
5487
+ ) && Y$3(
5488
5488
  i.lastPoint,
5489
5489
  l.intersections[0],
5490
5490
  r
@@ -5503,7 +5503,7 @@ function jt(t, n = "Stroke") {
5503
5503
  throw new Error(`${n} must have at least one segment`);
5504
5504
  Kt([t.slice(0, -1), t.slice(1)]).forEach(
5505
5505
  ([e, s]) => {
5506
- if (!Y$2(e.lastPoint, s.firstPoint))
5506
+ if (!Y$3(e.lastPoint, s.firstPoint))
5507
5507
  throw new Error(
5508
5508
  `${n} segments must be connected, but ${e.info} and ${s.info} are not`
5509
5509
  );
@@ -5511,9 +5511,9 @@ function jt(t, n = "Stroke") {
5511
5511
  ), qn(t, n);
5512
5512
  }
5513
5513
  function Ct$1(t, n) {
5514
- return !!(t instanceof at$3 && n instanceof at$3 && Ie(t.V, n.V) || t instanceof ct$3 && n instanceof ct$3 && Y$2(t.center, n.center) && t.radius - n.radius < t.precision);
5514
+ return !!(t instanceof at$3 && n instanceof at$3 && Ie(t.V, n.V) || t instanceof ct$3 && n instanceof ct$3 && Y$3(t.center, n.center) && t.radius - n.radius < t.precision);
5515
5515
  }
5516
- function Mt$1(t, n) {
5516
+ function Mt(t, n) {
5517
5517
  if (t instanceof at$3 && n instanceof at$3)
5518
5518
  return new at$3(t.firstPoint, n.lastPoint);
5519
5519
  if (t instanceof ct$3 && n instanceof ct$3)
@@ -5534,22 +5534,22 @@ function Ht(t) {
5534
5534
  continue;
5535
5535
  }
5536
5536
  const i = e[e.length - 1];
5537
- Ct$1(i, s) ? (n = !0, e.pop(), e.push(Mt$1(i, s))) : e.push(s);
5537
+ Ct$1(i, s) ? (n = !0, e.pop(), e.push(Mt(i, s))) : e.push(s);
5538
5538
  }
5539
- if (Y$2(t.firstPoint, t.lastPoint) && Ct$1(
5539
+ if (Y$3(t.firstPoint, t.lastPoint) && Ct$1(
5540
5540
  e[0],
5541
5541
  e[e.length - 1]
5542
5542
  )) {
5543
5543
  n = !0;
5544
5544
  const s = e.pop();
5545
- e[0] = Mt$1(s, e[0]);
5545
+ e[0] = Mt(s, e[0]);
5546
5546
  }
5547
5547
  return n ? e : null;
5548
5548
  }
5549
- let B$3 = class B extends Ut {
5549
+ let B$3 = class B extends Ut$1 {
5550
5550
  constructor() {
5551
5551
  super(...arguments);
5552
- C(this, "strokeType", "STRAND");
5552
+ C$1(this, "strokeType", "STRAND");
5553
5553
  }
5554
5554
  reverse() {
5555
5555
  const e = this.segments.map((s) => s.reverse());
@@ -5562,7 +5562,7 @@ let B$3 = class B extends Ut {
5562
5562
  );
5563
5563
  }
5564
5564
  extend(e) {
5565
- if (!Y$2(this.lastPoint, e.firstPoint))
5565
+ if (!Y$3(this.lastPoint, e.firstPoint))
5566
5566
  throw console.error(this.repr, e.repr), new Error("Cannot extend strand: connection point is not the same");
5567
5567
  return new B([...this.segments, ...e.segments]);
5568
5568
  }
@@ -5595,12 +5595,12 @@ const zn$1 = (t, n) => {
5595
5595
  };
5596
5596
  let at$2 = class at {
5597
5597
  constructor(n) {
5598
- C(this, "_count", 0);
5599
- C(this, "segment");
5598
+ C$1(this, "_count", 0);
5599
+ C$1(this, "segment");
5600
5600
  this.segment = n;
5601
5601
  }
5602
5602
  update(n, e = !1) {
5603
- !e && !this.segment.isOnSegment(n) || (Y$2(n, this.segment.firstPoint) ? this._count += this.segment.tangentAtFirstPoint[1] > 0 ? 1 : 0 : Y$2(n, this.segment.lastPoint) ? this._count += this.segment.tangentAtLastPoint[1] > 0 ? 0 : 1 : this._count += 1);
5603
+ !e && !this.segment.isOnSegment(n) || (Y$3(n, this.segment.firstPoint) ? this._count += this.segment.tangentAtFirstPoint[1] > 0 ? 1 : 0 : Y$3(n, this.segment.lastPoint) ? this._count += this.segment.tangentAtLastPoint[1] > 0 ? 0 : 1 : this._count += 1);
5604
5604
  }
5605
5605
  get count() {
5606
5606
  return this._count;
@@ -5609,7 +5609,7 @@ let at$2 = class at {
5609
5609
  const Dn$1 = (t, n) => {
5610
5610
  const e = n.precision, s = Math.abs(t[1] - n.center[1]);
5611
5611
  if (s > n.radius + e) return 0;
5612
- const i = Rt$1(t, n.center), o = n.radius * n.radius, l = e * e;
5612
+ const i = Rt$2(t, n.center), o = n.radius * n.radius, l = e * e;
5613
5613
  if (Math.abs(i - o) < l && n.isOnSegment(t))
5614
5614
  return 0;
5615
5615
  const r = i - o > l;
@@ -5649,12 +5649,12 @@ function Nn(t, n) {
5649
5649
  return Vn(t, n);
5650
5650
  throw new Error("Not implemented");
5651
5651
  }
5652
- let _$2 = class _ extends Ut {
5652
+ let _$1 = class _ extends Ut$1 {
5653
5653
  constructor(e, { ignoreChecks: s = !1 } = {}) {
5654
5654
  super(e, { ignoreChecks: !0 });
5655
- C(this, "strokeType", "LOOP");
5656
- C(this, "_clockwise", null);
5657
- s || Un(e);
5655
+ C$1(this, "strokeType", "LOOP");
5656
+ C$1(this, "_clockwise", null);
5657
+ s || Un$1(e);
5658
5658
  }
5659
5659
  get clockwise() {
5660
5660
  if (this._clockwise === null) {
@@ -5690,11 +5690,11 @@ let _$2 = class _ extends Ut {
5690
5690
  return e ? new _(e, { ignoreChecks: !0 }) : this;
5691
5691
  }
5692
5692
  };
5693
- function Un(t) {
5694
- if (jt(t, "Loop"), !Y$2(t[0].firstPoint, t[t.length - 1].lastPoint))
5693
+ function Un$1(t) {
5694
+ if (jt(t, "Loop"), !Y$3(t[0].firstPoint, t[t.length - 1].lastPoint))
5695
5695
  throw new Error("Loop segment must be closed");
5696
5696
  }
5697
- const jn = [
5697
+ const jn$1 = [
5698
5698
  at$3,
5699
5699
  ct$3,
5700
5700
  jt$1,
@@ -5702,7 +5702,7 @@ const jn = [
5702
5702
  Et$1
5703
5703
  ];
5704
5704
  function Hn(t) {
5705
- return jn.some((n) => t instanceof n);
5705
+ return jn$1.some((n) => t instanceof n);
5706
5706
  }
5707
5707
  function $t(t) {
5708
5708
  if (t instanceof at$3)
@@ -5747,7 +5747,7 @@ function $t(t) {
5747
5747
  };
5748
5748
  throw new Error("Unknown segment type");
5749
5749
  }
5750
- function ot$3(t) {
5750
+ function ot$2(t) {
5751
5751
  return {
5752
5752
  type: "LOOP",
5753
5753
  segments: t.segments.map($t)
@@ -5756,8 +5756,8 @@ function ot$3(t) {
5756
5756
  function Yt(t) {
5757
5757
  return {
5758
5758
  type: "FIGURE",
5759
- contour: ot$3(t.contour),
5760
- holes: t.holes.map(ot$3)
5759
+ contour: ot$2(t.contour),
5760
+ holes: t.holes.map(ot$2)
5761
5761
  };
5762
5762
  }
5763
5763
  function $n$1(t) {
@@ -5766,18 +5766,18 @@ function $n$1(t) {
5766
5766
  figures: t.figures.map(Yt)
5767
5767
  };
5768
5768
  }
5769
- function It$1(t) {
5769
+ function It(t) {
5770
5770
  if (t instanceof O$2)
5771
5771
  return $n$1(t);
5772
5772
  if (t instanceof v$2)
5773
5773
  return Yt(t);
5774
- if (t instanceof _$2)
5775
- return ot$3(t);
5774
+ if (t instanceof _$1)
5775
+ return ot$2(t);
5776
5776
  if (Hn(t))
5777
5777
  return $t(t);
5778
5778
  throw new Error("Unknown shape type");
5779
5779
  }
5780
- class Yn {
5780
+ let Yn$1 = class Yn {
5781
5781
  constructor() {
5782
5782
  this.ids = [], this.values = [], this.length = 0;
5783
5783
  }
@@ -5822,8 +5822,8 @@ class Yn {
5822
5822
  shrink() {
5823
5823
  this.ids.length = this.values.length = this.length;
5824
5824
  }
5825
- }
5826
- const At$1 = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], et$3 = 3;
5825
+ };
5826
+ const At = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], et$3 = 3;
5827
5827
  let ft$1 = class ft {
5828
5828
  /**
5829
5829
  * Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
@@ -5842,7 +5842,7 @@ let ft$1 = class ft {
5842
5842
  const o = i >> 4;
5843
5843
  if (o !== et$3)
5844
5844
  throw new Error(`Got v${o} data when expected v${et$3}.`);
5845
- const l = At$1[i & 15];
5845
+ const l = At[i & 15];
5846
5846
  if (!l)
5847
5847
  throw new Error("Unrecognized array type.");
5848
5848
  const [r] = new Uint16Array(n, e + 2, 1), [u] = new Uint32Array(n, e + 4, 1);
@@ -5867,10 +5867,10 @@ let ft$1 = class ft {
5867
5867
  r = Math.ceil(r / this.nodeSize), u += r, this._levelBounds.push(u * 4);
5868
5868
  while (r !== 1);
5869
5869
  this.ArrayType = s, this.IndexArrayType = u < 16384 ? Uint16Array : Uint32Array;
5870
- const a = At$1.indexOf(this.ArrayType), f = u * 4 * this.ArrayType.BYTES_PER_ELEMENT;
5870
+ const a = At.indexOf(this.ArrayType), f = u * 4 * this.ArrayType.BYTES_PER_ELEMENT;
5871
5871
  if (a < 0)
5872
5872
  throw new Error(`Unexpected typed array class: ${s}.`);
5873
- o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, l + 8, u * 4), this._indices = new this.IndexArrayType(this.data, l + 8 + f, u), this._pos = u * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new i(8 + f + u * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, u * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, u), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (et$3 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new Yn();
5873
+ o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, l + 8, u * 4), this._indices = new this.IndexArrayType(this.data, l + 8 + f, u), this._pos = u * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new i(8 + f + u * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, u * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, u), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (et$3 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new Yn$1();
5874
5874
  }
5875
5875
  /**
5876
5876
  * Add a given rectangle to the index.
@@ -5896,7 +5896,7 @@ let ft$1 = class ft {
5896
5896
  const e = this.maxX - this.minX || 1, s = this.maxY - this.minY || 1, i = new Uint32Array(this.numItems), o = 65535;
5897
5897
  for (let l = 0, r = 0; l < this.numItems; l++) {
5898
5898
  const u = n[r++], a = n[r++], f = n[r++], c = n[r++], h = Math.floor(o * ((u + f) / 2 - this.minX) / e), p = Math.floor(o * ((a + c) / 2 - this.minY) / s);
5899
- i[l] = Gn(h, p);
5899
+ i[l] = Gn$1(h, p);
5900
5900
  }
5901
5901
  rt$3(i, n, this._indices, 0, this.numItems - 1, this.nodeSize);
5902
5902
  for (let l = 0, r = 0; l < this._levelBounds.length - 1; l++) {
@@ -5925,7 +5925,7 @@ let ft$1 = class ft {
5925
5925
  let l = this._boxes.length - 4;
5926
5926
  const r = [], u = [];
5927
5927
  for (; l !== void 0; ) {
5928
- const a = Math.min(l + this.nodeSize * 4, Ft(l, this._levelBounds));
5928
+ const a = Math.min(l + this.nodeSize * 4, Ft$1(l, this._levelBounds));
5929
5929
  for (let f = l; f < a; f += 4) {
5930
5930
  if (s < this._boxes[f] || i < this._boxes[f + 1] || n > this._boxes[f + 2] || e > this._boxes[f + 3]) continue;
5931
5931
  const c = this._indices[f >> 2] | 0;
@@ -5950,7 +5950,7 @@ let ft$1 = class ft {
5950
5950
  let l = this._boxes.length - 4;
5951
5951
  const r = this._queue, u = [], a = i * i;
5952
5952
  t: for (; l !== void 0; ) {
5953
- const f = Math.min(l + this.nodeSize * 4, Ft(l, this._levelBounds));
5953
+ const f = Math.min(l + this.nodeSize * 4, Ft$1(l, this._levelBounds));
5954
5954
  for (let c = l; c < f; c += 4) {
5955
5955
  const h = this._indices[c >> 2] | 0, p = Et(n, this._boxes[c], this._boxes[c + 2]), d = Et(e, this._boxes[c + 1], this._boxes[c + 3]), m = p * p + d * d;
5956
5956
  m > a || (l >= this.numItems * 4 ? r.push(h << 1, m) : (o === void 0 || o(h)) && r.push((h << 1) + 1, m));
@@ -5965,7 +5965,7 @@ let ft$1 = class ft {
5965
5965
  function Et(t, n, e) {
5966
5966
  return t < n ? n - t : t <= e ? 0 : t - e;
5967
5967
  }
5968
- function Ft(t, n) {
5968
+ function Ft$1(t, n) {
5969
5969
  let e = 0, s = n.length - 1;
5970
5970
  for (; e < s; ) {
5971
5971
  const i = e + s >> 1;
@@ -5985,11 +5985,11 @@ function rt$3(t, n, e, s, i, o) {
5985
5985
  u--;
5986
5986
  while (t[u] > l);
5987
5987
  if (r >= u) break;
5988
- Xn(t, n, e, r, u);
5988
+ Xn$1(t, n, e, r, u);
5989
5989
  }
5990
5990
  rt$3(t, n, e, s, u, o), rt$3(t, n, e, u + 1, i, o);
5991
5991
  }
5992
- function Xn(t, n, e, s, i) {
5992
+ function Xn$1(t, n, e, s, i) {
5993
5993
  const o = t[s];
5994
5994
  t[s] = t[i], t[i] = o;
5995
5995
  const l = 4 * s, r = 4 * i, u = n[l], a = n[l + 1], f = n[l + 2], c = n[l + 3];
@@ -5997,7 +5997,7 @@ function Xn(t, n, e, s, i) {
5997
5997
  const h = e[s];
5998
5998
  e[s] = e[i], e[i] = h;
5999
5999
  }
6000
- function Gn(t, n) {
6000
+ function Gn$1(t, n) {
6001
6001
  let e = t ^ n, s = 65535 ^ e, i = 65535 ^ (t | n), o = t & (n ^ 65535), l = e | s >> 1, r = e >> 1 ^ e, u = i >> 1 ^ s & o >> 1 ^ i, a = e & i >> 1 ^ o >> 1 ^ o;
6002
6002
  e = l, s = r, i = u, o = a, l = e & e >> 2 ^ s & s >> 2, r = e & s >> 2 ^ s & (e ^ s) >> 2, u ^= e & i >> 2 ^ s & o >> 2, a ^= s & i >> 2 ^ (e ^ s) & o >> 2, e = l, s = r, i = u, o = a, l = e & e >> 4 ^ s & s >> 4, r = e & s >> 4 ^ s & (e ^ s) >> 4, u ^= e & i >> 4 ^ s & o >> 4, a ^= s & i >> 4 ^ (e ^ s) & o >> 4, e = l, s = r, i = u, o = a, u ^= e & i >> 8 ^ s & o >> 8, a ^= s & i >> 8 ^ (e ^ s) & o >> 8, e = u ^ u >> 1, s = a ^ a >> 1;
6003
6003
  let f = t ^ n, c = s | 65535 ^ (f | e);
@@ -6043,9 +6043,9 @@ function Xt(t, n = 1e-7) {
6043
6043
  let v$2 = class v extends Ze {
6044
6044
  constructor(e, s = [], { ignoreChecks: i = !1 } = {}) {
6045
6045
  super();
6046
- C(this, "contour");
6047
- C(this, "holes");
6048
- i || Qn(e, s), this.contour = e, this.holes = s;
6046
+ C$1(this, "contour");
6047
+ C$1(this, "holes");
6048
+ i || Qn$1(e, s), this.contour = e, this.holes = s;
6049
6049
  }
6050
6050
  get boundingBox() {
6051
6051
  return this.contour.boundingBox;
@@ -6081,24 +6081,24 @@ let v$2 = class v extends Ze {
6081
6081
  return Xt(i).map((o) => new B$3(o));
6082
6082
  }
6083
6083
  };
6084
- function Qn(t, n = []) {
6084
+ function Qn$1(t, n = []) {
6085
6085
  if (!t) throw new Error("Figure must have a contour");
6086
- for (const [e, s] of it$2([t, ...n]))
6086
+ for (const [e, s] of it$1([t, ...n]))
6087
6087
  if (e.intersects(s))
6088
6088
  throw new Error("Loops in a figure must not intersect");
6089
6089
  if (n.some(
6090
6090
  (e) => !t.contains(e.firstPoint) && !t.onStroke(e.firstPoint)
6091
6091
  ))
6092
6092
  throw new Error("Holes must be inside the contour");
6093
- for (const [e, s] of it$2(n))
6093
+ for (const [e, s] of it$1(n))
6094
6094
  if (e.contains(s.firstPoint))
6095
- throw console.error(It$1(e), It$1(s)), new Error("Holes must not be inside other holes");
6095
+ throw console.error(It(e), It(s)), new Error("Holes must not be inside other holes");
6096
6096
  }
6097
- const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn = (t, n) => {
6097
+ const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn$1 = (t, n) => {
6098
6098
  const e = t.boundingBox, s = n.boundingBox;
6099
6099
  return J$2(e.xMin, s.xMin) && J$2(e.yMin, s.yMin) && J$2(e.xMax, s.xMax) && J$2(e.yMax, s.yMax);
6100
- }, Jn = (t, n) => {
6101
- if (t.segmentsCount !== n.segmentsCount || !Wn(t, n)) return !1;
6100
+ }, Jn$1 = (t, n) => {
6101
+ if (t.segmentsCount !== n.segmentsCount || !Wn$1(t, n)) return !1;
6102
6102
  const e = t.segments, s = n.segments, i = e.length, o = (l, r) => {
6103
6103
  for (let u = 0; u < i; u += 1) {
6104
6104
  const a = (l + r * u + i) % i;
@@ -6113,9 +6113,9 @@ const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn = (t, n) => {
6113
6113
  }, Kn = (t) => {
6114
6114
  const n = [];
6115
6115
  return t.forEach((e) => {
6116
- n.some((s) => Jn(e, s)) || n.push(e);
6116
+ n.some((s) => Jn$1(e, s)) || n.push(e);
6117
6117
  }), n;
6118
- }, Zn = (t) => {
6118
+ }, Zn$1 = (t) => {
6119
6119
  const n = t.map((i, o) => t.slice(o + 1).map((l, r) => [r + o + 1, l]).filter(([, l]) => i.boundingBox.overlaps(l.boundingBox)).map(([l]) => l)), e = [], s = Array(n.length);
6120
6120
  return n.forEach((i, o) => {
6121
6121
  let l = s[o];
@@ -6129,49 +6129,49 @@ const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn = (t, n) => {
6129
6129
  loop: n,
6130
6130
  isIn: o
6131
6131
  };
6132
- }), te = (t, n) => t.flatMap(({ loop: e }) => ht$1(
6132
+ }), te$1 = (t, n) => t.flatMap(({ loop: e }) => ht$2(
6133
6133
  n.filter(
6134
6134
  ({ loop: s, isIn: i }) => s === e || i.indexOf(e) !== -1
6135
6135
  )
6136
- )), ne = (t, n) => {
6137
- const e = n.filter(({ isIn: i }) => i.length <= 1), s = ht$1(
6136
+ )), ne$1 = (t, n) => {
6137
+ const e = n.filter(({ isIn: i }) => i.length <= 1), s = ht$2(
6138
6138
  Gt(t.map(({ loop: i }) => i))
6139
6139
  );
6140
6140
  return [e, ...s];
6141
- }, ht$1 = (t) => {
6141
+ }, ht$2 = (t) => {
6142
6142
  if (!t.length) return [];
6143
6143
  const n = t.filter(({ isIn: s }) => !s.length), e = t.filter(({ isIn: s }) => s.length > 1);
6144
- return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ? te(n, t) : ne(e, t);
6144
+ return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ? te$1(n, t) : ne$1(e, t);
6145
6145
  };
6146
6146
  function X$2(t) {
6147
6147
  const n = Kn(t);
6148
- return Zn(n).map(Gt).flatMap(ht$1).map((s) => {
6148
+ return Zn$1(n).map(Gt).flatMap(ht$2).map((s) => {
6149
6149
  if (s.length === 1) return new v$2(s[0].loop);
6150
6150
  s.sort((l, r) => l.isIn.length - r.isIn.length);
6151
6151
  const [i, ...o] = s.map(({ loop: l }) => l);
6152
6152
  return new v$2(i, o);
6153
6153
  });
6154
6154
  }
6155
- function ee(t, n) {
6155
+ function ee$1(t, n) {
6156
6156
  const e = [];
6157
6157
  for (const s of t)
6158
6158
  for (const i of n)
6159
6159
  e.push([s, i]);
6160
6160
  return e;
6161
6161
  }
6162
- function* vt$1(t, n, e) {
6163
- const s = (r) => n.some((u) => Y$2(u, r.lastPoint)), i = (r, u) => r.segmentType !== u.segmentType || !u.isOnSegment(r.firstPoint) || !u.isOnSegment(r.lastPoint) ? !1 : r.segmentType !== "LINE" ? u.isOnSegment(r.midPoint) : !0, o = (r) => e.some((u) => r.isSame(u) || i(r, u));
6162
+ function* vt(t, n, e) {
6163
+ const s = (r) => n.some((u) => Y$3(u, r.lastPoint)), i = (r, u) => r.segmentType !== u.segmentType || !u.isOnSegment(r.firstPoint) || !u.isOnSegment(r.lastPoint) ? !1 : r.segmentType !== "LINE" ? u.isOnSegment(r.midPoint) : !0, o = (r) => e.some((u) => r.isSame(u) || i(r, u));
6164
6164
  let l = [];
6165
6165
  for (const r of t)
6166
6166
  s(r) ? (l.push(r), yield new B$3(l, { ignoreChecks: !0 }), l = []) : o(r) ? (l.length && (yield new B$3(l, { ignoreChecks: !0 }), l = []), yield new B$3([r], { ignoreChecks: !0 })) : l.push(r);
6167
6167
  l.length && (yield new B$3(l, { ignoreChecks: !0 }));
6168
6168
  }
6169
- const Bt = (t, n) => {
6170
- const e = t.findIndex((o) => Y$2(n, o.firstPoint)), s = t.slice(0, e);
6169
+ const Bt$1 = (t, n) => {
6170
+ const e = t.findIndex((o) => Y$3(n, o.firstPoint)), s = t.slice(0, e);
6171
6171
  return t.slice(e).concat(s);
6172
- }, kt = (t, n) => {
6172
+ }, kt$1 = (t, n) => {
6173
6173
  let e = t;
6174
- const s = (r) => Y$2(r.firstPoint, n.firstPoint) && Y$2(r.lastPoint, n.lastPoint);
6174
+ const s = (r) => Y$3(r.firstPoint, n.firstPoint) && Y$3(r.lastPoint, n.lastPoint);
6175
6175
  let i = t.findIndex(s);
6176
6176
  if (i === -1) {
6177
6177
  const r = t.map((u) => u.reverse());
@@ -6187,7 +6187,7 @@ const Bt = (t, n) => {
6187
6187
  };
6188
6188
  function se(t, n, e) {
6189
6189
  return t.filter((s) => {
6190
- const i = n.filter((r) => Y$2(r.firstPoint, s) || Y$2(r.lastPoint, s));
6190
+ const i = n.filter((r) => Y$3(r.firstPoint, s) || Y$3(r.lastPoint, s));
6191
6191
  if (i.length % 2)
6192
6192
  throw new Error("Bug in the intersection algo on non crossing point");
6193
6193
  const o = i.map((r) => e.contains(r.midPoint));
@@ -6199,7 +6199,7 @@ function ie(t, n, e, s = !1) {
6199
6199
  const o = [], l = new Array(t.segments.length).fill(0).map(() => []), r = new Array(n.segments.length).fill(0).map(() => []);
6200
6200
  if (t.segments.forEach((p, d) => {
6201
6201
  n.segments.forEach((m, x) => {
6202
- const { intersections: g, overlaps: w } = Z(
6202
+ const { intersections: g, overlaps: w } = Z$1(
6203
6203
  p,
6204
6204
  m,
6205
6205
  e
@@ -6221,34 +6221,34 @@ function ie(t, n, e, s = !1) {
6221
6221
  ), !i.length && !o.length) return null;
6222
6222
  if (o.length) {
6223
6223
  const p = o[0];
6224
- a = kt(
6224
+ a = kt$1(
6225
6225
  a,
6226
6226
  p
6227
- ), f = kt(
6227
+ ), f = kt$1(
6228
6228
  f,
6229
6229
  p
6230
6230
  );
6231
6231
  } else {
6232
6232
  const p = i[0];
6233
- a = Bt(a, p), f = Bt(f, p);
6233
+ a = Bt$1(a, p), f = Bt$1(f, p);
6234
6234
  }
6235
6235
  let c = Array.from(
6236
- vt$1(
6236
+ vt(
6237
6237
  a,
6238
6238
  i,
6239
6239
  o
6240
6240
  )
6241
6241
  ), h = Array.from(
6242
- vt$1(
6242
+ vt(
6243
6243
  f,
6244
6244
  i,
6245
6245
  o
6246
6246
  )
6247
6247
  );
6248
- return (!Y$2(
6248
+ return (!Y$3(
6249
6249
  h[0].lastPoint,
6250
6250
  c[0].lastPoint
6251
- ) || o.length > 0 && h[0].segmentsCount !== 1) && (h = h.map((p) => p.reverse()).reverse(), Y$2(h[0].lastPoint, c[0].lastPoint) || (c = c.map((p) => p.reverse()).reverse())), Kt([c, h]).map(([p, d]) => {
6251
+ ) || o.length > 0 && h[0].segmentsCount !== 1) && (h = h.map((p) => p.reverse()).reverse(), Y$3(h[0].lastPoint, c[0].lastPoint) || (c = c.map((p) => p.reverse()).reverse())), Kt([c, h]).map(([p, d]) => {
6252
6252
  if (s) {
6253
6253
  if (((x) => x.segments.every(
6254
6254
  (g) => o.some(
@@ -6261,47 +6261,47 @@ function ie(t, n, e, s = !1) {
6261
6261
  return [p, d];
6262
6262
  });
6263
6263
  }
6264
- function Ot(t) {
6264
+ function Ot$1(t) {
6265
6265
  let n = t[0];
6266
6266
  for (const e of t.slice(1))
6267
6267
  n = n.extend(e);
6268
- if (!Y$2(n.firstPoint, n.lastPoint))
6268
+ if (!Y$3(n.firstPoint, n.lastPoint))
6269
6269
  throw console.error(
6270
- Z$1(n.firstPoint),
6271
- Z$1(n.lastPoint)
6270
+ Z$2(n.firstPoint),
6271
+ Z$2(n.lastPoint)
6272
6272
  ), new Error("Bug in the intersection algo on non closing strand");
6273
- return new _$2(n.segments);
6273
+ return new _$1(n.segments);
6274
6274
  }
6275
6275
  function oe(t, n) {
6276
6276
  const e = Kt([
6277
6277
  n.slice(0, -1),
6278
6278
  n.slice(1)
6279
- ]).map(([i, o]) => Ot(t.slice(i, o)));
6279
+ ]).map(([i, o]) => Ot$1(t.slice(i, o)));
6280
6280
  let s = t.slice(
6281
6281
  n[n.length - 1]
6282
6282
  );
6283
- return n[0] !== 0 && (s = s.concat(t.slice(0, n[0]))), e.push(Ot(s)), e;
6283
+ return n[0] !== 0 && (s = s.concat(t.slice(0, n[0]))), e.push(Ot$1(s)), e;
6284
6284
  }
6285
- function re(t) {
6285
+ function re$1(t) {
6286
6286
  if (!t.length) return [];
6287
6287
  const n = t.map((i) => i.firstPoint);
6288
6288
  let e = t.map((i) => i.lastPoint);
6289
6289
  e = e.slice(-1).concat(e.slice(0, -1));
6290
6290
  const s = Kt([n, e]).flatMap(
6291
- ([i, o], l) => Y$2(i, o) ? [] : l
6291
+ ([i, o], l) => Y$3(i, o) ? [] : l
6292
6292
  );
6293
6293
  try {
6294
6294
  return oe(t, s);
6295
6295
  } catch {
6296
- return Xt(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => Y$2(o[0].firstPoint, o.at(-1).lastPoint)).map((o) => new _$2(o));
6296
+ return Xt(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => Y$3(o[0].firstPoint, o.at(-1).lastPoint)).map((o) => new _$1(o));
6297
6297
  }
6298
6298
  }
6299
6299
  const _t = (t, n) => {
6300
6300
  if (t.length === 0) return [n];
6301
6301
  const e = t.at(-1);
6302
- return Y$2(e.lastPoint, n.firstPoint) ? t.slice(0, -1).concat([e.extend(n)]) : Y$2(e.lastPoint, n.lastPoint) ? t.slice(0, -1).concat([e.extend(n.reverse())]) : t.concat([n]);
6303
- }, le = (t, n) => t.length === 0 ? [n] : Y$2(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
6304
- function pt(t, n, {
6302
+ return Y$3(e.lastPoint, n.firstPoint) ? t.slice(0, -1).concat([e.extend(n)]) : Y$3(e.lastPoint, n.lastPoint) ? t.slice(0, -1).concat([e.extend(n.reverse())]) : t.concat([n]);
6303
+ }, le = (t, n) => t.length === 0 ? [n] : Y$3(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
6304
+ function pt$1(t, n, {
6305
6305
  firstInside: e,
6306
6306
  secondInside: s,
6307
6307
  firstBoundaryInside: i = !1,
@@ -6345,23 +6345,23 @@ function pt(t, n, {
6345
6345
  }
6346
6346
  return u === null && p === 1 && r && (h = le(h, r)), p === 1 && (u = p, r = null), h.length ? h : (r = null, []);
6347
6347
  });
6348
- return re(a);
6348
+ return re$1(a);
6349
6349
  }
6350
6350
  const ue = (t, n, e) => {
6351
- const s = pt(t, n, {
6351
+ const s = pt$1(t, n, {
6352
6352
  firstInside: "remove",
6353
6353
  secondInside: "remove",
6354
6354
  ...e
6355
6355
  });
6356
6356
  return Array.isArray(s) ? s : s.identical ? [t] : s.firstCurveInSecond ? [n] : s.secondCurveInFirst ? [t] : [t, n];
6357
6357
  }, tt$2 = (t, n, e) => {
6358
- const s = pt(t, n, {
6358
+ const s = pt$1(t, n, {
6359
6359
  firstInside: "remove",
6360
6360
  secondInside: "keep",
6361
6361
  ...e
6362
6362
  });
6363
6363
  return Array.isArray(s) ? s : s.identical ? [] : s.firstCurveInSecond ? [] : s.secondCurveInFirst ? [t, n] : [t];
6364
- }, dt = (t, n, e) => {
6364
+ }, dt$1 = (t, n, e) => {
6365
6365
  const s = (e == null ? void 0 : e.firstBoundaryInside) ?? !1, i = (e == null ? void 0 : e.secondBoundaryInside) ?? !1, o = s || i, l = (u, a, f) => u.segments.every(
6366
6366
  (c) => a.contains(c.midPoint, { strokeIsInside: f })
6367
6367
  );
@@ -6371,7 +6371,7 @@ const ue = (t, n, e) => {
6371
6371
  if (l(n, t, s))
6372
6372
  return [n];
6373
6373
  }
6374
- const r = pt(t, n, {
6374
+ const r = pt$1(t, n, {
6375
6375
  firstInside: "keep",
6376
6376
  secondInside: "keep",
6377
6377
  ...e
@@ -6390,13 +6390,13 @@ function ce(t) {
6390
6390
  (d) => f.some((m) => d.intersects(m))
6391
6391
  )) return;
6392
6392
  let p;
6393
- u.length > 1 || f.length > 1 ? p = G(u, f) : p = Qt(u[0], f[0]), o.fusedWith.add(a), o.current = p, c || n.set(a, o);
6393
+ u.length > 1 || f.length > 1 ? p = G$1(u, f) : p = Qt(u[0], f[0]), o.fusedWith.add(a), o.current = p, c || n.set(a, o);
6394
6394
  });
6395
6395
  }), e.flatMap(({ current: s }) => s);
6396
6396
  }
6397
6397
  function Qt(t, n) {
6398
- const e = ue(t.contour, n.contour), s = n.holes.flatMap((l) => tt$2(l, t.contour)), i = t.holes.flatMap((l) => tt$2(l, n.contour)), o = ee(t.holes, n.holes).flatMap(
6399
- ([l, r]) => dt(l, r)
6398
+ const e = ue(t.contour, n.contour), s = n.holes.flatMap((l) => tt$2(l, t.contour)), i = t.holes.flatMap((l) => tt$2(l, n.contour)), o = ee$1(t.holes, n.holes).flatMap(
6399
+ ([l, r]) => dt$1(l, r)
6400
6400
  );
6401
6401
  return X$2([
6402
6402
  ...e,
@@ -6410,12 +6410,12 @@ function nt$1(t, n) {
6410
6410
  return X$2(tt$2(t.contour, n.contour));
6411
6411
  if (t.isFull) {
6412
6412
  const s = tt$2(t.contour, n.contour), i = n.holes.flatMap(
6413
- (o) => dt(o, t.contour, { firstBoundaryInside: !0 })
6413
+ (o) => dt$1(o, t.contour, { firstBoundaryInside: !0 })
6414
6414
  );
6415
6415
  return X$2([...s, ...i]);
6416
6416
  } else if (n.isFull && !t.contour.intersects(n.contour))
6417
6417
  if (t.contour.contains(n.contour.firstPoint)) {
6418
- const s = G(
6418
+ const s = G$1(
6419
6419
  t.holes.map((i) => new v$2(i)),
6420
6420
  [n]
6421
6421
  );
@@ -6431,7 +6431,7 @@ function nt$1(t, n) {
6431
6431
  }), e;
6432
6432
  }
6433
6433
  function ae(t, n) {
6434
- const e = dt(t.contour, n.contour);
6434
+ const e = dt$1(t.contour, n.contour);
6435
6435
  if (!e.length) return [];
6436
6436
  let s = X$2(e);
6437
6437
  return s = Q$1(
@@ -6442,15 +6442,15 @@ function ae(t, n) {
6442
6442
  n.holes.map((i) => new v$2(i))
6443
6443
  );
6444
6444
  }
6445
- function G(t, n) {
6445
+ function G$1(t, n) {
6446
6446
  if (!t.length) return n;
6447
6447
  if (!n.length) return t;
6448
6448
  if (t.length === 1 && n.length > 1 || n.length === 1 && t.length > 1)
6449
6449
  return ce([...t, ...n]);
6450
6450
  if (t.length > 1 && n.length > 1) {
6451
- let e = G([t[0]], n);
6451
+ let e = G$1([t[0]], n);
6452
6452
  return t.slice(1).forEach((s) => {
6453
- e = G([s], e);
6453
+ e = G$1([s], e);
6454
6454
  }), e;
6455
6455
  }
6456
6456
  return t.length === 1 && n.length === 1 ? Qt(t[0], n[0]) : [];
@@ -6467,14 +6467,14 @@ function Q$1(t, n) {
6467
6467
  e = Q$1(e, [s]);
6468
6468
  }), e;
6469
6469
  }
6470
- function lt$2(t, n) {
6471
- return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? ae(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt$2([e], n)) : n.flatMap((e) => lt$2(t, [e]));
6470
+ function lt$3(t, n) {
6471
+ return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? ae(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt$3([e], n)) : n.flatMap((e) => lt$3(t, [e]));
6472
6472
  }
6473
6473
  let O$2 = class O extends Ze {
6474
6474
  constructor(e = [], { ignoreChecks: s = !1 } = {}) {
6475
6475
  super();
6476
- C(this, "figures");
6477
- C(this, "_boundingBox", null);
6476
+ C$1(this, "figures");
6477
+ C$1(this, "_boundingBox", null);
6478
6478
  s || fe(e), this.figures = e;
6479
6479
  }
6480
6480
  get isEmpty() {
@@ -6512,30 +6512,30 @@ let O$2 = class O extends Ze {
6512
6512
  ) : s.overlappingStrands(e));
6513
6513
  }
6514
6514
  fuse(e) {
6515
- return new O(G(this.figures, e.figures));
6515
+ return new O(G$1(this.figures, e.figures));
6516
6516
  }
6517
6517
  cut(e) {
6518
6518
  return new O(Q$1(this.figures, e.figures));
6519
6519
  }
6520
6520
  intersect(e) {
6521
- return new O(lt$2(this.figures, e.figures));
6521
+ return new O(lt$3(this.figures, e.figures));
6522
6522
  }
6523
6523
  };
6524
6524
  function fe(t) {
6525
- for (const [n, e] of it$2(t))
6525
+ for (const [n, e] of it$1(t))
6526
6526
  if (n.intersects(e))
6527
6527
  throw new Error("Diagram figures must not intersect");
6528
6528
  }
6529
6529
 
6530
- var W$2 = Object.defineProperty;
6531
- var q$1 = (e, t, n) => t in e ? W$2(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6532
- var m$1 = (e, t, n) => q$1(e, typeof t != "symbol" ? t + "" : t, n);
6530
+ var W$1 = Object.defineProperty;
6531
+ var q = (e, t, n) => t in e ? W$1(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6532
+ var m$1 = (e, t, n) => q(e, typeof t != "symbol" ? t + "" : t, n);
6533
6533
  const B$2 = (e, t, n) => {
6534
- const r = St$2(e.V, t.V), i = e.precision * t.precision;
6534
+ const r = St$1(e.V, t.V), i = e.precision * t.precision;
6535
6535
  if (r * r < i)
6536
6536
  return "parallel";
6537
- const s = Q$2(t.firstPoint, e.firstPoint), o = St$2(s, t.V) / r;
6538
- return it$3(e.firstPoint, nt$2(e.V, o));
6537
+ const s = Q$2(t.firstPoint, e.firstPoint), o = St$1(s, t.V) / r;
6538
+ return it$2(e.firstPoint, nt$2(e.V, o));
6539
6539
  };
6540
6540
  class S {
6541
6541
  constructor(t, n) {
@@ -6548,21 +6548,21 @@ function y(e, t) {
6548
6548
  if (e instanceof ct$3)
6549
6549
  return rt$2(e, t);
6550
6550
  if (e instanceof _t$1 || e instanceof Et$1)
6551
- return it$1(e, t);
6551
+ return it(e, t);
6552
6552
  throw new Error("Not implemented");
6553
6553
  }
6554
6554
  function et$2(e, t) {
6555
6555
  const { firstPoint: n, lastPoint: r } = e, i = e.normalVector;
6556
6556
  return new at$3(
6557
- it$3(n, nt$2(i, t)),
6558
- it$3(r, nt$2(i, t))
6557
+ it$2(n, nt$2(i, t)),
6558
+ it$2(r, nt$2(i, t))
6559
6559
  );
6560
6560
  }
6561
6561
  function rt$2(e, t) {
6562
- const n = it$3(
6562
+ const n = it$2(
6563
6563
  e.firstPoint,
6564
6564
  nt$2(tt$3(e.tangentAtFirstPoint), t)
6565
- ), r = it$3(
6565
+ ), r = it$2(
6566
6566
  e.lastPoint,
6567
6567
  nt$2(tt$3(e.tangentAtLastPoint), t)
6568
6568
  ), i = t * (e.clockwise ? 1 : -1);
@@ -6587,14 +6587,14 @@ function b(e, t, n, r, i) {
6587
6587
  );
6588
6588
  return s;
6589
6589
  }
6590
- function it$1(e, t) {
6590
+ function it(e, t) {
6591
6591
  const { firstPoint: n, lastPoint: r, normalAtFirstPoint: i, normalAtLastPoint: s } = e, o = B$2(
6592
6592
  { V: i, firstPoint: n, precision: e.precision },
6593
6593
  { V: s, firstPoint: r, precision: e.precision }
6594
- ), a = it$3(
6594
+ ), a = it$2(
6595
6595
  n,
6596
6596
  nt$2(i, t)
6597
- ), h = it$3(
6597
+ ), h = it$2(
6598
6598
  r,
6599
6599
  nt$2(s, t)
6600
6600
  );
@@ -6639,8 +6639,8 @@ function it$1(e, t) {
6639
6639
  f
6640
6640
  );
6641
6641
  }
6642
- function M(e, t, n) {
6643
- const r = St$2(
6642
+ function M$1(e, t, n) {
6643
+ const r = St$1(
6644
6644
  e.tangentAtLastPoint,
6645
6645
  t.tangentAtFirstPoint
6646
6646
  );
@@ -6657,13 +6657,13 @@ function M(e, t, n) {
6657
6657
  if (!h)
6658
6658
  return null;
6659
6659
  const c = h, p = (v, O) => {
6660
- const I = O.tangentAt(c), N = Qt$1(I), Y = it$3(c, nt$2(N, s));
6660
+ const I = O.tangentAt(c), N = Qt$1(I), Y = it$2(c, nt$2(N, s));
6661
6661
  return v.splitAt(Y);
6662
6662
  }, [f] = p(e, o), [, g] = p(t, a);
6663
6663
  return { first: f, second: g, center: c };
6664
6664
  }
6665
- function V(e, t, n) {
6666
- const r = M(e, t, n);
6665
+ function V$1(e, t, n) {
6666
+ const r = M$1(e, t, n);
6667
6667
  if (!r)
6668
6668
  return console.warn(
6669
6669
  "Cannot fillet between segments",
@@ -6677,8 +6677,8 @@ function V(e, t, n) {
6677
6677
  s
6678
6678
  ];
6679
6679
  }
6680
- function _$1(e, t, n) {
6681
- const r = M(e, t, n);
6680
+ function _(e, t, n) {
6681
+ const r = M$1(e, t, n);
6682
6682
  if (!r)
6683
6683
  return console.warn(
6684
6684
  "Cannot chamfer between segments",
@@ -6698,14 +6698,14 @@ const st$1 = (e) => {
6698
6698
  startTangent: s
6699
6699
  } = t;
6700
6700
  let o;
6701
- typeof n == "number" ? o = Tt(1, n * fe$1) : o = n;
6701
+ typeof n == "number" ? o = Tt$1(1, n * fe$1) : o = n;
6702
6702
  let a;
6703
- return typeof s == "number" ? a = Tt(1, s * fe$1) : a = s, { endTangent: o, startFactor: r, endFactor: i, startTangent: a };
6703
+ return typeof s == "number" ? a = Tt$1(1, s * fe$1) : a = s, { endTangent: o, startFactor: r, endFactor: i, startTangent: a };
6704
6704
  };
6705
6705
  function z$2(e, { ignoreChecks: t = !1 } = {}) {
6706
- return new O$2([new v$2(new _$2([...e], { ignoreChecks: t }))]);
6706
+ return new O$2([new v$2(new _$1([...e], { ignoreChecks: t }))]);
6707
6707
  }
6708
- let ot$2 = class ot {
6708
+ let ot$1 = class ot {
6709
6709
  constructor(t = [0, 0]) {
6710
6710
  m$1(this, "pointer");
6711
6711
  m$1(this, "firstPoint");
@@ -6721,13 +6721,13 @@ let ot$2 = class ot {
6721
6721
  return this.pointer = t, this.firstPoint = t, this;
6722
6722
  }
6723
6723
  saveSegment(t) {
6724
- if (Y$2(t.firstPoint, t.lastPoint))
6724
+ if (Y$3(t.firstPoint, t.lastPoint))
6725
6725
  throw new Error(`Segment has no length, ${t.repr}`);
6726
6726
  if (!this._nextCorner)
6727
6727
  return this.pendingSegments.push(t), this;
6728
6728
  const n = this.pendingSegments.pop();
6729
6729
  if (!n) throw new Error("bug in the custom corner algorithm");
6730
- const r = this._nextCorner.mode === "chamfer" ? _$1 : V;
6730
+ const r = this._nextCorner.mode === "chamfer" ? _ : V$1;
6731
6731
  return this.pendingSegments.push(
6732
6732
  ...r(n, t, this._nextCorner.radius)
6733
6733
  ), this._nextCorner = null, this;
@@ -6752,11 +6752,11 @@ let ot$2 = class ot {
6752
6752
  return this.lineTo([t, this.pointer[1]]);
6753
6753
  }
6754
6754
  polarLineTo([t, n]) {
6755
- const r = n * fe$1, i = Tt(t, r);
6755
+ const r = n * fe$1, i = Tt$1(t, r);
6756
6756
  return this.lineTo(i);
6757
6757
  }
6758
6758
  polarLine(t, n) {
6759
- const r = n * fe$1, [i, s] = Tt(t, r);
6759
+ const r = n * fe$1, [i, s] = Tt$1(t, r);
6760
6760
  return this.line(i, s);
6761
6761
  }
6762
6762
  tangentLine(t) {
@@ -6767,7 +6767,7 @@ let ot$2 = class ot {
6767
6767
  return this.line(r * t, i * t);
6768
6768
  }
6769
6769
  threePointsArcTo(t, n) {
6770
- return this.saveSegment(fn$1(this.pointer, n, t)), this.pointer = t, this;
6770
+ return this.saveSegment(fn(this.pointer, n, t)), this.pointer = t, this;
6771
6771
  }
6772
6772
  threePointsArc(t, n, r, i) {
6773
6773
  const [s, o] = this.pointer;
@@ -6778,7 +6778,7 @@ let ot$2 = class ot {
6778
6778
  }
6779
6779
  sagittaArcTo(t, n) {
6780
6780
  if (!n) return this.lineTo(t);
6781
- const r = new at$3(this.pointer, t), i = tt$3(r.tangentAtFirstPoint), s = it$3(r.midPoint, nt$2(i, n));
6781
+ const r = new at$3(this.pointer, t), i = tt$3(r.tangentAtFirstPoint), s = it$2(r.midPoint, nt$2(i, n));
6782
6782
  return this.threePointsArcTo(t, s);
6783
6783
  }
6784
6784
  sagittaArc(t, n, r) {
@@ -6898,13 +6898,13 @@ let ot$2 = class ot {
6898
6898
  const r = this.pendingSegments.pop(), i = this.pendingSegments.shift();
6899
6899
  if (!r || !i)
6900
6900
  throw new Error("Not enough curves to close and fillet");
6901
- const s = n === "chamfer" ? _$1 : V;
6901
+ const s = n === "chamfer" ? _ : V$1;
6902
6902
  this.pendingSegments.push(...s(r, i, t));
6903
6903
  }
6904
6904
  close(t = !1) {
6905
6905
  if (!this.pendingSegments.length) throw new Error("No segments to close");
6906
6906
  const n = this.pendingSegments[0], r = this.pendingSegments.at(-1);
6907
- return Y$2(n.firstPoint, r.lastPoint) || this.lineTo(n.firstPoint), this._nextCorner !== null && (this._customCornerLastWithFirst(
6907
+ return Y$3(n.firstPoint, r.lastPoint) || this.lineTo(n.firstPoint), this._nextCorner !== null && (this._customCornerLastWithFirst(
6908
6908
  this._nextCorner.radius,
6909
6909
  this._nextCorner.mode
6910
6910
  ), this._nextCorner = null), z$2(this.pendingSegments, { ignoreChecks: t });
@@ -6930,36 +6930,36 @@ let ot$2 = class ot {
6930
6930
  }
6931
6931
  get isClosed() {
6932
6932
  var t;
6933
- return Y$2(this.pointer, (t = this.pendingSegments[0]) == null ? void 0 : t.firstPoint);
6933
+ return Y$3(this.pointer, (t = this.pendingSegments[0]) == null ? void 0 : t.firstPoint);
6934
6934
  }
6935
6935
  };
6936
- function lt$1(e = [0, 0]) {
6937
- return new ot$2(e);
6936
+ function lt$2(e = [0, 0]) {
6937
+ return new ot$1(e);
6938
6938
  }
6939
6939
 
6940
6940
  function ct$1(c) {
6941
- return lt$1([-c, 0]).sagittaArc(2 * c, 0, c).sagittaArc(-2 * c, 0, c).close();
6941
+ return lt$2([-c, 0]).sagittaArc(2 * c, 0, c).sagittaArc(-2 * c, 0, c).close();
6942
6942
  }
6943
- function ot$1(c, e, t = 0) {
6943
+ function ot(c, e, t = 0) {
6944
6944
  const { rx: a = 0, ry: o = 0 } = typeof t == "number" ? { ry: t, rx: t } : t;
6945
6945
  let n = Math.min(a ?? t ?? 0, c / 2), r = Math.min(o ?? t ?? 0, e / 2);
6946
6946
  const s = n && r;
6947
6947
  s || (n = 0, r = 0);
6948
- const h = n === r, f = lt$1([Math.min(0, -(c / 2 - n)), -e / 2]), l = (k, i) => {
6948
+ const h = n === r, f = lt$2([Math.min(0, -(c / 2 - n)), -e / 2]), l = (k, i) => {
6949
6949
  s && (h ? f.tangentArc(k, i) : f.ellipse(k, i, n, r, 0, !1, !1));
6950
6950
  };
6951
6951
  return n < c / 2 && f.hLine(c - 2 * n), l(n, r), r < e / 2 && f.vLine(e - 2 * r), l(-n, r), n < c / 2 && f.hLine(-(c - 2 * n)), l(-n, -r), r < e / 2 && f.vLine(-(e - 2 * r)), l(n, -r), f.close();
6952
6952
  }
6953
6953
  function rt$1(c, e) {
6954
- const t = lt$1([-c, 0]);
6954
+ const t = lt$2([-c, 0]);
6955
6955
  return t.halfEllipse(2 * c, 0, e), t.halfEllipse(-2 * c, 0, e), t.close();
6956
6956
  }
6957
- function lt(c, e, t) {
6957
+ function lt$1(c, e, t) {
6958
6958
  const a = Je(e).map((n) => {
6959
6959
  const r = -(Math.PI * 2 / e) * n;
6960
6960
  return [c * Math.sin(r), c * Math.cos(r)];
6961
6961
  });
6962
- let o = lt$1(a[a.length - 1]);
6962
+ let o = lt$2(a[a.length - 1]);
6963
6963
  for (const n of a)
6964
6964
  t ? o = o.sagittaArcTo(n, t) : o = o.lineTo(n);
6965
6965
  return o.close();
@@ -7031,7 +7031,7 @@ function X$1(c) {
7031
7031
  }
7032
7032
  return e.join(" ");
7033
7033
  }
7034
- function Y(c) {
7034
+ function Y$1(c) {
7035
7035
  let e = 0, t = 0, a = 0, o = 0;
7036
7036
  const n = [];
7037
7037
  for (const { key: r, data: s } of c)
@@ -7195,13 +7195,13 @@ function F(c, e, t, a, o, n, r, s, h, f) {
7195
7195
  return x;
7196
7196
  }
7197
7197
  }
7198
- const W$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7198
+ const W = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7199
7199
  __proto__: null,
7200
- absolutize: Y,
7200
+ absolutize: Y$1,
7201
7201
  normalize: J$1,
7202
7202
  parsePath: O$1,
7203
7203
  serialize: X$1
7204
- }, Symbol.toStringTag, { value: "Module" })), { parsePath: v$1, absolutize: tt$1 } = W$1, et$1 = (c, e, t) => {
7204
+ }, Symbol.toStringTag, { value: "Module" })), { parsePath: v$1, absolutize: tt$1 } = W, et$1 = (c, e, t) => {
7205
7205
  let a, o = null, n = null;
7206
7206
  if (c.key === "M") {
7207
7207
  const [r, s] = c.data;
@@ -7292,7 +7292,7 @@ function* at$1(c) {
7292
7292
  }
7293
7293
  const r = et$1(n, a, o), s = r.p, h = "control1" in r ? r.control1 : null, f = "control1" in r ? r.control2 : null, l = "arcConfig" in r ? r.arcConfig : null;
7294
7294
  if (n.key === "M") {
7295
- t && (yield t.isClosed ? t.close() : t.asStrand()), t = lt$1(s), a = s;
7295
+ t && (yield t.isClosed ? t.close() : t.asStrand()), t = lt$2(s), a = s;
7296
7296
  continue;
7297
7297
  }
7298
7298
  if (a && Math.abs(s[0] - a[0]) < 1e-9 && Math.abs(s[1] - a[1]) < 1e-9) {
@@ -7303,7 +7303,7 @@ function* at$1(c) {
7303
7303
  }
7304
7304
  t && (yield t.isClosed ? t.close() : t.asStrand());
7305
7305
  }
7306
- function ht(c) {
7306
+ function ht$1(c) {
7307
7307
  return Array.from(at$1(c));
7308
7308
  }
7309
7309
 
@@ -7311,9 +7311,9 @@ var drawShape = /*#__PURE__*/Object.freeze({
7311
7311
  __proto__: null,
7312
7312
  drawCircle: ct$1,
7313
7313
  drawEllipse: rt$1,
7314
- drawPolysides: lt,
7315
- drawRect: ot$1,
7316
- drawSVGPath: ht
7314
+ drawPolysides: lt$1,
7315
+ drawRect: ot,
7316
+ drawSVGPath: ht$1
7317
7317
  });
7318
7318
 
7319
7319
  function i([t, n]) {
@@ -7352,7 +7352,7 @@ function d(t) {
7352
7352
  `)}
7353
7353
  </g>`;
7354
7354
  }
7355
- function j$1(t) {
7355
+ function j(t) {
7356
7356
  const n = `M ${t.firstPoint.join(" ")}`, o = t.segments.map(s).join(" ");
7357
7357
  return `${n} ${o}`;
7358
7358
  }
@@ -7368,563 +7368,563 @@ function A(t, n, o = 1, r) {
7368
7368
  </svg>`;
7369
7369
  }
7370
7370
 
7371
- var yt = Object.defineProperty;
7372
- var Ct = (n, t, e) => t in n ? yt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
7373
- var P = (n, t, e) => Ct(n, typeof t != "symbol" ? t + "" : t, e);
7374
- function L(n) {
7375
- if (n instanceof v$2)
7376
- return [n];
7377
- if (n instanceof _$2)
7378
- return [new v$2(n)];
7379
- if (n instanceof O$2)
7380
- return n.figures;
7371
+ var Ut = Object.defineProperty;
7372
+ var Vt = (t, n, e) => n in t ? Ut(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
7373
+ var M = (t, n, e) => Vt(t, typeof n != "symbol" ? n + "" : n, e);
7374
+ function x(t) {
7375
+ if (t instanceof v$2)
7376
+ return [t];
7377
+ if (t instanceof _$1)
7378
+ return [new v$2(t)];
7379
+ if (t instanceof O$2)
7380
+ return t.figures;
7381
7381
  throw new Error("Unknown shape");
7382
7382
  }
7383
- function mt(n, t, e = 1e-9) {
7384
- let s = [];
7385
- const r = [], i = new Array(t.segments.length).fill(0).map(() => []);
7386
- t.segments.forEach((a, f) => {
7387
- n.segments.forEach((c) => {
7388
- const { intersections: l, overlaps: p } = Z(
7389
- a,
7383
+ function kt(t, n, e = 1e-9) {
7384
+ let r = [];
7385
+ const s = [], i = new Array(n.segments.length).fill(0).map(() => []);
7386
+ n.segments.forEach((c, f) => {
7387
+ t.segments.forEach((a) => {
7388
+ const { intersections: u, overlaps: g } = Z$1(
7390
7389
  c,
7390
+ a,
7391
7391
  e
7392
7392
  );
7393
- s.push(...l), i[f].push(...l), r.push(...p);
7394
- const g = p.flatMap((d) => [
7393
+ r.push(...u), i[f].push(...u), s.push(...g);
7394
+ const p = g.flatMap((d) => [
7395
7395
  d.firstPoint,
7396
7396
  d.lastPoint
7397
7397
  ]);
7398
- s.push(...g), i[f].push(...g);
7398
+ r.push(...p), i[f].push(...p);
7399
7399
  });
7400
- }), s = Te(s, e);
7401
- const o = Kt([t.segments, i]).flatMap(([a, f]) => f.length ? a.splitAt(f) : [a]);
7400
+ }), r = Te(r, e);
7401
+ const o = Kt([n.segments, i]).flatMap(([c, f]) => f.length ? c.splitAt(f) : [c]);
7402
7402
  return Array.from(
7403
- vt$1(
7403
+ vt(
7404
7404
  o,
7405
- s,
7406
- r
7405
+ r,
7406
+ s
7407
7407
  )
7408
7408
  );
7409
7409
  }
7410
- function J(n, t, e = !1) {
7411
- return mt(t, n).filter((r) => {
7412
- const i = r.segments[0].midPoint;
7413
- return t.onStroke(i) ? !e : !t.contains(i);
7410
+ function tt(t, n, e = !1) {
7411
+ return kt(n, t).filter((s) => {
7412
+ const i = s.segments[0].midPoint;
7413
+ return n.onStroke(i) ? !e : !n.contains(i);
7414
7414
  });
7415
7415
  }
7416
- function Q(n, t, e = !1) {
7417
- return mt(t, n).filter((r) => {
7418
- const i = r.segments[0].midPoint;
7419
- return t.onStroke(i) ? !e : t.contains(i);
7416
+ function nt(t, n, e = !1) {
7417
+ return kt(n, t).filter((s) => {
7418
+ const i = s.segments[0].midPoint;
7419
+ return n.onStroke(i) ? !e : n.contains(i);
7420
7420
  });
7421
7421
  }
7422
- function W(n, t, e = !1) {
7423
- const s = J(
7424
- n,
7425
- t.contour,
7422
+ function ct(t, n, e = !1) {
7423
+ const r = tt(
7424
+ t,
7425
+ n.contour,
7426
7426
  e
7427
- ), r = t.holes.flatMap(
7428
- (i) => Q(n, i, e)
7427
+ ), s = n.holes.flatMap(
7428
+ (i) => nt(t, i, e)
7429
7429
  );
7430
- return [...s, ...r];
7430
+ return [...r, ...s];
7431
7431
  }
7432
- function j(n, t, e = !1) {
7433
- let s = Q(
7434
- n,
7435
- t.contour,
7432
+ function at(t, n, e = !1) {
7433
+ let r = nt(
7434
+ t,
7435
+ n.contour,
7436
7436
  e
7437
7437
  );
7438
- return t.holes.forEach((r) => {
7439
- s = s.flatMap(
7440
- (i) => J(i, r, e)
7438
+ return n.holes.forEach((s) => {
7439
+ r = r.flatMap(
7440
+ (i) => tt(i, s, e)
7441
7441
  );
7442
- }), s;
7442
+ }), r;
7443
7443
  }
7444
- function sn(n, t) {
7444
+ function gn(t, n) {
7445
7445
  return new O$2(
7446
- G(L(n), L(t))
7446
+ G$1(x(t), x(n))
7447
7447
  );
7448
7448
  }
7449
- function z(n) {
7450
- return n.reduce(
7451
- (t, e) => sn(t, e),
7449
+ function z(t) {
7450
+ return t.reduce(
7451
+ (n, e) => gn(n, e),
7452
7452
  new O$2()
7453
7453
  );
7454
7454
  }
7455
- function Pt(n, t) {
7455
+ function Ft(t, n) {
7456
7456
  return new O$2(
7457
- Q$1(L(n), L(t))
7457
+ Q$1(x(t), x(n))
7458
7458
  );
7459
7459
  }
7460
- function yn(n, t) {
7460
+ function Xn(t, n) {
7461
7461
  return new O$2(
7462
- lt$2(L(n), L(t))
7462
+ lt$3(x(t), x(n))
7463
7463
  );
7464
7464
  }
7465
- function Cn(n, t, e = !0) {
7466
- if (t instanceof _$2)
7467
- return J(n, t, e);
7468
- if (t instanceof v$2)
7469
- return W(n, t, e);
7470
- let s = [new B$3([...n.segments])];
7471
- return t.figures.forEach((r) => {
7472
- s = s.flatMap((i) => W(i, r, e));
7473
- }), s;
7474
- }
7475
- function xn(n, t, e = !1) {
7476
- if (t instanceof _$2)
7477
- return Q(n, t, e);
7478
- if (t instanceof v$2)
7479
- return j(n, t, e);
7480
- let s = [new B$3([...n.segments])];
7481
- return t.figures.forEach((r) => {
7482
- s = s.flatMap((i) => j(i, r, e));
7483
- }), s;
7465
+ function Jn(t, n, e = !0) {
7466
+ if (n instanceof _$1)
7467
+ return tt(t, n, e);
7468
+ if (n instanceof v$2)
7469
+ return ct(t, n, e);
7470
+ let r = [new B$3([...t.segments])];
7471
+ return n.figures.forEach((s) => {
7472
+ r = r.flatMap((i) => ct(i, s, e));
7473
+ }), r;
7474
+ }
7475
+ function Qn(t, n, e = !1) {
7476
+ if (n instanceof _$1)
7477
+ return nt(t, n, e);
7478
+ if (n instanceof v$2)
7479
+ return at(t, n, e);
7480
+ let r = [new B$3([...t.segments])];
7481
+ return n.figures.forEach((s) => {
7482
+ r = r.flatMap((i) => at(i, s, e));
7483
+ }), r;
7484
7484
  }
7485
- function tt(n) {
7486
- return n < 0 ? "before" : n > 1 ? "after" : "between";
7485
+ function ft(t) {
7486
+ return t < 0 ? "before" : t > 1 ? "after" : "between";
7487
7487
  }
7488
- const nt = (n, t, e) => {
7488
+ const ut = (t, n, e) => {
7489
7489
  if (e === "before")
7490
- return n.distanceFrom(t.firstPoint);
7490
+ return t.distanceFrom(n.firstPoint);
7491
7491
  if (e === "after")
7492
- return n.distanceFrom(t.lastPoint);
7492
+ return t.distanceFrom(n.lastPoint);
7493
7493
  throw new Error("Invalid position");
7494
7494
  };
7495
- function rn(n, t) {
7496
- const e = me(n, t);
7495
+ function pn(t, n) {
7496
+ const e = me(t, n);
7497
7497
  if (e === "parallel")
7498
7498
  return Math.min(
7499
- n.distanceFrom(t.firstPoint),
7500
- n.distanceFrom(t.lastPoint)
7499
+ t.distanceFrom(n.firstPoint),
7500
+ t.distanceFrom(n.lastPoint)
7501
7501
  );
7502
- const { intersectionParam1: s, intersectionParam2: r } = e, i = tt(s), o = tt(r);
7502
+ const { intersectionParam1: r, intersectionParam2: s } = e, i = ft(r), o = ft(s);
7503
7503
  if (i === "between" && o === "between")
7504
7504
  return 0;
7505
7505
  if (i === "between" && o !== "between")
7506
- return nt(n, t, o);
7506
+ return ut(t, n, o);
7507
7507
  if (o === "between" && i !== "between")
7508
- return nt(t, n, i);
7508
+ return ut(n, t, i);
7509
7509
  if (i === "before" && o === "before")
7510
- return J$3(n.firstPoint, t.firstPoint);
7510
+ return J$3(t.firstPoint, n.firstPoint);
7511
7511
  if (i === "after" && o === "after")
7512
- return J$3(n.lastPoint, t.lastPoint);
7512
+ return J$3(t.lastPoint, n.lastPoint);
7513
7513
  if (i === "before" && o === "after")
7514
- return J$3(n.firstPoint, t.lastPoint);
7514
+ return J$3(t.firstPoint, n.lastPoint);
7515
7515
  if (i === "after" && o === "before")
7516
- return J$3(n.lastPoint, t.firstPoint);
7516
+ return J$3(t.lastPoint, n.firstPoint);
7517
7517
  throw new Error("Invalid position");
7518
7518
  }
7519
- function et(n, t) {
7520
- if (K$2(n, t).length > 0)
7519
+ function lt(t, n) {
7520
+ if (K$2(t, n).length > 0)
7521
7521
  return 0;
7522
- const e = dn$1(n, t.center);
7523
- if (n.isOnSegment(e)) {
7524
- const s = J$3(e, t.center);
7525
- if (Math.abs(s - t.radius) < n.precision && t.isOnSegment(e))
7522
+ const e = dn$1(t, n.center);
7523
+ if (t.isOnSegment(e)) {
7524
+ const r = J$3(e, n.center);
7525
+ if (Math.abs(r - n.radius) < t.precision && n.isOnSegment(e))
7526
7526
  return 0;
7527
- if (s - t.radius > n.precision) {
7528
- const r = H$1(
7529
- Q$2(e, t.center)
7530
- ), i = it$3(
7531
- t.center,
7532
- nt$2(r, t.radius)
7527
+ if (r - n.radius > t.precision) {
7528
+ const s = H$1(
7529
+ Q$2(e, n.center)
7530
+ ), i = it$2(
7531
+ n.center,
7532
+ nt$2(s, n.radius)
7533
7533
  );
7534
- if (t.isOnSegment(i))
7534
+ if (n.isOnSegment(i))
7535
7535
  return J$3(i, e);
7536
7536
  }
7537
7537
  }
7538
7538
  return Math.min(
7539
- t.distanceFrom(n.firstPoint),
7540
- t.distanceFrom(n.lastPoint),
7541
7539
  n.distanceFrom(t.firstPoint),
7542
- n.distanceFrom(t.lastPoint)
7540
+ n.distanceFrom(t.lastPoint),
7541
+ t.distanceFrom(n.firstPoint),
7542
+ t.distanceFrom(n.lastPoint)
7543
7543
  );
7544
7544
  }
7545
- const on = (n, t) => {
7546
- const e = n.angleToParam(t.firstAngle);
7547
- if (n.isValidParameter(e)) return !0;
7548
- const s = n.angleToParam(t.lastAngle);
7549
- return !!n.isValidParameter(s);
7545
+ const dn = (t, n) => {
7546
+ const e = t.angleToParam(n.firstAngle);
7547
+ if (t.isValidParameter(e)) return !0;
7548
+ const r = t.angleToParam(n.lastAngle);
7549
+ return !!t.isValidParameter(r);
7550
7550
  };
7551
- function an(n, t) {
7552
- if (Dt(n, t, !0).length > 0) return 0;
7553
- const e = J$3(n.center, t.center);
7554
- if (e < n.precision && on(n, t))
7555
- return Math.abs(n.radius - t.radius);
7556
- const s = H$1(Q$2(t.center, n.center)), r = e - Math.abs(n.radius - t.radius) < n.precision;
7557
- let i = Ye(s);
7558
- r && t.radius > n.radius && (i += Math.PI);
7559
- const o = r ? i : i + Math.PI, a = n.angleToParam(i), f = t.angleToParam(o);
7560
- return n.isValidParameter(a) && t.isValidParameter(f) ? J$3(n.paramPoint(a), t.paramPoint(f)) : Math.min(
7561
- n.distanceFrom(t.firstPoint),
7562
- n.distanceFrom(t.lastPoint),
7551
+ function mn(t, n) {
7552
+ if (Dt$1(t, n, !0).length > 0) return 0;
7553
+ const e = J$3(t.center, n.center);
7554
+ if (e < t.precision && dn(t, n))
7555
+ return Math.abs(t.radius - n.radius);
7556
+ const r = H$1(Q$2(n.center, t.center)), s = e - Math.abs(t.radius - n.radius) < t.precision;
7557
+ let i = Ye(r);
7558
+ s && n.radius > t.radius && (i += Math.PI);
7559
+ const o = s ? i : i + Math.PI, c = t.angleToParam(i), f = n.angleToParam(o);
7560
+ return t.isValidParameter(c) && n.isValidParameter(f) ? J$3(t.paramPoint(c), n.paramPoint(f)) : Math.min(
7563
7561
  t.distanceFrom(n.firstPoint),
7564
- t.distanceFrom(n.lastPoint)
7562
+ t.distanceFrom(n.lastPoint),
7563
+ n.distanceFrom(t.firstPoint),
7564
+ n.distanceFrom(t.lastPoint)
7565
7565
  );
7566
7566
  }
7567
- function cn(n, t, e) {
7568
- let s = 0, r = n.length - 1;
7569
- for (; s <= r; ) {
7570
- const i = Math.floor((s + r) / 2), o = e(n[i], t);
7567
+ function Pn(t, n, e) {
7568
+ let r = 0, s = t.length - 1;
7569
+ for (; r <= s; ) {
7570
+ const i = Math.floor((r + s) / 2), o = e(t[i], n);
7571
7571
  if (o < 0)
7572
- s = i + 1;
7572
+ r = i + 1;
7573
7573
  else if (o > 0)
7574
- r = i - 1;
7574
+ s = i - 1;
7575
7575
  else
7576
7576
  return i;
7577
7577
  }
7578
- return -(s + 1);
7578
+ return -(r + 1);
7579
7579
  }
7580
- function fn(n, t, e) {
7581
- const s = cn(n, t, e);
7582
- s < 0 ? n.splice(-(s + 1), 0, t) : n.splice(s, 0, t);
7580
+ function wn(t, n, e) {
7581
+ const r = Pn(t, n, e);
7582
+ r < 0 ? t.splice(-(r + 1), 0, n) : t.splice(r, 0, n);
7583
7583
  }
7584
- class ln {
7584
+ class Mn {
7585
7585
  constructor() {
7586
- P(this, "buckets");
7586
+ M(this, "buckets");
7587
7587
  this.buckets = [];
7588
7588
  }
7589
- addInterval(t) {
7590
- const e = this.buckets[t.rectangle.diagonalBucketIndex];
7591
- e === void 0 ? this.buckets[t.rectangle.diagonalBucketIndex] = [t] : fn(e, t, (s, r) => s.value - r.value);
7589
+ addInterval(n) {
7590
+ const e = this.buckets[n.rectangle.diagonalBucketIndex];
7591
+ e === void 0 ? this.buckets[n.rectangle.diagonalBucketIndex] = [n] : wn(e, n, (r, s) => r.value - s.value);
7592
7592
  }
7593
- removeInterval(t) {
7594
- const e = this.buckets[t.rectangle.diagonalBucketIndex];
7593
+ removeInterval(n) {
7594
+ const e = this.buckets[n.rectangle.diagonalBucketIndex];
7595
7595
  if (e === void 0)
7596
7596
  throw new Error("Interval not found");
7597
7597
  e.shift();
7598
7598
  }
7599
7599
  getBottomRightHullIntervals() {
7600
- const t = [];
7600
+ const n = [];
7601
7601
  for (let e = this.buckets.length - 1; e >= 0; e--) {
7602
- const s = this.buckets[e];
7603
- if (!s === void 0) continue;
7604
- const r = s[0];
7605
- if (r !== void 0) {
7606
- if (!t.length) {
7607
- t.push(r);
7602
+ const r = this.buckets[e];
7603
+ if (!r === void 0) continue;
7604
+ const s = r[0];
7605
+ if (s !== void 0) {
7606
+ if (!n.length) {
7607
+ n.push(s);
7608
7608
  continue;
7609
7609
  }
7610
- for (; t.length && t[t.length - 1].value >= r.value; )
7611
- t.pop();
7612
- for (; t.length >= 2; ) {
7613
- const i = t[t.length - 1], o = t[t.length - 2], a = (r.value - o.value) / ((r.rectangle.diagonal - o.rectangle.diagonal) * 2);
7614
- if (o.value + (i.rectangle.diagonal - o.rectangle.diagonal) / 2 * a < i.value)
7615
- t.pop();
7610
+ for (; n.length && n[n.length - 1].value >= s.value; )
7611
+ n.pop();
7612
+ for (; n.length >= 2; ) {
7613
+ const i = n[n.length - 1], o = n[n.length - 2], c = (s.value - o.value) / ((s.rectangle.diagonal - o.rectangle.diagonal) * 2);
7614
+ if (o.value + (i.rectangle.diagonal - o.rectangle.diagonal) / 2 * c < i.value)
7615
+ n.pop();
7616
7616
  else
7617
7617
  break;
7618
7618
  }
7619
- t.push(r);
7619
+ n.push(s);
7620
7620
  }
7621
7621
  }
7622
- return t;
7622
+ return n;
7623
7623
  }
7624
7624
  }
7625
- class un {
7626
- constructor(t, e) {
7627
- P(this, "diagonal");
7628
- P(this, "diagonalBucketIndex");
7629
- P(this, "xLength");
7630
- P(this, "yLength");
7631
- P(this, "index");
7632
- this.x = t, this.y = e, this.xLength = Math.pow(3, -t), this.yLength = Math.pow(3, -e), this.diagonal = Math.sqrt(
7625
+ class Sn {
7626
+ constructor(n, e) {
7627
+ M(this, "diagonal");
7628
+ M(this, "diagonalBucketIndex");
7629
+ M(this, "xLength");
7630
+ M(this, "yLength");
7631
+ M(this, "index");
7632
+ this.x = n, this.y = e, this.xLength = Math.pow(3, -n), this.yLength = Math.pow(3, -e), this.diagonal = Math.sqrt(
7633
7633
  this.xLength * this.xLength + this.yLength * this.yLength
7634
- ), this.diagonalBucketIndex = t + e, this.index = `${t},${e}`;
7635
- }
7636
- }
7637
- class hn {
7638
- constructor(t, e = 1e-8, s = 1e3, r = 1e-6) {
7639
- P(this, "rectangles");
7640
- P(this, "buckets");
7641
- P(this, "fMin");
7642
- P(this, "argMin");
7643
- P(this, "tol");
7644
- this.fcn = t, this.endTolerance = e, this.maxIterations = s, this.epsilon = r, this.fcn = t, this.epsilon = r, this.endTolerance = e, this.maxIterations = s, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new ln();
7645
- const i = [0.5, 0.5], o = this.rect(0, 0), a = this.fcn(i);
7646
- this.buckets.addInterval(new O(i, a, o)), this.fMin = a, this.argMin = i, this.tol = o.diagonal;
7647
- }
7648
- registerInterval(t) {
7649
- this.buckets.addInterval(t), t.value <= this.fMin && (this.fMin = t.value, this.argMin = t.center, this.tol = t.rectangle.diagonal);
7650
- }
7651
- rect(t, e) {
7652
- const s = `${t},${e}`;
7653
- return this.rectangles.has(s) || this.rectangles.set(s, new un(t, e)), this.rectangles.get(s);
7654
- }
7655
- splitInterval(t) {
7656
- let e, s, r;
7657
- const [i, o] = t.center;
7658
- return t.rectangle.x <= t.rectangle.y ? (e = this.rect(t.rectangle.x + 1, t.rectangle.y), s = [i - e.xLength, o], r = [i + e.xLength, o]) : (e = this.rect(t.rectangle.x, t.rectangle.y + 1), s = [i, o - e.yLength], r = [i, o + e.yLength]), [
7659
- new O(s, this.fcn(s), e),
7660
- new O(t.center, t.value, e),
7661
- new O(r, this.fcn(r), e)
7634
+ ), this.diagonalBucketIndex = n + e, this.index = `${n},${e}`;
7635
+ }
7636
+ }
7637
+ class In {
7638
+ constructor(n, e = 1e-8, r = 1e3, s = 1e-6) {
7639
+ M(this, "rectangles");
7640
+ M(this, "buckets");
7641
+ M(this, "fMin");
7642
+ M(this, "argMin");
7643
+ M(this, "tol");
7644
+ this.fcn = n, this.endTolerance = e, this.maxIterations = r, this.epsilon = s, this.fcn = n, this.epsilon = s, this.endTolerance = e, this.maxIterations = r, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new Mn();
7645
+ const i = [0.5, 0.5], o = this.rect(0, 0), c = this.fcn(i);
7646
+ this.buckets.addInterval(new O(i, c, o)), this.fMin = c, this.argMin = i, this.tol = o.diagonal;
7647
+ }
7648
+ registerInterval(n) {
7649
+ this.buckets.addInterval(n), n.value <= this.fMin && (this.fMin = n.value, this.argMin = n.center, this.tol = n.rectangle.diagonal);
7650
+ }
7651
+ rect(n, e) {
7652
+ const r = `${n},${e}`;
7653
+ return this.rectangles.has(r) || this.rectangles.set(r, new Sn(n, e)), this.rectangles.get(r);
7654
+ }
7655
+ splitInterval(n) {
7656
+ let e, r, s;
7657
+ const [i, o] = n.center;
7658
+ return n.rectangle.x <= n.rectangle.y ? (e = this.rect(n.rectangle.x + 1, n.rectangle.y), r = [i - e.xLength, o], s = [i + e.xLength, o]) : (e = this.rect(n.rectangle.x, n.rectangle.y + 1), r = [i, o - e.yLength], s = [i, o + e.yLength]), [
7659
+ new O(r, this.fcn(r), e),
7660
+ new O(n.center, n.value, e),
7661
+ new O(s, this.fcn(s), e)
7662
7662
  ];
7663
7663
  }
7664
7664
  single_iteration() {
7665
- const t = this.buckets.getBottomRightHullIntervals();
7666
- for (; t.length >= 2; ) {
7667
- const e = t[0], s = t[1], r = (s.value - e.value) / ((s.rectangle.diagonal - e.rectangle.diagonal) / 2), i = e.value - r * s.value / 2;
7665
+ const n = this.buckets.getBottomRightHullIntervals();
7666
+ for (; n.length >= 2; ) {
7667
+ const e = n[0], r = n[1], s = (r.value - e.value) / ((r.rectangle.diagonal - e.rectangle.diagonal) / 2), i = e.value - s * r.value / 2;
7668
7668
  if ((this.fMin - i) / Math.abs(this.fMin) < this.epsilon)
7669
- t.shift();
7669
+ n.shift();
7670
7670
  else
7671
7671
  break;
7672
7672
  }
7673
- t.forEach((e) => {
7673
+ n.forEach((e) => {
7674
7674
  this.buckets.removeInterval(e);
7675
7675
  });
7676
- for (const e of t) {
7677
- const [s, r, i] = this.splitInterval(e);
7678
- this.registerInterval(s), this.registerInterval(r), this.registerInterval(i);
7676
+ for (const e of n) {
7677
+ const [r, s, i] = this.splitInterval(e);
7678
+ this.registerInterval(r), this.registerInterval(s), this.registerInterval(i);
7679
7679
  }
7680
7680
  }
7681
7681
  run() {
7682
- let t = 0;
7683
- for (; this.tol > this.endTolerance / 2 && (this.single_iteration(), t++, !(t > this.maxIterations)); )
7682
+ let n = 0;
7683
+ for (; this.tol > this.endTolerance / 2 && (this.single_iteration(), n++, !(n > this.maxIterations)); )
7684
7684
  ;
7685
7685
  return {
7686
7686
  fMin: this.fMin,
7687
7687
  argMin: this.argMin,
7688
7688
  tol: this.tol,
7689
- iterations: t
7689
+ iterations: n
7690
7690
  };
7691
7691
  }
7692
7692
  }
7693
7693
  class O {
7694
- constructor(t, e, s) {
7695
- this.center = t, this.value = e, this.rectangle = s;
7694
+ constructor(n, e, r) {
7695
+ this.center = n, this.value = e, this.rectangle = r;
7696
7696
  }
7697
7697
  }
7698
- function gn(n, t = 1e-8, e = 1e3, s = 1e-6) {
7699
- return new hn(
7700
- n,
7698
+ function An(t, n = 1e-8, e = 1e3, r = 1e-6) {
7699
+ return new In(
7701
7700
  t,
7701
+ n,
7702
7702
  e,
7703
- s
7703
+ r
7704
7704
  ).run();
7705
7705
  }
7706
- function pn(n, t, e = 1e-9) {
7707
- const s = gn((r) => {
7708
- const i = n.paramPoint(r[0]), o = t.paramPoint(r[1]);
7709
- return Rt$1(i, o);
7706
+ function vn(t, n, e = 1e-9) {
7707
+ const r = An((s) => {
7708
+ const i = t.paramPoint(s[0]), o = n.paramPoint(s[1]);
7709
+ return Rt$2(i, o);
7710
7710
  }, e);
7711
- return Math.sqrt(s.fMin);
7711
+ return Math.sqrt(r.fMin);
7712
7712
  }
7713
- function dn(n, t) {
7714
- return n instanceof at$3 && t instanceof at$3 ? rn(n, t) : n instanceof at$3 && t instanceof ct$3 ? et(n, t) : n instanceof ct$3 && t instanceof at$3 ? et(t, n) : n instanceof ct$3 && t instanceof ct$3 ? an(n, t) : pn(n, t);
7713
+ function bn(t, n) {
7714
+ return t instanceof at$3 && n instanceof at$3 ? pn(t, n) : t instanceof at$3 && n instanceof ct$3 ? lt(t, n) : t instanceof ct$3 && n instanceof at$3 ? lt(n, t) : t instanceof ct$3 && n instanceof ct$3 ? mn(t, n) : vn(t, n);
7715
7715
  }
7716
- function wt(n) {
7717
- if (n instanceof Et$1) {
7718
- const r = Q$2(n.lastPoint, n.firstPoint), i = Q$2(n.firstControlPoint, n.firstPoint), o = Q$2(n.lastControlPoint, n.firstPoint), a = un$1(r, i), f = un$1(r, o);
7719
- if (a > 0 && f < 0 || a < 0 && f > 0) return !1;
7716
+ function xt(t) {
7717
+ if (t instanceof Et$1) {
7718
+ const s = Q$2(t.lastPoint, t.firstPoint), i = Q$2(t.firstControlPoint, t.firstPoint), o = Q$2(t.lastControlPoint, t.firstPoint), c = un(s, i), f = un(s, o);
7719
+ if (c > 0 && f < 0 || c < 0 && f > 0) return !1;
7720
7720
  }
7721
- const t = tt$3(n.tangentAtFirstPoint), e = tt$3(n.tangentAtLastPoint);
7722
- let s = Pe(t, e);
7723
- return Math.abs(Math.acos(s)) < Math.PI / 3;
7721
+ const n = tt$3(t.tangentAtFirstPoint), e = tt$3(t.tangentAtLastPoint);
7722
+ let r = Pe(n, e);
7723
+ return Math.abs(Math.acos(r)) < Math.PI / 3;
7724
7724
  }
7725
- function K(n) {
7726
- if (wt(n)) return [n];
7727
- const [t, e] = n.splitAtParameters([0.5]);
7725
+ function X(t) {
7726
+ if (xt(t)) return [t];
7727
+ const [n, e] = t.splitAtParameters([0.5]);
7728
7728
  return [
7729
- ...K(t),
7730
- ...K(e)
7729
+ ...X(n),
7730
+ ...X(e)
7731
7731
  ];
7732
7732
  }
7733
- function st(n) {
7734
- return wt(n) ? [n] : n.splitAtParameters(n.getParametersOfExtrema()).flatMap(K);
7733
+ function ht(t) {
7734
+ return xt(t) ? [t] : t.splitAtParameters(t.getParametersOfExtrema()).flatMap(X);
7735
7735
  }
7736
- function mn(n) {
7737
- const t = n.deltaAngle, e = Math.ceil(Math.abs(t) / (Math.PI / 2)), s = t / e, r = 4 * Math.tan(s / 4) / 3, i = n.clockwise ? -1 : 1, o = Array.from(
7736
+ function Ln(t) {
7737
+ const n = t.deltaAngle, e = Math.ceil(Math.abs(n) / (Math.PI / 2)), r = n / e, s = 4 * Math.tan(r / 4) / 3, i = t.clockwise ? -1 : 1, o = Array.from(
7738
7738
  { length: e + 1 },
7739
- (f, c) => n.firstAngle + c * s * i
7739
+ (f, a) => t.firstAngle + a * r * i
7740
7740
  );
7741
- return o.slice(0, -1).map((f, c) => [f, o[c + 1]]).map(([f, c]) => {
7742
- const l = Math.cos(f), p = Math.sin(f), g = Math.cos(c), d = Math.sin(c), [u, S] = n.center, M = n.minorRadius, v = n.majorRadius, k = new et$4().rotate(
7743
- n.tiltAngle,
7744
- n.center
7745
- ), C = (Ft) => k.transform(Ft), D = C([u + v * l, S + M * p]), G = C([
7746
- u + v * (l - r * p * i),
7747
- S + M * (p + r * l * i)
7748
- ]), kt = C([
7749
- u + v * (g + r * d * i),
7750
- S + M * (d - r * g * i)
7751
- ]), Et = C([u + v * g, S + M * d]);
7752
- return new Et$1(D, Et, G, kt);
7741
+ return o.slice(0, -1).map((f, a) => [f, o[a + 1]]).map(([f, a]) => {
7742
+ const u = Math.cos(f), g = Math.sin(f), p = Math.cos(a), d = Math.sin(a), [l, S] = t.center, w = t.minorRadius, I = t.majorRadius, L = new et$4().rotate(
7743
+ t.tiltAngle,
7744
+ t.center
7745
+ ), k = ($t) => L.transform($t), D = k([l + I * u, S + w * g]), $ = k([
7746
+ l + I * (u - s * g * i),
7747
+ S + w * (g + s * u * i)
7748
+ ]), Gt = k([
7749
+ l + I * (p + s * d * i),
7750
+ S + w * (d - s * p * i)
7751
+ ]), _t = k([l + I * p, S + w * d]);
7752
+ return new Et$1(D, _t, $, Gt);
7753
7753
  });
7754
7754
  }
7755
- const X = 1e-8, Mt = (n) => n.flatMap((t) => t instanceof at$3 ? [t] : t instanceof ct$3 ? [t] : t instanceof jt$1 ? mn(t).flatMap(
7756
- (e) => st(e)
7757
- ) : t instanceof _t$1 || t instanceof Et$1 ? st(t) : [new at$3(t.firstPoint, t.lastPoint)]);
7758
- function q(n, t, e = !0) {
7759
- const s = n.map((c) => ({
7760
- offset: y(c, t),
7761
- original: c
7762
- })), r = [];
7763
- let i = e ? null : s.at(-1), o = e ? s.at(-1) : null;
7764
- if (r.length === 1) return r;
7765
- const a = (c) => {
7766
- i ? c.offset instanceof S ? Y$2(c.offset.firstPoint, c.offset.lastPoint) || r.push(
7767
- new at$3(c.offset.firstPoint, c.offset.lastPoint)
7768
- ) : r.push(c.offset) : i = c;
7755
+ const et = 1e-8, yt = (t) => t.flatMap((n) => n instanceof at$3 ? [n] : n instanceof ct$3 ? [n] : n instanceof jt$1 ? Ln(n).flatMap(
7756
+ (e) => ht(e)
7757
+ ) : n instanceof _t$1 || n instanceof Et$1 ? ht(n) : [new at$3(n.firstPoint, n.lastPoint)]);
7758
+ function J(t, n, e = !0) {
7759
+ const r = t.map((a) => ({
7760
+ offset: y(a, n),
7761
+ original: a
7762
+ })), s = [];
7763
+ let i = e ? null : r.at(-1), o = e ? r.at(-1) : null;
7764
+ if (s.length === 1) return s;
7765
+ const c = (a) => {
7766
+ i ? a.offset instanceof S ? Y$3(a.offset.firstPoint, a.offset.lastPoint) || s.push(
7767
+ new at$3(a.offset.firstPoint, a.offset.lastPoint)
7768
+ ) : s.push(a.offset) : i = a;
7769
7769
  }, f = function* () {
7770
- for (const c of s.slice(0, -1))
7771
- yield c;
7770
+ for (const a of r.slice(0, -1))
7771
+ yield a;
7772
7772
  if (!i) throw new Error("Bug in the offset algorithm");
7773
7773
  yield i;
7774
7774
  };
7775
- for (const c of f()) {
7775
+ for (const a of f()) {
7776
7776
  if (!o) {
7777
- o = c;
7777
+ o = a;
7778
7778
  continue;
7779
7779
  }
7780
- const l = o.offset.lastPoint, p = c.offset.firstPoint;
7781
- if (Y$2(l, p)) {
7782
- a(o), o = c;
7780
+ const u = o.offset.lastPoint, g = a.offset.firstPoint;
7781
+ if (Y$3(u, g)) {
7782
+ c(o), o = a;
7783
7783
  continue;
7784
7784
  }
7785
- let g = [];
7786
- if (!(o.offset instanceof S) && !(c.offset instanceof S)) {
7787
- const { intersections: M, overlaps: v } = Z(
7785
+ let p = [];
7786
+ if (!(o.offset instanceof S) && !(a.offset instanceof S)) {
7787
+ const { intersections: w, overlaps: I } = Z$1(
7788
7788
  o.offset,
7789
- c.offset,
7790
- X / 100
7789
+ a.offset,
7790
+ et / 100
7791
7791
  );
7792
- g = [
7793
- ...M,
7794
- ...v.flatMap((k) => [k.firstPoint, k.lastPoint])
7792
+ p = [
7793
+ ...w,
7794
+ ...I.flatMap((L) => [L.firstPoint, L.lastPoint])
7795
7795
  ];
7796
7796
  }
7797
- if (g.length > 0) {
7798
- let M = g[0];
7799
- if (g.length > 1) {
7800
- const C = o == null ? void 0 : o.original.lastPoint, D = g.map(
7801
- (G) => Rt$1(G, C)
7797
+ if (p.length > 0) {
7798
+ let w = p[0];
7799
+ if (p.length > 1) {
7800
+ const k = o == null ? void 0 : o.original.lastPoint, D = p.map(
7801
+ ($) => Rt$2($, k)
7802
7802
  );
7803
- M = g[D.indexOf(Math.min(...D))];
7803
+ w = p[D.indexOf(Math.min(...D))];
7804
7804
  }
7805
- const v = o.offset.splitAt([
7806
- M
7807
- ])[0], k = c.offset.splitAt([M]).at(-1);
7808
- if (!k) throw new Error("Bug in the splitting algo in offset");
7809
- a({
7810
- offset: v,
7805
+ const I = o.offset.splitAt([
7806
+ w
7807
+ ])[0], L = a.offset.splitAt([w]).at(-1);
7808
+ if (!L) throw new Error("Bug in the splitting algo in offset");
7809
+ c({
7810
+ offset: I,
7811
7811
  original: o.original
7812
- }), o = { offset: k, original: c.original };
7812
+ }), o = { offset: L, original: a.original };
7813
7813
  continue;
7814
7814
  }
7815
- const d = o.original.lastPoint, u = St$2(
7816
- Q$2(p, d),
7817
- Q$2(l, d)
7818
- ) > 0, S$1 = new ct$3(l, p, d, u);
7819
- a(o), r.push(S$1), o = c;
7815
+ const d = o.original.lastPoint, l = St$1(
7816
+ Q$2(g, d),
7817
+ Q$2(u, d)
7818
+ ) > 0, S$1 = new ct$3(u, g, d, l);
7819
+ c(o), s.push(S$1), o = a;
7820
7820
  }
7821
- return o && a(o), r;
7821
+ return o && c(o), s;
7822
7822
  }
7823
- function It(n) {
7824
- const t = /* @__PURE__ */ new Map(), e = (s, r) => {
7825
- const i = t.get(s) || [];
7826
- t.set(s, [...i, ...r]);
7823
+ function Ct(t) {
7824
+ const n = /* @__PURE__ */ new Map(), e = (r, s) => {
7825
+ const i = n.get(r) || [];
7826
+ n.set(r, [...i, ...s]);
7827
7827
  };
7828
- return n.forEach((s, r) => {
7829
- n.slice(r + 1).forEach((i, o) => {
7830
- const { intersections: a, overlaps: f } = Z(s, i, X), c = [
7831
- ...a,
7832
- ...f.flatMap((l) => [l.firstPoint, l.lastPoint])
7833
- ].filter((l) => {
7834
- const p = Y$2(l, s.firstPoint) || Y$2(l, s.lastPoint), g = Y$2(l, i.firstPoint) || Y$2(l, i.lastPoint);
7835
- return !(p && g);
7828
+ return t.forEach((r, s) => {
7829
+ t.slice(s + 1).forEach((i, o) => {
7830
+ const { intersections: c, overlaps: f } = Z$1(r, i, et), a = [
7831
+ ...c,
7832
+ ...f.flatMap((u) => [u.firstPoint, u.lastPoint])
7833
+ ].filter((u) => {
7834
+ const g = Y$3(u, r.firstPoint) || Y$3(u, r.lastPoint), p = Y$3(u, i.firstPoint) || Y$3(u, i.lastPoint);
7835
+ return !(g && p);
7836
7836
  });
7837
- c.length && (e(r, c), e(o + r + 1, c));
7837
+ a.length && (e(s, a), e(o + s + 1, a));
7838
7838
  });
7839
- }), t;
7839
+ }), n;
7840
7840
  }
7841
- function St(n, t) {
7842
- return t.flatMap((e, s) => {
7843
- if (!n.has(s)) return e;
7844
- const r = n.get(s);
7845
- return r ? e.splitAt(r) : e;
7841
+ function Dt(t, n) {
7842
+ return n.flatMap((e, r) => {
7843
+ if (!t.has(r)) return e;
7844
+ const s = t.get(r);
7845
+ return s ? e.splitAt(s) : e;
7846
7846
  });
7847
7847
  }
7848
- function bt(n, t, e) {
7849
- return n.filter((s) => !t.segments.some((i) => dn(i, s) < Math.abs(e) - X));
7848
+ function Ot(t, n, e) {
7849
+ return t.filter((r) => !n.segments.some((i) => bn(i, r) < Math.abs(e) - et));
7850
7850
  }
7851
- function T(n, t) {
7852
- const e = n.clockwise ? t : -t, s = Mt(n.segments), r = q(s, e);
7853
- if (r.length < 2) return new O$2();
7854
- const i = It(r);
7851
+ function G(t, n) {
7852
+ const e = t.clockwise ? n : -n, r = yt(t.segments), s = J(r, e);
7853
+ if (s.length < 2) return new O$2();
7854
+ const i = Ct(s);
7855
7855
  if (!i.size) {
7856
- const l = new _$2(r);
7857
- return new O$2([new v$2(l)]);
7856
+ const u = new _$1(s);
7857
+ return new O$2([new v$2(u)]);
7858
7858
  }
7859
- const o = St(
7859
+ const o = Dt(
7860
7860
  i,
7861
- r
7862
- ), a = bt(o, n, t);
7863
- if (!a.length) return new O$2();
7864
- const c = Xt(a).filter((l) => l.length > 1).filter((l) => Y$2(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new _$2(l));
7865
- return c.length ? new O$2(c.map((l) => new v$2(l))) : new O$2();
7861
+ s
7862
+ ), c = Ot(o, t, n);
7863
+ if (!c.length) return new O$2();
7864
+ const a = Xt(c).filter((u) => u.length > 1).filter((u) => Y$3(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new _$1(u));
7865
+ return a.length ? new O$2(a.map((u) => new v$2(u))) : new O$2();
7866
7866
  }
7867
- function Pn(n, t, e = "round") {
7868
- const s = t / 2, r = Mt(n.segments), i = q(r, s, !1), o = q(
7869
- r,
7870
- -s,
7867
+ function En(t, n, e = "round") {
7868
+ const r = n / 2, s = yt(t.segments), i = J(s, r, !1), o = J(
7869
+ s,
7870
+ -r,
7871
7871
  !1
7872
- ).map((u) => u.reverse());
7872
+ ).map((l) => l.reverse());
7873
7873
  o.reverse();
7874
- const a = (u, S) => e === "round" ? mn$2(
7875
- u.lastPoint,
7874
+ const c = (l, S) => e === "round" ? mn$2(
7875
+ l.lastPoint,
7876
7876
  S.firstPoint,
7877
- u.tangentAtLastPoint
7878
- ) : new at$3(u.lastPoint, S.firstPoint), f = [
7877
+ l.tangentAtLastPoint
7878
+ ) : new at$3(l.lastPoint, S.firstPoint), f = [
7879
7879
  ...i,
7880
- a(
7880
+ c(
7881
7881
  i[i.length - 1],
7882
7882
  o[0]
7883
7883
  ),
7884
7884
  ...o,
7885
- a(
7885
+ c(
7886
7886
  o[o.length - 1],
7887
7887
  i[0]
7888
7888
  )
7889
- ], c = It(f);
7890
- if (!c.size) {
7891
- const u = new _$2(f);
7892
- return new O$2([new v$2(u)]);
7889
+ ], a = Ct(f);
7890
+ if (!a.size) {
7891
+ const l = new _$1(f);
7892
+ return new O$2([new v$2(l)]);
7893
7893
  }
7894
- const l = St(
7895
- c,
7894
+ const u = Dt(
7895
+ a,
7896
7896
  f
7897
- ), p = bt(l, n, s);
7898
- if (!p.length) return new O$2();
7899
- const d = Xt(p).filter((u) => u.length > 1).filter((u) => Y$2(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new _$2(u));
7900
- return d.length ? new O$2(d.map((u) => new v$2(u))) : new O$2();
7901
- }
7902
- function wn(n, t) {
7903
- const e = n.map((s) => {
7904
- const r = z(
7905
- s.holes.map((i) => T(i, t))
7897
+ ), g = Ot(u, t, r);
7898
+ if (!g.length) return new O$2();
7899
+ const d = Xt(g).filter((l) => l.length > 1).filter((l) => Y$3(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new _$1(l));
7900
+ return d.length ? new O$2(d.map((l) => new v$2(l))) : new O$2();
7901
+ }
7902
+ function kn(t, n) {
7903
+ const e = t.map((r) => {
7904
+ const s = z(
7905
+ r.holes.map((i) => G(i, n))
7906
7906
  );
7907
- return Pt(T(s.contour, t), r);
7907
+ return Ft(G(r.contour, n), s);
7908
7908
  });
7909
7909
  return z(e);
7910
7910
  }
7911
- function Mn(n, t) {
7912
- const e = Math.abs(t / 2), s = n.map(
7913
- (r) => z(
7914
- r.allLoops.map((i) => Pt(T(i, e), T(i, -e)))
7911
+ function Fn(t, n) {
7912
+ const e = Math.abs(n / 2), r = t.map(
7913
+ (s) => z(
7914
+ s.allLoops.map((i) => Ft(G(i, e), G(i, -e)))
7915
7915
  )
7916
7916
  );
7917
- return z(s);
7917
+ return z(r);
7918
7918
  }
7919
- function Dn(n, t) {
7920
- return wn(L(n), t);
7919
+ function Yn(t, n) {
7920
+ return kn(x(t), n);
7921
7921
  }
7922
- function On(n, t, { endCap: e = "round" } = {}) {
7923
- return n instanceof B$3 ? Pn(n, t, e) : Mn(L(n), t);
7922
+ function Zn(t, n, { endCap: e = "round" } = {}) {
7923
+ return t instanceof B$3 ? En(t, n, e) : Fn(x(t), n);
7924
7924
  }
7925
- class In {
7925
+ class xn {
7926
7926
  constructor() {
7927
- P(this, "filters");
7927
+ M(this, "filters");
7928
7928
  this.filters = [];
7929
7929
  }
7930
7930
  delete() {
@@ -7934,66 +7934,66 @@ class In {
7934
7934
  * Combine logically a set of filter with an AND operation.
7935
7935
  *
7936
7936
  */
7937
- and(t) {
7938
- return t.forEach((e) => e(this)), this;
7937
+ and(n) {
7938
+ return n.forEach((e) => e(this)), this;
7939
7939
  }
7940
7940
  /**
7941
7941
  * Invert the result of a particular filter
7942
7942
  *
7943
7943
  */
7944
- not(t) {
7944
+ not(n) {
7945
7945
  const e = new this.constructor();
7946
- t(e);
7947
- const s = ({ element: r }) => !e.shouldKeep(r);
7948
- return this.filters.push(s), this;
7946
+ n(e);
7947
+ const r = ({ element: s }) => !e.shouldKeep(s);
7948
+ return this.filters.push(r), this;
7949
7949
  }
7950
7950
  /**
7951
7951
  * Combine logically a set of filter with an OR operation.
7952
7952
  *
7953
7953
  */
7954
- either(t) {
7955
- const e = t.map((r) => {
7954
+ either(n) {
7955
+ const e = n.map((s) => {
7956
7956
  const i = new this.constructor();
7957
- return r(i), i;
7958
- }), s = ({ element: r }) => e.some((i) => i.shouldKeep(r));
7959
- return this.filters.push(s), this;
7957
+ return s(i), i;
7958
+ }), r = ({ element: s }) => e.some((i) => i.shouldKeep(s));
7959
+ return this.filters.push(r), this;
7960
7960
  }
7961
7961
  }
7962
- const _ = 2 * Math.PI, rt = (n) => {
7963
- const t = n % _, e = t < 0 ? t + _ : t;
7964
- return e < Math.PI ? e : e === Math.PI ? 0 : Math.abs(e - _);
7962
+ const V = 2 * Math.PI, gt = (t) => {
7963
+ const n = t % V, e = n < 0 ? n + V : n;
7964
+ return e < Math.PI ? e : e === Math.PI ? 0 : Math.abs(e - V);
7965
7965
  };
7966
- class x extends In {
7966
+ class C extends xn {
7967
7967
  clone() {
7968
- const t = new x();
7969
- return t.filters = [...this.filters], t;
7968
+ const n = new C();
7969
+ return n.filters = [...this.filters], n;
7970
7970
  }
7971
7971
  /**
7972
7972
  * Filter to find corner that have their point are in the list.
7973
7973
  *
7974
7974
  */
7975
- inList(t) {
7976
- const e = ({ element: s }) => !!t.find((r) => Y$2(r, s.point));
7975
+ inList(n) {
7976
+ const e = ({ element: r }) => !!n.find((s) => Y$3(s, r.point));
7977
7977
  return this.filters.push(e), this;
7978
7978
  }
7979
7979
  /**
7980
7980
  * Filter to find elements that are at a specified distance from a point.
7981
7981
  *
7982
7982
  */
7983
- atDistance(t, e = [0, 0]) {
7984
- function s({ element: r }) {
7985
- return Math.abs(J$3(e, r.point) - t) < 1e-9;
7983
+ atDistance(n, e = [0, 0]) {
7984
+ function r({ element: s }) {
7985
+ return Math.abs(J$3(e, s.point) - n) < 1e-9;
7986
7986
  }
7987
- return this.filters.push(s), this;
7987
+ return this.filters.push(r), this;
7988
7988
  }
7989
7989
  /**
7990
7990
  * Filter to find elements that contain a certain point
7991
7991
  *
7992
7992
  * @category Filter
7993
7993
  */
7994
- atPoint(t) {
7995
- function e({ element: s }) {
7996
- return Y$2(t, s.point);
7994
+ atPoint(n) {
7995
+ function e({ element: r }) {
7996
+ return Y$3(n, r.point);
7997
7997
  }
7998
7998
  return this.filters.push(e), this;
7999
7999
  }
@@ -8002,245 +8002,351 @@ class x extends In {
8002
8002
  *
8003
8003
  * @category Filter
8004
8004
  */
8005
- inBox(t, e) {
8006
- const [s, r] = t, [i, o] = e, a = Math.min(s, i), f = Math.max(s, i), c = Math.min(r, o), l = Math.max(r, o);
8007
- function p({ element: g }) {
8008
- const [d, u] = g.point;
8009
- return d >= a && d <= f && u >= c && u <= l;
8005
+ inBox(n, e) {
8006
+ const [r, s] = n, [i, o] = e, c = Math.min(r, i), f = Math.max(r, i), a = Math.min(s, o), u = Math.max(s, o);
8007
+ function g({ element: p }) {
8008
+ const [d, l] = p.point;
8009
+ return d >= c && d <= f && l >= a && l <= u;
8010
8010
  }
8011
- return this.filters.push(p), this;
8011
+ return this.filters.push(g), this;
8012
8012
  }
8013
8013
  /**
8014
8014
  * Filter to find corner that a certain angle between them - only between
8015
8015
  * 0 and 180.
8016
8016
  *
8017
8017
  */
8018
- ofAngle(t) {
8019
- function e({ element: s }) {
8020
- const r = s.firstCurve.tangentAtLastPoint, i = s.secondCurve.tangentAtFirstPoint;
8018
+ ofAngle(n) {
8019
+ function e({ element: r }) {
8020
+ const s = r.firstCurve.tangentAtLastPoint, i = r.secondCurve.tangentAtFirstPoint;
8021
8021
  return Math.abs(
8022
- rt(un$1(r, i)) - rt(fe$1 * t)
8022
+ gt(un(s, i)) - gt(fe$1 * n)
8023
8023
  ) < 1e-9;
8024
8024
  }
8025
8025
  return this.filters.push(e), this;
8026
8026
  }
8027
- above(t = 0) {
8028
- function e({ element: s }) {
8029
- return s.point[1] > t;
8027
+ above(n = 0) {
8028
+ function e({ element: r }) {
8029
+ return r.point[1] > n;
8030
8030
  }
8031
8031
  return this.filters.push(e), this;
8032
8032
  }
8033
- below(t = 0) {
8034
- function e({ element: s }) {
8035
- return s.point[1] < t;
8033
+ below(n = 0) {
8034
+ function e({ element: r }) {
8035
+ return r.point[1] < n;
8036
8036
  }
8037
8037
  return this.filters.push(e), this;
8038
8038
  }
8039
- leftOf(t = 0) {
8040
- function e({ element: s }) {
8041
- return s.point[0] < t;
8039
+ leftOf(n = 0) {
8040
+ function e({ element: r }) {
8041
+ return r.point[0] < n;
8042
8042
  }
8043
8043
  return this.filters.push(e), this;
8044
8044
  }
8045
- rightOf(t = 0) {
8046
- function e({ element: s }) {
8047
- return s.point[0] > t;
8045
+ rightOf(n = 0) {
8046
+ function e({ element: r }) {
8047
+ return r.point[0] > n;
8048
8048
  }
8049
8049
  return this.filters.push(e), this;
8050
8050
  }
8051
- shouldKeep(t) {
8052
- return this.filters.every((s) => s({ element: t }));
8051
+ shouldKeep(n) {
8052
+ return this.filters.every((r) => r({ element: n }));
8053
8053
  }
8054
8054
  asFilterFun() {
8055
8055
  return this.shouldKeep.bind(this);
8056
8056
  }
8057
8057
  }
8058
- function At(n, t, e, s = () => !0) {
8059
- const r = [t.segments[0]], i = (a, f) => {
8060
- s({ firstCurve: a, secondCurve: f, point: a.lastPoint }) ? r.push(...n(a, f, e)) : r.push(a, f);
8058
+ function Bt(t, n, e, r = () => !0) {
8059
+ const s = [n.segments[0]], i = (c, f) => {
8060
+ r({ firstCurve: c, secondCurve: f, point: c.lastPoint }) ? s.push(...t(c, f, e)) : s.push(c, f);
8061
8061
  };
8062
- if (t.segments.slice(1).forEach((a) => {
8063
- const f = r.pop();
8062
+ if (n.segments.slice(1).forEach((c) => {
8063
+ const f = s.pop();
8064
8064
  if (!f) throw new Error("Bug in the stroke filletting algo");
8065
- i(f, a);
8066
- }), !r.at(-1)) throw new Error("Bug in the stroke corner algo");
8067
- if (t instanceof _$2) {
8068
- const a = r.pop(), f = r.shift();
8069
- if (!a || !f)
8065
+ i(f, c);
8066
+ }), !s.at(-1)) throw new Error("Bug in the stroke corner algo");
8067
+ if (n instanceof _$1) {
8068
+ const c = s.pop(), f = s.shift();
8069
+ if (!c || !f)
8070
8070
  throw new Error("Bug in the filletting algo");
8071
- return i(a, f), new _$2(r, { ignoreChecks: !0 });
8071
+ return i(c, f), new _$1(s, { ignoreChecks: !0 });
8072
8072
  } else
8073
- return new B$3(r, { ignoreChecks: !0 });
8074
- }
8075
- function B(n, t, e) {
8076
- const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
8077
- if (n instanceof _$2 || n instanceof B$3)
8078
- return At(V, n, t, r);
8079
- if (n instanceof v$2) {
8080
- const i = B(n.contour, t, s), o = n.holes.map((a) => B(a, t, s));
8073
+ return new B$3(s, { ignoreChecks: !0 });
8074
+ }
8075
+ function R(t, n, e) {
8076
+ const r = typeof e == "function" ? e(new C()) : e, s = r && r.asFilterFun();
8077
+ if (t instanceof _$1 || t instanceof B$3)
8078
+ return Bt(V$1, t, n, s);
8079
+ if (t instanceof v$2) {
8080
+ const i = R(t.contour, n, r), o = t.holes.map((c) => R(c, n, r));
8081
8081
  return new v$2(i, o, { ignoreChecks: !0 });
8082
8082
  }
8083
- if (n instanceof O$2) {
8084
- const i = n.figures.map((o) => B(o, t, s));
8083
+ if (t instanceof O$2) {
8084
+ const i = t.figures.map((o) => R(o, n, r));
8085
8085
  return new O$2(i, { ignoreChecks: !0 });
8086
8086
  }
8087
8087
  throw new Error("invalid shape to fillet");
8088
8088
  }
8089
- function R(n, t, e) {
8090
- const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
8091
- if (n instanceof _$2 || n instanceof B$3)
8092
- return At(V, n, t, r);
8093
- if (n instanceof v$2) {
8094
- const i = R(n.contour, t, s), o = n.holes.map((a) => R(a, t, s));
8089
+ function T(t, n, e) {
8090
+ const r = typeof e == "function" ? e(new C()) : e, s = r && r.asFilterFun();
8091
+ if (t instanceof _$1 || t instanceof B$3)
8092
+ return Bt(V$1, t, n, s);
8093
+ if (t instanceof v$2) {
8094
+ const i = T(t.contour, n, r), o = t.holes.map((c) => T(c, n, r));
8095
8095
  return new v$2(i, o, { ignoreChecks: !0 });
8096
8096
  }
8097
- if (n instanceof O$2) {
8098
- const i = n.figures.map((o) => R(o, t, s));
8097
+ if (t instanceof O$2) {
8098
+ const i = t.figures.map((o) => T(o, n, r));
8099
8099
  return new O$2(i, { ignoreChecks: !0 });
8100
8100
  }
8101
8101
  throw new Error("invalid shape to chamfer");
8102
8102
  }
8103
- class Sn extends x {
8104
- constructor(t) {
8105
- super(), this.shape = t;
8103
+ class yn extends C {
8104
+ constructor(n) {
8105
+ super(), this.shape = n;
8106
8106
  }
8107
- fillet(t) {
8108
- return B(this.shape, t, this.clone());
8107
+ fillet(n) {
8108
+ return R(this.shape, n, this.clone());
8109
8109
  }
8110
- chamfer(t) {
8111
- return R(this.shape, t, this.clone());
8110
+ chamfer(n) {
8111
+ return T(this.shape, n, this.clone());
8112
8112
  }
8113
8113
  }
8114
- function Bn(n) {
8115
- return new Sn(n);
8114
+ function Wn(t) {
8115
+ return new yn(t);
8116
8116
  }
8117
- function it(n) {
8118
- if (n instanceof O$2)
8119
- return d(n);
8120
- if (n instanceof v$2)
8121
- return p(n);
8122
- if (n instanceof _$2)
8123
- return `<path d="${w(n)}" />`;
8124
- if (n instanceof B$3)
8125
- return `<path d="${j$1(n)}" />`;
8126
- if (Hn(n))
8127
- return `<path d="${`M ${n.firstPoint.join(" ")}`} ${s(
8128
- n
8117
+ const Cn = 1 * fe$1, Dn = 24;
8118
+ function H(t, n, e, r) {
8119
+ const s = t.gradientAt(n);
8120
+ return an(s) <= r ? e : H$1(s);
8121
+ }
8122
+ function Q(t, n, e, r, s, i) {
8123
+ const o = t.paramPoint(n), c = t.paramPoint(e), f = Q$2(c, o), a = an(f);
8124
+ if (a <= t.precision || i >= r.maxDepth)
8125
+ return [o, c];
8126
+ const u = [f[0] / a, f[1] / a], g = (n + e) * 0.5, p = H(t, n, u, t.precision), d = H(t, g, u, t.precision), l = H(t, e, u, t.precision), S = Pe(p, d), w = Pe(d, l);
8127
+ if (S >= s && w >= s)
8128
+ return [o, c];
8129
+ const I = t.paramPoint(g), L = S >= s ? [o, I] : Q(t, n, g, r, s, i + 1), k = w >= s ? [I, c] : Q(t, g, e, r, s, i + 1);
8130
+ return [...L.slice(0, -1), ...k];
8131
+ }
8132
+ function rt(t, n = {}) {
8133
+ const e = {
8134
+ maxAngle: n.maxAngle ?? Cn,
8135
+ maxDepth: n.maxDepth ?? Dn
8136
+ }, r = Math.cos(e.maxAngle);
8137
+ return Q(t, 0, 1, e, r, 0);
8138
+ }
8139
+ function On(t, n) {
8140
+ return new O$2(
8141
+ t.figures.map((e) => Rt(e, n))
8142
+ );
8143
+ }
8144
+ function Rt(t, n) {
8145
+ return new v$2(
8146
+ Y(t.contour, n),
8147
+ t.holes.map((e) => Y(e, n))
8148
+ );
8149
+ }
8150
+ function Y(t, n) {
8151
+ return new _$1(st(t.segments, n));
8152
+ }
8153
+ function Bn(t, n) {
8154
+ return new B$3(st(t.segments, n));
8155
+ }
8156
+ function st(t, n) {
8157
+ return t.flatMap(n);
8158
+ }
8159
+ function Rn(t, n) {
8160
+ if (t instanceof O$2)
8161
+ return On(t, n);
8162
+ if (t instanceof v$2)
8163
+ return Rt(t, n);
8164
+ if (t instanceof _$1)
8165
+ return Y(t, n);
8166
+ if (t instanceof B$3)
8167
+ return Bn(t, n);
8168
+ if (Hn(t))
8169
+ return st([t], n);
8170
+ throw new Error("Unsupported shape type");
8171
+ }
8172
+ function Tn(t) {
8173
+ if (t.length < 2) return [];
8174
+ const n = [];
8175
+ for (let e = 0; e < t.length - 1; e += 1)
8176
+ n.push(new at$3(t[e], t[e + 1]));
8177
+ return n;
8178
+ }
8179
+ function zn(t, n) {
8180
+ return Tn(rt(t, n));
8181
+ }
8182
+ function B(t, n) {
8183
+ const e = [];
8184
+ return t.forEach((r, s) => {
8185
+ const i = rt(r, n);
8186
+ if (i.length !== 0) {
8187
+ if (s === 0) {
8188
+ e.push(...i);
8189
+ return;
8190
+ }
8191
+ e.push(...i.slice(1));
8192
+ }
8193
+ }), e.length > 1 && Y$3(e[0], e[e.length - 1]) && e.pop(), e;
8194
+ }
8195
+ function Gn(t) {
8196
+ return t.length < 3 ? !1 : t.map((e, r) => {
8197
+ const s = t[(r + 1) % t.length];
8198
+ return (s[0] - e[0]) * (s[1] + e[1]);
8199
+ }).reduce((e, r) => e + r, 0) > 0;
8200
+ }
8201
+ function K(t, n) {
8202
+ return t.length < 3 || Gn(t) === n ? t : [...t].reverse();
8203
+ }
8204
+ function jn(t, n = {}) {
8205
+ return Rn(t, (r) => zn(r, n));
8206
+ }
8207
+ function _n(t, n = {}) {
8208
+ if (t instanceof O$2)
8209
+ return t.figures.map((e) => _n(e, n));
8210
+ if (t instanceof v$2) {
8211
+ const e = K(
8212
+ B(t.contour.segments, n),
8213
+ !1
8214
+ ), r = t.holes.map(
8215
+ (s) => K(B(s.segments, n), !0)
8216
+ );
8217
+ return [e, ...r];
8218
+ }
8219
+ return t instanceof _$1 ? K(B(t.segments, n), !1) : t instanceof B$3 ? B(t.segments, n) : rt(t, n);
8220
+ }
8221
+ function pt(t) {
8222
+ if (t instanceof O$2)
8223
+ return d(t);
8224
+ if (t instanceof v$2)
8225
+ return p(t);
8226
+ if (t instanceof _$1)
8227
+ return `<path d="${w(t)}" />`;
8228
+ if (t instanceof B$3)
8229
+ return `<path d="${j(t)}" />`;
8230
+ if (Hn(t))
8231
+ return `<path d="${`M ${t.firstPoint.join(" ")}`} ${s(
8232
+ t
8129
8233
  )}" />`;
8130
8234
  throw new Error("Unknown shape type");
8131
8235
  }
8132
- const ot = (n) => "shape" in n ? n.shape : n, at = (n, t) => {
8133
- if (!("shape" in n)) return t;
8134
- const { color: e } = n;
8135
- return e ? `<g stroke="${e}">${t}</g>` : t;
8136
- }, ct = (n) => new mt$1(n.xMin, -n.yMax, n.xMax, -n.yMin);
8137
- function Rn(n, {
8138
- margin: t = 1,
8236
+ const dt = (t) => "shape" in t ? t.shape : t, mt = (t, n) => {
8237
+ if (!("shape" in t)) return n;
8238
+ const { color: e } = t;
8239
+ return e ? `<g stroke="${e}">${n}</g>` : n;
8240
+ }, Pt = (t) => new mt$1(t.xMin, -t.yMax, t.xMax, -t.yMin);
8241
+ function te(t, {
8242
+ margin: n = 1,
8139
8243
  unit: e = null,
8140
- viewBox: s
8244
+ viewBox: r
8141
8245
  } = {}) {
8142
- if (Array.isArray(n)) {
8143
- const i = n.map((f) => ot(f).mirror()), o = i.map((f, c) => at(n[c], it(f))).join(`
8144
- `), a = i.slice(1).reduce((f, c) => f.merge(c.boundingBox), i[0].boundingBox);
8145
- return A(o, s ? ct(s) : a, t, e);
8246
+ if (Array.isArray(t)) {
8247
+ const i = t.map((f) => dt(f).mirror()), o = i.map((f, a) => mt(t[a], pt(f))).join(`
8248
+ `), c = i.slice(1).reduce((f, a) => f.merge(a.boundingBox), i[0].boundingBox);
8249
+ return A(o, r ? Pt(r) : c, n, e);
8146
8250
  }
8147
- const r = ot(n).mirror();
8251
+ const s = dt(t).mirror();
8148
8252
  return A(
8149
- at(n, it(r)),
8150
- s ? ct(s) : r.boundingBox,
8151
- t,
8253
+ mt(t, pt(s)),
8254
+ r ? Pt(r) : s.boundingBox,
8255
+ n,
8152
8256
  e
8153
8257
  );
8154
8258
  }
8155
- const vt = (n) => {
8156
- if (n.type === "LINE")
8157
- return new at$3(n.firstPoint, n.lastPoint);
8158
- if (n.type === "ARC")
8259
+ const Tt = (t) => {
8260
+ if (t.type === "LINE")
8261
+ return new at$3(t.firstPoint, t.lastPoint);
8262
+ if (t.type === "ARC")
8159
8263
  return new ct$3(
8160
- n.firstPoint,
8161
- n.lastPoint,
8162
- n.center,
8163
- n.clockwise
8264
+ t.firstPoint,
8265
+ t.lastPoint,
8266
+ t.center,
8267
+ t.clockwise
8164
8268
  );
8165
- if (n.type === "ELLIPSE_ARC")
8269
+ if (t.type === "ELLIPSE_ARC")
8166
8270
  return new jt$1(
8167
- n.firstPoint,
8168
- n.lastPoint,
8169
- n.center,
8170
- n.majorRadius,
8171
- n.minorRadius,
8172
- n.tiltAngle,
8173
- n.clockwise,
8271
+ t.firstPoint,
8272
+ t.lastPoint,
8273
+ t.center,
8274
+ t.majorRadius,
8275
+ t.minorRadius,
8276
+ t.tiltAngle,
8277
+ t.clockwise,
8174
8278
  { angleUnits: "rad" }
8175
8279
  );
8176
- if (n.type === "QUADRATIC_BEZIER")
8280
+ if (t.type === "QUADRATIC_BEZIER")
8177
8281
  return new _t$1(
8178
- n.firstPoint,
8179
- n.lastPoint,
8180
- n.controlPoint
8282
+ t.firstPoint,
8283
+ t.lastPoint,
8284
+ t.controlPoint
8181
8285
  );
8182
- if (n.type === "CUBIC_BEZIER")
8286
+ if (t.type === "CUBIC_BEZIER")
8183
8287
  return new Et$1(
8184
- n.firstPoint,
8185
- n.lastPoint,
8186
- n.firstControlPoint,
8187
- n.lastControlPoint
8288
+ t.firstPoint,
8289
+ t.lastPoint,
8290
+ t.firstControlPoint,
8291
+ t.lastControlPoint
8188
8292
  );
8189
8293
  throw new Error("Unknown segment type");
8190
- }, H = (n) => {
8191
- const t = n.segments.map(vt);
8192
- return new _$2(t);
8193
- }, Lt = (n) => {
8194
- const t = H(n.contour), e = n.holes.map(H);
8195
- return new v$2(t, e);
8196
- }, bn = (n) => {
8197
- const t = n.figures.map(Lt);
8198
- return new O$2(t);
8294
+ }, Z = (t) => {
8295
+ const n = t.segments.map(Tt);
8296
+ return new _$1(n);
8297
+ }, zt = (t) => {
8298
+ const n = Z(t.contour), e = t.holes.map(Z);
8299
+ return new v$2(n, e);
8300
+ }, $n = (t) => {
8301
+ const n = t.figures.map(zt);
8302
+ return new O$2(n);
8199
8303
  };
8200
- function zn(n) {
8201
- if (n.type === "DIAGRAM")
8202
- return bn(n);
8203
- if (n.type === "FIGURE")
8204
- return Lt(n);
8205
- if (n.type === "LOOP")
8206
- return H(n);
8207
- if (n.type === "LINE" || n.type === "ARC" || n.type === "ELLIPSE_ARC" || n.type === "CUBIC_BEZIER")
8208
- return vt(n);
8304
+ function ne(t) {
8305
+ if (t.type === "DIAGRAM")
8306
+ return $n(t);
8307
+ if (t.type === "FIGURE")
8308
+ return zt(t);
8309
+ if (t.type === "LOOP")
8310
+ return Z(t);
8311
+ if (t.type === "LINE" || t.type === "ARC" || t.type === "ELLIPSE_ARC" || t.type === "CUBIC_BEZIER")
8312
+ return Tt(t);
8209
8313
  throw new Error("Unknown shape type");
8210
8314
  }
8211
- const ft = Math.PI / 180, An = 180 / Math.PI;
8212
- function Tn(n, t) {
8213
- const e = Math.cos(t * ft) * n, s = Math.sin(t * ft) * n;
8214
- return [e, s];
8315
+ const wt = Math.PI / 180, Un = 180 / Math.PI;
8316
+ function ee(t, n) {
8317
+ const e = Math.cos(n * wt) * t, r = Math.sin(n * wt) * t;
8318
+ return [e, r];
8215
8319
  }
8216
- function $n([n, t]) {
8217
- const e = Math.sqrt(n * n + t * t), s = Math.atan2(t, n) * An;
8218
- return [e, s];
8320
+ function re([t, n]) {
8321
+ const e = Math.sqrt(t * t + n * n), r = Math.atan2(n, t) * Un;
8322
+ return [e, r];
8219
8323
  }
8220
8324
 
8221
8325
  var pantograph = /*#__PURE__*/Object.freeze({
8222
8326
  __proto__: null,
8223
- DEG2RAD: ft,
8224
- DrawingPen: ot$2,
8225
- RAD2DEG: An,
8226
- cartesianToPolar: $n,
8227
- chamfer: R,
8228
- confineStrand: xn,
8229
- cut: Pt,
8230
- draw: lt$1,
8231
- eraseStrand: Cn,
8232
- exportJSON: It$1,
8233
- exportSVG: Rn,
8234
- fillet: B,
8235
- fuse: sn,
8327
+ DEG2RAD: wt,
8328
+ DrawingPen: ot$1,
8329
+ RAD2DEG: Un,
8330
+ cartesianToPolar: re,
8331
+ chamfer: T,
8332
+ confineStrand: Qn,
8333
+ cut: Ft,
8334
+ draw: lt$2,
8335
+ eraseStrand: Jn,
8336
+ exportJSON: It,
8337
+ exportSVG: te,
8338
+ fillet: R,
8339
+ fuse: gn,
8236
8340
  fuseAll: z,
8237
- importJSON: zn,
8238
- intersect: yn,
8239
- offset: Dn,
8240
- outlineStroke: On,
8241
- polarToCartesian: Tn,
8242
- selectCorners: Bn,
8243
- svgBody: it
8341
+ importJSON: ne,
8342
+ intersect: Xn,
8343
+ offset: Yn,
8344
+ outlineStroke: Zn,
8345
+ polarToCartesian: ee,
8346
+ selectCorners: Wn,
8347
+ svgBody: pt,
8348
+ tesselate: jn,
8349
+ tesselatePoints: _n
8244
8350
  });
8245
8351
 
8246
8352
  function sketchSegment(segment, plane) {
@@ -8310,7 +8416,7 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
8310
8416
  if (pantographObject instanceof v$2) {
8311
8417
  return sketchFigure(pantographObject, plane);
8312
8418
  }
8313
- if (pantographObject instanceof _$2) {
8419
+ if (pantographObject instanceof _$1) {
8314
8420
  return sketchStroke(pantographObject, plane);
8315
8421
  }
8316
8422
  if (pantographObject instanceof at$3 ||
@@ -8329,11 +8435,11 @@ function svgPathsForShape(shape) {
8329
8435
  else if (shape instanceof v$2) {
8330
8436
  return shape.allLoops.map((loop) => w(loop));
8331
8437
  }
8332
- else if (shape instanceof _$2) {
8438
+ else if (shape instanceof _$1) {
8333
8439
  return [w(shape)];
8334
8440
  }
8335
8441
  else if (shape instanceof B$3) {
8336
- return [j$1(shape)];
8442
+ return [j(shape)];
8337
8443
  }
8338
8444
  else if (Hn(shape)) {
8339
8445
  return [`M ${shape.firstPoint.join(" ")} ${s(shape)}`];
@@ -8346,7 +8452,7 @@ function toSVGViewBox(shape) {
8346
8452
  }
8347
8453
  function wrapPantograph(pantographObject) {
8348
8454
  const isPantograph = Hn(pantographObject) ||
8349
- pantographObject instanceof _$2 ||
8455
+ pantographObject instanceof _$1 ||
8350
8456
  pantographObject instanceof v$2 ||
8351
8457
  pantographObject instanceof O$2 ||
8352
8458
  pantographObject instanceof Drawing;
@@ -8374,13 +8480,13 @@ class Drawing {
8374
8480
  return new Drawing(this.diagram.clone());
8375
8481
  }
8376
8482
  serialize() {
8377
- return JSON.stringify(It$1(this.diagram));
8483
+ return JSON.stringify(It(this.diagram));
8378
8484
  }
8379
8485
  get boundingBox() {
8380
8486
  return this.diagram.boundingBox;
8381
8487
  }
8382
8488
  get repr() {
8383
- return JSON.stringify(It$1(this.diagram));
8489
+ return JSON.stringify(It(this.diagram));
8384
8490
  }
8385
8491
  rotate(angle, center) {
8386
8492
  return new Drawing(this.diagram.rotate(angle, center));
@@ -8406,23 +8512,23 @@ class Drawing {
8406
8512
  cut(other) {
8407
8513
  const base = this.diagram;
8408
8514
  const tool = other.diagram;
8409
- return new Drawing(Pt(base, tool));
8515
+ return new Drawing(Ft(base, tool));
8410
8516
  }
8411
8517
  fuse(other) {
8412
8518
  const base = this.diagram;
8413
8519
  const tool = other.diagram;
8414
- return new Drawing(sn(base, tool));
8520
+ return new Drawing(gn(base, tool));
8415
8521
  }
8416
8522
  intersect(other) {
8417
8523
  const base = this.diagram;
8418
8524
  const tool = other.diagram;
8419
- return new Drawing(yn(base, tool));
8525
+ return new Drawing(Xn(base, tool));
8420
8526
  }
8421
8527
  fillet(radius, filter) {
8422
- return new Drawing(B(this.diagram, radius, filter));
8528
+ return new Drawing(R(this.diagram, radius, filter));
8423
8529
  }
8424
8530
  chamfer(radius, filter) {
8425
- return new Drawing(R(this.diagram, radius, filter));
8531
+ return new Drawing(T(this.diagram, radius, filter));
8426
8532
  }
8427
8533
  sketchOnPlane(inputPlane = "XY", origin = [0, 0, 0]) {
8428
8534
  if (typeof inputPlane !== "string") {
@@ -8431,7 +8537,7 @@ class Drawing {
8431
8537
  return sketchOnPlane(this.diagram, inputPlane, origin);
8432
8538
  }
8433
8539
  toSVG(margin) {
8434
- return Rn(this.diagram, { margin });
8540
+ return te(this.diagram, { margin });
8435
8541
  }
8436
8542
  toSVGViewBox(margin = 1) {
8437
8543
  return v(this.diagram.boundingBox, margin);
@@ -8440,17 +8546,17 @@ class Drawing {
8440
8546
  return svgPathsForShape(this.diagram);
8441
8547
  }
8442
8548
  offset(distance) {
8443
- return new Drawing(Dn(this.diagram, distance));
8549
+ return new Drawing(Yn(this.diagram, distance));
8444
8550
  }
8445
8551
  }
8446
- class ReDrawingPen extends ot$2 {
8552
+ class ReDrawingPen extends ot$1 {
8447
8553
  // @ts-expect-error forcing a different type
8448
8554
  close() {
8449
8555
  return new Drawing(super.close());
8450
8556
  }
8451
8557
  // @ts-expect-error forcing a different type
8452
8558
  closeWithMirror() {
8453
- return new Drawing(super.close());
8559
+ return new Drawing(super.closeWithMirror());
8454
8560
  }
8455
8561
  }
8456
8562
  function redraw(p) {
@@ -8462,8 +8568,8 @@ function wrapDrawing(fn) {
8462
8568
  };
8463
8569
  }
8464
8570
  const drawCircle = wrapDrawing(ct$1);
8465
- const drawRect = wrapDrawing(ot$1);
8571
+ const drawRect = wrapDrawing(ot);
8466
8572
  const drawEllipse = wrapDrawing(rt$1);
8467
- const drawPolysides = wrapDrawing(lt);
8573
+ const drawPolysides = wrapDrawing(lt$1);
8468
8574
 
8469
8575
  export { Drawing, ReDrawingPen, drawCircle, drawEllipse, drawPolysides, drawRect, drawShape, initStudioIntegration, pantograph, redraw, sketchDiagram, sketchFigure, sketchOnPlane, sketchSegment, sketchStroke, wrapDrawing };