pantograph2d 0.10.1 → 0.11.1

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.
Files changed (55) hide show
  1. package/dist/{QuadraticBezier-DCa0WGs0.js → QuadraticBezier-BeY2TXKH.js} +464 -433
  2. package/dist/QuadraticBezier-BeY2TXKH.js.map +1 -0
  3. package/dist/{QuadraticBezier-CuRsIP_D.cjs → QuadraticBezier-eSR75IzC.cjs} +9 -9
  4. package/dist/QuadraticBezier-eSR75IzC.cjs.map +1 -0
  5. package/dist/draw-BmJ8wIc9.cjs +2 -0
  6. package/dist/draw-BmJ8wIc9.cjs.map +1 -0
  7. package/dist/{draw-CJWiicbK.js → draw-DzKVhurb.js} +94 -89
  8. package/dist/draw-DzKVhurb.js.map +1 -0
  9. package/dist/{models-CFd5lRKc.js → models-BHeLX0dj.js} +544 -527
  10. package/dist/models-BHeLX0dj.js.map +1 -0
  11. package/dist/models-Fv9xfQBT.cjs +4 -0
  12. package/dist/models-Fv9xfQBT.cjs.map +1 -0
  13. package/dist/pantograph/drawShape.cjs +1 -1
  14. package/dist/pantograph/drawShape.js +2 -2
  15. package/dist/pantograph/models.cjs +1 -1
  16. package/dist/pantograph/models.js +2 -2
  17. package/dist/pantograph/svg.cjs +1 -1
  18. package/dist/pantograph/svg.js +1 -1
  19. package/dist/pantograph.cjs +2 -2
  20. package/dist/pantograph.cjs.map +1 -1
  21. package/dist/pantograph.js +677 -571
  22. package/dist/pantograph.js.map +1 -1
  23. package/dist/svg-BTO7h1ix.js +62 -0
  24. package/dist/svg-BTO7h1ix.js.map +1 -0
  25. package/dist/svg-b6SOnbda.cjs +8 -0
  26. package/dist/svg-b6SOnbda.cjs.map +1 -0
  27. package/dist/types/src/algorithms/offsets/offsetSegment.d.ts +1 -0
  28. package/dist/types/src/algorithms/tesselate/tesselateSegment.d.ts +7 -0
  29. package/dist/types/src/main.d.ts +1 -1
  30. package/dist/types/src/models/BoundingBox.d.ts +1 -0
  31. package/dist/types/src/models/Diagram.d.ts +1 -0
  32. package/dist/types/src/models/Figure.d.ts +1 -0
  33. package/dist/types/src/models/Loop.d.ts +1 -0
  34. package/dist/types/src/models/Strand.d.ts +5 -0
  35. package/dist/types/src/models/TransformationMatrix.d.ts +1 -0
  36. package/dist/types/src/models/segments/Arc.d.ts +1 -0
  37. package/dist/types/src/models/segments/CubicBezier.d.ts +1 -0
  38. package/dist/types/src/models/segments/EllipseArc.d.ts +1 -0
  39. package/dist/types/src/models/segments/Line.d.ts +2 -0
  40. package/dist/types/src/models/segments/QuadraticBezier.d.ts +1 -0
  41. package/dist/types/src/operations.d.ts +1 -0
  42. package/dist/types/src/tesselationOperations.d.ts +15 -0
  43. package/package.json +2 -2
  44. package/dist/QuadraticBezier-CuRsIP_D.cjs.map +0 -1
  45. package/dist/QuadraticBezier-DCa0WGs0.js.map +0 -1
  46. package/dist/draw-9Elv4xz6.cjs +0 -2
  47. package/dist/draw-9Elv4xz6.cjs.map +0 -1
  48. package/dist/draw-CJWiicbK.js.map +0 -1
  49. package/dist/models-CFd5lRKc.js.map +0 -1
  50. package/dist/models-LHGiMarC.cjs +0 -4
  51. package/dist/models-LHGiMarC.cjs.map +0 -1
  52. package/dist/svg-BzloQ9l1.cjs +0 -8
  53. package/dist/svg-BzloQ9l1.cjs.map +0 -1
  54. package/dist/svg-CD4q2GBE.js +0 -62
  55. package/dist/svg-CD4q2GBE.js.map +0 -1
@@ -1,34 +1,34 @@
1
- var nn = Object.defineProperty;
2
- var en = (t, n, e) => n in t ? nn(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var C = (t, n, e) => en(t, typeof n != "symbol" ? n + "" : n, e);
4
- import { b as k, d as sn, e as Tt, a as z, s as V, n as on, p as Lt, l as U, A as S, g as P, v as qt, E as M, T as rn, w as ln, Q as I, x as $, C as A, c as un, y as cn, L as b, F as zt, G as ut, z as N, H as an, m as fn, q as hn, I as mt, B as pn } from "./QuadraticBezier-DCa0WGs0.js";
5
- function dn(t, n) {
6
- const e = k(n, t.firstPoint), s = sn(e, t.V) / t.squareLength;
1
+ var on = Object.defineProperty;
2
+ var ln = (t, n, e) => n in t ? on(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var b = (t, n, e) => ln(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { b as k, d as un, e as Dt, a as z, s as N, n as cn, p as Rt, l as j, A as x, g as P, w as Nt, E as C, T as an, x as fn, Q as M, y as $, C as A, c as hn, v as pn, L as y, F as Vt, G as ut, z as V, H as dn, m as mn, q as gn, I as mt, B as Pn } from "./QuadraticBezier-BeY2TXKH.js";
5
+ function In(t, n) {
6
+ const e = k(n, t.firstPoint), s = un(e, t.V) / t.squareLength;
7
7
  return t.paramPoint(s);
8
8
  }
9
9
  function K(t, n, e) {
10
- const s = e || t.precision, i = dn(t, n.center), o = Tt(i, n.center);
11
- if (o > n.radius + s) return [];
12
- if (Math.abs(o - n.radius) < s) {
10
+ const s = e || t.precision, i = In(t, n.center), r = Dt(i, n.center);
11
+ if (r > n.radius + s) return [];
12
+ if (Math.abs(r - n.radius) < s) {
13
13
  const c = i;
14
14
  return t.isOnSegment(c) && n.isOnSegment(c) ? [c] : [];
15
15
  }
16
- const l = [], r = Math.sqrt(
17
- n.radius * n.radius - o * o
18
- ), u = t.tangentAtFirstPoint, a = z(i, V(u, r));
16
+ const l = [], o = Math.sqrt(
17
+ n.radius * n.radius - r * r
18
+ ), u = t.tangentAtFirstPoint, a = z(i, N(u, o));
19
19
  t.isOnSegment(a) && n.isOnSegment(a) && l.push(a);
20
- const f = z(i, V(u, -r));
20
+ const f = z(i, N(u, -o));
21
21
  return t.isOnSegment(f) && n.isOnSegment(f) && l.push(f), l;
22
22
  }
23
- const mn = (t) => {
23
+ const wn = (t) => {
24
24
  const { firstPoint: n, lastPoint: e, center: s, clockwise: i } = t;
25
- return new S(e, n, s, i, {
25
+ return new x(e, n, s, i, {
26
26
  ignoreChecks: !0
27
27
  });
28
- }, gn = (t, n) => {
28
+ }, xn = (t, n) => {
29
29
  if (t.isSame(n))
30
30
  return [t];
31
- const e = U(
31
+ const e = j(
32
32
  [
33
33
  n.isOnSegment(t.firstPoint) ? t.firstPoint : null,
34
34
  n.isOnSegment(t.lastPoint) ? t.lastPoint : null,
@@ -41,11 +41,11 @@ const mn = (t) => {
41
41
  if (e.length === 0) return [];
42
42
  if (e.length === 1) return [];
43
43
  if (e.length === 2)
44
- return t.isSame(mn(n)) ? [] : [new S(e[0], e[1], t.center, t.clockwise)];
44
+ return t.isSame(wn(n)) ? [] : [new x(e[0], e[1], t.center, t.clockwise)];
45
45
  if (e.length === 3) {
46
46
  const s = P(e[0], n.lastPoint) || P(e[0], n.firstPoint) ? 1 : 0;
47
47
  return [
48
- new S(
48
+ new x(
49
49
  e[0 + s],
50
50
  e[1 + s],
51
51
  t.center,
@@ -54,133 +54,133 @@ const mn = (t) => {
54
54
  ];
55
55
  } else if (e.length === 4)
56
56
  return [
57
- new S(e[0], e[1], t.center, t.clockwise),
58
- new S(e[2], e[3], t.center, t.clockwise)
57
+ new x(e[0], e[1], t.center, t.clockwise),
58
+ new x(e[2], e[3], t.center, t.clockwise)
59
59
  ];
60
60
  throw new Error("Bug in the arc arc overlap algorithm");
61
61
  };
62
- function Dt(t, n, e = !1, s) {
63
- const i = s || t.precision, o = Tt(t.center, n.center), l = t.radius + n.radius;
64
- if (o > l + i)
62
+ function jt(t, n, e = !1, s) {
63
+ const i = s || t.precision, r = Dt(t.center, n.center), l = t.radius + n.radius;
64
+ if (r > l + i)
65
65
  return [];
66
- const r = Math.abs(t.radius - n.radius);
67
- if (o < r - i)
66
+ const o = Math.abs(t.radius - n.radius);
67
+ if (r < o - i)
68
68
  return [];
69
- if (o < i)
70
- return r > i ? [] : e ? gn(t, n) : [];
71
- const u = on(k(n.center, t.center)), a = o > l - i;
69
+ if (r < i)
70
+ return o > i ? [] : e ? xn(t, n) : [];
71
+ const u = cn(k(n.center, t.center)), a = r > l - i;
72
72
  if (
73
73
  // circles are outside each other
74
74
  a || // circles are inside each other
75
- Math.abs(o - r) < i
75
+ Math.abs(r - o) < i
76
76
  ) {
77
- const g = a || t.radius > n.radius ? 1 : -1, w = z(
77
+ const g = a || t.radius > n.radius ? 1 : -1, I = z(
78
78
  t.center,
79
- V(u, g * t.radius)
79
+ N(u, g * t.radius)
80
80
  );
81
- return t.isOnSegment(w) && n.isOnSegment(w) ? [w] : [];
81
+ return t.isOnSegment(I) && n.isOnSegment(I) ? [I] : [];
82
82
  }
83
- const f = t.radius * t.radius / (2 * o) - n.radius * n.radius / (2 * o) + o / 2, c = z(
83
+ const f = t.radius * t.radius / (2 * r) - n.radius * n.radius / (2 * r) + r / 2, c = z(
84
84
  t.center,
85
- V(u, f)
85
+ N(u, f)
86
86
  ), h = Math.sqrt(
87
87
  t.radius * t.radius - f * f
88
- ), p = Lt(u), d = z(c, V(p, h)), m = z(c, V(p, -h)), x = [];
89
- return t.isOnSegment(d) && n.isOnSegment(d) && x.push(d), t.isOnSegment(m) && n.isOnSegment(m) && x.push(m), x;
88
+ ), p = Rt(u), d = z(c, N(p, h)), m = z(c, N(p, -h)), w = [];
89
+ return t.isOnSegment(d) && n.isOnSegment(d) && w.push(d), t.isOnSegment(m) && n.isOnSegment(m) && w.push(m), w;
90
90
  }
91
91
  function st(t, n, e = 1e-9) {
92
- const s = t.transform(n.ellipseReferenceFrameTransform), i = s.slope, o = s.yIntercept, l = n.majorRadius * n.majorRadius, r = n.minorRadius * n.minorRadius, u = n.majorRadius * n.minorRadius, a = s.slope * s.slope, f = s.yIntercept * s.yIntercept, c = (g) => g.map(
93
- (w) => n.reverseEllipseReferenceFrameTransform.transform(w)
94
- ).filter((w) => t.isOnSegment(w) && n.isOnSegment(w));
92
+ const s = t.transform(n.ellipseReferenceFrameTransform), i = s.slope, r = s.yIntercept, l = n.majorRadius * n.majorRadius, o = n.minorRadius * n.minorRadius, u = n.majorRadius * n.minorRadius, a = s.slope * s.slope, f = s.yIntercept * s.yIntercept, c = (g) => g.map(
93
+ (I) => n.reverseEllipseReferenceFrameTransform.transform(I)
94
+ ).filter((I) => t.isOnSegment(I) && n.isOnSegment(I));
95
95
  if (!Number.isFinite(i)) {
96
96
  const g = s.firstPoint[0];
97
97
  if (Math.abs(g) - n.majorRadius > e) return [];
98
98
  if (Math.abs(Math.abs(g) - n.majorRadius) < e)
99
99
  return c([[g, 0]]);
100
- const w = n.minorRadius * Math.sqrt(1 - g * g / l), F = [g, w], y = [g, -w];
101
- return c([F, y]);
100
+ const I = n.minorRadius * Math.sqrt(1 - g * g / l), F = [g, I], S = [g, -I];
101
+ return c([F, S]);
102
102
  }
103
- const h = l * a + r - f;
103
+ const h = l * a + o - f;
104
104
  if (h < -e)
105
105
  return [];
106
- const p = l * a + r;
106
+ const p = l * a + o;
107
107
  if (Math.abs(h) < e) {
108
- const g = -(l * i * o) / p, w = r * o / p;
109
- return c([[g, w]]);
108
+ const g = -(l * i * r) / p, I = o * r / p;
109
+ return c([[g, I]]);
110
110
  }
111
111
  const d = Math.sqrt(h), m = [
112
- -(l * i * o + u * d) / p,
113
- (r * o - u * i * d) / p
114
- ], x = [
115
- -(l * i * o - u * d) / p,
116
- (r * o + u * i * d) / p
112
+ -(l * i * r + u * d) / p,
113
+ (o * r - u * i * d) / p
114
+ ], w = [
115
+ -(l * i * r - u * d) / p,
116
+ (o * r + u * i * d) / p
117
117
  ];
118
- return c([m, x]);
119
- }
120
- function Rt(t, n) {
121
- 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 = {
122
- 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,
123
- 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,
124
- 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,
125
- 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,
126
- 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
127
- }, F = qt(
118
+ return c([m, w]);
119
+ }
120
+ function Ut(t, n) {
121
+ const e = Math.max(t.precision, n.precision), s = t.coefficients, i = s.x2, r = s.xy, l = s.y2, o = 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, w = f.c, g = {
122
+ z0: a * i * d * d + i * i * w * w - o * i * d * w + c * c * a * a - 2 * i * w * c * a - o * d * c * a + c * o * o * w,
123
+ z1: m * o * o * c - w * d * i * r - 2 * i * w * c * u - a * c * h * o + 2 * d * h * i * a + 2 * m * w * i * i + d * d * i * u - m * d * i * o - 2 * i * m * c * a - a * c * d * r + 2 * a * u * c * c - w * h * i * o - u * c * d * o + 2 * w * r * c * o,
124
+ z2: m * m * i * i + 2 * p * w * i * i - u * c * d * r + w * c * r * r - u * c * h * o - w * h * i * r - 2 * i * m * c * u + 2 * d * h * i * u - p * d * i * o - 2 * i * p * c * a + h * h * i * a + 2 * m * r * c * o + u * u * c * c - l * c * d * o - m * h * i * o + 2 * a * l * c * c - a * c * h * r + p * o * o * c + d * d * i * l - m * d * i * r - 2 * i * w * c * l,
125
+ z3: -2 * i * c * l * m + m * c * r * r + 2 * p * r * c * o - l * c * h * o + h * h * i * u - m * h * i * r - 2 * i * p * c * u - u * c * h * r - p * h * i * o + 2 * m * p * i * i + 2 * u * l * c * c - l * c * d * r + 2 * d * h * i * l - p * d * i * r,
126
+ z4: i * i * p * p - 2 * i * p * c * l + c * c * l * l - r * i * h * p - r * h * c * l + r * r * c * p + l * i * h * h
127
+ }, F = Nt(
128
128
  [g.z0, g.z1, g.z2, g.z3, g.z4],
129
129
  e
130
- ).flatMap((y) => {
131
- const R = i * h * y + i * d - c * o * y - c * r;
130
+ ).flatMap((S) => {
131
+ const R = i * h * S + i * d - c * r * S - c * o;
132
132
  if (R)
133
- return [[-(i * x + i * p * y * y - c * l * y * y + i * m * y - c * u * y - c * a) / R, y]];
134
- const T = o * y + r, L = -T / (2 * i), j = l * y * y + u * y + a, q = T * T / (4 * i * i) - j / i;
133
+ return [[-(i * w + i * p * S * S - c * l * S * S + i * m * S - c * u * S - c * a) / R, S]];
134
+ const T = r * S + o, L = -T / (2 * i), U = l * S * S + u * S + a, q = T * T / (4 * i * i) - U / i;
135
135
  if (Math.abs(q) < e)
136
- return [[L, y]];
136
+ return [[L, S]];
137
137
  if (q > 0) {
138
138
  const H = Math.sqrt(q);
139
- return [[L + H, y], [L - H, y]];
139
+ return [[L + H, S], [L - H, S]];
140
140
  }
141
141
  return [];
142
142
  });
143
- return U(F, e);
143
+ return j(F, e);
144
144
  }
145
145
  function gt(t, n) {
146
- return Rt(t, n).filter((s) => t.isOnSegment(s) && n.isOnSegment(s));
146
+ return Ut(t, n).filter((s) => t.isOnSegment(s) && n.isOnSegment(s));
147
147
  }
148
- const Pn = (t) => {
148
+ const Sn = (t) => {
149
149
  const {
150
150
  firstPoint: n,
151
151
  lastPoint: e,
152
152
  center: s,
153
153
  majorRadius: i,
154
- minorRadius: o,
154
+ minorRadius: r,
155
155
  tiltAngle: l,
156
- clockwise: r
156
+ clockwise: o
157
157
  } = t;
158
- return new M(
158
+ return new C(
159
159
  e,
160
160
  n,
161
161
  s,
162
162
  i,
163
- o,
164
- l,
165
163
  r,
164
+ l,
165
+ o,
166
166
  {
167
167
  ignoreChecks: !0,
168
168
  angleUnits: "rad"
169
169
  }
170
170
  );
171
- }, wn = (t, n) => {
171
+ }, yn = (t, n) => {
172
172
  if (t.isSame(n))
173
173
  return [t];
174
- const e = (i, o) => new M(
174
+ const e = (i, r) => new C(
175
175
  i,
176
- o,
176
+ r,
177
177
  t.center,
178
178
  t.majorRadius,
179
179
  t.minorRadius,
180
180
  t.tiltAngle,
181
181
  t.clockwise,
182
182
  { ignoreChecks: !0, angleUnits: "rad" }
183
- ), s = U(
183
+ ), s = j(
184
184
  [
185
185
  n.isOnSegment(t.firstPoint) ? t.firstPoint : null,
186
186
  n.isOnSegment(t.lastPoint) ? t.lastPoint : null,
@@ -189,11 +189,11 @@ const Pn = (t) => {
189
189
  ].filter((i) => i !== null)
190
190
  // We sort by the param value of the first arc. This means that the points
191
191
  // will be sorted with the same orientation than arc1
192
- ).sort((i, o) => t.pointToParam(i) - t.pointToParam(o));
192
+ ).sort((i, r) => t.pointToParam(i) - t.pointToParam(r));
193
193
  if (s.length === 0) return [];
194
194
  if (s.length === 1) return [];
195
195
  if (s.length === 2)
196
- return t.isSame(Pn(n)) ? [] : [e(s[0], s[1])];
196
+ return t.isSame(Sn(n)) ? [] : [e(s[0], s[1])];
197
197
  if (s.length === 3) {
198
198
  const i = P(s[0], n.lastPoint) || P(s[0], n.firstPoint) ? 1 : 0;
199
199
  return [e(s[0 + i], s[1 + i])];
@@ -201,42 +201,42 @@ const Pn = (t) => {
201
201
  return [e(s[0], s[1]), e(s[2], s[3])];
202
202
  throw new Error("Bug in the ellipse arc ellipse arc overlap algorithm");
203
203
  };
204
- function xn(t, n, e = !1) {
204
+ function bn(t, n, e = !1) {
205
205
  const s = Math.max(t.precision, n.precision);
206
- return P(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(t, n) : [] : Rt(t, n).filter((l) => t.isOnSegment(l) && n.isOnSegment(l));
206
+ return P(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 ? yn(t, n) : [] : Ut(t, n).filter((l) => t.isOnSegment(l) && n.isOnSegment(l));
207
207
  }
208
208
  function Pt(t, n) {
209
- const [e, s] = t.firstPoint, [i, o] = t.lastPoint, l = new rn().translate(-e, -s).rotate(-Math.atan2(o - s, i - e)), r = l.clone().inverse(), u = n.transform(l);
210
- return u.paramsAtY(0).map((a) => u.paramPoint(a)).map((a) => r.transform(a)).filter((a) => t.isOnSegment(a));
209
+ const [e, s] = t.firstPoint, [i, r] = t.lastPoint, l = new an().translate(-e, -s).rotate(-Math.atan2(r - s, i - e)), o = l.clone().inverse(), u = n.transform(l);
210
+ return u.paramsAtY(0).map((a) => u.paramPoint(a)).map((a) => o.transform(a)).filter((a) => t.isOnSegment(a));
211
211
  }
212
- const Sn = (t, n = 1e-9) => {
212
+ const Cn = (t, n = 1e-9) => {
213
213
  let e = t;
214
214
  return Math.abs(t) < n && (e = 0), e.toFixed(-Math.log10(n));
215
215
  };
216
- function Vt(t, n = 1e-9) {
216
+ function Ht(t, n = 1e-9) {
217
217
  return Array.from(
218
- new Map(t.map((e) => [Sn(e, n), e])).values()
218
+ new Map(t.map((e) => [Cn(e, n), e])).values()
219
219
  );
220
220
  }
221
- const yn = (t, n) => {
222
- const [[e, s, i, o], [l, r, u, a]] = n.polynomialCoefficients, f = t.coefficients, c = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, x = f.c, g = e * e, w = s * s, F = i * i, y = o * o, R = l * l, T = r * r, L = u * u, j = a * a, q = x + d * e + c * g + m * l + h * e * l + p * R, H = d * s + 2 * c * e * s + h * s * l + m * r + h * e * r + 2 * p * l * r, Wt = c * w + d * i + 2 * c * e * i + h * i * l + h * s * r + p * T + m * u + h * e * u + 2 * p * l * u, Jt = 2 * c * s * i + d * o + 2 * c * e * o + h * o * l + h * i * r + h * s * u + 2 * p * r * u + m * a + h * e * a + 2 * p * l * a, Kt = c * F + 2 * c * s * o + h * o * r + h * i * u + p * L + h * s * a + 2 * p * r * a, Zt = 2 * c * i * o + h * o * u + h * i * a + 2 * p * u * a, tn = c * y + h * o * a + p * j;
223
- return [q, H, Wt, Jt, Kt, Zt, tn];
221
+ const Mn = (t, n) => {
222
+ const [[e, s, i, r], [l, o, u, a]] = n.polynomialCoefficients, f = t.coefficients, c = f.x2, h = f.xy, p = f.y2, d = f.x, m = f.y, w = f.c, g = e * e, I = s * s, F = i * i, S = r * r, R = l * l, T = o * o, L = u * u, U = a * a, q = w + d * e + c * g + m * l + h * e * l + p * R, H = d * s + 2 * c * e * s + h * s * l + m * o + h * e * o + 2 * p * l * o, tn = c * I + d * i + 2 * c * e * i + h * i * l + h * s * o + p * T + m * u + h * e * u + 2 * p * l * u, nn = 2 * c * s * i + d * r + 2 * c * e * r + h * r * l + h * i * o + h * s * u + 2 * p * o * u + m * a + h * e * a + 2 * p * l * a, en = c * F + 2 * c * s * r + h * r * o + h * i * u + p * L + h * s * a + 2 * p * o * a, sn = 2 * c * i * r + h * r * u + h * i * a + 2 * p * u * a, rn = c * S + h * r * a + p * U;
223
+ return [q, H, tn, nn, en, sn, rn];
224
224
  };
225
- function wt(t, n) {
226
- const e = Math.max(t.precision, n.precision), s = yn(t, n), i = qt(s, e).filter((o) => o >= -n.precision && o <= 1 + n.precision);
227
- return Vt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
225
+ function It(t, n) {
226
+ const e = Math.max(t.precision, n.precision), s = Mn(t, n), i = Nt(s, e).filter((r) => r >= -n.precision && r <= 1 + n.precision);
227
+ return Ht(i, e).map((r) => n.paramPoint(r)).filter((r) => t.isOnSegment(r));
228
228
  }
229
- const bn = (t, n) => {
230
- 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;
231
- return [R, T, L, j, q];
229
+ const An = (t, n) => {
230
+ const [[e, s, i], [r, l, o]] = 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, w = s * s, g = i * i, I = r * r, F = l * l, S = o * o, R = a * m + f * e * r + c * I + h * e + p * r + d, T = 2 * a * e * s + f * e * l + f * s * r + 2 * c * r * l + h * s + p * l, L = 2 * a * e * i + a * w + f * e * o + f * s * l + f * i * r + 2 * c * r * o + c * F + h * i + p * o, U = 2 * a * s * i + f * s * o + f * i * l + 2 * c * l * o, q = a * g + f * i * o + c * S;
231
+ return [R, T, L, U, q];
232
232
  };
233
- function xt(t, n) {
234
- const e = Math.max(t.precision, n.precision), s = bn(t, n), i = ln(...s).filter((o) => o >= -n.precision && o <= 1 + n.precision);
235
- return Vt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
233
+ function wt(t, n) {
234
+ const e = Math.max(t.precision, n.precision), s = An(t, n), i = fn(...s).filter((r) => r >= -n.precision && r <= 1 + n.precision);
235
+ return Ht(i, e).map((r) => n.paramPoint(r)).filter((r) => t.isOnSegment(r));
236
236
  }
237
237
  function E(t, { firstPoint: n, lastPoint: e }, s = 1e-9) {
238
238
  const i = k(e, n);
239
- 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] : un(i, k(t, n)) / cn(i);
239
+ 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] : hn(i, k(t, n)) / pn(i);
240
240
  }
241
241
  class ct {
242
242
  constructor(n, e, s, i) {
@@ -246,9 +246,9 @@ class ct {
246
246
  return this.positiveThickness - this.negativeThickness;
247
247
  }
248
248
  }
249
- const Cn = 3 / 4, Mn = 4 / 9;
250
- function In(t) {
251
- const n = E(t.firstControlPoint, t), e = E(t.lastControlPoint, t), s = n * e > 0 ? Cn : Mn;
249
+ const En = 3 / 4, Fn = 4 / 9;
250
+ function vn(t) {
251
+ const n = E(t.firstControlPoint, t), e = E(t.lastControlPoint, t), s = n * e > 0 ? En : Fn;
252
252
  return new ct(
253
253
  t.firstPoint,
254
254
  t.lastPoint,
@@ -256,7 +256,7 @@ function In(t) {
256
256
  s * Math.max(0, n, e)
257
257
  );
258
258
  }
259
- function An(t) {
259
+ function Bn(t) {
260
260
  const n = E(t.controlPoint, t);
261
261
  return new ct(
262
262
  t.firstPoint,
@@ -265,32 +265,32 @@ function An(t) {
265
265
  Math.max(0, n / 2)
266
266
  );
267
267
  }
268
- function En(t) {
269
- if (t instanceof A)
270
- return In(t);
271
- if (t instanceof I)
272
- return An(t);
268
+ function kn(t) {
269
+ if (A.isInstance(t))
270
+ return vn(t);
271
+ if (M.isInstance(t))
272
+ return Bn(t);
273
273
  throw new Error("Not implemented");
274
274
  }
275
- function Fn(t) {
276
- const n = t.paramPoint(0.5), e = Lt(k(n, t.firstPoint)), s = z(n, e), i = {
275
+ function On(t) {
276
+ const n = t.paramPoint(0.5), e = Rt(k(n, t.firstPoint)), s = z(n, e), i = {
277
277
  firstPoint: n,
278
278
  lastPoint: s
279
- }, o = [
279
+ }, r = [
280
280
  E(t.firstPoint, i),
281
281
  E(t.lastPoint, i)
282
282
  ];
283
- return t instanceof A ? o.push(
283
+ return A.isInstance(t) ? r.push(
284
284
  E(t.firstControlPoint, i),
285
285
  E(t.lastControlPoint, i)
286
- ) : t instanceof I && o.push(E(t.controlPoint, i)), new ct(
286
+ ) : M.isInstance(t) && r.push(E(t.controlPoint, i)), new ct(
287
287
  n,
288
288
  s,
289
- Math.min(...o),
290
- Math.max(...o)
289
+ Math.min(...r),
290
+ Math.max(...r)
291
291
  );
292
292
  }
293
- function St(t, n) {
293
+ function xt(t, n) {
294
294
  const e = [];
295
295
  for (let s = 1; s < t.length; s++) {
296
296
  const i = t[s];
@@ -298,10 +298,10 @@ function St(t, n) {
298
298
  e.push(i[0]);
299
299
  continue;
300
300
  }
301
- const o = t[s - 1], l = n - o[1], r = n - i[1];
302
- if (l * r < 0) {
301
+ const r = t[s - 1], l = n - r[1], o = n - i[1];
302
+ if (l * o < 0) {
303
303
  e.push(
304
- o[0] + (n - o[1]) * (i[0] - o[0]) / (i[1] - o[1])
304
+ r[0] + (n - r[1]) * (i[0] - r[0]) / (i[1] - r[1])
305
305
  );
306
306
  continue;
307
307
  }
@@ -319,29 +319,29 @@ class Y {
319
319
  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];
320
320
  }
321
321
  }
322
- function vn(t, n) {
323
- if (t instanceof A)
324
- return new kn([
322
+ function _n(t, n) {
323
+ if (A.isInstance(t))
324
+ return new Ln([
325
325
  E(t.firstPoint, n),
326
326
  E(t.firstControlPoint, n),
327
327
  E(t.lastControlPoint, n),
328
328
  E(t.lastPoint, n)
329
329
  ]);
330
- if (t instanceof I)
331
- return new Bn([
330
+ if (M.isInstance(t))
331
+ return new Tn([
332
332
  E(t.firstPoint, n),
333
333
  E(t.controlPoint, n),
334
334
  E(t.lastPoint, n)
335
335
  ]);
336
336
  throw new Error("Not implemented");
337
337
  }
338
- class Bn {
338
+ class Tn {
339
339
  constructor(n) {
340
- C(this, "topHull", []);
341
- C(this, "bottomHull", []);
340
+ b(this, "topHull", []);
341
+ b(this, "bottomHull", []);
342
342
  this.distances = n;
343
- const [e, s, i] = n, o = [0, e], l = [1 / 2, s], r = [1, i], u = i - e, a = e;
344
- s - (u * (1 / 2) + a) > 0 ? (this.topHull = [o, l, r], this.bottomHull = [o, r]) : (this.topHull = [o, r], this.bottomHull = [o, l, r]);
343
+ const [e, s, i] = n, r = [0, e], l = [1 / 2, s], o = [1, i], u = i - e, a = e;
344
+ s - (u * (1 / 2) + a) > 0 ? (this.topHull = [r, l, o], this.bottomHull = [r, o]) : (this.topHull = [r, o], this.bottomHull = [r, l, o]);
345
345
  }
346
346
  get startDistance() {
347
347
  return this.distances[0];
@@ -350,18 +350,18 @@ class Bn {
350
350
  return this.distances[2];
351
351
  }
352
352
  }
353
- class kn {
353
+ class Ln {
354
354
  constructor(n) {
355
- C(this, "topHull", []);
356
- C(this, "bottomHull", []);
355
+ b(this, "topHull", []);
356
+ b(this, "bottomHull", []);
357
357
  this.distances = n;
358
- 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);
358
+ const [e, s, i, r] = n, l = [0, e], o = [1 / 3, s], u = [2 / 3, i], a = [1, r], f = r - e, c = e, h = s - (f * (1 / 3) + c), p = i - (f * (2 / 3) + c);
359
359
  let d = null, m = null;
360
360
  if (h * p < 0)
361
- d = [l, r, a], m = [l, u, a];
361
+ d = [l, o, a], m = [l, u, a];
362
362
  else {
363
363
  const g = h / p;
364
- g >= 2 ? (d = [l, r, a], m = [l, a]) : g <= 0.5 ? (d = [l, u, a], m = [l, a]) : (d = [l, r, u, a], m = [l, a]);
364
+ g >= 2 ? (d = [l, o, a], m = [l, a]) : g <= 0.5 ? (d = [l, u, a], m = [l, a]) : (d = [l, o, u, a], m = [l, a]);
365
365
  }
366
366
  h < 0 && ([d, m] = [m, d]), this.topHull = d, this.bottomHull = m;
367
367
  }
@@ -372,16 +372,16 @@ class kn {
372
372
  return this.distances[3];
373
373
  }
374
374
  }
375
- function yt(t, n) {
376
- const e = vn(n, t), s = St(
375
+ function St(t, n) {
376
+ const e = _n(n, t), s = xt(
377
377
  e.topHull,
378
378
  t.negativeThickness
379
- ), i = St(
379
+ ), i = xt(
380
380
  e.bottomHull,
381
381
  t.positiveThickness
382
- ), o = e.endDistance >= t.negativeThickness && e.endDistance <= t.positiveThickness;
382
+ ), r = e.endDistance >= t.negativeThickness && e.endDistance <= t.positiveThickness;
383
383
  if (!s.length && !i.length)
384
- return o ? new Y("start", "end") : null;
384
+ return r ? new Y("start", "end") : null;
385
385
  if (s.length === 1 && i.length === 1)
386
386
  return new Y(s[0], i[0]);
387
387
  if (s.length === 2 && i.length === 2)
@@ -389,26 +389,26 @@ function yt(t, n) {
389
389
  "Bug in the clipping algorithm, unexpected number of crossing points"
390
390
  );
391
391
  const l = s.length ? s : i;
392
- return l.length === 2 ? new Y(l[0], l[1]) : o ? new Y(l[0], "end") : new Y("start", l[0]);
392
+ return l.length === 2 ? new Y(l[0], l[1]) : r ? new Y(l[0], "end") : new Y("start", l[0]);
393
393
  }
394
- function bt(t, n) {
395
- const e = En(t), s = yt(e, n);
394
+ function yt(t, n) {
395
+ const e = kn(t), s = St(e, n);
396
396
  if (!s)
397
397
  return null;
398
- const i = Fn(t), o = yt(
398
+ const i = On(t), r = St(
399
399
  i,
400
400
  n
401
401
  );
402
- return o ? s.size > o.size ? o.clipCurve(n) : s.clipCurve(n) : null;
402
+ return r ? s.size > r.size ? r.clipCurve(n) : s.clipCurve(n) : null;
403
403
  }
404
- const W = (t) => t instanceof I ? $(k(t.controlPoint, t.firstPoint)) + $(k(t.controlPoint, t.lastPoint)) : $(k(t.firstControlPoint, t.firstPoint)) + $(k(t.lastControlPoint, t.firstControlPoint)) + $(k(t.lastControlPoint, t.lastPoint));
404
+ const W = (t) => M.isInstance(t) ? $(k(t.controlPoint, t.firstPoint)) + $(k(t.controlPoint, t.lastPoint)) : $(k(t.firstControlPoint, t.firstPoint)) + $(k(t.lastControlPoint, t.firstControlPoint)) + $(k(t.lastControlPoint, t.lastPoint));
405
405
  function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
406
406
  const i = Math.max(e * e, Number.EPSILON * 10);
407
- let o = t, l = n, r = W(o), u = W(l);
407
+ let r = t, l = n, o = W(r), u = W(l);
408
408
  for (let a = 0; a < s; a++) {
409
- const f = r > i ? bt(l, o) : o;
409
+ const f = o > i ? yt(l, r) : r;
410
410
  if (!f) return [];
411
- const c = W(f), h = u > i ? bt(f, l) : l;
411
+ const c = W(f), h = u > i ? yt(f, l) : l;
412
412
  if (!h) return [];
413
413
  const p = W(h);
414
414
  if (c <= i && p <= i)
@@ -419,12 +419,12 @@ function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
419
419
  return [f.firstPoint];
420
420
  if (P(h.firstPoint, h.lastPoint) && f.isOnSegment(h.firstPoint))
421
421
  return [h.firstPoint];
422
- if (c > 0.8 * r && p > 0.8 * u)
423
- if (c / r > p / u) {
422
+ if (c > 0.8 * o && p > 0.8 * u)
423
+ if (c / o > p / u) {
424
424
  const [d, m] = f.splitAtParameters([
425
425
  0.5
426
426
  ]);
427
- return U(
427
+ return j(
428
428
  [
429
429
  ...D(d, h, e, {
430
430
  maxIterations: s - a
@@ -439,7 +439,7 @@ function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
439
439
  const [d, m] = h.splitAtParameters([
440
440
  0.5
441
441
  ]);
442
- return U(
442
+ return j(
443
443
  [
444
444
  ...D(f, d, e, {
445
445
  maxIterations: s - a
@@ -451,19 +451,19 @@ function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
451
451
  e
452
452
  );
453
453
  }
454
- o = f, l = h, r = c, u = p;
454
+ r = f, l = h, o = c, u = p;
455
455
  }
456
456
  throw new Error("Bézier clip: Maximum number of iterations reached");
457
457
  }
458
- function On(t, n) {
458
+ function qn(t, n) {
459
459
  const e = [];
460
460
  if ([
461
461
  [t.firstPoint, n],
462
462
  [t.lastPoint, n],
463
463
  [n.firstPoint, t],
464
464
  [n.lastPoint, t]
465
- ].forEach(([i, o]) => {
466
- o.isOnSegment(i) && e.push(i);
465
+ ].forEach(([i, r]) => {
466
+ r.isOnSegment(i) && e.push(i);
467
467
  }), e.length < 2)
468
468
  return null;
469
469
  if (e.length === 2)
@@ -473,24 +473,24 @@ function On(t, n) {
473
473
  if (e.length === 4)
474
474
  return [t];
475
475
  }
476
- function _n(t, n, e = !1) {
476
+ function zn(t, n, e = !1) {
477
477
  const s = Math.max(t.precision, n.precision);
478
478
  if (e) {
479
- const i = On(t, n);
479
+ const i = qn(t, n);
480
480
  if (i)
481
481
  return i;
482
482
  }
483
483
  return D(t, n, s);
484
484
  }
485
- function Tn(t, n) {
485
+ function Dn(t, n) {
486
486
  const e = [];
487
487
  if ([
488
488
  [t.firstPoint, n],
489
489
  [t.lastPoint, n],
490
490
  [n.firstPoint, t],
491
491
  [n.lastPoint, t]
492
- ].forEach(([i, o]) => {
493
- o.isOnSegment(i) && e.push(i);
492
+ ].forEach(([i, r]) => {
493
+ r.isOnSegment(i) && e.push(i);
494
494
  }), e.length < 2)
495
495
  return null;
496
496
  if (e.length === 2)
@@ -500,18 +500,18 @@ function Tn(t, n) {
500
500
  if (e.length === 4)
501
501
  return [t];
502
502
  }
503
- function Ln(t, n, e = !1) {
503
+ function Rn(t, n, e = !1) {
504
504
  const s = Math.max(t.precision, n.precision);
505
505
  if (e) {
506
- const i = Tn(t, n);
506
+ const i = Dn(t, n);
507
507
  if (i)
508
508
  return i;
509
509
  }
510
510
  return D(t, n, s);
511
511
  }
512
- function de(t, n, e) {
513
- if (t instanceof b && n instanceof b) {
514
- const s = zt(
512
+ function Ie(t, n, e) {
513
+ if (y.isInstance(t) && y.isInstance(n)) {
514
+ const s = Vt(
515
515
  t,
516
516
  n,
517
517
  !1,
@@ -519,42 +519,42 @@ function de(t, n, e) {
519
519
  );
520
520
  return s === null ? [] : [s];
521
521
  }
522
- if (t instanceof b && n instanceof S)
522
+ if (y.isInstance(t) && x.isInstance(n))
523
523
  return K(t, n, e);
524
- if (t instanceof S && n instanceof b)
524
+ if (x.isInstance(t) && y.isInstance(n))
525
525
  return K(n, t, e);
526
- if (t instanceof S && n instanceof S)
527
- return Dt(t, n, !1, e);
526
+ if (x.isInstance(t) && x.isInstance(n))
527
+ return jt(t, n, !1, e);
528
528
  throw new Error("Not implemented");
529
529
  }
530
530
  function Z(t, n, e) {
531
- if (t instanceof b && n instanceof b) {
532
- const s = zt(
531
+ if (y.isInstance(t) && y.isInstance(n)) {
532
+ const s = Vt(
533
533
  t,
534
534
  n,
535
535
  !0,
536
536
  e
537
537
  );
538
- return s === null ? { intersections: [], overlaps: [], count: 0 } : s instanceof b ? { intersections: [], overlaps: [s], count: 1 } : { intersections: [s], overlaps: [], count: 1 };
538
+ return s === null ? { intersections: [], overlaps: [], count: 0 } : y.isInstance(s) ? { intersections: [], overlaps: [s], count: 1 } : { intersections: [s], overlaps: [], count: 1 };
539
539
  }
540
540
  if (!t.boundingBox.overlaps(n.boundingBox))
541
541
  return { intersections: [], overlaps: [], count: 0 };
542
- if (t instanceof b && n instanceof S) {
542
+ if (y.isInstance(t) && x.isInstance(n)) {
543
543
  const s = K(t, n, e);
544
544
  return { intersections: s, overlaps: [], count: s.length };
545
545
  }
546
- if (t instanceof S && n instanceof b) {
546
+ if (x.isInstance(t) && y.isInstance(n)) {
547
547
  const s = K(n, t, e);
548
548
  return { intersections: s, overlaps: [], count: s.length };
549
549
  }
550
- if (t instanceof S && n instanceof S) {
551
- const s = Dt(
550
+ if (x.isInstance(t) && x.isInstance(n)) {
551
+ const s = jt(
552
552
  t,
553
553
  n,
554
554
  !0,
555
555
  e
556
556
  );
557
- return s.length ? s[0] instanceof S ? {
557
+ return s.length ? x.isInstance(s[0]) ? {
558
558
  intersections: [],
559
559
  overlaps: s,
560
560
  count: s.length
@@ -564,7 +564,7 @@ function Z(t, n, e) {
564
564
  count: s.length
565
565
  } : { intersections: [], overlaps: [], count: 0 };
566
566
  }
567
- if (t instanceof b && n instanceof M) {
567
+ if (y.isInstance(t) && C.isInstance(n)) {
568
568
  const s = st(
569
569
  t,
570
570
  n,
@@ -572,7 +572,7 @@ function Z(t, n, e) {
572
572
  );
573
573
  return { intersections: s, overlaps: [], count: s.length };
574
574
  }
575
- if (n instanceof b && t instanceof M) {
575
+ if (y.isInstance(n) && C.isInstance(t)) {
576
576
  const s = st(
577
577
  n,
578
578
  t,
@@ -580,21 +580,21 @@ function Z(t, n, e) {
580
580
  );
581
581
  return { intersections: s, overlaps: [], count: s.length };
582
582
  }
583
- if (t instanceof S && n instanceof M) {
583
+ if (x.isInstance(t) && C.isInstance(n)) {
584
584
  const s = gt(t, n);
585
585
  return { intersections: s, overlaps: [], count: s.length };
586
586
  }
587
- if (n instanceof S && t instanceof M) {
587
+ if (x.isInstance(n) && C.isInstance(t)) {
588
588
  const s = gt(n, t);
589
589
  return { intersections: s, overlaps: [], count: s.length };
590
590
  }
591
- if (t instanceof M && n instanceof M) {
592
- const s = xn(
591
+ if (C.isInstance(t) && C.isInstance(n)) {
592
+ const s = bn(
593
593
  t,
594
594
  n,
595
595
  !0
596
596
  );
597
- return s.length ? s[0] instanceof M ? {
597
+ return s.length ? C.isInstance(s[0]) ? {
598
598
  intersections: [],
599
599
  overlaps: s,
600
600
  count: s.length
@@ -604,36 +604,36 @@ function Z(t, n, e) {
604
604
  count: s.length
605
605
  } : { intersections: [], overlaps: [], count: 0 };
606
606
  }
607
- if (t instanceof b && (n instanceof A || n instanceof I)) {
607
+ if (y.isInstance(t) && (A.isInstance(n) || M.isInstance(n))) {
608
608
  const s = Pt(t, n);
609
609
  return { intersections: s, overlaps: [], count: s.length };
610
610
  }
611
- if (n instanceof b && (t instanceof A || t instanceof I)) {
611
+ if (y.isInstance(n) && (A.isInstance(t) || M.isInstance(t))) {
612
612
  const s = Pt(n, t);
613
613
  return { intersections: s, overlaps: [], count: s.length };
614
614
  }
615
- if ((t instanceof S || t instanceof M) && n instanceof I) {
616
- const s = xt(t, n);
615
+ if ((x.isInstance(t) || C.isInstance(t)) && M.isInstance(n)) {
616
+ const s = wt(t, n);
617
617
  return { intersections: s, overlaps: [], count: s.length };
618
618
  }
619
- if ((n instanceof S || n instanceof M) && t instanceof I) {
620
- const s = xt(n, t);
619
+ if ((x.isInstance(n) || C.isInstance(n)) && M.isInstance(t)) {
620
+ const s = wt(n, t);
621
621
  return { intersections: s, overlaps: [], count: s.length };
622
622
  }
623
- if ((t instanceof S || t instanceof M) && n instanceof A) {
624
- const s = wt(t, n);
623
+ if ((x.isInstance(t) || C.isInstance(t)) && A.isInstance(n)) {
624
+ const s = It(t, n);
625
625
  return { intersections: s, overlaps: [], count: s.length };
626
626
  }
627
- if ((n instanceof S || n instanceof M) && t instanceof A) {
628
- const s = wt(n, t);
627
+ if ((x.isInstance(n) || C.isInstance(n)) && A.isInstance(t)) {
628
+ const s = It(n, t);
629
629
  return { intersections: s, overlaps: [], count: s.length };
630
630
  }
631
- if (t instanceof I && n instanceof I) {
632
- const s = Ln(
631
+ if (M.isInstance(t) && M.isInstance(n)) {
632
+ const s = Rn(
633
633
  t,
634
634
  n
635
635
  );
636
- return s.length ? s[0] instanceof I ? {
636
+ return s.length ? M.isInstance(s[0]) ? {
637
637
  intersections: [],
638
638
  overlaps: s,
639
639
  count: s.length
@@ -643,16 +643,16 @@ function Z(t, n, e) {
643
643
  count: s.length
644
644
  } : { intersections: [], overlaps: [], count: 0 };
645
645
  }
646
- if (t instanceof I && n instanceof A || n instanceof I && t instanceof A) {
646
+ if (M.isInstance(t) && A.isInstance(n) || M.isInstance(n) && A.isInstance(t)) {
647
647
  const s = D(t, n);
648
648
  return { intersections: s, overlaps: [], count: s.length };
649
649
  }
650
- if (t instanceof A && n instanceof A) {
651
- const s = _n(
650
+ if (A.isInstance(t) && A.isInstance(n)) {
651
+ const s = zn(
652
652
  t,
653
653
  n
654
654
  );
655
- return s.length ? s[0] instanceof A ? {
655
+ return s.length ? A.isInstance(s[0]) ? {
656
656
  intersections: [],
657
657
  overlaps: s,
658
658
  count: s.length
@@ -664,7 +664,7 @@ function Z(t, n, e) {
664
664
  }
665
665
  throw new Error("Not implemented");
666
666
  }
667
- function Nt(t) {
667
+ function $t(t) {
668
668
  const n = [];
669
669
  for (let e = 0; e < t; e++)
670
670
  for (let s = 0; s <= e; s++)
@@ -672,15 +672,15 @@ function Nt(t) {
672
672
  return n;
673
673
  }
674
674
  function* it(t) {
675
- for (const [n, e] of Nt(t.length))
675
+ for (const [n, e] of $t(t.length))
676
676
  n !== e && (yield [t[n], t[e]]);
677
677
  }
678
- class Ut extends ut {
678
+ class Yt extends ut {
679
679
  constructor(e, { ignoreChecks: s = !1 } = {}) {
680
680
  super();
681
- C(this, "segments");
682
- C(this, "_boundingBox", null);
683
- s || jt(e), this.segments = e;
681
+ b(this, "segments");
682
+ b(this, "_boundingBox", null);
683
+ s || Xt(e), this.segments = e;
684
684
  }
685
685
  get repr() {
686
686
  return this.segments.map((e) => e.repr).join(`
@@ -725,36 +725,36 @@ class Ut extends ut {
725
725
  return this.repr;
726
726
  }
727
727
  }
728
- function qn(t, n = "Stroke") {
729
- Nt(t.length).forEach(
728
+ function Nn(t, n = "Stroke") {
729
+ $t(t.length).forEach(
730
730
  ([e, s]) => {
731
731
  if (e === s) return;
732
- const i = t[e], o = t[s], l = Z(i, o), r = Math.max(i.precision, o.precision);
732
+ const i = t[e], r = t[s], l = Z(i, r), o = Math.max(i.precision, r.precision);
733
733
  if (l.count !== 0) {
734
734
  if (l.count === 1 && !l.overlaps.length) {
735
735
  const u = e - s, a = l.intersections[0];
736
- if (u === 1 && P(i.firstPoint, a, r) || u === -1 && P(i.lastPoint, a, r) || u === t.length - 1 && P(i.lastPoint, a, r) && P(o.firstPoint, a, r) || -u === t.length - 1 && P(i.firstPoint, a, r) && P(o.lastPoint, a, r))
736
+ if (u === 1 && P(i.firstPoint, a, o) || u === -1 && P(i.lastPoint, a, o) || u === t.length - 1 && P(i.lastPoint, a, o) && P(r.firstPoint, a, o) || -u === t.length - 1 && P(i.firstPoint, a, o) && P(r.lastPoint, a, o))
737
737
  return;
738
738
  }
739
739
  if (!(l.count === 2 && t.length === 2 && (P(
740
740
  i.firstPoint,
741
741
  l.intersections[0],
742
- r
742
+ o
743
743
  ) && P(
744
744
  i.lastPoint,
745
745
  l.intersections[1],
746
- r
746
+ o
747
747
  ) || P(
748
748
  i.firstPoint,
749
749
  l.intersections[1],
750
- r
750
+ o
751
751
  ) && P(
752
752
  i.lastPoint,
753
753
  l.intersections[0],
754
- r
754
+ o
755
755
  ))))
756
756
  throw new Error(
757
- `${n} segments must not intersect, but segments ${i.info} and ${o.info} do at ${JSON.stringify(
757
+ `${n} segments must not intersect, but segments ${i.info} and ${r.info} do at ${JSON.stringify(
758
758
  l.intersections
759
759
  )}`
760
760
  );
@@ -762,26 +762,26 @@ function qn(t, n = "Stroke") {
762
762
  }
763
763
  );
764
764
  }
765
- function jt(t, n = "Stroke") {
765
+ function Xt(t, n = "Stroke") {
766
766
  if (t.length === 0)
767
767
  throw new Error(`${n} must have at least one segment`);
768
- N([t.slice(0, -1), t.slice(1)]).forEach(
768
+ V([t.slice(0, -1), t.slice(1)]).forEach(
769
769
  ([e, s]) => {
770
770
  if (!P(e.lastPoint, s.firstPoint))
771
771
  throw new Error(
772
772
  `${n} segments must be connected, but ${e.info} and ${s.info} are not`
773
773
  );
774
774
  }
775
- ), qn(t, n);
775
+ ), Nn(t, n);
776
776
  }
777
- function Ct(t, n) {
778
- return !!(t instanceof b && n instanceof b && an(t.V, n.V) || t instanceof S && n instanceof S && P(t.center, n.center) && t.radius - n.radius < t.precision);
777
+ function bt(t, n) {
778
+ return !!(y.isInstance(t) && y.isInstance(n) && dn(t.V, n.V) || x.isInstance(t) && x.isInstance(n) && P(t.center, n.center) && t.radius - n.radius < t.precision);
779
779
  }
780
- function Mt(t, n) {
781
- if (t instanceof b && n instanceof b)
782
- return new b(t.firstPoint, n.lastPoint);
783
- if (t instanceof S && n instanceof S)
784
- return new S(
780
+ function Ct(t, n) {
781
+ if (y.isInstance(t) && y.isInstance(n))
782
+ return new y(t.firstPoint, n.lastPoint);
783
+ if (x.isInstance(t) && x.isInstance(n))
784
+ return new x(
785
785
  t.firstPoint,
786
786
  n.lastPoint,
787
787
  t.center,
@@ -789,7 +789,7 @@ function Mt(t, n) {
789
789
  );
790
790
  throw new Error("Not implemented");
791
791
  }
792
- function Ht(t) {
792
+ function Gt(t) {
793
793
  let n = !1;
794
794
  const e = [];
795
795
  for (const s of t.segments) {
@@ -798,22 +798,27 @@ function Ht(t) {
798
798
  continue;
799
799
  }
800
800
  const i = e[e.length - 1];
801
- Ct(i, s) ? (n = !0, e.pop(), e.push(Mt(i, s))) : e.push(s);
801
+ bt(i, s) ? (n = !0, e.pop(), e.push(Ct(i, s))) : e.push(s);
802
802
  }
803
- if (P(t.firstPoint, t.lastPoint) && Ct(
803
+ if (P(t.firstPoint, t.lastPoint) && bt(
804
804
  e[0],
805
805
  e[e.length - 1]
806
806
  )) {
807
807
  n = !0;
808
808
  const s = e.pop();
809
- e[0] = Mt(s, e[0]);
809
+ e[0] = Ct(s, e[0]);
810
810
  }
811
811
  return n ? e : null;
812
812
  }
813
- class B extends Ut {
814
- constructor() {
815
- super(...arguments);
816
- C(this, "strokeType", "STRAND");
813
+ const Mt = Symbol.for("pantograph:Strand");
814
+ class B extends Yt {
815
+ constructor(e, { ignoreChecks: s = !1 } = {}) {
816
+ super(e, { ignoreChecks: s });
817
+ b(this, "strokeType", "STRAND");
818
+ Object.defineProperty(this, Mt, { value: !0 });
819
+ }
820
+ static isInstance(e) {
821
+ return !!e && e[Mt] === !0;
817
822
  }
818
823
  reverse() {
819
824
  const e = this.segments.map((s) => s.reverse());
@@ -831,7 +836,7 @@ class B extends Ut {
831
836
  return new B([...this.segments, ...e.segments]);
832
837
  }
833
838
  simplify() {
834
- const e = Ht(this);
839
+ const e = Gt(this);
835
840
  return e ? new B(e, { ignoreChecks: !0 }) : this;
836
841
  }
837
842
  transform(e) {
@@ -841,8 +846,8 @@ class B extends Ut {
841
846
  );
842
847
  }
843
848
  }
844
- const zn = (t, n) => {
845
- const e = fn(n, {
849
+ const Vn = (t, n) => {
850
+ const e = mn(n, {
846
851
  V: [1, 0],
847
852
  firstPoint: t,
848
853
  precision: n.precision
@@ -852,15 +857,15 @@ const zn = (t, n) => {
852
857
  const { intersectionParam1: s, intersectionParam2: i } = e;
853
858
  if (!n.isValidParameter(s) || i <= -n.precision) return 0;
854
859
  if (Math.abs(s) < n.precision || Math.abs(s - 1) < n.precision) {
855
- const [, o] = n.midPoint;
856
- return t[1] - o < 0 ? 1 : 0;
860
+ const [, r] = n.midPoint;
861
+ return t[1] - r < 0 ? 1 : 0;
857
862
  }
858
863
  return 1;
859
864
  };
860
865
  class at {
861
866
  constructor(n) {
862
- C(this, "_count", 0);
863
- C(this, "segment");
867
+ b(this, "_count", 0);
868
+ b(this, "segment");
864
869
  this.segment = n;
865
870
  }
866
871
  update(n, e = !1) {
@@ -870,24 +875,24 @@ class at {
870
875
  return this._count;
871
876
  }
872
877
  }
873
- const Dn = (t, n) => {
878
+ const jn = (t, n) => {
874
879
  const e = n.precision, s = Math.abs(t[1] - n.center[1]);
875
880
  if (s > n.radius + e) return 0;
876
- const i = hn(t, n.center), o = n.radius * n.radius, l = e * e;
877
- if (Math.abs(i - o) < l && n.isOnSegment(t))
881
+ const i = gn(t, n.center), r = n.radius * n.radius, l = e * e;
882
+ if (Math.abs(i - r) < l && n.isOnSegment(t))
878
883
  return 0;
879
- const r = i - o > l;
880
- if (r && n.center[0] < t[0]) return 0;
884
+ const o = i - r > l;
885
+ if (o && n.center[0] < t[0]) return 0;
881
886
  const u = Math.sqrt(
882
887
  n.radius * n.radius - s * s
883
888
  ), a = new at(n);
884
- return a.update([n.center[0] + u, t[1]]), r && a.update([n.center[0] - u, t[1]]), a.count;
885
- }, Rn = (t, n) => {
886
- const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new b(t, [e, t[1]]), i = new at(n);
887
- return st(s, n).forEach((o) => {
888
- i.update(o, !0);
889
+ return a.update([n.center[0] + u, t[1]]), o && a.update([n.center[0] - u, t[1]]), a.count;
890
+ }, Un = (t, n) => {
891
+ const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new y(t, [e, t[1]]), i = new at(n);
892
+ return st(s, n).forEach((r) => {
893
+ i.update(r, !0);
889
894
  }), i.count;
890
- }, Vn = (t, n) => {
895
+ }, Hn = (t, n) => {
891
896
  const e = new at(n);
892
897
  return n.paramsAtY(t[1]).map((s) => {
893
898
  try {
@@ -902,30 +907,34 @@ const Dn = (t, n) => {
902
907
  e.update(s, !0);
903
908
  }), e.count;
904
909
  };
905
- function Nn(t, n) {
906
- if (n instanceof b)
907
- return zn(t, n);
908
- if (n instanceof S)
909
- return Dn(t, n);
910
- if (n instanceof M)
911
- return Rn(t, n);
912
- if (n instanceof A || n instanceof I)
910
+ function $n(t, n) {
911
+ if (y.isInstance(n))
913
912
  return Vn(t, n);
913
+ if (x.isInstance(n))
914
+ return jn(t, n);
915
+ if (C.isInstance(n))
916
+ return Un(t, n);
917
+ if (A.isInstance(n) || M.isInstance(n))
918
+ return Hn(t, n);
914
919
  throw new Error("Not implemented");
915
920
  }
916
- class _ extends Ut {
921
+ const At = Symbol.for("pantograph:Loop");
922
+ class _ extends Yt {
917
923
  constructor(e, { ignoreChecks: s = !1 } = {}) {
918
924
  super(e, { ignoreChecks: !0 });
919
- C(this, "strokeType", "LOOP");
920
- C(this, "_clockwise", null);
921
- s || Un(e);
925
+ b(this, "strokeType", "LOOP");
926
+ b(this, "_clockwise", null);
927
+ Object.defineProperty(this, At, { value: !0 }), s || Yn(e);
928
+ }
929
+ static isInstance(e) {
930
+ return !!e && e[At] === !0;
922
931
  }
923
932
  get clockwise() {
924
933
  if (this._clockwise === null) {
925
- const e = this.segments.flatMap((i) => i instanceof b ? [i.firstPoint] : [i.firstPoint, i.paramPoint(0.5)]), s = e.map((i, o) => {
926
- const l = e[(o + 1) % e.length];
934
+ const e = this.segments.flatMap((i) => y.isInstance(i) ? [i.firstPoint] : [i.firstPoint, i.paramPoint(0.5)]), s = e.map((i, r) => {
935
+ const l = e[(r + 1) % e.length];
927
936
  return (l[0] - i[0]) * (l[1] + i[1]);
928
- }).reduce((i, o) => i + o, 0);
937
+ }).reduce((i, r) => i + r, 0);
929
938
  this._clockwise = s > 0;
930
939
  }
931
940
  return this._clockwise;
@@ -947,35 +956,35 @@ class _ extends Ut {
947
956
  );
948
957
  }
949
958
  contains(e, { strokeIsInside: s = !1 } = {}) {
950
- return this.onStroke(e) ? s : this.boundingBox.contains(e) ? this.segments.reduce((o, l) => o + Nn(e, l), 0) % 2 === 1 : !1;
959
+ return this.onStroke(e) ? s : this.boundingBox.contains(e) ? this.segments.reduce((r, l) => r + $n(e, l), 0) % 2 === 1 : !1;
951
960
  }
952
961
  simplify() {
953
- const e = Ht(this);
962
+ const e = Gt(this);
954
963
  return e ? new _(e, { ignoreChecks: !0 }) : this;
955
964
  }
956
965
  }
957
- function Un(t) {
958
- if (jt(t, "Loop"), !P(t[0].firstPoint, t[t.length - 1].lastPoint))
966
+ function Yn(t) {
967
+ if (Xt(t, "Loop"), !P(t[0].firstPoint, t[t.length - 1].lastPoint))
959
968
  throw new Error("Loop segment must be closed");
960
969
  }
961
- const jn = [
962
- b,
963
- S,
970
+ const Xn = [
971
+ y,
972
+ x,
973
+ C,
964
974
  M,
965
- I,
966
975
  A
967
976
  ];
968
- function Hn(t) {
969
- return jn.some((n) => t instanceof n);
977
+ function Gn(t) {
978
+ return Xn.some((n) => n.isInstance(t));
970
979
  }
971
- function $t(t) {
972
- if (t instanceof b)
980
+ function Qt(t) {
981
+ if (y.isInstance(t))
973
982
  return {
974
983
  type: t.segmentType,
975
984
  firstPoint: t.firstPoint,
976
985
  lastPoint: t.lastPoint
977
986
  };
978
- if (t instanceof S)
987
+ if (x.isInstance(t))
979
988
  return {
980
989
  type: t.segmentType,
981
990
  firstPoint: t.firstPoint,
@@ -983,7 +992,7 @@ function $t(t) {
983
992
  center: t.center,
984
993
  clockwise: t.clockwise
985
994
  };
986
- if (t instanceof M)
995
+ if (C.isInstance(t))
987
996
  return {
988
997
  type: t.segmentType,
989
998
  firstPoint: t.firstPoint,
@@ -994,14 +1003,14 @@ function $t(t) {
994
1003
  minorRadius: t.minorRadius,
995
1004
  tiltAngle: t.tiltAngle
996
1005
  };
997
- if (t instanceof I)
1006
+ if (M.isInstance(t))
998
1007
  return {
999
1008
  type: t.segmentType,
1000
1009
  firstPoint: t.firstPoint,
1001
1010
  lastPoint: t.lastPoint,
1002
1011
  controlPoint: t.controlPoint
1003
1012
  };
1004
- if (t instanceof A)
1013
+ if (A.isInstance(t))
1005
1014
  return {
1006
1015
  type: t.segmentType,
1007
1016
  firstPoint: t.firstPoint,
@@ -1011,37 +1020,37 @@ function $t(t) {
1011
1020
  };
1012
1021
  throw new Error("Unknown segment type");
1013
1022
  }
1014
- function ot(t) {
1023
+ function rt(t) {
1015
1024
  return {
1016
1025
  type: "LOOP",
1017
- segments: t.segments.map($t)
1026
+ segments: t.segments.map(Qt)
1018
1027
  };
1019
1028
  }
1020
- function Yt(t) {
1029
+ function Wt(t) {
1021
1030
  return {
1022
1031
  type: "FIGURE",
1023
- contour: ot(t.contour),
1024
- holes: t.holes.map(ot)
1032
+ contour: rt(t.contour),
1033
+ holes: t.holes.map(rt)
1025
1034
  };
1026
1035
  }
1027
- function $n(t) {
1036
+ function Qn(t) {
1028
1037
  return {
1029
1038
  type: "DIAGRAM",
1030
- figures: t.figures.map(Yt)
1039
+ figures: t.figures.map(Wt)
1031
1040
  };
1032
1041
  }
1033
- function It(t) {
1034
- if (t instanceof O)
1035
- return $n(t);
1036
- if (t instanceof v)
1037
- return Yt(t);
1038
- if (t instanceof _)
1039
- return ot(t);
1040
- if (Hn(t))
1041
- return $t(t);
1042
+ function Et(t) {
1043
+ if (O.isInstance(t))
1044
+ return Qn(t);
1045
+ if (v.isInstance(t))
1046
+ return Wt(t);
1047
+ if (_.isInstance(t))
1048
+ return rt(t);
1049
+ if (Gn(t))
1050
+ return Qt(t);
1042
1051
  throw new Error("Unknown shape type");
1043
1052
  }
1044
- class Yn {
1053
+ class Wn {
1045
1054
  constructor() {
1046
1055
  this.ids = [], this.values = [], this.length = 0;
1047
1056
  }
@@ -1051,9 +1060,9 @@ class Yn {
1051
1060
  push(n, e) {
1052
1061
  let s = this.length++;
1053
1062
  for (; s > 0; ) {
1054
- const i = s - 1 >> 1, o = this.values[i];
1055
- if (e >= o) break;
1056
- this.ids[s] = this.ids[i], this.values[s] = o, s = i;
1063
+ const i = s - 1 >> 1, r = this.values[i];
1064
+ if (e >= r) break;
1065
+ this.ids[s] = this.ids[i], this.values[s] = r, s = i;
1057
1066
  }
1058
1067
  this.ids[s] = n, this.values[s] = e;
1059
1068
  }
@@ -1062,16 +1071,16 @@ class Yn {
1062
1071
  const n = this.ids[0];
1063
1072
  if (this.length--, this.length > 0) {
1064
1073
  const e = this.ids[0] = this.ids[this.length], s = this.values[0] = this.values[this.length], i = this.length >> 1;
1065
- let o = 0;
1066
- for (; o < i; ) {
1067
- let l = (o << 1) + 1;
1068
- const r = l + 1;
1074
+ let r = 0;
1075
+ for (; r < i; ) {
1076
+ let l = (r << 1) + 1;
1077
+ const o = l + 1;
1069
1078
  let u = this.ids[l], a = this.values[l];
1070
- const f = this.values[r];
1071
- if (r < this.length && f < a && (l = r, u = this.ids[r], a = f), a >= s) break;
1072
- this.ids[o] = u, this.values[o] = a, o = l;
1079
+ const f = this.values[o];
1080
+ if (o < this.length && f < a && (l = o, u = this.ids[o], a = f), a >= s) break;
1081
+ this.ids[r] = u, this.values[r] = a, r = l;
1073
1082
  }
1074
- this.ids[o] = e, this.values[o] = s;
1083
+ this.ids[r] = e, this.values[r] = s;
1075
1084
  }
1076
1085
  return n;
1077
1086
  }
@@ -1087,7 +1096,7 @@ class Yn {
1087
1096
  this.ids.length = this.values.length = this.length;
1088
1097
  }
1089
1098
  }
1090
- const At = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], et = 3;
1099
+ const Ft = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], et = 3;
1091
1100
  class ft {
1092
1101
  /**
1093
1102
  * Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
@@ -1103,14 +1112,14 @@ class ft {
1103
1112
  const [s, i] = new Uint8Array(n, e + 0, 2);
1104
1113
  if (s !== 251)
1105
1114
  throw new Error("Data does not appear to be in a Flatbush format.");
1106
- const o = i >> 4;
1107
- if (o !== et)
1108
- throw new Error(`Got v${o} data when expected v${et}.`);
1109
- const l = At[i & 15];
1115
+ const r = i >> 4;
1116
+ if (r !== et)
1117
+ throw new Error(`Got v${r} data when expected v${et}.`);
1118
+ const l = Ft[i & 15];
1110
1119
  if (!l)
1111
1120
  throw new Error("Unrecognized array type.");
1112
- const [r] = new Uint16Array(n, e + 2, 1), [u] = new Uint32Array(n, e + 4, 1);
1113
- return new ft(u, r, l, void 0, n, e);
1121
+ const [o] = new Uint16Array(n, e + 2, 1), [u] = new Uint32Array(n, e + 4, 1);
1122
+ return new ft(u, o, l, void 0, n, e);
1114
1123
  }
1115
1124
  /**
1116
1125
  * Create a Flatbush index that will hold a given number of items.
@@ -1121,20 +1130,20 @@ class ft {
1121
1130
  * @param {ArrayBuffer | SharedArrayBuffer} [data] (Only used internally)
1122
1131
  * @param {number} [byteOffset=0] (Only used internally)
1123
1132
  */
1124
- constructor(n, e = 16, s = Float64Array, i = ArrayBuffer, o, l = 0) {
1133
+ constructor(n, e = 16, s = Float64Array, i = ArrayBuffer, r, l = 0) {
1125
1134
  if (n === void 0) throw new Error("Missing required argument: numItems.");
1126
1135
  if (isNaN(n) || n <= 0) throw new Error(`Unexpected numItems value: ${n}.`);
1127
1136
  this.numItems = +n, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.byteOffset = l;
1128
- let r = n, u = r;
1129
- this._levelBounds = [r * 4];
1137
+ let o = n, u = o;
1138
+ this._levelBounds = [o * 4];
1130
1139
  do
1131
- r = Math.ceil(r / this.nodeSize), u += r, this._levelBounds.push(u * 4);
1132
- while (r !== 1);
1140
+ o = Math.ceil(o / this.nodeSize), u += o, this._levelBounds.push(u * 4);
1141
+ while (o !== 1);
1133
1142
  this.ArrayType = s, this.IndexArrayType = u < 16384 ? Uint16Array : Uint32Array;
1134
- const a = At.indexOf(this.ArrayType), f = u * 4 * this.ArrayType.BYTES_PER_ELEMENT;
1143
+ const a = Ft.indexOf(this.ArrayType), f = u * 4 * this.ArrayType.BYTES_PER_ELEMENT;
1135
1144
  if (a < 0)
1136
1145
  throw new Error(`Unexpected typed array class: ${s}.`);
1137
- 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 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new Yn();
1146
+ r && r.byteLength !== void 0 && !r.buffer ? (this.data = r, 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 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new Wn();
1138
1147
  }
1139
1148
  /**
1140
1149
  * Add a given rectangle to the index.
@@ -1145,8 +1154,8 @@ class ft {
1145
1154
  * @returns {number} A zero-based, incremental number that represents the newly added rectangle.
1146
1155
  */
1147
1156
  add(n, e, s = n, i = e) {
1148
- const o = this._pos >> 2, l = this._boxes;
1149
- return this._indices[o] = o, l[this._pos++] = n, l[this._pos++] = e, l[this._pos++] = s, l[this._pos++] = i, n < this.minX && (this.minX = n), e < this.minY && (this.minY = e), s > this.maxX && (this.maxX = s), i > this.maxY && (this.maxY = i), o;
1157
+ const r = this._pos >> 2, l = this._boxes;
1158
+ return this._indices[r] = r, l[this._pos++] = n, l[this._pos++] = e, l[this._pos++] = s, l[this._pos++] = i, n < this.minX && (this.minX = n), e < this.minY && (this.minY = e), s > this.maxX && (this.maxX = s), i > this.maxY && (this.maxY = i), r;
1150
1159
  }
1151
1160
  /** Perform indexing of the added rectangles. */
1152
1161
  finish() {
@@ -1157,19 +1166,19 @@ class ft {
1157
1166
  n[this._pos++] = this.minX, n[this._pos++] = this.minY, n[this._pos++] = this.maxX, n[this._pos++] = this.maxY;
1158
1167
  return;
1159
1168
  }
1160
- const e = this.maxX - this.minX || 1, s = this.maxY - this.minY || 1, i = new Uint32Array(this.numItems), o = 65535;
1161
- for (let l = 0, r = 0; l < this.numItems; l++) {
1162
- 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);
1163
- i[l] = Gn(h, p);
1169
+ const e = this.maxX - this.minX || 1, s = this.maxY - this.minY || 1, i = new Uint32Array(this.numItems), r = 65535;
1170
+ for (let l = 0, o = 0; l < this.numItems; l++) {
1171
+ const u = n[o++], a = n[o++], f = n[o++], c = n[o++], h = Math.floor(r * ((u + f) / 2 - this.minX) / e), p = Math.floor(r * ((a + c) / 2 - this.minY) / s);
1172
+ i[l] = Kn(h, p);
1164
1173
  }
1165
- rt(i, n, this._indices, 0, this.numItems - 1, this.nodeSize);
1166
- for (let l = 0, r = 0; l < this._levelBounds.length - 1; l++) {
1174
+ ot(i, n, this._indices, 0, this.numItems - 1, this.nodeSize);
1175
+ for (let l = 0, o = 0; l < this._levelBounds.length - 1; l++) {
1167
1176
  const u = this._levelBounds[l];
1168
- for (; r < u; ) {
1169
- const a = r;
1170
- let f = n[r++], c = n[r++], h = n[r++], p = n[r++];
1171
- for (let d = 1; d < this.nodeSize && r < u; d++)
1172
- f = Math.min(f, n[r++]), c = Math.min(c, n[r++]), h = Math.max(h, n[r++]), p = Math.max(p, n[r++]);
1177
+ for (; o < u; ) {
1178
+ const a = o;
1179
+ let f = n[o++], c = n[o++], h = n[o++], p = n[o++];
1180
+ for (let d = 1; d < this.nodeSize && o < u; d++)
1181
+ f = Math.min(f, n[o++]), c = Math.min(c, n[o++]), h = Math.max(h, n[o++]), p = Math.max(p, n[o++]);
1173
1182
  this._indices[this._pos >> 2] = a, n[this._pos++] = f, n[this._pos++] = c, n[this._pos++] = h, n[this._pos++] = p;
1174
1183
  }
1175
1184
  }
@@ -1183,19 +1192,19 @@ class ft {
1183
1192
  * @param {(index: number) => boolean} [filterFn] An optional function for filtering the results.
1184
1193
  * @returns {number[]} An array of indices of items intersecting or touching the given bounding box.
1185
1194
  */
1186
- search(n, e, s, i, o) {
1195
+ search(n, e, s, i, r) {
1187
1196
  if (this._pos !== this._boxes.length)
1188
1197
  throw new Error("Data not yet indexed - call index.finish().");
1189
1198
  let l = this._boxes.length - 4;
1190
- const r = [], u = [];
1199
+ const o = [], u = [];
1191
1200
  for (; l !== void 0; ) {
1192
- const a = Math.min(l + this.nodeSize * 4, Ft(l, this._levelBounds));
1201
+ const a = Math.min(l + this.nodeSize * 4, Bt(l, this._levelBounds));
1193
1202
  for (let f = l; f < a; f += 4) {
1194
1203
  if (s < this._boxes[f] || i < this._boxes[f + 1] || n > this._boxes[f + 2] || e > this._boxes[f + 3]) continue;
1195
1204
  const c = this._indices[f >> 2] | 0;
1196
- l >= this.numItems * 4 ? r.push(c) : (o === void 0 || o(c)) && u.push(c);
1205
+ l >= this.numItems * 4 ? o.push(c) : (r === void 0 || r(c)) && u.push(c);
1197
1206
  }
1198
- l = r.pop();
1207
+ l = o.pop();
1199
1208
  }
1200
1209
  return u;
1201
1210
  }
@@ -1208,28 +1217,28 @@ class ft {
1208
1217
  * @param {(index: number) => boolean} [filterFn] An optional function for filtering the results.
1209
1218
  * @returns {number[]} An array of indices of items found.
1210
1219
  */
1211
- neighbors(n, e, s = 1 / 0, i = 1 / 0, o) {
1220
+ neighbors(n, e, s = 1 / 0, i = 1 / 0, r) {
1212
1221
  if (this._pos !== this._boxes.length)
1213
1222
  throw new Error("Data not yet indexed - call index.finish().");
1214
1223
  let l = this._boxes.length - 4;
1215
- const r = this._queue, u = [], a = i * i;
1224
+ const o = this._queue, u = [], a = i * i;
1216
1225
  t: for (; l !== void 0; ) {
1217
- const f = Math.min(l + this.nodeSize * 4, Ft(l, this._levelBounds));
1226
+ const f = Math.min(l + this.nodeSize * 4, Bt(l, this._levelBounds));
1218
1227
  for (let c = l; c < f; c += 4) {
1219
- 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;
1220
- m > a || (l >= this.numItems * 4 ? r.push(h << 1, m) : (o === void 0 || o(h)) && r.push((h << 1) + 1, m));
1228
+ const h = this._indices[c >> 2] | 0, p = vt(n, this._boxes[c], this._boxes[c + 2]), d = vt(e, this._boxes[c + 1], this._boxes[c + 3]), m = p * p + d * d;
1229
+ m > a || (l >= this.numItems * 4 ? o.push(h << 1, m) : (r === void 0 || r(h)) && o.push((h << 1) + 1, m));
1221
1230
  }
1222
- for (; r.length && r.peek() & 1; )
1223
- if (r.peekValue() > a || (u.push(r.pop() >> 1), u.length === s)) break t;
1224
- l = r.length ? r.pop() >> 1 : void 0;
1231
+ for (; o.length && o.peek() & 1; )
1232
+ if (o.peekValue() > a || (u.push(o.pop() >> 1), u.length === s)) break t;
1233
+ l = o.length ? o.pop() >> 1 : void 0;
1225
1234
  }
1226
- return r.clear(), u;
1235
+ return o.clear(), u;
1227
1236
  }
1228
1237
  }
1229
- function Et(t, n, e) {
1238
+ function vt(t, n, e) {
1230
1239
  return t < n ? n - t : t <= e ? 0 : t - e;
1231
1240
  }
1232
- function Ft(t, n) {
1241
+ function Bt(t, n) {
1233
1242
  let e = 0, s = n.length - 1;
1234
1243
  for (; e < s; ) {
1235
1244
  const i = e + s >> 1;
@@ -1237,79 +1246,83 @@ function Ft(t, n) {
1237
1246
  }
1238
1247
  return n[e];
1239
1248
  }
1240
- function rt(t, n, e, s, i, o) {
1241
- if (Math.floor(s / o) >= Math.floor(i / o)) return;
1249
+ function ot(t, n, e, s, i, r) {
1250
+ if (Math.floor(s / r) >= Math.floor(i / r)) return;
1242
1251
  const l = t[s + i >> 1];
1243
- let r = s - 1, u = i + 1;
1252
+ let o = s - 1, u = i + 1;
1244
1253
  for (; ; ) {
1245
1254
  do
1246
- r++;
1247
- while (t[r] < l);
1255
+ o++;
1256
+ while (t[o] < l);
1248
1257
  do
1249
1258
  u--;
1250
1259
  while (t[u] > l);
1251
- if (r >= u) break;
1252
- Xn(t, n, e, r, u);
1260
+ if (o >= u) break;
1261
+ Jn(t, n, e, o, u);
1253
1262
  }
1254
- rt(t, n, e, s, u, o), rt(t, n, e, u + 1, i, o);
1263
+ ot(t, n, e, s, u, r), ot(t, n, e, u + 1, i, r);
1255
1264
  }
1256
- function Xn(t, n, e, s, i) {
1257
- const o = t[s];
1258
- t[s] = t[i], t[i] = o;
1259
- const l = 4 * s, r = 4 * i, u = n[l], a = n[l + 1], f = n[l + 2], c = n[l + 3];
1260
- n[l] = n[r], n[l + 1] = n[r + 1], n[l + 2] = n[r + 2], n[l + 3] = n[r + 3], n[r] = u, n[r + 1] = a, n[r + 2] = f, n[r + 3] = c;
1265
+ function Jn(t, n, e, s, i) {
1266
+ const r = t[s];
1267
+ t[s] = t[i], t[i] = r;
1268
+ const l = 4 * s, o = 4 * i, u = n[l], a = n[l + 1], f = n[l + 2], c = n[l + 3];
1269
+ n[l] = n[o], n[l + 1] = n[o + 1], n[l + 2] = n[o + 2], n[l + 3] = n[o + 3], n[o] = u, n[o + 1] = a, n[o + 2] = f, n[o + 3] = c;
1261
1270
  const h = e[s];
1262
1271
  e[s] = e[i], e[i] = h;
1263
1272
  }
1264
- function Gn(t, n) {
1265
- 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;
1266
- 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;
1273
+ function Kn(t, n) {
1274
+ let e = t ^ n, s = 65535 ^ e, i = 65535 ^ (t | n), r = t & (n ^ 65535), l = e | s >> 1, o = e >> 1 ^ e, u = i >> 1 ^ s & r >> 1 ^ i, a = e & i >> 1 ^ r >> 1 ^ r;
1275
+ e = l, s = o, i = u, r = a, l = e & e >> 2 ^ s & s >> 2, o = e & s >> 2 ^ s & (e ^ s) >> 2, u ^= e & i >> 2 ^ s & r >> 2, a ^= s & i >> 2 ^ (e ^ s) & r >> 2, e = l, s = o, i = u, r = a, l = e & e >> 4 ^ s & s >> 4, o = e & s >> 4 ^ s & (e ^ s) >> 4, u ^= e & i >> 4 ^ s & r >> 4, a ^= s & i >> 4 ^ (e ^ s) & r >> 4, e = l, s = o, i = u, r = a, u ^= e & i >> 8 ^ s & r >> 8, a ^= s & i >> 8 ^ (e ^ s) & r >> 8, e = u ^ u >> 1, s = a ^ a >> 1;
1267
1276
  let f = t ^ n, c = s | 65535 ^ (f | e);
1268
1277
  return f = (f | f << 8) & 16711935, f = (f | f << 4) & 252645135, f = (f | f << 2) & 858993459, f = (f | f << 1) & 1431655765, c = (c | c << 8) & 16711935, c = (c | c << 4) & 252645135, c = (c | c << 2) & 858993459, c = (c | c << 1) & 1431655765, (c << 1 | f) >>> 0;
1269
1278
  }
1270
- function Xt(t, n = 1e-7) {
1279
+ function Jt(t, n = 1e-7) {
1271
1280
  if (t.length === 0) return [];
1272
1281
  if (t.length === 1) return [t];
1273
1282
  const e = new ft(t.length);
1274
- t.forEach((o) => {
1275
- const [l, r] = o.firstPoint;
1276
- e.add(l - n, r - n, l + n, r + n);
1283
+ t.forEach((r) => {
1284
+ const [l, o] = r.firstPoint;
1285
+ e.add(l - n, o - n, l + n, o + n);
1277
1286
  }), e.finish();
1278
1287
  const s = [], i = /* @__PURE__ */ new Set();
1279
- return t.forEach((o, l) => {
1288
+ return t.forEach((r, l) => {
1280
1289
  if (i.has(l)) return;
1281
- const r = [o];
1290
+ const o = [r];
1282
1291
  let u = l;
1283
1292
  i.add(l);
1284
1293
  let a = t.length;
1285
1294
  for (; ; ) {
1286
1295
  if (a-- < 0)
1287
1296
  throw new Error("Infinite loop detected");
1288
- const f = r[r.length - 1].lastPoint, [c, h] = f, p = e.search(
1297
+ const f = o[o.length - 1].lastPoint, [c, h] = f, p = e.search(
1289
1298
  c - n,
1290
1299
  h - n,
1291
1300
  c + n,
1292
1301
  h + n
1293
- ), d = (w) => Math.abs((u - w) % t.length), m = p.filter((w) => !i.has(w)).map((w) => [
1294
- t[w],
1295
- w,
1296
- d(w)
1297
- ]).sort(([, , w], [, , F]) => d(w) - d(F));
1302
+ ), d = (I) => Math.abs((u - I) % t.length), m = p.filter((I) => !i.has(I)).map((I) => [
1303
+ t[I],
1304
+ I,
1305
+ d(I)
1306
+ ]).sort(([, , I], [, , F]) => d(I) - d(F));
1298
1307
  if (m.length === 0) {
1299
- s.push(r);
1308
+ s.push(o);
1300
1309
  break;
1301
1310
  }
1302
- const [x, g] = m[0];
1303
- r.push(x), i.add(g), u = g;
1311
+ const [w, g] = m[0];
1312
+ o.push(w), i.add(g), u = g;
1304
1313
  }
1305
1314
  }), s;
1306
1315
  }
1316
+ const kt = Symbol.for("pantograph:Figure");
1307
1317
  class v extends ut {
1308
1318
  constructor(e, s = [], { ignoreChecks: i = !1 } = {}) {
1309
1319
  super();
1310
- C(this, "contour");
1311
- C(this, "holes");
1312
- i || Qn(e, s), this.contour = e, this.holes = s;
1320
+ b(this, "contour");
1321
+ b(this, "holes");
1322
+ Object.defineProperty(this, kt, { value: !0 }), i || Zn(e, s), this.contour = e, this.holes = s;
1323
+ }
1324
+ static isInstance(e) {
1325
+ return !!e && e[kt] === !0;
1313
1326
  }
1314
1327
  get boundingBox() {
1315
1328
  return this.contour.boundingBox;
@@ -1341,11 +1354,11 @@ class v extends ut {
1341
1354
  );
1342
1355
  }
1343
1356
  overlappingStrands(e) {
1344
- const s = e instanceof v ? e.allLoops : [e], i = this.allLoops.flatMap((o) => s.flatMap((l) => o.overlappingSegments(l)));
1345
- return Xt(i).map((o) => new B(o));
1357
+ const s = v.isInstance(e) ? e.allLoops : [e], i = this.allLoops.flatMap((r) => s.flatMap((l) => r.overlappingSegments(l)));
1358
+ return Jt(i).map((r) => new B(r));
1346
1359
  }
1347
1360
  }
1348
- function Qn(t, n = []) {
1361
+ function Zn(t, n = []) {
1349
1362
  if (!t) throw new Error("Figure must have a contour");
1350
1363
  for (const [e, s] of it([t, ...n]))
1351
1364
  if (e.intersects(s))
@@ -1356,176 +1369,176 @@ function Qn(t, n = []) {
1356
1369
  throw new Error("Holes must be inside the contour");
1357
1370
  for (const [e, s] of it(n))
1358
1371
  if (e.contains(s.firstPoint))
1359
- throw console.error(It(e), It(s)), new Error("Holes must not be inside other holes");
1372
+ throw console.error(Et(e), Et(s)), new Error("Holes must not be inside other holes");
1360
1373
  }
1361
- const J = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn = (t, n) => {
1374
+ const J = (t, n, e = 1e-7) => Math.abs(t - n) <= e, te = (t, n) => {
1362
1375
  const e = t.boundingBox, s = n.boundingBox;
1363
1376
  return J(e.xMin, s.xMin) && J(e.yMin, s.yMin) && J(e.xMax, s.xMax) && J(e.yMax, s.yMax);
1364
- }, Jn = (t, n) => {
1365
- if (t.segmentsCount !== n.segmentsCount || !Wn(t, n)) return !1;
1366
- const e = t.segments, s = n.segments, i = e.length, o = (l, r) => {
1377
+ }, ne = (t, n) => {
1378
+ if (t.segmentsCount !== n.segmentsCount || !te(t, n)) return !1;
1379
+ const e = t.segments, s = n.segments, i = e.length, r = (l, o) => {
1367
1380
  for (let u = 0; u < i; u += 1) {
1368
- const a = (l + r * u + i) % i;
1381
+ const a = (l + o * u + i) % i;
1369
1382
  if (!e[u].isSame(s[a])) return !1;
1370
1383
  }
1371
1384
  return !0;
1372
1385
  };
1373
1386
  for (let l = 0; l < i; l += 1)
1374
- if (e[0].isSame(s[l]) && (o(l, 1) || o(l, -1)))
1387
+ if (e[0].isSame(s[l]) && (r(l, 1) || r(l, -1)))
1375
1388
  return !0;
1376
1389
  return !1;
1377
- }, Kn = (t) => {
1390
+ }, ee = (t) => {
1378
1391
  const n = [];
1379
1392
  return t.forEach((e) => {
1380
- n.some((s) => Jn(e, s)) || n.push(e);
1393
+ n.some((s) => ne(e, s)) || n.push(e);
1381
1394
  }), n;
1382
- }, Zn = (t) => {
1383
- 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);
1384
- return n.forEach((i, o) => {
1385
- let l = s[o];
1386
- l || (l = [], e.push(l)), l.push(t[o]), i.length && i.forEach((r) => {
1387
- s[r] = l;
1395
+ }, se = (t) => {
1396
+ const n = t.map((i, r) => t.slice(r + 1).map((l, o) => [o + r + 1, l]).filter(([, l]) => i.boundingBox.overlaps(l.boundingBox)).map(([l]) => l)), e = [], s = Array(n.length);
1397
+ return n.forEach((i, r) => {
1398
+ let l = s[r];
1399
+ l || (l = [], e.push(l)), l.push(t[r]), i.length && i.forEach((o) => {
1400
+ s[o] = l;
1388
1401
  });
1389
1402
  }), e;
1390
- }, Gt = (t) => t.map((n, e) => {
1391
- const i = n.segments[0].midPoint, o = t.filter((l, r) => e === r ? !1 : l.contains(i));
1403
+ }, Kt = (t) => t.map((n, e) => {
1404
+ const i = n.segments[0].midPoint, r = t.filter((l, o) => e === o ? !1 : l.contains(i));
1392
1405
  return {
1393
1406
  loop: n,
1394
- isIn: o
1407
+ isIn: r
1395
1408
  };
1396
- }), te = (t, n) => t.flatMap(({ loop: e }) => ht(
1409
+ }), ie = (t, n) => t.flatMap(({ loop: e }) => ht(
1397
1410
  n.filter(
1398
1411
  ({ loop: s, isIn: i }) => s === e || i.indexOf(e) !== -1
1399
1412
  )
1400
- )), ne = (t, n) => {
1413
+ )), re = (t, n) => {
1401
1414
  const e = n.filter(({ isIn: i }) => i.length <= 1), s = ht(
1402
- Gt(t.map(({ loop: i }) => i))
1415
+ Kt(t.map(({ loop: i }) => i))
1403
1416
  );
1404
1417
  return [e, ...s];
1405
1418
  }, ht = (t) => {
1406
1419
  if (!t.length) return [];
1407
1420
  const n = t.filter(({ isIn: s }) => !s.length), e = t.filter(({ isIn: s }) => s.length > 1);
1408
- return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ? te(n, t) : ne(e, t);
1421
+ return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ? ie(n, t) : re(e, t);
1409
1422
  };
1410
1423
  function X(t) {
1411
- const n = Kn(t);
1412
- return Zn(n).map(Gt).flatMap(ht).map((s) => {
1424
+ const n = ee(t);
1425
+ return se(n).map(Kt).flatMap(ht).map((s) => {
1413
1426
  if (s.length === 1) return new v(s[0].loop);
1414
- s.sort((l, r) => l.isIn.length - r.isIn.length);
1415
- const [i, ...o] = s.map(({ loop: l }) => l);
1416
- return new v(i, o);
1427
+ s.sort((l, o) => l.isIn.length - o.isIn.length);
1428
+ const [i, ...r] = s.map(({ loop: l }) => l);
1429
+ return new v(i, r);
1417
1430
  });
1418
1431
  }
1419
- function ee(t, n) {
1432
+ function oe(t, n) {
1420
1433
  const e = [];
1421
1434
  for (const s of t)
1422
1435
  for (const i of n)
1423
1436
  e.push([s, i]);
1424
1437
  return e;
1425
1438
  }
1426
- function* vt(t, n, e) {
1427
- const s = (r) => n.some((u) => P(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));
1439
+ function* Ot(t, n, e) {
1440
+ const s = (o) => n.some((u) => P(u, o.lastPoint)), i = (o, u) => o.segmentType !== u.segmentType || !u.isOnSegment(o.firstPoint) || !u.isOnSegment(o.lastPoint) ? !1 : o.segmentType !== "LINE" ? u.isOnSegment(o.midPoint) : !0, r = (o) => e.some((u) => o.isSame(u) || i(o, u));
1428
1441
  let l = [];
1429
- for (const r of t)
1430
- s(r) ? (l.push(r), yield new B(l, { ignoreChecks: !0 }), l = []) : o(r) ? (l.length && (yield new B(l, { ignoreChecks: !0 }), l = []), yield new B([r], { ignoreChecks: !0 })) : l.push(r);
1442
+ for (const o of t)
1443
+ s(o) ? (l.push(o), yield new B(l, { ignoreChecks: !0 }), l = []) : r(o) ? (l.length && (yield new B(l, { ignoreChecks: !0 }), l = []), yield new B([o], { ignoreChecks: !0 })) : l.push(o);
1431
1444
  l.length && (yield new B(l, { ignoreChecks: !0 }));
1432
1445
  }
1433
- const Bt = (t, n) => {
1434
- const e = t.findIndex((o) => P(n, o.firstPoint)), s = t.slice(0, e);
1446
+ const _t = (t, n) => {
1447
+ const e = t.findIndex((r) => P(n, r.firstPoint)), s = t.slice(0, e);
1435
1448
  return t.slice(e).concat(s);
1436
- }, kt = (t, n) => {
1449
+ }, Tt = (t, n) => {
1437
1450
  let e = t;
1438
- const s = (r) => P(r.firstPoint, n.firstPoint) && P(r.lastPoint, n.lastPoint);
1451
+ const s = (o) => P(o.firstPoint, n.firstPoint) && P(o.lastPoint, n.lastPoint);
1439
1452
  let i = t.findIndex(s);
1440
1453
  if (i === -1) {
1441
- const r = t.map((u) => u.reverse());
1442
- if (r.reverse(), i = r.findIndex(s), i === -1)
1454
+ const o = t.map((u) => u.reverse());
1455
+ if (o.reverse(), i = o.findIndex(s), i === -1)
1443
1456
  throw console.error(
1444
- r.map((u) => u.repr),
1457
+ o.map((u) => u.repr),
1445
1458
  n.repr
1446
1459
  ), new Error("Failed to rotate to segment start");
1447
- e = r;
1460
+ e = o;
1448
1461
  }
1449
- const o = e.slice(0, i);
1450
- return e.slice(i).concat(o);
1462
+ const r = e.slice(0, i);
1463
+ return e.slice(i).concat(r);
1451
1464
  };
1452
- function se(t, n, e) {
1465
+ function le(t, n, e) {
1453
1466
  return t.filter((s) => {
1454
- const i = n.filter((r) => P(r.firstPoint, s) || P(r.lastPoint, s));
1467
+ const i = n.filter((o) => P(o.firstPoint, s) || P(o.lastPoint, s));
1455
1468
  if (i.length % 2)
1456
1469
  throw new Error("Bug in the intersection algo on non crossing point");
1457
- const o = i.map((r) => e.contains(r.midPoint));
1458
- return !(o.every((r) => r) || !o.some((r) => r));
1470
+ const r = i.map((o) => e.contains(o.midPoint));
1471
+ return !(r.every((o) => o) || !r.some((o) => o));
1459
1472
  });
1460
1473
  }
1461
- function ie(t, n, e, s = !1) {
1474
+ function ue(t, n, e, s = !1) {
1462
1475
  let i = [];
1463
- const o = [], l = new Array(t.segments.length).fill(0).map(() => []), r = new Array(n.segments.length).fill(0).map(() => []);
1476
+ const r = [], l = new Array(t.segments.length).fill(0).map(() => []), o = new Array(n.segments.length).fill(0).map(() => []);
1464
1477
  if (t.segments.forEach((p, d) => {
1465
- n.segments.forEach((m, x) => {
1466
- const { intersections: g, overlaps: w } = Z(
1478
+ n.segments.forEach((m, w) => {
1479
+ const { intersections: g, overlaps: I } = Z(
1467
1480
  p,
1468
1481
  m,
1469
1482
  e
1470
1483
  );
1471
- i.push(...g), l[d].push(...g), r[x].push(...g), o.push(...w);
1472
- const F = w.flatMap((y) => [
1473
- y.firstPoint,
1474
- y.lastPoint
1484
+ i.push(...g), l[d].push(...g), o[w].push(...g), r.push(...I);
1485
+ const F = I.flatMap((S) => [
1486
+ S.firstPoint,
1487
+ S.lastPoint
1475
1488
  ]);
1476
- i.push(...F), l[d].push(...F), r[x].push(...F);
1489
+ i.push(...F), l[d].push(...F), o[w].push(...F);
1477
1490
  });
1478
- }), i = U(i, e), !i.length || i.length === 1) return null;
1491
+ }), i = j(i, e), !i.length || i.length === 1) return null;
1479
1492
  const u = ([p, d]) => d.length ? p.splitAt(d) : [p];
1480
- let a = N([t.segments, l]).flatMap(u), f = N([n.segments, r]).flatMap(u);
1481
- if (i = se(
1493
+ let a = V([t.segments, l]).flatMap(u), f = V([n.segments, o]).flatMap(u);
1494
+ if (i = le(
1482
1495
  i,
1483
1496
  a,
1484
1497
  n
1485
- ), !i.length && !o.length) return null;
1486
- if (o.length) {
1487
- const p = o[0];
1488
- a = kt(
1498
+ ), !i.length && !r.length) return null;
1499
+ if (r.length) {
1500
+ const p = r[0];
1501
+ a = Tt(
1489
1502
  a,
1490
1503
  p
1491
- ), f = kt(
1504
+ ), f = Tt(
1492
1505
  f,
1493
1506
  p
1494
1507
  );
1495
1508
  } else {
1496
1509
  const p = i[0];
1497
- a = Bt(a, p), f = Bt(f, p);
1510
+ a = _t(a, p), f = _t(f, p);
1498
1511
  }
1499
1512
  let c = Array.from(
1500
- vt(
1513
+ Ot(
1501
1514
  a,
1502
1515
  i,
1503
- o
1516
+ r
1504
1517
  )
1505
1518
  ), h = Array.from(
1506
- vt(
1519
+ Ot(
1507
1520
  f,
1508
1521
  i,
1509
- o
1522
+ r
1510
1523
  )
1511
1524
  );
1512
1525
  return (!P(
1513
1526
  h[0].lastPoint,
1514
1527
  c[0].lastPoint
1515
- ) || o.length > 0 && h[0].segmentsCount !== 1) && (h = h.map((p) => p.reverse()).reverse(), P(h[0].lastPoint, c[0].lastPoint) || (c = c.map((p) => p.reverse()).reverse())), N([c, h]).map(([p, d]) => {
1528
+ ) || r.length > 0 && h[0].segmentsCount !== 1) && (h = h.map((p) => p.reverse()).reverse(), P(h[0].lastPoint, c[0].lastPoint) || (c = c.map((p) => p.reverse()).reverse())), V([c, h]).map(([p, d]) => {
1516
1529
  if (s) {
1517
- if (((x) => x.segments.every(
1518
- (g) => o.some(
1519
- (w) => g.isSame(w) || g.segmentType === w.segmentType && w.isOnSegment(g.firstPoint) && w.isOnSegment(g.lastPoint) && (g.segmentType === "LINE" || w.isOnSegment(g.midPoint))
1530
+ if (((w) => w.segments.every(
1531
+ (g) => r.some(
1532
+ (I) => g.isSame(I) || g.segmentType === I.segmentType && I.isOnSegment(g.firstPoint) && I.isOnSegment(g.lastPoint) && (g.segmentType === "LINE" || I.isOnSegment(g.midPoint))
1520
1533
  )
1521
1534
  ))(p))
1522
1535
  return [p, "same"];
1523
- } else if (p.segmentsCount === 1 && o.some((m) => p.segments[0].isSame(m)))
1536
+ } else if (p.segmentsCount === 1 && r.some((m) => p.segments[0].isSame(m)))
1524
1537
  return [p, "same"];
1525
1538
  return [p, d];
1526
1539
  });
1527
1540
  }
1528
- function Ot(t) {
1541
+ function Lt(t) {
1529
1542
  let n = t[0];
1530
1543
  for (const e of t.slice(1))
1531
1544
  n = n.extend(e);
@@ -1536,50 +1549,50 @@ function Ot(t) {
1536
1549
  ), new Error("Bug in the intersection algo on non closing strand");
1537
1550
  return new _(n.segments);
1538
1551
  }
1539
- function oe(t, n) {
1540
- const e = N([
1552
+ function ce(t, n) {
1553
+ const e = V([
1541
1554
  n.slice(0, -1),
1542
1555
  n.slice(1)
1543
- ]).map(([i, o]) => Ot(t.slice(i, o)));
1556
+ ]).map(([i, r]) => Lt(t.slice(i, r)));
1544
1557
  let s = t.slice(
1545
1558
  n[n.length - 1]
1546
1559
  );
1547
- return n[0] !== 0 && (s = s.concat(t.slice(0, n[0]))), e.push(Ot(s)), e;
1560
+ return n[0] !== 0 && (s = s.concat(t.slice(0, n[0]))), e.push(Lt(s)), e;
1548
1561
  }
1549
- function re(t) {
1562
+ function ae(t) {
1550
1563
  if (!t.length) return [];
1551
1564
  const n = t.map((i) => i.firstPoint);
1552
1565
  let e = t.map((i) => i.lastPoint);
1553
1566
  e = e.slice(-1).concat(e.slice(0, -1));
1554
- const s = N([n, e]).flatMap(
1555
- ([i, o], l) => P(i, o) ? [] : l
1567
+ const s = V([n, e]).flatMap(
1568
+ ([i, r], l) => P(i, r) ? [] : l
1556
1569
  );
1557
1570
  try {
1558
- return oe(t, s);
1571
+ return ce(t, s);
1559
1572
  } catch {
1560
- return Xt(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => P(o[0].firstPoint, o.at(-1).lastPoint)).map((o) => new _(o));
1573
+ return Jt(t.flatMap((r) => r.segments)).filter((r) => r.length > 1).filter((r) => P(r[0].firstPoint, r.at(-1).lastPoint)).map((r) => new _(r));
1561
1574
  }
1562
1575
  }
1563
- const _t = (t, n) => {
1576
+ const qt = (t, n) => {
1564
1577
  if (t.length === 0) return [n];
1565
1578
  const e = t.at(-1);
1566
1579
  return P(e.lastPoint, n.firstPoint) ? t.slice(0, -1).concat([e.extend(n)]) : P(e.lastPoint, n.lastPoint) ? t.slice(0, -1).concat([e.extend(n.reverse())]) : t.concat([n]);
1567
- }, le = (t, n) => t.length === 0 ? [n] : P(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
1580
+ }, fe = (t, n) => t.length === 0 ? [n] : P(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
1568
1581
  function pt(t, n, {
1569
1582
  firstInside: e,
1570
1583
  secondInside: s,
1571
1584
  firstBoundaryInside: i = !1,
1572
- secondBoundaryInside: o = !1
1585
+ secondBoundaryInside: r = !1
1573
1586
  }) {
1574
- const l = ie(
1587
+ const l = ue(
1575
1588
  t,
1576
1589
  n,
1577
1590
  void 0,
1578
- i || o
1591
+ i || r
1579
1592
  );
1580
1593
  if (!l) {
1581
1594
  const f = t.segments[0].midPoint, c = n.contains(f, {
1582
- strokeIsInside: o
1595
+ strokeIsInside: r
1583
1596
  }), h = n.segments[0].midPoint, p = t.contains(h, {
1584
1597
  strokeIsInside: i
1585
1598
  });
@@ -1591,27 +1604,27 @@ function pt(t, n, {
1591
1604
  }
1592
1605
  if (l.every(([, f]) => f === "same"))
1593
1606
  return { identical: !0 };
1594
- let r = null, u = null;
1607
+ let o = null, u = null;
1595
1608
  const a = l.flatMap(([f, c]) => {
1596
1609
  let h = [], p = 0;
1597
1610
  if (c === "same")
1598
- return u === 1 ? (u = 1, f) : u === 2 || u === 0 ? (u = null, []) : u === null ? (r ? r = r.extend(f) : r = f, []) : (console.error("weird situation"), []);
1611
+ return u === 1 ? (u = 1, f) : u === 2 || u === 0 ? (u = null, []) : u === null ? (o ? o = o.extend(f) : o = f, []) : (console.error("weird situation"), []);
1599
1612
  const d = f.segments[0].midPoint, m = n.contains(d, {
1600
- strokeIsInside: o
1613
+ strokeIsInside: r
1601
1614
  });
1602
- (e === "keep" && m || e === "remove" && !m) && (p += 1, h = _t(h, f));
1603
- const x = c.segments[0].midPoint, g = t.contains(x, {
1615
+ (e === "keep" && m || e === "remove" && !m) && (p += 1, h = qt(h, f));
1616
+ const w = c.segments[0].midPoint, g = t.contains(w, {
1604
1617
  strokeIsInside: i
1605
1618
  });
1606
1619
  if (s === "keep" && g || s === "remove" && !g) {
1607
- const w = c;
1608
- p += 1, p === 2 && h.length ? (h = _t(h, w), r = null) : h = [w];
1620
+ const I = c;
1621
+ p += 1, p === 2 && h.length ? (h = qt(h, I), o = null) : h = [I];
1609
1622
  }
1610
- return u === null && p === 1 && r && (h = le(h, r)), p === 1 && (u = p, r = null), h.length ? h : (r = null, []);
1623
+ return u === null && p === 1 && o && (h = fe(h, o)), p === 1 && (u = p, o = null), h.length ? h : (o = null, []);
1611
1624
  });
1612
- return re(a);
1625
+ return ae(a);
1613
1626
  }
1614
- const ue = (t, n, e) => {
1627
+ const he = (t, n, e) => {
1615
1628
  const s = pt(t, n, {
1616
1629
  firstInside: "remove",
1617
1630
  secondInside: "remove",
@@ -1626,47 +1639,47 @@ const ue = (t, n, e) => {
1626
1639
  });
1627
1640
  return Array.isArray(s) ? s : s.identical ? [] : s.firstCurveInSecond ? [] : s.secondCurveInFirst ? [t, n] : [t];
1628
1641
  }, dt = (t, n, e) => {
1629
- 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(
1642
+ const s = (e == null ? void 0 : e.firstBoundaryInside) ?? !1, i = (e == null ? void 0 : e.secondBoundaryInside) ?? !1, r = s || i, l = (u, a, f) => u.segments.every(
1630
1643
  (c) => a.contains(c.midPoint, { strokeIsInside: f })
1631
1644
  );
1632
- if (o) {
1645
+ if (r) {
1633
1646
  if (l(t, n, i))
1634
1647
  return [t];
1635
1648
  if (l(n, t, s))
1636
1649
  return [n];
1637
1650
  }
1638
- const r = pt(t, n, {
1651
+ const o = pt(t, n, {
1639
1652
  firstInside: "keep",
1640
1653
  secondInside: "keep",
1641
1654
  ...e
1642
1655
  });
1643
- return Array.isArray(r) ? r : r.identical ? [t] : r.firstCurveInSecond ? [t] : r.secondCurveInFirst ? [n] : [];
1656
+ return Array.isArray(o) ? o : o.identical ? [t] : o.firstCurveInSecond ? [t] : o.secondCurveInFirst ? [n] : [];
1644
1657
  };
1645
- function ce(t) {
1658
+ function pe(t) {
1646
1659
  const n = /* @__PURE__ */ new Map(), e = [];
1647
1660
  return t.forEach((s, i) => {
1648
- let o;
1649
- n.has(i) ? o = n.get(i) : (o = { current: [s], fusedWith: /* @__PURE__ */ new Set([i]) }, e.push(o)), t.slice(i + 1).forEach((l, r) => {
1650
- const u = o.current, a = i + r + 1;
1651
- if (o.fusedWith.has(a)) return;
1661
+ let r;
1662
+ n.has(i) ? r = n.get(i) : (r = { current: [s], fusedWith: /* @__PURE__ */ new Set([i]) }, e.push(r)), t.slice(i + 1).forEach((l, o) => {
1663
+ const u = r.current, a = i + o + 1;
1664
+ if (r.fusedWith.has(a)) return;
1652
1665
  let f = [l], c = !1;
1653
1666
  if (n.has(a) && (f = n.get(a).current, c = !0), !u.some(
1654
1667
  (d) => f.some((m) => d.intersects(m))
1655
1668
  )) return;
1656
1669
  let p;
1657
- 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);
1670
+ u.length > 1 || f.length > 1 ? p = G(u, f) : p = Zt(u[0], f[0]), r.fusedWith.add(a), r.current = p, c || n.set(a, r);
1658
1671
  });
1659
1672
  }), e.flatMap(({ current: s }) => s);
1660
1673
  }
1661
- function Qt(t, n) {
1662
- const e = ue(t.contour, n.contour), s = n.holes.flatMap((l) => tt(l, t.contour)), i = t.holes.flatMap((l) => tt(l, n.contour)), o = ee(t.holes, n.holes).flatMap(
1663
- ([l, r]) => dt(l, r)
1674
+ function Zt(t, n) {
1675
+ const e = he(t.contour, n.contour), s = n.holes.flatMap((l) => tt(l, t.contour)), i = t.holes.flatMap((l) => tt(l, n.contour)), r = oe(t.holes, n.holes).flatMap(
1676
+ ([l, o]) => dt(l, o)
1664
1677
  );
1665
1678
  return X([
1666
1679
  ...e,
1667
1680
  ...s,
1668
1681
  ...i,
1669
- ...o
1682
+ ...r
1670
1683
  ]);
1671
1684
  }
1672
1685
  function nt(t, n) {
@@ -1674,7 +1687,7 @@ function nt(t, n) {
1674
1687
  return X(tt(t.contour, n.contour));
1675
1688
  if (t.isFull) {
1676
1689
  const s = tt(t.contour, n.contour), i = n.holes.flatMap(
1677
- (o) => dt(o, t.contour, { firstBoundaryInside: !0 })
1690
+ (r) => dt(r, t.contour, { firstBoundaryInside: !0 })
1678
1691
  );
1679
1692
  return X([...s, ...i]);
1680
1693
  } else if (n.isFull && !t.contour.intersects(n.contour))
@@ -1694,7 +1707,7 @@ function nt(t, n) {
1694
1707
  e = e.flatMap((i) => nt(i, new v(s)));
1695
1708
  }), e;
1696
1709
  }
1697
- function ae(t, n) {
1710
+ function de(t, n) {
1698
1711
  const e = dt(t.contour, n.contour);
1699
1712
  if (!e.length) return [];
1700
1713
  let s = X(e);
@@ -1710,14 +1723,14 @@ function G(t, n) {
1710
1723
  if (!t.length) return n;
1711
1724
  if (!n.length) return t;
1712
1725
  if (t.length === 1 && n.length > 1 || n.length === 1 && t.length > 1)
1713
- return ce([...t, ...n]);
1726
+ return pe([...t, ...n]);
1714
1727
  if (t.length > 1 && n.length > 1) {
1715
1728
  let e = G([t[0]], n);
1716
1729
  return t.slice(1).forEach((s) => {
1717
1730
  e = G([s], e);
1718
1731
  }), e;
1719
1732
  }
1720
- return t.length === 1 && n.length === 1 ? Qt(t[0], n[0]) : [];
1733
+ return t.length === 1 && n.length === 1 ? Zt(t[0], n[0]) : [];
1721
1734
  }
1722
1735
  function Q(t, n) {
1723
1736
  if (!t.length) return [];
@@ -1732,20 +1745,24 @@ function Q(t, n) {
1732
1745
  }), e;
1733
1746
  }
1734
1747
  function lt(t, n) {
1735
- return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? ae(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt([e], n)) : n.flatMap((e) => lt(t, [e]));
1748
+ return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? de(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt([e], n)) : n.flatMap((e) => lt(t, [e]));
1736
1749
  }
1750
+ const zt = Symbol.for("pantograph:Diagram");
1737
1751
  class O extends ut {
1738
1752
  constructor(e = [], { ignoreChecks: s = !1 } = {}) {
1739
1753
  super();
1740
- C(this, "figures");
1741
- C(this, "_boundingBox", null);
1742
- s || fe(e), this.figures = e;
1754
+ b(this, "figures");
1755
+ b(this, "_boundingBox", null);
1756
+ Object.defineProperty(this, zt, { value: !0 }), s || me(e), this.figures = e;
1757
+ }
1758
+ static isInstance(e) {
1759
+ return !!e && e[zt] === !0;
1743
1760
  }
1744
1761
  get isEmpty() {
1745
1762
  return this.figures.length === 0;
1746
1763
  }
1747
1764
  get boundingBox() {
1748
- if (this.isEmpty) return new pn();
1765
+ if (this.isEmpty) return new Pn();
1749
1766
  if (this._boundingBox === null) {
1750
1767
  let e = this.figures[0].boundingBox;
1751
1768
  for (const s of this.figures.slice(1))
@@ -1771,7 +1788,7 @@ class O extends ut {
1771
1788
  );
1772
1789
  }
1773
1790
  overlappingStrands(e) {
1774
- return this.figures.flatMap((s) => e instanceof O ? e.figures.flatMap(
1791
+ return this.figures.flatMap((s) => O.isInstance(e) ? e.figures.flatMap(
1775
1792
  (i) => s.overlappingStrands(i)
1776
1793
  ) : s.overlappingStrands(e));
1777
1794
  }
@@ -1785,7 +1802,7 @@ class O extends ut {
1785
1802
  return new O(lt(this.figures, e.figures));
1786
1803
  }
1787
1804
  }
1788
- function fe(t) {
1805
+ function me(t) {
1789
1806
  for (const [n, e] of it(t))
1790
1807
  if (n.intersects(e))
1791
1808
  throw new Error("Diagram figures must not intersect");
@@ -1798,14 +1815,14 @@ export {
1798
1815
  Z as a,
1799
1816
  G as b,
1800
1817
  Q as c,
1801
- Dt as d,
1802
- Xt as e,
1803
- de as f,
1804
- Hn as g,
1805
- It as h,
1818
+ jt as d,
1819
+ Jt as e,
1820
+ Ie as f,
1821
+ Gn as g,
1822
+ Et as h,
1806
1823
  lt as i,
1807
1824
  K as l,
1808
- dn as p,
1809
- vt as s
1825
+ In as p,
1826
+ Ot as s
1810
1827
  };
1811
- //# sourceMappingURL=models-CFd5lRKc.js.map
1828
+ //# sourceMappingURL=models-BHeLX0dj.js.map