replicad-pantograph 0.10.0 → 0.10.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.
- package/dist/es/index.d.ts +8 -0
- package/dist/es/replicad-pantograph.js +791 -423
- package/dist/es/replicad-pantograph.js.map +1 -1
- package/dist/studio/replicad-pantograph.js +791 -423
- package/package.json +3 -3
|
@@ -6,7 +6,7 @@ var Me = (r) => {
|
|
|
6
6
|
};
|
|
7
7
|
var Be = (r, s, t) => s in r ? Oe(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
8
8
|
var q$2 = (r, s, t) => Be(r, typeof s != "symbol" ? s + "" : s, t), oe$1 = (r, s, t) => s.has(r) || Me("Cannot " + t);
|
|
9
|
-
var ht$
|
|
9
|
+
var ht$2 = (r, s, t) => (oe$1(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le$1 = (r, s, t) => s.has(r) ? Me("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), Dt$1 = (r, s, t, e) => (oe$1(r, s, "write to private field"), s.set(r, t), t), he = (r, s, t) => (oe$1(r, s, "access private method"), t);
|
|
10
10
|
function zt(r, s, t, e) {
|
|
11
11
|
return r <= e && s >= t;
|
|
12
12
|
}
|
|
@@ -85,7 +85,7 @@ function Te(r, s = 1e-9) {
|
|
|
85
85
|
).values()
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
const fe$1 = Math.PI / 180, Ue = 180 / Math.PI, Z$1 = (r) => `[${r[0]}, ${r[1]}]`, Y$
|
|
88
|
+
const fe$1 = Math.PI / 180, Ue = 180 / Math.PI, Z$1 = (r) => `[${r[0]}, ${r[1]}]`, Y$2 = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it$3 = ([r, s], [t, e]) => [r + t, s + e], Q$2 = ([r, s], [t, e]) => [r - t, s - e], It$2 = ([r, s]) => r * r + s * s, an$1 = ([r, s]) => Math.sqrt(It$2([r, s])), nt$2 = ([r, s], t) => [r * t, s * t], Rt$1 = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J$3 = (r, s = [0, 0]) => Math.sqrt(Rt$1(r, s));
|
|
89
89
|
function St$2([r, s], [t, e]) {
|
|
90
90
|
return r * e - s * t;
|
|
91
91
|
}
|
|
@@ -96,7 +96,7 @@ function un$1([r, s], [t, e] = [0, 0]) {
|
|
|
96
96
|
return Math.atan2(e * r - s * t, r * t + s * e);
|
|
97
97
|
}
|
|
98
98
|
function H$1([r, s]) {
|
|
99
|
-
const t = J$
|
|
99
|
+
const t = J$3([r, s]);
|
|
100
100
|
return [r / t, s / t];
|
|
101
101
|
}
|
|
102
102
|
function Tt(r, s) {
|
|
@@ -107,21 +107,21 @@ function Ye([r, s]) {
|
|
|
107
107
|
return Math.atan2(s, r);
|
|
108
108
|
}
|
|
109
109
|
function We(r) {
|
|
110
|
-
const s = J$
|
|
110
|
+
const s = J$3(r), t = Ye(r);
|
|
111
111
|
return [s, t];
|
|
112
112
|
}
|
|
113
113
|
function Ie(r, s, t = 1e-9) {
|
|
114
114
|
const e = St$2(r, s), n = It$2(r), i = It$2(s);
|
|
115
115
|
return e * e < n * i * t * t;
|
|
116
116
|
}
|
|
117
|
-
function tt$
|
|
117
|
+
function tt$3(r) {
|
|
118
118
|
return [-r[1], r[0]];
|
|
119
119
|
}
|
|
120
120
|
function Qt$1(r) {
|
|
121
121
|
return [r[1], -r[0]];
|
|
122
122
|
}
|
|
123
123
|
function Qe(r, s, t) {
|
|
124
|
-
return Y$
|
|
124
|
+
return Y$2(t, r) || Ie(Q$2(t, r), s);
|
|
125
125
|
}
|
|
126
126
|
const Mt$2 = (r, s) => {
|
|
127
127
|
const [t, e, n, i, o, l, h, a, u] = r, [c, g, d, w, p, P, f, M, E] = s;
|
|
@@ -153,7 +153,7 @@ const Mt$2 = (r, s) => {
|
|
|
153
153
|
const [s, t, e, n, i, o, l, h, a] = r;
|
|
154
154
|
return [s, n, l, t, i, h, e, o, a];
|
|
155
155
|
};
|
|
156
|
-
let et$
|
|
156
|
+
let et$4 = class et {
|
|
157
157
|
constructor(s) {
|
|
158
158
|
q$2(this, "_matrix", [1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
159
159
|
s && (this._matrix = [...s]);
|
|
@@ -209,38 +209,38 @@ let et$3 = class et {
|
|
|
209
209
|
};
|
|
210
210
|
class Ze {
|
|
211
211
|
translateX(s) {
|
|
212
|
-
const t = new et$
|
|
212
|
+
const t = new et$4().translate(s, 0);
|
|
213
213
|
return this.transform(t);
|
|
214
214
|
}
|
|
215
215
|
translateY(s) {
|
|
216
|
-
const t = new et$
|
|
216
|
+
const t = new et$4().translate(0, s);
|
|
217
217
|
return this.transform(t);
|
|
218
218
|
}
|
|
219
219
|
translate(s, t) {
|
|
220
|
-
const e = new et$
|
|
220
|
+
const e = new et$4().translate(s, t);
|
|
221
221
|
return this.transform(e);
|
|
222
222
|
}
|
|
223
223
|
translateTo([s, t]) {
|
|
224
|
-
const e = new et$
|
|
224
|
+
const e = new et$4().translate(s, t);
|
|
225
225
|
return this.transform(e);
|
|
226
226
|
}
|
|
227
227
|
rotate(s, t) {
|
|
228
|
-
const e = new et$
|
|
228
|
+
const e = new et$4().rotate(
|
|
229
229
|
s * fe$1,
|
|
230
230
|
t
|
|
231
231
|
);
|
|
232
232
|
return this.transform(e);
|
|
233
233
|
}
|
|
234
234
|
scale(s, t) {
|
|
235
|
-
const e = new et$
|
|
235
|
+
const e = new et$4().scale(s, t);
|
|
236
236
|
return this.transform(e);
|
|
237
237
|
}
|
|
238
238
|
mirrorCenter(s) {
|
|
239
|
-
const t = new et$
|
|
239
|
+
const t = new et$4().mirrorCenter(s);
|
|
240
240
|
return this.transform(t);
|
|
241
241
|
}
|
|
242
242
|
mirror(s = "x", t) {
|
|
243
|
-
const e = new et$
|
|
243
|
+
const e = new et$4();
|
|
244
244
|
return s === "x" ? e.mirrorX() : s === "y" ? e.mirrorY() : e.mirrorLine(s, t), this.transform(e);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
@@ -262,7 +262,7 @@ let xt$1 = class xt extends Ze {
|
|
|
262
262
|
return this.repr;
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
|
-
let at$
|
|
265
|
+
let at$3 = class at extends xt$1 {
|
|
266
266
|
constructor() {
|
|
267
267
|
super(...arguments);
|
|
268
268
|
q$2(this, "segmentType", "LINE");
|
|
@@ -279,7 +279,7 @@ let at$2 = class at extends xt$1 {
|
|
|
279
279
|
return it$3(this.firstPoint, nt$2(this.V, t));
|
|
280
280
|
}
|
|
281
281
|
get length() {
|
|
282
|
-
return J$
|
|
282
|
+
return J$3(this.firstPoint, this.lastPoint);
|
|
283
283
|
}
|
|
284
284
|
get squareLength() {
|
|
285
285
|
return Rt$1(this.firstPoint, this.lastPoint);
|
|
@@ -301,7 +301,7 @@ let at$2 = class at extends xt$1 {
|
|
|
301
301
|
return it$3(this.firstPoint, nt$2(this.V, 0.5));
|
|
302
302
|
}
|
|
303
303
|
isSame(t) {
|
|
304
|
-
return t instanceof at ? Y$
|
|
304
|
+
return t instanceof at ? Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) : !1;
|
|
305
305
|
}
|
|
306
306
|
clone() {
|
|
307
307
|
return new at(this.firstPoint, this.lastPoint);
|
|
@@ -320,14 +320,14 @@ let at$2 = class at extends xt$1 {
|
|
|
320
320
|
distanceFrom(t) {
|
|
321
321
|
const e = Q$2(t, this.firstPoint), n = Pe(e, this.V) / this.squareLength;
|
|
322
322
|
if (n < 0)
|
|
323
|
-
return J$
|
|
323
|
+
return J$3(t, this.firstPoint);
|
|
324
324
|
if (n > 1)
|
|
325
|
-
return J$
|
|
325
|
+
return J$3(t, this.lastPoint);
|
|
326
326
|
const i = this.paramPoint(n);
|
|
327
|
-
return J$
|
|
327
|
+
return J$3(t, i);
|
|
328
328
|
}
|
|
329
329
|
isOnSegment(t) {
|
|
330
|
-
if (Y$
|
|
330
|
+
if (Y$2(t, this.firstPoint, this.precision)) return !0;
|
|
331
331
|
const e = Q$2(t, this.firstPoint);
|
|
332
332
|
if (!Ie(this.V, e)) return !1;
|
|
333
333
|
const n = Pe(e, this.V) / this.squareLength;
|
|
@@ -341,7 +341,7 @@ let at$2 = class at extends xt$1 {
|
|
|
341
341
|
return H$1(this.V);
|
|
342
342
|
}
|
|
343
343
|
get normalVector() {
|
|
344
|
-
return tt$
|
|
344
|
+
return tt$3(H$1(this.V));
|
|
345
345
|
}
|
|
346
346
|
get tangentAtFirstPoint() {
|
|
347
347
|
return H$1(this.V);
|
|
@@ -411,7 +411,7 @@ function cn$1(r, s, t = !1, e) {
|
|
|
411
411
|
).sort((h, a) => h[0] - a[0]);
|
|
412
412
|
if (l.length === 0) return null;
|
|
413
413
|
if (l.length === 1) return null;
|
|
414
|
-
if (l.length === 2) return new at$
|
|
414
|
+
if (l.length === 2) return new at$3(l[0], l[1]);
|
|
415
415
|
throw console.error(l), new Error(
|
|
416
416
|
"Unexpected number of points while intersecting parallel lines"
|
|
417
417
|
);
|
|
@@ -423,7 +423,7 @@ const Ot$1 = (r, s) => {
|
|
|
423
423
|
const t = Q$2(r, s);
|
|
424
424
|
return We(t);
|
|
425
425
|
};
|
|
426
|
-
let ct$
|
|
426
|
+
let ct$3 = class ct extends xt$1 {
|
|
427
427
|
constructor(t, e, n, i = !1, { ignoreChecks: o = !1 } = {}) {
|
|
428
428
|
super(t, e);
|
|
429
429
|
q$2(this, "segmentType", "ARC");
|
|
@@ -436,9 +436,9 @@ let ct$2 = class ct extends xt$1 {
|
|
|
436
436
|
q$2(this, "_lastAngle", null);
|
|
437
437
|
q$2(this, "_boundingBox", null);
|
|
438
438
|
if (this.center = n, this.clockwise = i, !o) {
|
|
439
|
-
if (Y$
|
|
439
|
+
if (Y$2(t, e))
|
|
440
440
|
throw new Error("Invalid arc, cannot be a full circle");
|
|
441
|
-
if (Math.abs(this.radius - J$
|
|
441
|
+
if (Math.abs(this.radius - J$3(this.lastPoint, this.center)) > this.precision)
|
|
442
442
|
throw new Error(
|
|
443
443
|
`Invalid arc, radius does not match between ${Z$1(
|
|
444
444
|
t
|
|
@@ -501,7 +501,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
501
501
|
return i;
|
|
502
502
|
}
|
|
503
503
|
get radius() {
|
|
504
|
-
return this._radius === null && (this._radius = J$
|
|
504
|
+
return this._radius === null && (this._radius = J$3(this.firstPoint, this.center)), this._radius;
|
|
505
505
|
}
|
|
506
506
|
get firstAngle() {
|
|
507
507
|
if (this._firstAngle === null) {
|
|
@@ -527,7 +527,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
527
527
|
return this.paramPoint(0.5);
|
|
528
528
|
}
|
|
529
529
|
isSame(t) {
|
|
530
|
-
return !(t instanceof ct) || !Y$
|
|
530
|
+
return !(t instanceof ct) || !Y$2(this.center, t.center) ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
|
|
531
531
|
}
|
|
532
532
|
clone() {
|
|
533
533
|
return new ct(
|
|
@@ -567,7 +567,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
567
567
|
);
|
|
568
568
|
}
|
|
569
569
|
isOnSegment(t) {
|
|
570
|
-
if (Y$
|
|
570
|
+
if (Y$2(t, this.firstPoint) || Y$2(t, this.lastPoint))
|
|
571
571
|
return !0;
|
|
572
572
|
const [e, n] = Ot$1(t, this.center);
|
|
573
573
|
if (Math.abs(e - this.radius) > this.precision) return !1;
|
|
@@ -586,15 +586,15 @@ let ct$2 = class ct extends xt$1 {
|
|
|
586
586
|
if (!this.isValidParameter(i))
|
|
587
587
|
throw new Error("Point is not on the arc");
|
|
588
588
|
const o = Tt(1, n);
|
|
589
|
-
return (this.clockwise ? Qt$1 : tt$
|
|
589
|
+
return (this.clockwise ? Qt$1 : tt$3)(H$1(o));
|
|
590
590
|
}
|
|
591
591
|
get tangentAtFirstPoint() {
|
|
592
592
|
const t = Tt(1, this.firstAngle);
|
|
593
|
-
return (this.clockwise ? Qt$1 : tt$
|
|
593
|
+
return (this.clockwise ? Qt$1 : tt$3)(H$1(t));
|
|
594
594
|
}
|
|
595
595
|
get tangentAtLastPoint() {
|
|
596
596
|
const t = Tt(1, this.lastAngle);
|
|
597
|
-
return (this.clockwise ? Qt$1 : tt$
|
|
597
|
+
return (this.clockwise ? Qt$1 : tt$3)(H$1(t));
|
|
598
598
|
}
|
|
599
599
|
splitAt(t) {
|
|
600
600
|
let e;
|
|
@@ -630,7 +630,7 @@ let ct$2 = class ct extends xt$1 {
|
|
|
630
630
|
}
|
|
631
631
|
};
|
|
632
632
|
function fn$1(r, s, t) {
|
|
633
|
-
const e = new at$
|
|
633
|
+
const e = new at$3(s, r), n = new at$3(s, t), i = tt$3(e.tangentAtFirstPoint), o = tt$3(n.tangentAtLastPoint), l = me(
|
|
634
634
|
{ firstPoint: e.midPoint, V: i, precision: 1e-9 },
|
|
635
635
|
{ firstPoint: n.midPoint, V: o, precision: 1e-9 }
|
|
636
636
|
);
|
|
@@ -640,7 +640,7 @@ function fn$1(r, s, t) {
|
|
|
640
640
|
Q$2(r, s),
|
|
641
641
|
Q$2(t, s)
|
|
642
642
|
) > 0;
|
|
643
|
-
return new ct$
|
|
643
|
+
return new ct$3(
|
|
644
644
|
r,
|
|
645
645
|
t,
|
|
646
646
|
it$3(e.midPoint, nt$2(i, l.intersectionParam1)),
|
|
@@ -649,11 +649,11 @@ function fn$1(r, s, t) {
|
|
|
649
649
|
);
|
|
650
650
|
}
|
|
651
651
|
function mn$2(r, s, t) {
|
|
652
|
-
const e = new at$
|
|
652
|
+
const e = new at$3(r, s), n = tt$3(e.tangentAtFirstPoint), i = me(
|
|
653
653
|
{ firstPoint: e.midPoint, V: n, precision: 1e-9 },
|
|
654
654
|
{
|
|
655
655
|
firstPoint: r,
|
|
656
|
-
V: tt$
|
|
656
|
+
V: tt$3(t),
|
|
657
657
|
precision: 1e-9
|
|
658
658
|
}
|
|
659
659
|
);
|
|
@@ -666,7 +666,7 @@ function mn$2(r, s, t) {
|
|
|
666
666
|
Q$2(o, r),
|
|
667
667
|
Q$2(o, it$3(r, t))
|
|
668
668
|
) < 0;
|
|
669
|
-
return new ct$
|
|
669
|
+
return new ct$3(r, s, o, l, {
|
|
670
670
|
ignoreChecks: !0
|
|
671
671
|
});
|
|
672
672
|
}
|
|
@@ -781,7 +781,7 @@ function qe(r) {
|
|
|
781
781
|
});
|
|
782
782
|
}), t;
|
|
783
783
|
}
|
|
784
|
-
var
|
|
784
|
+
var $$1 = {};
|
|
785
785
|
const ts = Object.prototype.toString;
|
|
786
786
|
function Ct$2(r) {
|
|
787
787
|
const s = ts.call(r);
|
|
@@ -848,7 +848,7 @@ const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
848
848
|
__proto__: null,
|
|
849
849
|
default: rs
|
|
850
850
|
}, Symbol.toStringTag, { value: "Module" })), ls = /* @__PURE__ */ qe(os);
|
|
851
|
-
Object.defineProperty(
|
|
851
|
+
Object.defineProperty($$1, "__esModule", { value: !0 });
|
|
852
852
|
var st$3 = ss, je = ls;
|
|
853
853
|
const Ut$1 = " ".repeat(2), Fe = " ".repeat(4);
|
|
854
854
|
function hs() {
|
|
@@ -1299,12 +1299,12 @@ function cs(r, s) {
|
|
|
1299
1299
|
return this;
|
|
1300
1300
|
};
|
|
1301
1301
|
}
|
|
1302
|
-
function ot$
|
|
1302
|
+
function ot$4(r, s, t) {
|
|
1303
1303
|
let e = t ? r.rows : r.rows - 1;
|
|
1304
1304
|
if (s < 0 || s > e)
|
|
1305
1305
|
throw new RangeError("Row index out of range");
|
|
1306
1306
|
}
|
|
1307
|
-
function lt$
|
|
1307
|
+
function lt$3(r, s, t) {
|
|
1308
1308
|
let e = t ? r.columns : r.columns - 1;
|
|
1309
1309
|
if (s < 0 || s > e)
|
|
1310
1310
|
throw new RangeError("Column index out of range");
|
|
@@ -1728,7 +1728,7 @@ let V$1 = class V {
|
|
|
1728
1728
|
return this.mulS(-1);
|
|
1729
1729
|
}
|
|
1730
1730
|
getRow(s) {
|
|
1731
|
-
ot$
|
|
1731
|
+
ot$4(this, s);
|
|
1732
1732
|
let t = [];
|
|
1733
1733
|
for (let e = 0; e < this.columns; e++)
|
|
1734
1734
|
t.push(this.get(s, e));
|
|
@@ -1738,13 +1738,13 @@ let V$1 = class V {
|
|
|
1738
1738
|
return _$3.rowVector(this.getRow(s));
|
|
1739
1739
|
}
|
|
1740
1740
|
setRow(s, t) {
|
|
1741
|
-
ot$
|
|
1741
|
+
ot$4(this, s), t = Pt$2(this, t);
|
|
1742
1742
|
for (let e = 0; e < this.columns; e++)
|
|
1743
1743
|
this.set(s, e, t[e]);
|
|
1744
1744
|
return this;
|
|
1745
1745
|
}
|
|
1746
1746
|
swapRows(s, t) {
|
|
1747
|
-
ot$
|
|
1747
|
+
ot$4(this, s), ot$4(this, t);
|
|
1748
1748
|
for (let e = 0; e < this.columns; e++) {
|
|
1749
1749
|
let n = this.get(s, e);
|
|
1750
1750
|
this.set(s, e, this.get(t, e)), this.set(t, e, n);
|
|
@@ -1752,7 +1752,7 @@ let V$1 = class V {
|
|
|
1752
1752
|
return this;
|
|
1753
1753
|
}
|
|
1754
1754
|
getColumn(s) {
|
|
1755
|
-
lt$
|
|
1755
|
+
lt$3(this, s);
|
|
1756
1756
|
let t = [];
|
|
1757
1757
|
for (let e = 0; e < this.rows; e++)
|
|
1758
1758
|
t.push(this.get(e, s));
|
|
@@ -1762,13 +1762,13 @@ let V$1 = class V {
|
|
|
1762
1762
|
return _$3.columnVector(this.getColumn(s));
|
|
1763
1763
|
}
|
|
1764
1764
|
setColumn(s, t) {
|
|
1765
|
-
lt$
|
|
1765
|
+
lt$3(this, s), t = bt$2(this, t);
|
|
1766
1766
|
for (let e = 0; e < this.rows; e++)
|
|
1767
1767
|
this.set(e, s, t[e]);
|
|
1768
1768
|
return this;
|
|
1769
1769
|
}
|
|
1770
1770
|
swapColumns(s, t) {
|
|
1771
|
-
lt$
|
|
1771
|
+
lt$3(this, s), lt$3(this, t);
|
|
1772
1772
|
for (let e = 0; e < this.rows; e++) {
|
|
1773
1773
|
let n = this.get(e, s);
|
|
1774
1774
|
this.set(e, s, this.get(e, t)), this.set(e, t, n);
|
|
@@ -1832,13 +1832,13 @@ let V$1 = class V {
|
|
|
1832
1832
|
return this;
|
|
1833
1833
|
}
|
|
1834
1834
|
mulRow(s, t) {
|
|
1835
|
-
ot$
|
|
1835
|
+
ot$4(this, s);
|
|
1836
1836
|
for (let e = 0; e < this.columns; e++)
|
|
1837
1837
|
this.set(s, e, this.get(s, e) * t);
|
|
1838
1838
|
return this;
|
|
1839
1839
|
}
|
|
1840
1840
|
mulColumn(s, t) {
|
|
1841
|
-
lt$
|
|
1841
|
+
lt$3(this, s);
|
|
1842
1842
|
for (let e = 0; e < this.rows; e++)
|
|
1843
1843
|
this.set(e, s, this.get(e, s) * t);
|
|
1844
1844
|
return this;
|
|
@@ -1918,7 +1918,7 @@ let V$1 = class V {
|
|
|
1918
1918
|
return t;
|
|
1919
1919
|
}
|
|
1920
1920
|
maxRow(s) {
|
|
1921
|
-
if (ot$
|
|
1921
|
+
if (ot$4(this, s), this.isEmpty())
|
|
1922
1922
|
return NaN;
|
|
1923
1923
|
let t = this.get(s, 0);
|
|
1924
1924
|
for (let e = 1; e < this.columns; e++)
|
|
@@ -1926,14 +1926,14 @@ let V$1 = class V {
|
|
|
1926
1926
|
return t;
|
|
1927
1927
|
}
|
|
1928
1928
|
maxRowIndex(s) {
|
|
1929
|
-
ot$
|
|
1929
|
+
ot$4(this, s), yt$2(this);
|
|
1930
1930
|
let t = this.get(s, 0), e = [s, 0];
|
|
1931
1931
|
for (let n = 1; n < this.columns; n++)
|
|
1932
1932
|
this.get(s, n) > t && (t = this.get(s, n), e[1] = n);
|
|
1933
1933
|
return e;
|
|
1934
1934
|
}
|
|
1935
1935
|
minRow(s) {
|
|
1936
|
-
if (ot$
|
|
1936
|
+
if (ot$4(this, s), this.isEmpty())
|
|
1937
1937
|
return NaN;
|
|
1938
1938
|
let t = this.get(s, 0);
|
|
1939
1939
|
for (let e = 1; e < this.columns; e++)
|
|
@@ -1941,14 +1941,14 @@ let V$1 = class V {
|
|
|
1941
1941
|
return t;
|
|
1942
1942
|
}
|
|
1943
1943
|
minRowIndex(s) {
|
|
1944
|
-
ot$
|
|
1944
|
+
ot$4(this, s), yt$2(this);
|
|
1945
1945
|
let t = this.get(s, 0), e = [s, 0];
|
|
1946
1946
|
for (let n = 1; n < this.columns; n++)
|
|
1947
1947
|
this.get(s, n) < t && (t = this.get(s, n), e[1] = n);
|
|
1948
1948
|
return e;
|
|
1949
1949
|
}
|
|
1950
1950
|
maxColumn(s) {
|
|
1951
|
-
if (lt$
|
|
1951
|
+
if (lt$3(this, s), this.isEmpty())
|
|
1952
1952
|
return NaN;
|
|
1953
1953
|
let t = this.get(0, s);
|
|
1954
1954
|
for (let e = 1; e < this.rows; e++)
|
|
@@ -1956,14 +1956,14 @@ let V$1 = class V {
|
|
|
1956
1956
|
return t;
|
|
1957
1957
|
}
|
|
1958
1958
|
maxColumnIndex(s) {
|
|
1959
|
-
lt$
|
|
1959
|
+
lt$3(this, s), yt$2(this);
|
|
1960
1960
|
let t = this.get(0, s), e = [0, s];
|
|
1961
1961
|
for (let n = 1; n < this.rows; n++)
|
|
1962
1962
|
this.get(n, s) > t && (t = this.get(n, s), e[0] = n);
|
|
1963
1963
|
return e;
|
|
1964
1964
|
}
|
|
1965
1965
|
minColumn(s) {
|
|
1966
|
-
if (lt$
|
|
1966
|
+
if (lt$3(this, s), this.isEmpty())
|
|
1967
1967
|
return NaN;
|
|
1968
1968
|
let t = this.get(0, s);
|
|
1969
1969
|
for (let e = 1; e < this.rows; e++)
|
|
@@ -1971,7 +1971,7 @@ let V$1 = class V {
|
|
|
1971
1971
|
return t;
|
|
1972
1972
|
}
|
|
1973
1973
|
minColumnIndex(s) {
|
|
1974
|
-
lt$
|
|
1974
|
+
lt$3(this, s), yt$2(this);
|
|
1975
1975
|
let t = this.get(0, s), e = [0, s];
|
|
1976
1976
|
for (let n = 1; n < this.rows; n++)
|
|
1977
1977
|
this.get(n, s) < t && (t = this.get(n, s), e[0] = n);
|
|
@@ -2466,13 +2466,13 @@ let _$3 = (dt$1 = class extends V$1 {
|
|
|
2466
2466
|
return this.data[t][e];
|
|
2467
2467
|
}
|
|
2468
2468
|
removeRow(t) {
|
|
2469
|
-
return ot$
|
|
2469
|
+
return ot$4(this, t), this.data.splice(t, 1), this.rows -= 1, this;
|
|
2470
2470
|
}
|
|
2471
2471
|
addRow(t, e) {
|
|
2472
|
-
return e === void 0 && (e = t, t = this.rows), ot$
|
|
2472
|
+
return e === void 0 && (e = t, t = this.rows), ot$4(this, t, !0), e = Float64Array.from(Pt$2(this, e)), this.data.splice(t, 0, e), this.rows += 1, this;
|
|
2473
2473
|
}
|
|
2474
2474
|
removeColumn(t) {
|
|
2475
|
-
lt$
|
|
2475
|
+
lt$3(this, t);
|
|
2476
2476
|
for (let e = 0; e < this.rows; e++) {
|
|
2477
2477
|
const n = new Float64Array(this.columns - 1);
|
|
2478
2478
|
for (let i = 0; i < t; i++)
|
|
@@ -2484,7 +2484,7 @@ let _$3 = (dt$1 = class extends V$1 {
|
|
|
2484
2484
|
return this.columns -= 1, this;
|
|
2485
2485
|
}
|
|
2486
2486
|
addColumn(t, e) {
|
|
2487
|
-
typeof e > "u" && (e = t, t = this.columns), lt$
|
|
2487
|
+
typeof e > "u" && (e = t, t = this.columns), lt$3(this, t, !0), e = bt$2(this, e);
|
|
2488
2488
|
for (let n = 0; n < this.rows; n++) {
|
|
2489
2489
|
const i = new Float64Array(this.columns + 1);
|
|
2490
2490
|
let o = 0;
|
|
@@ -2510,7 +2510,7 @@ ue$1 = function(t, e) {
|
|
|
2510
2510
|
this.rows = t, this.columns = e;
|
|
2511
2511
|
}, dt$1);
|
|
2512
2512
|
cs(V$1, _$3);
|
|
2513
|
-
var K$
|
|
2513
|
+
var K$3;
|
|
2514
2514
|
const Jt = class Jt extends V$1 {
|
|
2515
2515
|
/**
|
|
2516
2516
|
* @param {number | AbstractMatrix | ArrayLike<ArrayLike<number>>} diagonalSize
|
|
@@ -2519,27 +2519,27 @@ const Jt = class Jt extends V$1 {
|
|
|
2519
2519
|
constructor(t) {
|
|
2520
2520
|
super();
|
|
2521
2521
|
/** @type {Matrix} */
|
|
2522
|
-
le$1(this, K$
|
|
2522
|
+
le$1(this, K$3);
|
|
2523
2523
|
if (_$3.isMatrix(t)) {
|
|
2524
2524
|
if (!t.isSymmetric())
|
|
2525
2525
|
throw new TypeError("not symmetric data");
|
|
2526
|
-
Dt$1(this, K$
|
|
2526
|
+
Dt$1(this, K$3, _$3.copy(
|
|
2527
2527
|
t,
|
|
2528
2528
|
new _$3(t.rows, t.rows)
|
|
2529
2529
|
));
|
|
2530
2530
|
} else if (Number.isInteger(t) && t >= 0)
|
|
2531
|
-
Dt$1(this, K$
|
|
2532
|
-
else if (Dt$1(this, K$
|
|
2531
|
+
Dt$1(this, K$3, new _$3(t, t));
|
|
2532
|
+
else if (Dt$1(this, K$3, new _$3(t)), !this.isSymmetric())
|
|
2533
2533
|
throw new TypeError("not symmetric data");
|
|
2534
2534
|
}
|
|
2535
2535
|
get size() {
|
|
2536
|
-
return ht$
|
|
2536
|
+
return ht$2(this, K$3).size;
|
|
2537
2537
|
}
|
|
2538
2538
|
get rows() {
|
|
2539
|
-
return ht$
|
|
2539
|
+
return ht$2(this, K$3).rows;
|
|
2540
2540
|
}
|
|
2541
2541
|
get columns() {
|
|
2542
|
-
return ht$
|
|
2542
|
+
return ht$2(this, K$3).columns;
|
|
2543
2543
|
}
|
|
2544
2544
|
get diagonalSize() {
|
|
2545
2545
|
return this.rows;
|
|
@@ -2578,18 +2578,18 @@ const Jt = class Jt extends V$1 {
|
|
|
2578
2578
|
return new _$3(this);
|
|
2579
2579
|
}
|
|
2580
2580
|
get(t, e) {
|
|
2581
|
-
return ht$
|
|
2581
|
+
return ht$2(this, K$3).get(t, e);
|
|
2582
2582
|
}
|
|
2583
2583
|
set(t, e, n) {
|
|
2584
|
-
return ht$
|
|
2584
|
+
return ht$2(this, K$3).set(t, e, n), ht$2(this, K$3).set(e, t, n), this;
|
|
2585
2585
|
}
|
|
2586
2586
|
removeCross(t) {
|
|
2587
|
-
return ht$
|
|
2587
|
+
return ht$2(this, K$3).removeRow(t), ht$2(this, K$3).removeColumn(t), this;
|
|
2588
2588
|
}
|
|
2589
2589
|
addCross(t, e) {
|
|
2590
2590
|
e === void 0 && (e = t, t = this.diagonalSize);
|
|
2591
2591
|
const n = e.slice();
|
|
2592
|
-
return n.splice(t, 1), ht$
|
|
2592
|
+
return n.splice(t, 1), ht$2(this, K$3).addRow(t, n), ht$2(this, K$3).addColumn(t, e), this;
|
|
2593
2593
|
}
|
|
2594
2594
|
/**
|
|
2595
2595
|
* @param {Mask[]} mask
|
|
@@ -2669,7 +2669,7 @@ const Jt = class Jt extends V$1 {
|
|
|
2669
2669
|
yield this.get(t, e), ++e >= this.diagonalSize && (e = ++t);
|
|
2670
2670
|
}
|
|
2671
2671
|
};
|
|
2672
|
-
K$
|
|
2672
|
+
K$3 = new WeakMap();
|
|
2673
2673
|
let pt$1 = Jt;
|
|
2674
2674
|
pt$1.prototype.klassType = "SymmetricMatrix";
|
|
2675
2675
|
let te$1 = class te extends pt$1 {
|
|
@@ -2755,7 +2755,7 @@ let ft$2 = class ft extends V$1 {
|
|
|
2755
2755
|
};
|
|
2756
2756
|
class Cs extends ft$2 {
|
|
2757
2757
|
constructor(s, t) {
|
|
2758
|
-
lt$
|
|
2758
|
+
lt$3(s, t), super(s, s.rows, 1), this.column = t;
|
|
2759
2759
|
}
|
|
2760
2760
|
set(s, t, e) {
|
|
2761
2761
|
return this.matrix.set(s, this.column, e), this;
|
|
@@ -2799,7 +2799,7 @@ class xs extends ft$2 {
|
|
|
2799
2799
|
}
|
|
2800
2800
|
class As extends ft$2 {
|
|
2801
2801
|
constructor(s, t) {
|
|
2802
|
-
ot$
|
|
2802
|
+
ot$4(s, t), super(s, 1, s.columns), this.row = t;
|
|
2803
2803
|
}
|
|
2804
2804
|
set(s, t, e) {
|
|
2805
2805
|
return this.matrix.set(this.row, t, e), this;
|
|
@@ -2885,7 +2885,7 @@ class Ae extends V$1 {
|
|
|
2885
2885
|
return s * this.columns + t;
|
|
2886
2886
|
}
|
|
2887
2887
|
}
|
|
2888
|
-
let rt$
|
|
2888
|
+
let rt$4 = class rt extends V$1 {
|
|
2889
2889
|
constructor(s) {
|
|
2890
2890
|
super(), this.data = s, this.rows = s.length, this.columns = s[0].length;
|
|
2891
2891
|
}
|
|
@@ -2898,12 +2898,12 @@ let rt$3 = class rt extends V$1 {
|
|
|
2898
2898
|
};
|
|
2899
2899
|
function Ls(r, s) {
|
|
2900
2900
|
if (st$3.isAnyArray(r))
|
|
2901
|
-
return r[0] && st$3.isAnyArray(r[0]) ? new rt$
|
|
2901
|
+
return r[0] && st$3.isAnyArray(r[0]) ? new rt$4(r) : new Ae(r, s);
|
|
2902
2902
|
throw new Error("the argument is not an array");
|
|
2903
2903
|
}
|
|
2904
2904
|
let ee$1 = class ee {
|
|
2905
2905
|
constructor(s) {
|
|
2906
|
-
s = rt$
|
|
2906
|
+
s = rt$4.checkMatrix(s);
|
|
2907
2907
|
let t = s.clone(), e = t.rows, n = t.columns, i = new Float64Array(e), o = 1, l, h, a, u, c, g, d, w, p;
|
|
2908
2908
|
for (l = 0; l < e; l++)
|
|
2909
2909
|
i[l] = l;
|
|
@@ -2989,7 +2989,7 @@ function ut(r, s) {
|
|
|
2989
2989
|
}
|
|
2990
2990
|
class pe {
|
|
2991
2991
|
constructor(s) {
|
|
2992
|
-
s = rt$
|
|
2992
|
+
s = rt$4.checkMatrix(s);
|
|
2993
2993
|
let t = s.clone(), e = s.rows, n = s.columns, i = new Float64Array(n), o, l, h, a;
|
|
2994
2994
|
for (h = 0; h < n; h++) {
|
|
2995
2995
|
let u = 0;
|
|
@@ -3065,7 +3065,7 @@ class pe {
|
|
|
3065
3065
|
}
|
|
3066
3066
|
let vt$2 = class vt {
|
|
3067
3067
|
constructor(s, t = {}) {
|
|
3068
|
-
if (s = rt$
|
|
3068
|
+
if (s = rt$4.checkMatrix(s), s.isEmpty())
|
|
3069
3069
|
throw new Error("Matrix must be non-empty");
|
|
3070
3070
|
let e = s.rows, n = s.columns;
|
|
3071
3071
|
const {
|
|
@@ -3343,10 +3343,10 @@ let vt$2 = class vt {
|
|
|
3343
3343
|
}
|
|
3344
3344
|
};
|
|
3345
3345
|
function Ds(r, s = !1) {
|
|
3346
|
-
return r = rt$
|
|
3346
|
+
return r = rt$4.checkMatrix(r), s ? new vt$2(r).inverse() : Ve(r, _$3.eye(r.rows));
|
|
3347
3347
|
}
|
|
3348
3348
|
function Ve(r, s, t = !1) {
|
|
3349
|
-
return r = rt$
|
|
3349
|
+
return r = rt$4.checkMatrix(r), s = rt$4.checkMatrix(s), t ? new vt$2(r).solve(s) : r.isSquare() ? new ee$1(r).solve(s) : new pe(r).solve(s);
|
|
3350
3350
|
}
|
|
3351
3351
|
function Xt$1(r) {
|
|
3352
3352
|
if (r = _$3.checkMatrix(r), r.isSquare()) {
|
|
@@ -3433,7 +3433,7 @@ function Ws(r, s = r, t = {}) {
|
|
|
3433
3433
|
let Ne = class {
|
|
3434
3434
|
constructor(s, t = {}) {
|
|
3435
3435
|
const { assumeSymmetric: e = !1 } = t;
|
|
3436
|
-
if (s = rt$
|
|
3436
|
+
if (s = rt$4.checkMatrix(s), !s.isSquare())
|
|
3437
3437
|
throw new Error("Matrix is not a square matrix");
|
|
3438
3438
|
if (s.isEmpty())
|
|
3439
3439
|
throw new Error("Matrix must be non-empty");
|
|
@@ -3696,7 +3696,7 @@ function Wt(r, s, t, e) {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
class $e {
|
|
3698
3698
|
constructor(s) {
|
|
3699
|
-
if (s = rt$
|
|
3699
|
+
if (s = rt$4.checkMatrix(s), !s.isSymmetric())
|
|
3700
3700
|
throw new Error("Matrix is not symmetric");
|
|
3701
3701
|
let t = s, e = t.rows, n = new _$3(e, e), i = !0, o, l, h;
|
|
3702
3702
|
for (l = 0; l < e; l++) {
|
|
@@ -3716,7 +3716,7 @@ class $e {
|
|
|
3716
3716
|
return this.positiveDefinite;
|
|
3717
3717
|
}
|
|
3718
3718
|
solve(s) {
|
|
3719
|
-
s = rt$
|
|
3719
|
+
s = rt$4.checkMatrix(s);
|
|
3720
3720
|
let t = this.L, e = t.rows;
|
|
3721
3721
|
if (s.rows !== e)
|
|
3722
3722
|
throw new Error("Matrix dimensions do not match");
|
|
@@ -3743,7 +3743,7 @@ class $e {
|
|
|
3743
3743
|
}
|
|
3744
3744
|
class Le {
|
|
3745
3745
|
constructor(s, t = {}) {
|
|
3746
|
-
s = rt$
|
|
3746
|
+
s = rt$4.checkMatrix(s);
|
|
3747
3747
|
let { Y: e } = t;
|
|
3748
3748
|
const {
|
|
3749
3749
|
scaleScores: n = !1,
|
|
@@ -3752,7 +3752,7 @@ class Le {
|
|
|
3752
3752
|
} = t;
|
|
3753
3753
|
let l;
|
|
3754
3754
|
if (e) {
|
|
3755
|
-
if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$3.columnVector(e) : e = rt$
|
|
3755
|
+
if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$3.columnVector(e) : e = rt$4.checkMatrix(e), e.rows !== s.rows)
|
|
3756
3756
|
throw new Error("Y should have the same number of rows as X");
|
|
3757
3757
|
l = e.getColumnVector(0);
|
|
3758
3758
|
} else
|
|
@@ -3771,42 +3771,42 @@ class Le {
|
|
|
3771
3771
|
this.w = c.transpose(), this.s = a.transpose().mmul(a).sqrt(), n ? this.t = a.clone().div(this.s.get(0, 0)) : this.t = a, this.xResidual = s.sub(a.mmul(c.transpose()));
|
|
3772
3772
|
}
|
|
3773
3773
|
}
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
var Js =
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
var De =
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
var Re =
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3774
|
+
$$1.AbstractMatrix = V$1;
|
|
3775
|
+
$$1.CHO = $e;
|
|
3776
|
+
$$1.CholeskyDecomposition = $e;
|
|
3777
|
+
$$1.DistanceMatrix = te$1;
|
|
3778
|
+
$$1.EVD = Ne;
|
|
3779
|
+
var Js = $$1.EigenvalueDecomposition = Ne;
|
|
3780
|
+
$$1.LU = ee$1;
|
|
3781
|
+
$$1.LuDecomposition = ee$1;
|
|
3782
|
+
var De = $$1.Matrix = _$3;
|
|
3783
|
+
$$1.MatrixColumnSelectionView = qs;
|
|
3784
|
+
$$1.MatrixColumnView = Cs;
|
|
3785
|
+
$$1.MatrixFlipColumnView = Fs;
|
|
3786
|
+
$$1.MatrixFlipRowView = xs;
|
|
3787
|
+
$$1.MatrixRowSelectionView = Vs;
|
|
3788
|
+
$$1.MatrixRowView = As;
|
|
3789
|
+
$$1.MatrixSelectionView = Gt$1;
|
|
3790
|
+
$$1.MatrixSubView = Ns;
|
|
3791
|
+
$$1.MatrixTransposeView = $s;
|
|
3792
|
+
$$1.NIPALS = Le;
|
|
3793
|
+
$$1.Nipals = Le;
|
|
3794
|
+
$$1.QR = pe;
|
|
3795
|
+
$$1.QrDecomposition = pe;
|
|
3796
|
+
$$1.SVD = vt$2;
|
|
3797
|
+
$$1.SingularValueDecomposition = vt$2;
|
|
3798
|
+
$$1.SymmetricMatrix = pt$1;
|
|
3799
|
+
$$1.WrapperMatrix1D = Ae;
|
|
3800
|
+
$$1.WrapperMatrix2D = rt$4;
|
|
3801
|
+
$$1.correlation = Ws;
|
|
3802
|
+
$$1.covariance = Ys;
|
|
3803
|
+
var Re = $$1.default = _$3;
|
|
3804
|
+
$$1.determinant = Xt$1;
|
|
3805
|
+
$$1.inverse = Ds;
|
|
3806
|
+
$$1.linearDependencies = Bs;
|
|
3807
|
+
$$1.pseudoInverse = Us;
|
|
3808
|
+
$$1.solve = Ve;
|
|
3809
|
+
$$1.wrap = Ls;
|
|
3810
3810
|
const Ks = Js, Hs = De;
|
|
3811
3811
|
Re.Matrix && Re.Matrix;
|
|
3812
3812
|
function qt(r, s, t) {
|
|
@@ -4036,7 +4036,7 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4036
4036
|
);
|
|
4037
4037
|
}
|
|
4038
4038
|
get alignedCurve() {
|
|
4039
|
-
const t = [-this.firstPoint[0], -this.firstPoint[1]], e = Q$2(this.lastPoint, this.firstPoint), n = Math.atan2(e[1], e[0]), i = new et$
|
|
4039
|
+
const t = [-this.firstPoint[0], -this.firstPoint[1]], e = Q$2(this.lastPoint, this.firstPoint), n = Math.atan2(e[1], e[0]), i = new et$4();
|
|
4040
4040
|
return i.translate(t[0], t[1]), i.rotate(-n), this.transform(i);
|
|
4041
4041
|
}
|
|
4042
4042
|
getInflexionParameters() {
|
|
@@ -4067,13 +4067,13 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4067
4067
|
);
|
|
4068
4068
|
}
|
|
4069
4069
|
isSame(t) {
|
|
4070
|
-
return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$
|
|
4070
|
+
return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.firstControlPoint, t.firstControlPoint) && Y$2(this.lastControlPoint, t.lastControlPoint);
|
|
4071
4071
|
}
|
|
4072
4072
|
distanceFrom(t) {
|
|
4073
4073
|
const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
|
|
4074
4074
|
return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
|
|
4075
|
-
J$
|
|
4076
|
-
J$
|
|
4075
|
+
J$3(this.firstPoint, t),
|
|
4076
|
+
J$3(this.lastPoint, t)
|
|
4077
4077
|
) : Math.sqrt(n.fMin);
|
|
4078
4078
|
}
|
|
4079
4079
|
isOnSegment(t) {
|
|
@@ -4109,13 +4109,13 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4109
4109
|
}
|
|
4110
4110
|
normalAt(t) {
|
|
4111
4111
|
const e = this.tangentAt(t);
|
|
4112
|
-
return tt$
|
|
4112
|
+
return tt$3(e);
|
|
4113
4113
|
}
|
|
4114
4114
|
get normalAtFirstPoint() {
|
|
4115
|
-
return tt$
|
|
4115
|
+
return tt$3(this.tangentAtFirstPoint);
|
|
4116
4116
|
}
|
|
4117
4117
|
get normalAtLastPoint() {
|
|
4118
|
-
return tt$
|
|
4118
|
+
return tt$3(this.tangentAtLastPoint);
|
|
4119
4119
|
}
|
|
4120
4120
|
splitAtParameters(t, e = null) {
|
|
4121
4121
|
const n = [...t];
|
|
@@ -4203,8 +4203,8 @@ let Et$1 = class Et extends xt$1 {
|
|
|
4203
4203
|
return ze(e - t, n, i, o).filter((l) => l >= -this.precision && l <= 1 + this.precision);
|
|
4204
4204
|
}
|
|
4205
4205
|
pointToParam(t) {
|
|
4206
|
-
if (Y$
|
|
4207
|
-
if (Y$
|
|
4206
|
+
if (Y$2(t, this.firstPoint, this.precision)) return 0;
|
|
4207
|
+
if (Y$2(t, this.lastPoint, this.precision)) return 1;
|
|
4208
4208
|
const e = this.paramsAtY(t[1]);
|
|
4209
4209
|
if (e.length === 0)
|
|
4210
4210
|
throw new Error("Point is not on the curve");
|
|
@@ -4247,7 +4247,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4247
4247
|
if (this.tiltAngle = wt$2(
|
|
4248
4248
|
c ? g : g + Math.PI / 2
|
|
4249
4249
|
), this.clockwise = h, !a) {
|
|
4250
|
-
if (Y$
|
|
4250
|
+
if (Y$2(t, e))
|
|
4251
4251
|
throw new Error("Invalid arc, cannot be a full circle");
|
|
4252
4252
|
if (!this.isPointOnEllipse(t))
|
|
4253
4253
|
throw new Error(
|
|
@@ -4370,7 +4370,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4370
4370
|
return 1 - t >= -this.precision && t >= -this.precision;
|
|
4371
4371
|
}
|
|
4372
4372
|
isSame(t) {
|
|
4373
|
-
return Y$
|
|
4373
|
+
return Y$2(this.center, t.center) && Math.abs(this.majorRadius - t.majorRadius) < this.precision && Math.abs(this.minorRadius - t.minorRadius) < this.precision && (Math.abs(this.tiltAngle - t.tiltAngle) < this.precision || Math.abs(Math.abs(this.tiltAngle - t.tiltAngle) - Math.PI) < this.precision) && (Y$2(this.firstPoint, t.firstPoint) && this.clockwise === t.clockwise || Y$2(this.firstPoint, t.lastPoint) && this.clockwise !== t.clockwise);
|
|
4374
4374
|
}
|
|
4375
4375
|
pointTheta(t) {
|
|
4376
4376
|
const e = this.ellipseReferenceFrameTransform.transform(t), n = Math.atan2(
|
|
@@ -4383,7 +4383,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4383
4383
|
return Zt(this.firstAngle, wt$2(t), this.clockwise) / this.deltaAngle;
|
|
4384
4384
|
}
|
|
4385
4385
|
isPointOnEllipse(t) {
|
|
4386
|
-
const [e, n] = this.focals, i = J$
|
|
4386
|
+
const [e, n] = this.focals, i = J$3(t, e), o = J$3(t, n);
|
|
4387
4387
|
return Math.abs(2 * this.majorRadius - i - o) < this.precision;
|
|
4388
4388
|
}
|
|
4389
4389
|
isOnSegment(t) {
|
|
@@ -4391,9 +4391,9 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4391
4391
|
}
|
|
4392
4392
|
distanceFrom(t) {
|
|
4393
4393
|
let e;
|
|
4394
|
-
if (Y$
|
|
4394
|
+
if (Y$2(t, this.center) ? e = it$3(
|
|
4395
4395
|
this.center,
|
|
4396
|
-
nt$2(tt$
|
|
4396
|
+
nt$2(tt$3(this.majorAxis), this.minorRadius)
|
|
4397
4397
|
) : e = this.reverseEllipseReferenceFrameTransform.transform(
|
|
4398
4398
|
ln$1(
|
|
4399
4399
|
this.majorRadius,
|
|
@@ -4401,27 +4401,27 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4401
4401
|
this.ellipseReferenceFrameTransform.transform(t)
|
|
4402
4402
|
)
|
|
4403
4403
|
), this.isValidParameter(this.thetaToParam(this.pointTheta(t))))
|
|
4404
|
-
return J$
|
|
4404
|
+
return J$3(t, e);
|
|
4405
4405
|
if (Qe(t, this.majorAxis, this.center)) {
|
|
4406
4406
|
const n = wt$2(
|
|
4407
4407
|
2 * Math.PI - this.pointTheta(t)
|
|
4408
4408
|
), i = this.thetaToParam(n);
|
|
4409
4409
|
if (this.isValidParameter(i))
|
|
4410
|
-
return J$
|
|
4410
|
+
return J$3(t, this.paramPoint(i));
|
|
4411
4411
|
}
|
|
4412
4412
|
return Math.min(
|
|
4413
|
-
J$
|
|
4414
|
-
J$
|
|
4413
|
+
J$3(t, this.firstPoint),
|
|
4414
|
+
J$3(t, this.lastPoint)
|
|
4415
4415
|
);
|
|
4416
4416
|
}
|
|
4417
4417
|
get ellipseReferenceFrameTransform() {
|
|
4418
|
-
return this._ellipseReferenceFrameTransform === void 0 && (this._ellipseReferenceFrameTransform = new et$
|
|
4418
|
+
return this._ellipseReferenceFrameTransform === void 0 && (this._ellipseReferenceFrameTransform = new et$4().translate(-this.center[0], -this.center[1]).rotate(-this.tiltAngle)), this._ellipseReferenceFrameTransform;
|
|
4419
4419
|
}
|
|
4420
4420
|
get reverseEllipseReferenceFrameTransform() {
|
|
4421
|
-
return this._reverseEllipseReferenceFrameTransform === void 0 && (this._reverseEllipseReferenceFrameTransform = new et$
|
|
4421
|
+
return this._reverseEllipseReferenceFrameTransform === void 0 && (this._reverseEllipseReferenceFrameTransform = new et$4().rotate(this.tiltAngle).translate(this.center[0], this.center[1])), this._reverseEllipseReferenceFrameTransform;
|
|
4422
4422
|
}
|
|
4423
4423
|
get rotateFromEllipseReferenceFrame() {
|
|
4424
|
-
return this._rotateFromEllipseReferenceFrame === void 0 && (this._rotateFromEllipseReferenceFrame = new et$
|
|
4424
|
+
return this._rotateFromEllipseReferenceFrame === void 0 && (this._rotateFromEllipseReferenceFrame = new et$4().rotate(
|
|
4425
4425
|
this.tiltAngle
|
|
4426
4426
|
)), this._rotateFromEllipseReferenceFrame;
|
|
4427
4427
|
}
|
|
@@ -4440,7 +4440,7 @@ let jt$1 = class jt extends xt$1 {
|
|
|
4440
4440
|
}
|
|
4441
4441
|
normalAt(t) {
|
|
4442
4442
|
const e = this.tangentAt(t);
|
|
4443
|
-
return this.clockwise ? tt$
|
|
4443
|
+
return this.clockwise ? tt$3(e) : Qt$1(e);
|
|
4444
4444
|
}
|
|
4445
4445
|
gradientAt(t) {
|
|
4446
4446
|
const e = this.firstAngle + t * this.deltaAngle * (this.clockwise ? -1 : 1), n = -this.majorRadius * this.deltaAngle * Math.sin(e), i = this.minorRadius * this.deltaAngle * Math.cos(e), o = this.clockwise ? [-n, -i] : [n, i];
|
|
@@ -4510,7 +4510,7 @@ function pn$1(r, s, t, e, n, i, o) {
|
|
|
4510
4510
|
!i,
|
|
4511
4511
|
o
|
|
4512
4512
|
);
|
|
4513
|
-
return Math.abs(h - a) < 1e-9 ? new ct$
|
|
4513
|
+
return Math.abs(h - a) < 1e-9 ? new ct$3(r, s, l, o) : new jt$1(r, s, l, h, a, n, o);
|
|
4514
4514
|
}
|
|
4515
4515
|
function on$1([r, s], [t, e], n, i, o, l, h) {
|
|
4516
4516
|
if (n < 0 && (n = -n), i < 0 && (i = -i), n == 0 || i == 0)
|
|
@@ -4592,13 +4592,13 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4592
4592
|
);
|
|
4593
4593
|
}
|
|
4594
4594
|
isSame(t) {
|
|
4595
|
-
return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$
|
|
4595
|
+
return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.controlPoint, t.controlPoint);
|
|
4596
4596
|
}
|
|
4597
4597
|
distanceFrom(t) {
|
|
4598
4598
|
const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
|
|
4599
4599
|
return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
|
|
4600
|
-
J$
|
|
4601
|
-
J$
|
|
4600
|
+
J$3(this.firstPoint, t),
|
|
4601
|
+
J$3(this.lastPoint, t)
|
|
4602
4602
|
) : Math.sqrt(n.fMin);
|
|
4603
4603
|
}
|
|
4604
4604
|
isOnSegment(t) {
|
|
@@ -4639,13 +4639,13 @@ let _t$1 = class _t extends xt$1 {
|
|
|
4639
4639
|
}
|
|
4640
4640
|
normalAt(t) {
|
|
4641
4641
|
const e = this.tangentAt(t);
|
|
4642
|
-
return tt$
|
|
4642
|
+
return tt$3(e);
|
|
4643
4643
|
}
|
|
4644
4644
|
get normalAtFirstPoint() {
|
|
4645
|
-
return tt$
|
|
4645
|
+
return tt$3(this.tangentAtFirstPoint);
|
|
4646
4646
|
}
|
|
4647
4647
|
get normalAtLastPoint() {
|
|
4648
|
-
return tt$
|
|
4648
|
+
return tt$3(this.tangentAtLastPoint);
|
|
4649
4649
|
}
|
|
4650
4650
|
splitAtParameters(t, e = null) {
|
|
4651
4651
|
const n = [...t];
|
|
@@ -4742,8 +4742,8 @@ function dn$1(t, n) {
|
|
|
4742
4742
|
const e = Q$2(n, t.firstPoint), s = Pe(e, t.V) / t.squareLength;
|
|
4743
4743
|
return t.paramPoint(s);
|
|
4744
4744
|
}
|
|
4745
|
-
function K$
|
|
4746
|
-
const s = e || t.precision, i = dn$1(t, n.center), o = J$
|
|
4745
|
+
function K$2(t, n, e) {
|
|
4746
|
+
const s = e || t.precision, i = dn$1(t, n.center), o = J$3(i, n.center);
|
|
4747
4747
|
if (o > n.radius + s) return [];
|
|
4748
4748
|
if (Math.abs(o - n.radius) < s) {
|
|
4749
4749
|
const c = i;
|
|
@@ -4758,7 +4758,7 @@ function K$1(t, n, e) {
|
|
|
4758
4758
|
}
|
|
4759
4759
|
const mn$1 = (t) => {
|
|
4760
4760
|
const { firstPoint: n, lastPoint: e, center: s, clockwise: i } = t;
|
|
4761
|
-
return new ct$
|
|
4761
|
+
return new ct$3(e, n, s, i, {
|
|
4762
4762
|
ignoreChecks: !0
|
|
4763
4763
|
});
|
|
4764
4764
|
}, gn$1 = (t, n) => {
|
|
@@ -4777,11 +4777,11 @@ const mn$1 = (t) => {
|
|
|
4777
4777
|
if (e.length === 0) return [];
|
|
4778
4778
|
if (e.length === 1) return [];
|
|
4779
4779
|
if (e.length === 2)
|
|
4780
|
-
return t.isSame(mn$1(n)) ? [] : [new ct$
|
|
4780
|
+
return t.isSame(mn$1(n)) ? [] : [new ct$3(e[0], e[1], t.center, t.clockwise)];
|
|
4781
4781
|
if (e.length === 3) {
|
|
4782
|
-
const s = Y$
|
|
4782
|
+
const s = Y$2(e[0], n.lastPoint) || Y$2(e[0], n.firstPoint) ? 1 : 0;
|
|
4783
4783
|
return [
|
|
4784
|
-
new ct$
|
|
4784
|
+
new ct$3(
|
|
4785
4785
|
e[0 + s],
|
|
4786
4786
|
e[1 + s],
|
|
4787
4787
|
t.center,
|
|
@@ -4790,13 +4790,13 @@ const mn$1 = (t) => {
|
|
|
4790
4790
|
];
|
|
4791
4791
|
} else if (e.length === 4)
|
|
4792
4792
|
return [
|
|
4793
|
-
new ct$
|
|
4794
|
-
new ct$
|
|
4793
|
+
new ct$3(e[0], e[1], t.center, t.clockwise),
|
|
4794
|
+
new ct$3(e[2], e[3], t.center, t.clockwise)
|
|
4795
4795
|
];
|
|
4796
4796
|
throw new Error("Bug in the arc arc overlap algorithm");
|
|
4797
4797
|
};
|
|
4798
4798
|
function Dt(t, n, e = !1, s) {
|
|
4799
|
-
const i = s || t.precision, o = J$
|
|
4799
|
+
const i = s || t.precision, o = J$3(t.center, n.center), l = t.radius + n.radius;
|
|
4800
4800
|
if (o > l + i)
|
|
4801
4801
|
return [];
|
|
4802
4802
|
const r = Math.abs(t.radius - n.radius);
|
|
@@ -4821,7 +4821,7 @@ function Dt(t, n, e = !1, s) {
|
|
|
4821
4821
|
nt$2(u, f)
|
|
4822
4822
|
), h = Math.sqrt(
|
|
4823
4823
|
t.radius * t.radius - f * f
|
|
4824
|
-
), p = tt$
|
|
4824
|
+
), p = tt$3(u), d = it$3(c, nt$2(p, h)), m = it$3(c, nt$2(p, -h)), x = [];
|
|
4825
4825
|
return t.isOnSegment(d) && n.isOnSegment(d) && x.push(d), t.isOnSegment(m) && n.isOnSegment(m) && x.push(m), x;
|
|
4826
4826
|
}
|
|
4827
4827
|
function st$2(t, n, e = 1e-9) {
|
|
@@ -4931,7 +4931,7 @@ const Pn$1 = (t) => {
|
|
|
4931
4931
|
if (s.length === 2)
|
|
4932
4932
|
return t.isSame(Pn$1(n)) ? [] : [e(s[0], s[1])];
|
|
4933
4933
|
if (s.length === 3) {
|
|
4934
|
-
const i = Y$
|
|
4934
|
+
const i = Y$2(s[0], n.lastPoint) || Y$2(s[0], n.firstPoint) ? 1 : 0;
|
|
4935
4935
|
return [e(s[0 + i], s[1 + i])];
|
|
4936
4936
|
} else if (s.length === 4)
|
|
4937
4937
|
return [e(s[0], s[1]), e(s[2], s[3])];
|
|
@@ -4939,10 +4939,10 @@ const Pn$1 = (t) => {
|
|
|
4939
4939
|
};
|
|
4940
4940
|
function xn$1(t, n, e = !1) {
|
|
4941
4941
|
const s = Math.max(t.precision, n.precision);
|
|
4942
|
-
return Y$
|
|
4942
|
+
return Y$2(t.center, n.center) && Math.abs(t.majorRadius - n.majorRadius) < s && Math.abs(t.minorRadius - n.minorRadius) < s && (Math.abs(t.tiltAngle - n.tiltAngle) < s || Math.abs(Math.abs(t.tiltAngle - n.tiltAngle) - Math.PI) < s) ? e ? wn$1(t, n) : [] : Rt(t, n).filter((l) => t.isOnSegment(l) && n.isOnSegment(l));
|
|
4943
4943
|
}
|
|
4944
4944
|
function Pt$1(t, n) {
|
|
4945
|
-
const [e, s] = t.firstPoint, [i, o] = t.lastPoint, l = new et$
|
|
4945
|
+
const [e, s] = t.firstPoint, [i, o] = t.lastPoint, l = new et$4().translate(-e, -s).rotate(-Math.atan2(o - s, i - e)), r = l.clone().inverse(), u = n.transform(l);
|
|
4946
4946
|
return u.paramsAtY(0).map((a) => u.paramPoint(a)).map((a) => r.transform(a)).filter((a) => t.isOnSegment(a));
|
|
4947
4947
|
}
|
|
4948
4948
|
const Sn$1 = (t, n = 1e-9) => {
|
|
@@ -4974,7 +4974,7 @@ function E(t, { firstPoint: n, lastPoint: e }, s = 1e-9) {
|
|
|
4974
4974
|
const i = Q$2(e, n);
|
|
4975
4975
|
return Math.abs(i[0]) < s ? i[1] > 0 ? n[0] - t[0] : t[0] - n[0] : Math.abs(i[1]) < s ? i[0] > 0 ? t[1] - n[1] : n[1] - t[1] : St$2(i, Q$2(t, n)) / an$1(i);
|
|
4976
4976
|
}
|
|
4977
|
-
let ct$
|
|
4977
|
+
let ct$2 = class ct {
|
|
4978
4978
|
constructor(n, e, s, i) {
|
|
4979
4979
|
this.firstPoint = n, this.lastPoint = e, this.negativeThickness = s, this.positiveThickness = i;
|
|
4980
4980
|
}
|
|
@@ -4985,7 +4985,7 @@ let ct$1 = class ct {
|
|
|
4985
4985
|
const Cn$1 = 3 / 4, Mn$1 = 4 / 9;
|
|
4986
4986
|
function In$1(t) {
|
|
4987
4987
|
const n = E(t.firstControlPoint, t), e = E(t.lastControlPoint, t), s = n * e > 0 ? Cn$1 : Mn$1;
|
|
4988
|
-
return new ct$
|
|
4988
|
+
return new ct$2(
|
|
4989
4989
|
t.firstPoint,
|
|
4990
4990
|
t.lastPoint,
|
|
4991
4991
|
s * Math.min(0, n, e),
|
|
@@ -4994,7 +4994,7 @@ function In$1(t) {
|
|
|
4994
4994
|
}
|
|
4995
4995
|
function An$1(t) {
|
|
4996
4996
|
const n = E(t.controlPoint, t);
|
|
4997
|
-
return new ct$
|
|
4997
|
+
return new ct$2(
|
|
4998
4998
|
t.firstPoint,
|
|
4999
4999
|
t.lastPoint,
|
|
5000
5000
|
Math.min(0, n / 2),
|
|
@@ -5009,7 +5009,7 @@ function En(t) {
|
|
|
5009
5009
|
throw new Error("Not implemented");
|
|
5010
5010
|
}
|
|
5011
5011
|
function Fn(t) {
|
|
5012
|
-
const n = t.paramPoint(0.5), e = tt$
|
|
5012
|
+
const n = t.paramPoint(0.5), e = tt$3(Q$2(n, t.firstPoint)), s = it$3(n, e), i = {
|
|
5013
5013
|
firstPoint: n,
|
|
5014
5014
|
lastPoint: s
|
|
5015
5015
|
}, o = [
|
|
@@ -5019,7 +5019,7 @@ function Fn(t) {
|
|
|
5019
5019
|
return t instanceof Et$1 ? o.push(
|
|
5020
5020
|
E(t.firstControlPoint, i),
|
|
5021
5021
|
E(t.lastControlPoint, i)
|
|
5022
|
-
) : t instanceof _t$1 && o.push(E(t.controlPoint, i)), new ct$
|
|
5022
|
+
) : t instanceof _t$1 && o.push(E(t.controlPoint, i)), new ct$2(
|
|
5023
5023
|
n,
|
|
5024
5024
|
s,
|
|
5025
5025
|
Math.min(...o),
|
|
@@ -5044,7 +5044,7 @@ function St$1(t, n) {
|
|
|
5044
5044
|
}
|
|
5045
5045
|
return e;
|
|
5046
5046
|
}
|
|
5047
|
-
class Y {
|
|
5047
|
+
let Y$1 = class Y {
|
|
5048
5048
|
constructor(n, e) {
|
|
5049
5049
|
this.from = n, this.to = e;
|
|
5050
5050
|
}
|
|
@@ -5054,7 +5054,7 @@ class Y {
|
|
|
5054
5054
|
clipCurve(n) {
|
|
5055
5055
|
return this.from === "start" ? this.to === "end" ? n : n.splitAtParameters([this.to])[0] : this.to === "end" ? n.splitAtParameters([this.from])[1] : n.splitAtParameters([this.from, this.to])[1];
|
|
5056
5056
|
}
|
|
5057
|
-
}
|
|
5057
|
+
};
|
|
5058
5058
|
function vn(t, n) {
|
|
5059
5059
|
if (t instanceof Et$1)
|
|
5060
5060
|
return new kn([
|
|
@@ -5117,15 +5117,15 @@ function yt$1(t, n) {
|
|
|
5117
5117
|
t.positiveThickness
|
|
5118
5118
|
), o = e.endDistance >= t.negativeThickness && e.endDistance <= t.positiveThickness;
|
|
5119
5119
|
if (!s.length && !i.length)
|
|
5120
|
-
return o ? new Y("start", "end") : null;
|
|
5120
|
+
return o ? new Y$1("start", "end") : null;
|
|
5121
5121
|
if (s.length === 1 && i.length === 1)
|
|
5122
|
-
return new Y(s[0], i[0]);
|
|
5122
|
+
return new Y$1(s[0], i[0]);
|
|
5123
5123
|
if (s.length === 2 && i.length === 2)
|
|
5124
5124
|
throw new Error(
|
|
5125
5125
|
"Bug in the clipping algorithm, unexpected number of crossing points"
|
|
5126
5126
|
);
|
|
5127
5127
|
const l = s.length ? s : i;
|
|
5128
|
-
return l.length === 2 ? new Y(l[0], l[1]) : o ? new Y(l[0], "end") : new Y("start", l[0]);
|
|
5128
|
+
return l.length === 2 ? new Y$1(l[0], l[1]) : o ? new Y$1(l[0], "end") : new Y$1("start", l[0]);
|
|
5129
5129
|
}
|
|
5130
5130
|
function bt$1(t, n) {
|
|
5131
5131
|
const e = En(t), s = yt$1(e, n);
|
|
@@ -5137,23 +5137,23 @@ function bt$1(t, n) {
|
|
|
5137
5137
|
);
|
|
5138
5138
|
return o ? s.size > o.size ? o.clipCurve(n) : s.clipCurve(n) : null;
|
|
5139
5139
|
}
|
|
5140
|
-
const W$
|
|
5140
|
+
const W$3 = (t) => t instanceof _t$1 ? It$2(Q$2(t.controlPoint, t.firstPoint)) + It$2(Q$2(t.controlPoint, t.lastPoint)) : It$2(Q$2(t.firstControlPoint, t.firstPoint)) + It$2(Q$2(t.lastControlPoint, t.firstControlPoint)) + It$2(Q$2(t.lastControlPoint, t.lastPoint));
|
|
5141
5141
|
function D(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
|
|
5142
5142
|
const i = Math.max(e * e, Number.EPSILON * 10);
|
|
5143
|
-
let o = t, l = n, r = W$
|
|
5143
|
+
let o = t, l = n, r = W$3(o), u = W$3(l);
|
|
5144
5144
|
for (let a = 0; a < s; a++) {
|
|
5145
5145
|
const f = r > i ? bt$1(l, o) : o;
|
|
5146
5146
|
if (!f) return [];
|
|
5147
|
-
const c = W$
|
|
5147
|
+
const c = W$3(f), h = u > i ? bt$1(f, l) : l;
|
|
5148
5148
|
if (!h) return [];
|
|
5149
|
-
const p = W$
|
|
5149
|
+
const p = W$3(h);
|
|
5150
5150
|
if (c <= i && p <= i)
|
|
5151
5151
|
return [
|
|
5152
5152
|
f.boundingBox.intersection(h.boundingBox).center
|
|
5153
5153
|
];
|
|
5154
|
-
if (Y$
|
|
5154
|
+
if (Y$2(f.firstPoint, f.lastPoint) && h.isOnSegment(f.firstPoint))
|
|
5155
5155
|
return [f.firstPoint];
|
|
5156
|
-
if (Y$
|
|
5156
|
+
if (Y$2(h.firstPoint, h.lastPoint) && f.isOnSegment(h.firstPoint))
|
|
5157
5157
|
return [h.firstPoint];
|
|
5158
5158
|
if (c > 0.8 * r && p > 0.8 * u)
|
|
5159
5159
|
if (c / r > p / u) {
|
|
@@ -5205,7 +5205,7 @@ function On$1(t, n) {
|
|
|
5205
5205
|
if (e.length === 2)
|
|
5206
5206
|
return [t.splitAt(e)[1]];
|
|
5207
5207
|
if (e.length === 3)
|
|
5208
|
-
return Y$
|
|
5208
|
+
return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
|
|
5209
5209
|
if (e.length === 4)
|
|
5210
5210
|
return [t];
|
|
5211
5211
|
}
|
|
@@ -5232,7 +5232,7 @@ function Tn$1(t, n) {
|
|
|
5232
5232
|
if (e.length === 2)
|
|
5233
5233
|
return [t.splitAt(e)[1]];
|
|
5234
5234
|
if (e.length === 3)
|
|
5235
|
-
return Y$
|
|
5235
|
+
return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
|
|
5236
5236
|
if (e.length === 4)
|
|
5237
5237
|
return [t];
|
|
5238
5238
|
}
|
|
@@ -5246,7 +5246,7 @@ function Ln(t, n, e = !1) {
|
|
|
5246
5246
|
return D(t, n, s);
|
|
5247
5247
|
}
|
|
5248
5248
|
function de(t, n, e) {
|
|
5249
|
-
if (t instanceof at$
|
|
5249
|
+
if (t instanceof at$3 && n instanceof at$3) {
|
|
5250
5250
|
const s = cn$1(
|
|
5251
5251
|
t,
|
|
5252
5252
|
n,
|
|
@@ -5255,42 +5255,42 @@ function de(t, n, e) {
|
|
|
5255
5255
|
);
|
|
5256
5256
|
return s === null ? [] : [s];
|
|
5257
5257
|
}
|
|
5258
|
-
if (t instanceof at$
|
|
5259
|
-
return K$
|
|
5260
|
-
if (t instanceof ct$
|
|
5261
|
-
return K$
|
|
5262
|
-
if (t instanceof ct$
|
|
5258
|
+
if (t instanceof at$3 && n instanceof ct$3)
|
|
5259
|
+
return K$2(t, n, e);
|
|
5260
|
+
if (t instanceof ct$3 && n instanceof at$3)
|
|
5261
|
+
return K$2(n, t, e);
|
|
5262
|
+
if (t instanceof ct$3 && n instanceof ct$3)
|
|
5263
5263
|
return Dt(t, n, !1, e);
|
|
5264
5264
|
throw new Error("Not implemented");
|
|
5265
5265
|
}
|
|
5266
5266
|
function Z(t, n, e) {
|
|
5267
|
-
if (t instanceof at$
|
|
5267
|
+
if (t instanceof at$3 && n instanceof at$3) {
|
|
5268
5268
|
const s = cn$1(
|
|
5269
5269
|
t,
|
|
5270
5270
|
n,
|
|
5271
5271
|
!0,
|
|
5272
5272
|
e
|
|
5273
5273
|
);
|
|
5274
|
-
return s === null ? { intersections: [], overlaps: [], count: 0 } : s instanceof at$
|
|
5274
|
+
return s === null ? { intersections: [], overlaps: [], count: 0 } : s instanceof at$3 ? { intersections: [], overlaps: [s], count: 1 } : { intersections: [s], overlaps: [], count: 1 };
|
|
5275
5275
|
}
|
|
5276
5276
|
if (!t.boundingBox.overlaps(n.boundingBox))
|
|
5277
5277
|
return { intersections: [], overlaps: [], count: 0 };
|
|
5278
|
-
if (t instanceof at$
|
|
5279
|
-
const s = K$
|
|
5278
|
+
if (t instanceof at$3 && n instanceof ct$3) {
|
|
5279
|
+
const s = K$2(t, n, e);
|
|
5280
5280
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5281
5281
|
}
|
|
5282
|
-
if (t instanceof ct$
|
|
5283
|
-
const s = K$
|
|
5282
|
+
if (t instanceof ct$3 && n instanceof at$3) {
|
|
5283
|
+
const s = K$2(n, t, e);
|
|
5284
5284
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5285
5285
|
}
|
|
5286
|
-
if (t instanceof ct$
|
|
5286
|
+
if (t instanceof ct$3 && n instanceof ct$3) {
|
|
5287
5287
|
const s = Dt(
|
|
5288
5288
|
t,
|
|
5289
5289
|
n,
|
|
5290
5290
|
!0,
|
|
5291
5291
|
e
|
|
5292
5292
|
);
|
|
5293
|
-
return s.length ? s[0] instanceof ct$
|
|
5293
|
+
return s.length ? s[0] instanceof ct$3 ? {
|
|
5294
5294
|
intersections: [],
|
|
5295
5295
|
overlaps: s,
|
|
5296
5296
|
count: s.length
|
|
@@ -5300,7 +5300,7 @@ function Z(t, n, e) {
|
|
|
5300
5300
|
count: s.length
|
|
5301
5301
|
} : { intersections: [], overlaps: [], count: 0 };
|
|
5302
5302
|
}
|
|
5303
|
-
if (t instanceof at$
|
|
5303
|
+
if (t instanceof at$3 && n instanceof jt$1) {
|
|
5304
5304
|
const s = st$2(
|
|
5305
5305
|
t,
|
|
5306
5306
|
n,
|
|
@@ -5308,7 +5308,7 @@ function Z(t, n, e) {
|
|
|
5308
5308
|
);
|
|
5309
5309
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5310
5310
|
}
|
|
5311
|
-
if (n instanceof at$
|
|
5311
|
+
if (n instanceof at$3 && t instanceof jt$1) {
|
|
5312
5312
|
const s = st$2(
|
|
5313
5313
|
n,
|
|
5314
5314
|
t,
|
|
@@ -5316,11 +5316,11 @@ function Z(t, n, e) {
|
|
|
5316
5316
|
);
|
|
5317
5317
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5318
5318
|
}
|
|
5319
|
-
if (t instanceof ct$
|
|
5319
|
+
if (t instanceof ct$3 && n instanceof jt$1) {
|
|
5320
5320
|
const s = gt(t, n);
|
|
5321
5321
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5322
5322
|
}
|
|
5323
|
-
if (n instanceof ct$
|
|
5323
|
+
if (n instanceof ct$3 && t instanceof jt$1) {
|
|
5324
5324
|
const s = gt(n, t);
|
|
5325
5325
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5326
5326
|
}
|
|
@@ -5340,27 +5340,27 @@ function Z(t, n, e) {
|
|
|
5340
5340
|
count: s.length
|
|
5341
5341
|
} : { intersections: [], overlaps: [], count: 0 };
|
|
5342
5342
|
}
|
|
5343
|
-
if (t instanceof at$
|
|
5343
|
+
if (t instanceof at$3 && (n instanceof Et$1 || n instanceof _t$1)) {
|
|
5344
5344
|
const s = Pt$1(t, n);
|
|
5345
5345
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5346
5346
|
}
|
|
5347
|
-
if (n instanceof at$
|
|
5347
|
+
if (n instanceof at$3 && (t instanceof Et$1 || t instanceof _t$1)) {
|
|
5348
5348
|
const s = Pt$1(n, t);
|
|
5349
5349
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5350
5350
|
}
|
|
5351
|
-
if ((t instanceof ct$
|
|
5351
|
+
if ((t instanceof ct$3 || t instanceof jt$1) && n instanceof _t$1) {
|
|
5352
5352
|
const s = xt(t, n);
|
|
5353
5353
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5354
5354
|
}
|
|
5355
|
-
if ((n instanceof ct$
|
|
5355
|
+
if ((n instanceof ct$3 || n instanceof jt$1) && t instanceof _t$1) {
|
|
5356
5356
|
const s = xt(n, t);
|
|
5357
5357
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5358
5358
|
}
|
|
5359
|
-
if ((t instanceof ct$
|
|
5359
|
+
if ((t instanceof ct$3 || t instanceof jt$1) && n instanceof Et$1) {
|
|
5360
5360
|
const s = wt$1(t, n);
|
|
5361
5361
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5362
5362
|
}
|
|
5363
|
-
if ((n instanceof ct$
|
|
5363
|
+
if ((n instanceof ct$3 || n instanceof jt$1) && t instanceof Et$1) {
|
|
5364
5364
|
const s = wt$1(n, t);
|
|
5365
5365
|
return { intersections: s, overlaps: [], count: s.length };
|
|
5366
5366
|
}
|
|
@@ -5469,22 +5469,22 @@ function qn(t, n = "Stroke") {
|
|
|
5469
5469
|
if (l.count !== 0) {
|
|
5470
5470
|
if (l.count === 1 && !l.overlaps.length) {
|
|
5471
5471
|
const u = e - s, a = l.intersections[0];
|
|
5472
|
-
if (u === 1 && Y$
|
|
5472
|
+
if (u === 1 && Y$2(i.firstPoint, a, r) || u === -1 && Y$2(i.lastPoint, a, r) || u === t.length - 1 && Y$2(i.lastPoint, a, r) && Y$2(o.firstPoint, a, r) || -u === t.length - 1 && Y$2(i.firstPoint, a, r) && Y$2(o.lastPoint, a, r))
|
|
5473
5473
|
return;
|
|
5474
5474
|
}
|
|
5475
|
-
if (!(l.count === 2 && t.length === 2 && (Y$
|
|
5475
|
+
if (!(l.count === 2 && t.length === 2 && (Y$2(
|
|
5476
5476
|
i.firstPoint,
|
|
5477
5477
|
l.intersections[0],
|
|
5478
5478
|
r
|
|
5479
|
-
) && Y$
|
|
5479
|
+
) && Y$2(
|
|
5480
5480
|
i.lastPoint,
|
|
5481
5481
|
l.intersections[1],
|
|
5482
5482
|
r
|
|
5483
|
-
) || Y$
|
|
5483
|
+
) || Y$2(
|
|
5484
5484
|
i.firstPoint,
|
|
5485
5485
|
l.intersections[1],
|
|
5486
5486
|
r
|
|
5487
|
-
) && Y$
|
|
5487
|
+
) && Y$2(
|
|
5488
5488
|
i.lastPoint,
|
|
5489
5489
|
l.intersections[0],
|
|
5490
5490
|
r
|
|
@@ -5503,7 +5503,7 @@ function jt(t, n = "Stroke") {
|
|
|
5503
5503
|
throw new Error(`${n} must have at least one segment`);
|
|
5504
5504
|
Kt([t.slice(0, -1), t.slice(1)]).forEach(
|
|
5505
5505
|
([e, s]) => {
|
|
5506
|
-
if (!Y$
|
|
5506
|
+
if (!Y$2(e.lastPoint, s.firstPoint))
|
|
5507
5507
|
throw new Error(
|
|
5508
5508
|
`${n} segments must be connected, but ${e.info} and ${s.info} are not`
|
|
5509
5509
|
);
|
|
@@ -5511,13 +5511,13 @@ function jt(t, n = "Stroke") {
|
|
|
5511
5511
|
), qn(t, n);
|
|
5512
5512
|
}
|
|
5513
5513
|
function Ct$1(t, n) {
|
|
5514
|
-
return !!(t instanceof at$
|
|
5514
|
+
return !!(t instanceof at$3 && n instanceof at$3 && Ie(t.V, n.V) || t instanceof ct$3 && n instanceof ct$3 && Y$2(t.center, n.center) && t.radius - n.radius < t.precision);
|
|
5515
5515
|
}
|
|
5516
5516
|
function Mt$1(t, n) {
|
|
5517
|
-
if (t instanceof at$
|
|
5518
|
-
return new at$
|
|
5519
|
-
if (t instanceof ct$
|
|
5520
|
-
return new ct$
|
|
5517
|
+
if (t instanceof at$3 && n instanceof at$3)
|
|
5518
|
+
return new at$3(t.firstPoint, n.lastPoint);
|
|
5519
|
+
if (t instanceof ct$3 && n instanceof ct$3)
|
|
5520
|
+
return new ct$3(
|
|
5521
5521
|
t.firstPoint,
|
|
5522
5522
|
n.lastPoint,
|
|
5523
5523
|
t.center,
|
|
@@ -5536,7 +5536,7 @@ function Ht(t) {
|
|
|
5536
5536
|
const i = e[e.length - 1];
|
|
5537
5537
|
Ct$1(i, s) ? (n = !0, e.pop(), e.push(Mt$1(i, s))) : e.push(s);
|
|
5538
5538
|
}
|
|
5539
|
-
if (Y$
|
|
5539
|
+
if (Y$2(t.firstPoint, t.lastPoint) && Ct$1(
|
|
5540
5540
|
e[0],
|
|
5541
5541
|
e[e.length - 1]
|
|
5542
5542
|
)) {
|
|
@@ -5546,7 +5546,7 @@ function Ht(t) {
|
|
|
5546
5546
|
}
|
|
5547
5547
|
return n ? e : null;
|
|
5548
5548
|
}
|
|
5549
|
-
let B$
|
|
5549
|
+
let B$3 = class B extends Ut {
|
|
5550
5550
|
constructor() {
|
|
5551
5551
|
super(...arguments);
|
|
5552
5552
|
C(this, "strokeType", "STRAND");
|
|
@@ -5562,7 +5562,7 @@ let B$2 = class B extends Ut {
|
|
|
5562
5562
|
);
|
|
5563
5563
|
}
|
|
5564
5564
|
extend(e) {
|
|
5565
|
-
if (!Y$
|
|
5565
|
+
if (!Y$2(this.lastPoint, e.firstPoint))
|
|
5566
5566
|
throw console.error(this.repr, e.repr), new Error("Cannot extend strand: connection point is not the same");
|
|
5567
5567
|
return new B([...this.segments, ...e.segments]);
|
|
5568
5568
|
}
|
|
@@ -5593,14 +5593,14 @@ const zn$1 = (t, n) => {
|
|
|
5593
5593
|
}
|
|
5594
5594
|
return 1;
|
|
5595
5595
|
};
|
|
5596
|
-
let at$
|
|
5596
|
+
let at$2 = class at {
|
|
5597
5597
|
constructor(n) {
|
|
5598
5598
|
C(this, "_count", 0);
|
|
5599
5599
|
C(this, "segment");
|
|
5600
5600
|
this.segment = n;
|
|
5601
5601
|
}
|
|
5602
5602
|
update(n, e = !1) {
|
|
5603
|
-
!e && !this.segment.isOnSegment(n) || (Y$
|
|
5603
|
+
!e && !this.segment.isOnSegment(n) || (Y$2(n, this.segment.firstPoint) ? this._count += this.segment.tangentAtFirstPoint[1] > 0 ? 1 : 0 : Y$2(n, this.segment.lastPoint) ? this._count += this.segment.tangentAtLastPoint[1] > 0 ? 0 : 1 : this._count += 1);
|
|
5604
5604
|
}
|
|
5605
5605
|
get count() {
|
|
5606
5606
|
return this._count;
|
|
@@ -5616,15 +5616,15 @@ const Dn$1 = (t, n) => {
|
|
|
5616
5616
|
if (r && n.center[0] < t[0]) return 0;
|
|
5617
5617
|
const u = Math.sqrt(
|
|
5618
5618
|
n.radius * n.radius - s * s
|
|
5619
|
-
), a = new at$
|
|
5619
|
+
), a = new at$2(n);
|
|
5620
5620
|
return a.update([n.center[0] + u, t[1]]), r && a.update([n.center[0] - u, t[1]]), a.count;
|
|
5621
5621
|
}, Rn$1 = (t, n) => {
|
|
5622
|
-
const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new at$
|
|
5622
|
+
const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new at$3(t, [e, t[1]]), i = new at$2(n);
|
|
5623
5623
|
return st$2(s, n).forEach((o) => {
|
|
5624
5624
|
i.update(o, !0);
|
|
5625
5625
|
}), i.count;
|
|
5626
5626
|
}, Vn = (t, n) => {
|
|
5627
|
-
const e = new at$
|
|
5627
|
+
const e = new at$2(n);
|
|
5628
5628
|
return n.paramsAtY(t[1]).map((s) => {
|
|
5629
5629
|
try {
|
|
5630
5630
|
return n.paramPoint(s);
|
|
@@ -5639,9 +5639,9 @@ const Dn$1 = (t, n) => {
|
|
|
5639
5639
|
}), e.count;
|
|
5640
5640
|
};
|
|
5641
5641
|
function Nn(t, n) {
|
|
5642
|
-
if (n instanceof at$
|
|
5642
|
+
if (n instanceof at$3)
|
|
5643
5643
|
return zn$1(t, n);
|
|
5644
|
-
if (n instanceof ct$
|
|
5644
|
+
if (n instanceof ct$3)
|
|
5645
5645
|
return Dn$1(t, n);
|
|
5646
5646
|
if (n instanceof jt$1)
|
|
5647
5647
|
return Rn$1(t, n);
|
|
@@ -5658,7 +5658,7 @@ let _$2 = class _ extends Ut {
|
|
|
5658
5658
|
}
|
|
5659
5659
|
get clockwise() {
|
|
5660
5660
|
if (this._clockwise === null) {
|
|
5661
|
-
const e = this.segments.flatMap((i) => i instanceof at$
|
|
5661
|
+
const e = this.segments.flatMap((i) => i instanceof at$3 ? [i.firstPoint] : [i.firstPoint, i.paramPoint(0.5)]), s = e.map((i, o) => {
|
|
5662
5662
|
const l = e[(o + 1) % e.length];
|
|
5663
5663
|
return (l[0] - i[0]) * (l[1] + i[1]);
|
|
5664
5664
|
}).reduce((i, o) => i + o, 0);
|
|
@@ -5691,12 +5691,12 @@ let _$2 = class _ extends Ut {
|
|
|
5691
5691
|
}
|
|
5692
5692
|
};
|
|
5693
5693
|
function Un(t) {
|
|
5694
|
-
if (jt(t, "Loop"), !Y$
|
|
5694
|
+
if (jt(t, "Loop"), !Y$2(t[0].firstPoint, t[t.length - 1].lastPoint))
|
|
5695
5695
|
throw new Error("Loop segment must be closed");
|
|
5696
5696
|
}
|
|
5697
5697
|
const jn = [
|
|
5698
|
-
at$
|
|
5699
|
-
ct$
|
|
5698
|
+
at$3,
|
|
5699
|
+
ct$3,
|
|
5700
5700
|
jt$1,
|
|
5701
5701
|
_t$1,
|
|
5702
5702
|
Et$1
|
|
@@ -5705,13 +5705,13 @@ function Hn(t) {
|
|
|
5705
5705
|
return jn.some((n) => t instanceof n);
|
|
5706
5706
|
}
|
|
5707
5707
|
function $t(t) {
|
|
5708
|
-
if (t instanceof at$
|
|
5708
|
+
if (t instanceof at$3)
|
|
5709
5709
|
return {
|
|
5710
5710
|
type: t.segmentType,
|
|
5711
5711
|
firstPoint: t.firstPoint,
|
|
5712
5712
|
lastPoint: t.lastPoint
|
|
5713
5713
|
};
|
|
5714
|
-
if (t instanceof ct$
|
|
5714
|
+
if (t instanceof ct$3)
|
|
5715
5715
|
return {
|
|
5716
5716
|
type: t.segmentType,
|
|
5717
5717
|
firstPoint: t.firstPoint,
|
|
@@ -5747,7 +5747,7 @@ function $t(t) {
|
|
|
5747
5747
|
};
|
|
5748
5748
|
throw new Error("Unknown segment type");
|
|
5749
5749
|
}
|
|
5750
|
-
function ot$
|
|
5750
|
+
function ot$3(t) {
|
|
5751
5751
|
return {
|
|
5752
5752
|
type: "LOOP",
|
|
5753
5753
|
segments: t.segments.map($t)
|
|
@@ -5756,8 +5756,8 @@ function ot$2(t) {
|
|
|
5756
5756
|
function Yt(t) {
|
|
5757
5757
|
return {
|
|
5758
5758
|
type: "FIGURE",
|
|
5759
|
-
contour: ot$
|
|
5760
|
-
holes: t.holes.map(ot$
|
|
5759
|
+
contour: ot$3(t.contour),
|
|
5760
|
+
holes: t.holes.map(ot$3)
|
|
5761
5761
|
};
|
|
5762
5762
|
}
|
|
5763
5763
|
function $n$1(t) {
|
|
@@ -5767,12 +5767,12 @@ function $n$1(t) {
|
|
|
5767
5767
|
};
|
|
5768
5768
|
}
|
|
5769
5769
|
function It$1(t) {
|
|
5770
|
-
if (t instanceof O$
|
|
5770
|
+
if (t instanceof O$2)
|
|
5771
5771
|
return $n$1(t);
|
|
5772
|
-
if (t instanceof v$
|
|
5772
|
+
if (t instanceof v$2)
|
|
5773
5773
|
return Yt(t);
|
|
5774
5774
|
if (t instanceof _$2)
|
|
5775
|
-
return ot$
|
|
5775
|
+
return ot$3(t);
|
|
5776
5776
|
if (Hn(t))
|
|
5777
5777
|
return $t(t);
|
|
5778
5778
|
throw new Error("Unknown shape type");
|
|
@@ -5823,7 +5823,7 @@ class Yn {
|
|
|
5823
5823
|
this.ids.length = this.values.length = this.length;
|
|
5824
5824
|
}
|
|
5825
5825
|
}
|
|
5826
|
-
const At$1 = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], et$
|
|
5826
|
+
const At$1 = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], et$3 = 3;
|
|
5827
5827
|
let ft$1 = class ft {
|
|
5828
5828
|
/**
|
|
5829
5829
|
* Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
|
|
@@ -5840,8 +5840,8 @@ let ft$1 = class ft {
|
|
|
5840
5840
|
if (s !== 251)
|
|
5841
5841
|
throw new Error("Data does not appear to be in a Flatbush format.");
|
|
5842
5842
|
const o = i >> 4;
|
|
5843
|
-
if (o !== et$
|
|
5844
|
-
throw new Error(`Got v${o} data when expected v${et$
|
|
5843
|
+
if (o !== et$3)
|
|
5844
|
+
throw new Error(`Got v${o} data when expected v${et$3}.`);
|
|
5845
5845
|
const l = At$1[i & 15];
|
|
5846
5846
|
if (!l)
|
|
5847
5847
|
throw new Error("Unrecognized array type.");
|
|
@@ -5870,7 +5870,7 @@ let ft$1 = class ft {
|
|
|
5870
5870
|
const a = At$1.indexOf(this.ArrayType), f = u * 4 * this.ArrayType.BYTES_PER_ELEMENT;
|
|
5871
5871
|
if (a < 0)
|
|
5872
5872
|
throw new Error(`Unexpected typed array class: ${s}.`);
|
|
5873
|
-
o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, l + 8, u * 4), this._indices = new this.IndexArrayType(this.data, l + 8 + f, u), this._pos = u * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new i(8 + f + u * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, u * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, u), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (et$
|
|
5873
|
+
o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, l + 8, u * 4), this._indices = new this.IndexArrayType(this.data, l + 8 + f, u), this._pos = u * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new i(8 + f + u * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, u * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, u), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (et$3 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new Yn();
|
|
5874
5874
|
}
|
|
5875
5875
|
/**
|
|
5876
5876
|
* Add a given rectangle to the index.
|
|
@@ -5898,7 +5898,7 @@ let ft$1 = class ft {
|
|
|
5898
5898
|
const u = n[r++], a = n[r++], f = n[r++], c = n[r++], h = Math.floor(o * ((u + f) / 2 - this.minX) / e), p = Math.floor(o * ((a + c) / 2 - this.minY) / s);
|
|
5899
5899
|
i[l] = Gn(h, p);
|
|
5900
5900
|
}
|
|
5901
|
-
rt$
|
|
5901
|
+
rt$3(i, n, this._indices, 0, this.numItems - 1, this.nodeSize);
|
|
5902
5902
|
for (let l = 0, r = 0; l < this._levelBounds.length - 1; l++) {
|
|
5903
5903
|
const u = this._levelBounds[l];
|
|
5904
5904
|
for (; r < u; ) {
|
|
@@ -5973,7 +5973,7 @@ function Ft(t, n) {
|
|
|
5973
5973
|
}
|
|
5974
5974
|
return n[e];
|
|
5975
5975
|
}
|
|
5976
|
-
function rt$
|
|
5976
|
+
function rt$3(t, n, e, s, i, o) {
|
|
5977
5977
|
if (Math.floor(s / o) >= Math.floor(i / o)) return;
|
|
5978
5978
|
const l = t[s + i >> 1];
|
|
5979
5979
|
let r = s - 1, u = i + 1;
|
|
@@ -5987,7 +5987,7 @@ function rt$2(t, n, e, s, i, o) {
|
|
|
5987
5987
|
if (r >= u) break;
|
|
5988
5988
|
Xn(t, n, e, r, u);
|
|
5989
5989
|
}
|
|
5990
|
-
rt$
|
|
5990
|
+
rt$3(t, n, e, s, u, o), rt$3(t, n, e, u + 1, i, o);
|
|
5991
5991
|
}
|
|
5992
5992
|
function Xn(t, n, e, s, i) {
|
|
5993
5993
|
const o = t[s];
|
|
@@ -6040,7 +6040,7 @@ function Xt(t, n = 1e-7) {
|
|
|
6040
6040
|
}
|
|
6041
6041
|
}), s;
|
|
6042
6042
|
}
|
|
6043
|
-
let v$
|
|
6043
|
+
let v$2 = class v extends Ze {
|
|
6044
6044
|
constructor(e, s = [], { ignoreChecks: i = !1 } = {}) {
|
|
6045
6045
|
super();
|
|
6046
6046
|
C(this, "contour");
|
|
@@ -6078,7 +6078,7 @@ let v$1 = class v extends Ze {
|
|
|
6078
6078
|
}
|
|
6079
6079
|
overlappingStrands(e) {
|
|
6080
6080
|
const s = e instanceof v ? e.allLoops : [e], i = this.allLoops.flatMap((o) => s.flatMap((l) => o.overlappingSegments(l)));
|
|
6081
|
-
return Xt(i).map((o) => new B$
|
|
6081
|
+
return Xt(i).map((o) => new B$3(o));
|
|
6082
6082
|
}
|
|
6083
6083
|
};
|
|
6084
6084
|
function Qn(t, n = []) {
|
|
@@ -6094,9 +6094,9 @@ function Qn(t, n = []) {
|
|
|
6094
6094
|
if (e.contains(s.firstPoint))
|
|
6095
6095
|
throw console.error(It$1(e), It$1(s)), new Error("Holes must not be inside other holes");
|
|
6096
6096
|
}
|
|
6097
|
-
const J$
|
|
6097
|
+
const J$2 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn = (t, n) => {
|
|
6098
6098
|
const e = t.boundingBox, s = n.boundingBox;
|
|
6099
|
-
return J$
|
|
6099
|
+
return J$2(e.xMin, s.xMin) && J$2(e.yMin, s.yMin) && J$2(e.xMax, s.xMax) && J$2(e.yMax, s.yMax);
|
|
6100
6100
|
}, Jn = (t, n) => {
|
|
6101
6101
|
if (t.segmentsCount !== n.segmentsCount || !Wn(t, n)) return !1;
|
|
6102
6102
|
const e = t.segments, s = n.segments, i = e.length, o = (l, r) => {
|
|
@@ -6129,27 +6129,27 @@ const J$1 = (t, n, e = 1e-7) => Math.abs(t - n) <= e, Wn = (t, n) => {
|
|
|
6129
6129
|
loop: n,
|
|
6130
6130
|
isIn: o
|
|
6131
6131
|
};
|
|
6132
|
-
}), te = (t, n) => t.flatMap(({ loop: e }) => ht(
|
|
6132
|
+
}), te = (t, n) => t.flatMap(({ loop: e }) => ht$1(
|
|
6133
6133
|
n.filter(
|
|
6134
6134
|
({ loop: s, isIn: i }) => s === e || i.indexOf(e) !== -1
|
|
6135
6135
|
)
|
|
6136
6136
|
)), ne = (t, n) => {
|
|
6137
|
-
const e = n.filter(({ isIn: i }) => i.length <= 1), s = ht(
|
|
6137
|
+
const e = n.filter(({ isIn: i }) => i.length <= 1), s = ht$1(
|
|
6138
6138
|
Gt(t.map(({ loop: i }) => i))
|
|
6139
6139
|
);
|
|
6140
6140
|
return [e, ...s];
|
|
6141
|
-
}, ht = (t) => {
|
|
6141
|
+
}, ht$1 = (t) => {
|
|
6142
6142
|
if (!t.length) return [];
|
|
6143
6143
|
const n = t.filter(({ isIn: s }) => !s.length), e = t.filter(({ isIn: s }) => s.length > 1);
|
|
6144
6144
|
return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ? te(n, t) : ne(e, t);
|
|
6145
6145
|
};
|
|
6146
|
-
function X$
|
|
6146
|
+
function X$2(t) {
|
|
6147
6147
|
const n = Kn(t);
|
|
6148
|
-
return Zn(n).map(Gt).flatMap(ht).map((s) => {
|
|
6149
|
-
if (s.length === 1) return new v$
|
|
6148
|
+
return Zn(n).map(Gt).flatMap(ht$1).map((s) => {
|
|
6149
|
+
if (s.length === 1) return new v$2(s[0].loop);
|
|
6150
6150
|
s.sort((l, r) => l.isIn.length - r.isIn.length);
|
|
6151
6151
|
const [i, ...o] = s.map(({ loop: l }) => l);
|
|
6152
|
-
return new v$
|
|
6152
|
+
return new v$2(i, o);
|
|
6153
6153
|
});
|
|
6154
6154
|
}
|
|
6155
6155
|
function ee(t, n) {
|
|
@@ -6160,18 +6160,18 @@ function ee(t, n) {
|
|
|
6160
6160
|
return e;
|
|
6161
6161
|
}
|
|
6162
6162
|
function* vt$1(t, n, e) {
|
|
6163
|
-
const s = (r) => n.some((u) => Y$
|
|
6163
|
+
const s = (r) => n.some((u) => Y$2(u, r.lastPoint)), i = (r, u) => r.segmentType !== u.segmentType || !u.isOnSegment(r.firstPoint) || !u.isOnSegment(r.lastPoint) ? !1 : r.segmentType !== "LINE" ? u.isOnSegment(r.midPoint) : !0, o = (r) => e.some((u) => r.isSame(u) || i(r, u));
|
|
6164
6164
|
let l = [];
|
|
6165
6165
|
for (const r of t)
|
|
6166
|
-
s(r) ? (l.push(r), yield new B$
|
|
6167
|
-
l.length && (yield new B$
|
|
6166
|
+
s(r) ? (l.push(r), yield new B$3(l, { ignoreChecks: !0 }), l = []) : o(r) ? (l.length && (yield new B$3(l, { ignoreChecks: !0 }), l = []), yield new B$3([r], { ignoreChecks: !0 })) : l.push(r);
|
|
6167
|
+
l.length && (yield new B$3(l, { ignoreChecks: !0 }));
|
|
6168
6168
|
}
|
|
6169
6169
|
const Bt = (t, n) => {
|
|
6170
|
-
const e = t.findIndex((o) => Y$
|
|
6170
|
+
const e = t.findIndex((o) => Y$2(n, o.firstPoint)), s = t.slice(0, e);
|
|
6171
6171
|
return t.slice(e).concat(s);
|
|
6172
6172
|
}, kt = (t, n) => {
|
|
6173
6173
|
let e = t;
|
|
6174
|
-
const s = (r) => Y$
|
|
6174
|
+
const s = (r) => Y$2(r.firstPoint, n.firstPoint) && Y$2(r.lastPoint, n.lastPoint);
|
|
6175
6175
|
let i = t.findIndex(s);
|
|
6176
6176
|
if (i === -1) {
|
|
6177
6177
|
const r = t.map((u) => u.reverse());
|
|
@@ -6187,7 +6187,7 @@ const Bt = (t, n) => {
|
|
|
6187
6187
|
};
|
|
6188
6188
|
function se(t, n, e) {
|
|
6189
6189
|
return t.filter((s) => {
|
|
6190
|
-
const i = n.filter((r) => Y$
|
|
6190
|
+
const i = n.filter((r) => Y$2(r.firstPoint, s) || Y$2(r.lastPoint, s));
|
|
6191
6191
|
if (i.length % 2)
|
|
6192
6192
|
throw new Error("Bug in the intersection algo on non crossing point");
|
|
6193
6193
|
const o = i.map((r) => e.contains(r.midPoint));
|
|
@@ -6245,10 +6245,10 @@ function ie(t, n, e, s = !1) {
|
|
|
6245
6245
|
o
|
|
6246
6246
|
)
|
|
6247
6247
|
);
|
|
6248
|
-
return (!Y$
|
|
6248
|
+
return (!Y$2(
|
|
6249
6249
|
h[0].lastPoint,
|
|
6250
6250
|
c[0].lastPoint
|
|
6251
|
-
) || o.length > 0 && h[0].segmentsCount !== 1) && (h = h.map((p) => p.reverse()).reverse(), Y$
|
|
6251
|
+
) || o.length > 0 && h[0].segmentsCount !== 1) && (h = h.map((p) => p.reverse()).reverse(), Y$2(h[0].lastPoint, c[0].lastPoint) || (c = c.map((p) => p.reverse()).reverse())), Kt([c, h]).map(([p, d]) => {
|
|
6252
6252
|
if (s) {
|
|
6253
6253
|
if (((x) => x.segments.every(
|
|
6254
6254
|
(g) => o.some(
|
|
@@ -6265,7 +6265,7 @@ function Ot(t) {
|
|
|
6265
6265
|
let n = t[0];
|
|
6266
6266
|
for (const e of t.slice(1))
|
|
6267
6267
|
n = n.extend(e);
|
|
6268
|
-
if (!Y$
|
|
6268
|
+
if (!Y$2(n.firstPoint, n.lastPoint))
|
|
6269
6269
|
throw console.error(
|
|
6270
6270
|
Z$1(n.firstPoint),
|
|
6271
6271
|
Z$1(n.lastPoint)
|
|
@@ -6288,19 +6288,19 @@ function re(t) {
|
|
|
6288
6288
|
let e = t.map((i) => i.lastPoint);
|
|
6289
6289
|
e = e.slice(-1).concat(e.slice(0, -1));
|
|
6290
6290
|
const s = Kt([n, e]).flatMap(
|
|
6291
|
-
([i, o], l) => Y$
|
|
6291
|
+
([i, o], l) => Y$2(i, o) ? [] : l
|
|
6292
6292
|
);
|
|
6293
6293
|
try {
|
|
6294
6294
|
return oe(t, s);
|
|
6295
6295
|
} catch {
|
|
6296
|
-
return Xt(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => Y$
|
|
6296
|
+
return Xt(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => Y$2(o[0].firstPoint, o.at(-1).lastPoint)).map((o) => new _$2(o));
|
|
6297
6297
|
}
|
|
6298
6298
|
}
|
|
6299
6299
|
const _t = (t, n) => {
|
|
6300
6300
|
if (t.length === 0) return [n];
|
|
6301
6301
|
const e = t.at(-1);
|
|
6302
|
-
return Y$
|
|
6303
|
-
}, le = (t, n) => t.length === 0 ? [n] : Y$
|
|
6302
|
+
return Y$2(e.lastPoint, n.firstPoint) ? t.slice(0, -1).concat([e.extend(n)]) : Y$2(e.lastPoint, n.lastPoint) ? t.slice(0, -1).concat([e.extend(n.reverse())]) : t.concat([n]);
|
|
6303
|
+
}, le = (t, n) => t.length === 0 ? [n] : Y$2(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
|
|
6304
6304
|
function pt(t, n, {
|
|
6305
6305
|
firstInside: e,
|
|
6306
6306
|
secondInside: s,
|
|
@@ -6354,7 +6354,7 @@ const ue = (t, n, e) => {
|
|
|
6354
6354
|
...e
|
|
6355
6355
|
});
|
|
6356
6356
|
return Array.isArray(s) ? s : s.identical ? [t] : s.firstCurveInSecond ? [n] : s.secondCurveInFirst ? [t] : [t, n];
|
|
6357
|
-
}, tt$
|
|
6357
|
+
}, tt$2 = (t, n, e) => {
|
|
6358
6358
|
const s = pt(t, n, {
|
|
6359
6359
|
firstInside: "remove",
|
|
6360
6360
|
secondInside: "keep",
|
|
@@ -6395,10 +6395,10 @@ function ce(t) {
|
|
|
6395
6395
|
}), e.flatMap(({ current: s }) => s);
|
|
6396
6396
|
}
|
|
6397
6397
|
function Qt(t, n) {
|
|
6398
|
-
const e = ue(t.contour, n.contour), s = n.holes.flatMap((l) => tt$
|
|
6398
|
+
const e = ue(t.contour, n.contour), s = n.holes.flatMap((l) => tt$2(l, t.contour)), i = t.holes.flatMap((l) => tt$2(l, n.contour)), o = ee(t.holes, n.holes).flatMap(
|
|
6399
6399
|
([l, r]) => dt(l, r)
|
|
6400
6400
|
);
|
|
6401
|
-
return X$
|
|
6401
|
+
return X$2([
|
|
6402
6402
|
...e,
|
|
6403
6403
|
...s,
|
|
6404
6404
|
...i,
|
|
@@ -6407,39 +6407,39 @@ function Qt(t, n) {
|
|
|
6407
6407
|
}
|
|
6408
6408
|
function nt$1(t, n) {
|
|
6409
6409
|
if (t.isFull && n.isFull)
|
|
6410
|
-
return X$
|
|
6410
|
+
return X$2(tt$2(t.contour, n.contour));
|
|
6411
6411
|
if (t.isFull) {
|
|
6412
|
-
const s = tt$
|
|
6412
|
+
const s = tt$2(t.contour, n.contour), i = n.holes.flatMap(
|
|
6413
6413
|
(o) => dt(o, t.contour, { firstBoundaryInside: !0 })
|
|
6414
6414
|
);
|
|
6415
|
-
return X$
|
|
6415
|
+
return X$2([...s, ...i]);
|
|
6416
6416
|
} else if (n.isFull && !t.contour.intersects(n.contour))
|
|
6417
6417
|
if (t.contour.contains(n.contour.firstPoint)) {
|
|
6418
6418
|
const s = G(
|
|
6419
|
-
t.holes.map((i) => new v$
|
|
6419
|
+
t.holes.map((i) => new v$2(i)),
|
|
6420
6420
|
[n]
|
|
6421
6421
|
);
|
|
6422
|
-
return X$
|
|
6422
|
+
return X$2([
|
|
6423
6423
|
t.contour,
|
|
6424
6424
|
...s.flatMap((i) => i.allLoops)
|
|
6425
6425
|
]);
|
|
6426
6426
|
} else
|
|
6427
6427
|
return [t];
|
|
6428
|
-
let e = nt$1(new v$
|
|
6428
|
+
let e = nt$1(new v$2(t.contour), n);
|
|
6429
6429
|
return t.holes.forEach((s) => {
|
|
6430
|
-
e = e.flatMap((i) => nt$1(i, new v$
|
|
6430
|
+
e = e.flatMap((i) => nt$1(i, new v$2(s)));
|
|
6431
6431
|
}), e;
|
|
6432
6432
|
}
|
|
6433
6433
|
function ae(t, n) {
|
|
6434
6434
|
const e = dt(t.contour, n.contour);
|
|
6435
6435
|
if (!e.length) return [];
|
|
6436
|
-
let s = X$
|
|
6436
|
+
let s = X$2(e);
|
|
6437
6437
|
return s = Q$1(
|
|
6438
6438
|
s,
|
|
6439
|
-
t.holes.map((i) => new v$
|
|
6439
|
+
t.holes.map((i) => new v$2(i))
|
|
6440
6440
|
), Q$1(
|
|
6441
6441
|
s,
|
|
6442
|
-
n.holes.map((i) => new v$
|
|
6442
|
+
n.holes.map((i) => new v$2(i))
|
|
6443
6443
|
);
|
|
6444
6444
|
}
|
|
6445
6445
|
function G(t, n) {
|
|
@@ -6467,10 +6467,10 @@ function Q$1(t, n) {
|
|
|
6467
6467
|
e = Q$1(e, [s]);
|
|
6468
6468
|
}), e;
|
|
6469
6469
|
}
|
|
6470
|
-
function lt$
|
|
6471
|
-
return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? ae(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt$
|
|
6470
|
+
function lt$2(t, n) {
|
|
6471
|
+
return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? ae(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => lt$2([e], n)) : n.flatMap((e) => lt$2(t, [e]));
|
|
6472
6472
|
}
|
|
6473
|
-
let O$
|
|
6473
|
+
let O$2 = class O extends Ze {
|
|
6474
6474
|
constructor(e = [], { ignoreChecks: s = !1 } = {}) {
|
|
6475
6475
|
super();
|
|
6476
6476
|
C(this, "figures");
|
|
@@ -6518,7 +6518,7 @@ let O$1 = class O extends Ze {
|
|
|
6518
6518
|
return new O(Q$1(this.figures, e.figures));
|
|
6519
6519
|
}
|
|
6520
6520
|
intersect(e) {
|
|
6521
|
-
return new O(lt$
|
|
6521
|
+
return new O(lt$2(this.figures, e.figures));
|
|
6522
6522
|
}
|
|
6523
6523
|
};
|
|
6524
6524
|
function fe(t) {
|
|
@@ -6527,10 +6527,10 @@ function fe(t) {
|
|
|
6527
6527
|
throw new Error("Diagram figures must not intersect");
|
|
6528
6528
|
}
|
|
6529
6529
|
|
|
6530
|
-
var W$
|
|
6531
|
-
var q$1 = (e, t, n) => t in e ? W$
|
|
6532
|
-
var m = (e, t, n) => q$1(e, typeof t != "symbol" ? t + "" : t, n);
|
|
6533
|
-
const B$
|
|
6530
|
+
var W$2 = Object.defineProperty;
|
|
6531
|
+
var q$1 = (e, t, n) => t in e ? W$2(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
6532
|
+
var m$1 = (e, t, n) => q$1(e, typeof t != "symbol" ? t + "" : t, n);
|
|
6533
|
+
const B$2 = (e, t, n) => {
|
|
6534
6534
|
const r = St$2(e.V, t.V), i = e.precision * t.precision;
|
|
6535
6535
|
if (r * r < i)
|
|
6536
6536
|
return "parallel";
|
|
@@ -6543,33 +6543,33 @@ class S {
|
|
|
6543
6543
|
}
|
|
6544
6544
|
}
|
|
6545
6545
|
function y(e, t) {
|
|
6546
|
-
if (e instanceof at$
|
|
6547
|
-
return et$
|
|
6548
|
-
if (e instanceof ct$
|
|
6549
|
-
return rt$
|
|
6546
|
+
if (e instanceof at$3)
|
|
6547
|
+
return et$2(e, t);
|
|
6548
|
+
if (e instanceof ct$3)
|
|
6549
|
+
return rt$2(e, t);
|
|
6550
6550
|
if (e instanceof _t$1 || e instanceof Et$1)
|
|
6551
6551
|
return it$1(e, t);
|
|
6552
6552
|
throw new Error("Not implemented");
|
|
6553
6553
|
}
|
|
6554
|
-
function et$
|
|
6554
|
+
function et$2(e, t) {
|
|
6555
6555
|
const { firstPoint: n, lastPoint: r } = e, i = e.normalVector;
|
|
6556
|
-
return new at$
|
|
6556
|
+
return new at$3(
|
|
6557
6557
|
it$3(n, nt$2(i, t)),
|
|
6558
6558
|
it$3(r, nt$2(i, t))
|
|
6559
6559
|
);
|
|
6560
6560
|
}
|
|
6561
|
-
function rt$
|
|
6561
|
+
function rt$2(e, t) {
|
|
6562
6562
|
const n = it$3(
|
|
6563
6563
|
e.firstPoint,
|
|
6564
|
-
nt$2(tt$
|
|
6564
|
+
nt$2(tt$3(e.tangentAtFirstPoint), t)
|
|
6565
6565
|
), r = it$3(
|
|
6566
6566
|
e.lastPoint,
|
|
6567
|
-
nt$2(tt$
|
|
6567
|
+
nt$2(tt$3(e.tangentAtLastPoint), t)
|
|
6568
6568
|
), i = t * (e.clockwise ? 1 : -1);
|
|
6569
|
-
return e.radius + i < e.precision ? new S(n, r) : new ct$
|
|
6569
|
+
return e.radius + i < e.precision ? new S(n, r) : new ct$3(n, r, e.center, e.clockwise);
|
|
6570
6570
|
}
|
|
6571
6571
|
function b(e, t, n, r, i) {
|
|
6572
|
-
const s = B$
|
|
6572
|
+
const s = B$2(
|
|
6573
6573
|
{
|
|
6574
6574
|
V: n,
|
|
6575
6575
|
firstPoint: r,
|
|
@@ -6588,7 +6588,7 @@ function b(e, t, n, r, i) {
|
|
|
6588
6588
|
return s;
|
|
6589
6589
|
}
|
|
6590
6590
|
function it$1(e, t) {
|
|
6591
|
-
const { firstPoint: n, lastPoint: r, normalAtFirstPoint: i, normalAtLastPoint: s } = e, o = B$
|
|
6591
|
+
const { firstPoint: n, lastPoint: r, normalAtFirstPoint: i, normalAtLastPoint: s } = e, o = B$2(
|
|
6592
6592
|
{ V: i, firstPoint: n, precision: e.precision },
|
|
6593
6593
|
{ V: s, firstPoint: r, precision: e.precision }
|
|
6594
6594
|
), a = it$3(
|
|
@@ -6601,8 +6601,8 @@ function it$1(e, t) {
|
|
|
6601
6601
|
if (o === "parallel")
|
|
6602
6602
|
throw new Error("Parallel lines not expected in safe bezier offset");
|
|
6603
6603
|
if (Pe(Q$2(o, n), i) * t > 0 && Math.min(
|
|
6604
|
-
J$
|
|
6605
|
-
J$
|
|
6604
|
+
J$3(n, o),
|
|
6605
|
+
J$3(r, o)
|
|
6606
6606
|
) < t)
|
|
6607
6607
|
return new S(a, h);
|
|
6608
6608
|
if (e instanceof _t$1) {
|
|
@@ -6686,7 +6686,7 @@ function _$1(e, t, n) {
|
|
|
6686
6686
|
t.repr
|
|
6687
6687
|
), [e, t];
|
|
6688
6688
|
const { first: i, second: s } = r;
|
|
6689
|
-
return [i, new at$
|
|
6689
|
+
return [i, new at$3(i.lastPoint, s.firstPoint), s];
|
|
6690
6690
|
}
|
|
6691
6691
|
const st$1 = (e) => {
|
|
6692
6692
|
let t;
|
|
@@ -6702,15 +6702,15 @@ const st$1 = (e) => {
|
|
|
6702
6702
|
let a;
|
|
6703
6703
|
return typeof s == "number" ? a = Tt(1, s * fe$1) : a = s, { endTangent: o, startFactor: r, endFactor: i, startTangent: a };
|
|
6704
6704
|
};
|
|
6705
|
-
function z$
|
|
6706
|
-
return new O$
|
|
6705
|
+
function z$2(e, { ignoreChecks: t = !1 } = {}) {
|
|
6706
|
+
return new O$2([new v$2(new _$2([...e], { ignoreChecks: t }))]);
|
|
6707
6707
|
}
|
|
6708
|
-
let ot$
|
|
6708
|
+
let ot$2 = class ot {
|
|
6709
6709
|
constructor(t = [0, 0]) {
|
|
6710
|
-
m(this, "pointer");
|
|
6711
|
-
m(this, "firstPoint");
|
|
6712
|
-
m(this, "pendingSegments");
|
|
6713
|
-
m(this, "_nextCorner");
|
|
6710
|
+
m$1(this, "pointer");
|
|
6711
|
+
m$1(this, "firstPoint");
|
|
6712
|
+
m$1(this, "pendingSegments");
|
|
6713
|
+
m$1(this, "_nextCorner");
|
|
6714
6714
|
this.pointer = t, this.firstPoint = t, this.pendingSegments = [], this._nextCorner = null;
|
|
6715
6715
|
}
|
|
6716
6716
|
movePointerTo(t) {
|
|
@@ -6721,7 +6721,7 @@ let ot$1 = class ot {
|
|
|
6721
6721
|
return this.pointer = t, this.firstPoint = t, this;
|
|
6722
6722
|
}
|
|
6723
6723
|
saveSegment(t) {
|
|
6724
|
-
if (Y$
|
|
6724
|
+
if (Y$2(t.firstPoint, t.lastPoint))
|
|
6725
6725
|
throw new Error(`Segment has no length, ${t.repr}`);
|
|
6726
6726
|
if (!this._nextCorner)
|
|
6727
6727
|
return this.pendingSegments.push(t), this;
|
|
@@ -6733,7 +6733,7 @@ let ot$1 = class ot {
|
|
|
6733
6733
|
), this._nextCorner = null, this;
|
|
6734
6734
|
}
|
|
6735
6735
|
lineTo(t) {
|
|
6736
|
-
const n = new at$
|
|
6736
|
+
const n = new at$3(this.pointer, t);
|
|
6737
6737
|
return this.pointer = t, this.saveSegment(n);
|
|
6738
6738
|
}
|
|
6739
6739
|
line(t, n) {
|
|
@@ -6778,7 +6778,7 @@ let ot$1 = class ot {
|
|
|
6778
6778
|
}
|
|
6779
6779
|
sagittaArcTo(t, n) {
|
|
6780
6780
|
if (!n) return this.lineTo(t);
|
|
6781
|
-
const r = new at$
|
|
6781
|
+
const r = new at$3(this.pointer, t), i = tt$3(r.tangentAtFirstPoint), s = it$3(r.midPoint, nt$2(i, n));
|
|
6782
6782
|
return this.threePointsArcTo(t, s);
|
|
6783
6783
|
}
|
|
6784
6784
|
sagittaArc(t, n, r) {
|
|
@@ -6795,7 +6795,7 @@ let ot$1 = class ot {
|
|
|
6795
6795
|
}
|
|
6796
6796
|
bulgeArcTo(t, n) {
|
|
6797
6797
|
if (!n) return this.lineTo(t);
|
|
6798
|
-
const r = J$
|
|
6798
|
+
const r = J$3(this.pointer, t) / 2, i = -n * r;
|
|
6799
6799
|
return this.sagittaArcTo(t, i);
|
|
6800
6800
|
}
|
|
6801
6801
|
bulgeArc(t, n, r) {
|
|
@@ -6867,7 +6867,7 @@ let ot$1 = class ot {
|
|
|
6867
6867
|
return this.saveSegment(new _t$1(this.pointer, t, n)), this.pointer = t, this;
|
|
6868
6868
|
}
|
|
6869
6869
|
smoothCurveTo(t, n) {
|
|
6870
|
-
const { endTangent: r, startTangent: i, startFactor: s, endFactor: o } = st$1(n), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J$
|
|
6870
|
+
const { endTangent: r, startTangent: i, startFactor: s, endFactor: o } = st$1(n), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J$3(this.pointer, t) / 3;
|
|
6871
6871
|
let c;
|
|
6872
6872
|
i ? c = i : a ? c = a.tangentAtLastPoint : c = [1, 0], c = H$1(c);
|
|
6873
6873
|
const p = [
|
|
@@ -6904,66 +6904,425 @@ let ot$1 = class ot {
|
|
|
6904
6904
|
close(t = !1) {
|
|
6905
6905
|
if (!this.pendingSegments.length) throw new Error("No segments to close");
|
|
6906
6906
|
const n = this.pendingSegments[0], r = this.pendingSegments.at(-1);
|
|
6907
|
-
return Y$
|
|
6907
|
+
return Y$2(n.firstPoint, r.lastPoint) || this.lineTo(n.firstPoint), this._nextCorner !== null && (this._customCornerLastWithFirst(
|
|
6908
6908
|
this._nextCorner.radius,
|
|
6909
6909
|
this._nextCorner.mode
|
|
6910
|
-
), this._nextCorner = null), z$
|
|
6910
|
+
), this._nextCorner = null), z$2(this.pendingSegments, { ignoreChecks: t });
|
|
6911
6911
|
}
|
|
6912
6912
|
closeWithMirror(t = !1) {
|
|
6913
6913
|
if (!this.pendingSegments.length) throw new Error("No segments to close");
|
|
6914
6914
|
const n = this.pendingSegments[0], r = this.pendingSegments.at(-1), i = Q$2(
|
|
6915
6915
|
r.lastPoint,
|
|
6916
6916
|
n.firstPoint
|
|
6917
|
-
), s = new et$
|
|
6917
|
+
), s = new et$4().mirrorLine(
|
|
6918
6918
|
i,
|
|
6919
6919
|
n.firstPoint
|
|
6920
6920
|
), o = this.pendingSegments.map(
|
|
6921
6921
|
(a) => a.transform(s).reverse()
|
|
6922
6922
|
);
|
|
6923
|
-
return o.reverse(), z$
|
|
6923
|
+
return o.reverse(), z$2(
|
|
6924
6924
|
[...this.pendingSegments, ...o],
|
|
6925
6925
|
{ ignoreChecks: t }
|
|
6926
6926
|
);
|
|
6927
6927
|
}
|
|
6928
6928
|
asStrand() {
|
|
6929
|
-
return new B$
|
|
6929
|
+
return new B$3([...this.pendingSegments]);
|
|
6930
6930
|
}
|
|
6931
6931
|
get isClosed() {
|
|
6932
6932
|
var t;
|
|
6933
|
-
return Y$
|
|
6933
|
+
return Y$2(this.pointer, (t = this.pendingSegments[0]) == null ? void 0 : t.firstPoint);
|
|
6934
6934
|
}
|
|
6935
6935
|
};
|
|
6936
|
-
function lt(e = [0, 0]) {
|
|
6937
|
-
return new ot$
|
|
6936
|
+
function lt$1(e = [0, 0]) {
|
|
6937
|
+
return new ot$2(e);
|
|
6938
6938
|
}
|
|
6939
6939
|
|
|
6940
|
-
function
|
|
6941
|
-
return lt([-
|
|
6942
|
-
}
|
|
6943
|
-
function
|
|
6944
|
-
const { rx:
|
|
6945
|
-
let n = Math.min(
|
|
6946
|
-
const
|
|
6947
|
-
|
|
6948
|
-
const
|
|
6949
|
-
|
|
6940
|
+
function ct$1(c) {
|
|
6941
|
+
return lt$1([-c, 0]).sagittaArc(2 * c, 0, c).sagittaArc(-2 * c, 0, c).close();
|
|
6942
|
+
}
|
|
6943
|
+
function ot$1(c, e, t = 0) {
|
|
6944
|
+
const { rx: a = 0, ry: o = 0 } = typeof t == "number" ? { ry: t, rx: t } : t;
|
|
6945
|
+
let n = Math.min(a ?? t ?? 0, c / 2), r = Math.min(o ?? t ?? 0, e / 2);
|
|
6946
|
+
const s = n && r;
|
|
6947
|
+
s || (n = 0, r = 0);
|
|
6948
|
+
const h = n === r, f = lt$1([Math.min(0, -(c / 2 - n)), -e / 2]), l = (k, i) => {
|
|
6949
|
+
s && (h ? f.tangentArc(k, i) : f.ellipse(k, i, n, r, 0, !1, !1));
|
|
6950
6950
|
};
|
|
6951
|
-
return n <
|
|
6951
|
+
return n < c / 2 && f.hLine(c - 2 * n), l(n, r), r < e / 2 && f.vLine(e - 2 * r), l(-n, r), n < c / 2 && f.hLine(-(c - 2 * n)), l(-n, -r), r < e / 2 && f.vLine(-(e - 2 * r)), l(n, -r), f.close();
|
|
6952
|
+
}
|
|
6953
|
+
function rt$1(c, e) {
|
|
6954
|
+
const t = lt$1([-c, 0]);
|
|
6955
|
+
return t.halfEllipse(2 * c, 0, e), t.halfEllipse(-2 * c, 0, e), t.close();
|
|
6956
|
+
}
|
|
6957
|
+
function lt(c, e, t) {
|
|
6958
|
+
const a = Je(e).map((n) => {
|
|
6959
|
+
const r = -(Math.PI * 2 / e) * n;
|
|
6960
|
+
return [c * Math.sin(r), c * Math.cos(r)];
|
|
6961
|
+
});
|
|
6962
|
+
let o = lt$1(a[a.length - 1]);
|
|
6963
|
+
for (const n of a)
|
|
6964
|
+
t ? o = o.sagittaArcTo(n, t) : o = o.lineTo(n);
|
|
6965
|
+
return o.close();
|
|
6966
|
+
}
|
|
6967
|
+
const N = 0, $ = 1, B$1 = 2, m = { A: 7, a: 7, C: 6, c: 6, H: 1, h: 1, L: 2, l: 2, M: 2, m: 2, Q: 4, q: 4, S: 4, s: 4, T: 2, t: 2, V: 1, v: 1, Z: 0, z: 0 };
|
|
6968
|
+
function U(c) {
|
|
6969
|
+
const e = new Array();
|
|
6970
|
+
for (; c !== ""; )
|
|
6971
|
+
if (c.match(/^([ \t\r\n,]+)/))
|
|
6972
|
+
c = c.substr(RegExp.$1.length);
|
|
6973
|
+
else if (c.match(/^([aAcChHlLmMqQsStTvVzZ])/))
|
|
6974
|
+
e[e.length] = { type: N, text: RegExp.$1 }, c = c.substr(RegExp.$1.length);
|
|
6975
|
+
else if (c.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))
|
|
6976
|
+
e[e.length] = { type: $, text: `${parseFloat(RegExp.$1)}` }, c = c.substr(RegExp.$1.length);
|
|
6977
|
+
else
|
|
6978
|
+
return [];
|
|
6979
|
+
return e[e.length] = { type: B$1, text: "" }, e;
|
|
6980
|
+
}
|
|
6981
|
+
function z$1(c, e) {
|
|
6982
|
+
return c.type === e;
|
|
6983
|
+
}
|
|
6984
|
+
function O$1(c) {
|
|
6985
|
+
const e = [], t = U(c);
|
|
6986
|
+
let a = "BOD", o = 0, n = t[o];
|
|
6987
|
+
for (; !z$1(n, B$1); ) {
|
|
6988
|
+
let r = 0;
|
|
6989
|
+
const s = [];
|
|
6990
|
+
if (a === "BOD")
|
|
6991
|
+
if (n.text === "M" || n.text === "m")
|
|
6992
|
+
o++, r = m[n.text], a = n.text;
|
|
6993
|
+
else
|
|
6994
|
+
return O$1("M0,0" + c);
|
|
6995
|
+
else z$1(n, $) ? r = m[a] : (o++, r = m[n.text], a = n.text);
|
|
6996
|
+
if (o + r < t.length) {
|
|
6997
|
+
for (let h = o; h < o + r; h++) {
|
|
6998
|
+
const f = t[h];
|
|
6999
|
+
if (z$1(f, $))
|
|
7000
|
+
s[s.length] = +f.text;
|
|
7001
|
+
else
|
|
7002
|
+
throw new Error("Param not a number: " + a + "," + f.text);
|
|
7003
|
+
}
|
|
7004
|
+
if (typeof m[a] == "number") {
|
|
7005
|
+
const h = { key: a, data: s };
|
|
7006
|
+
e.push(h), o += r, n = t[o], a === "M" && (a = "L"), a === "m" && (a = "l");
|
|
7007
|
+
} else
|
|
7008
|
+
throw new Error("Bad segment: " + a);
|
|
7009
|
+
} else
|
|
7010
|
+
throw new Error("Path data ended short");
|
|
7011
|
+
}
|
|
7012
|
+
return e;
|
|
7013
|
+
}
|
|
7014
|
+
function X$1(c) {
|
|
7015
|
+
const e = [];
|
|
7016
|
+
for (const { key: t, data: a } of c)
|
|
7017
|
+
switch (e.push(t), t) {
|
|
7018
|
+
case "C":
|
|
7019
|
+
case "c":
|
|
7020
|
+
e.push(a[0], `${a[1]},`, a[2], `${a[3]},`, a[4], a[5]);
|
|
7021
|
+
break;
|
|
7022
|
+
case "S":
|
|
7023
|
+
case "s":
|
|
7024
|
+
case "Q":
|
|
7025
|
+
case "q":
|
|
7026
|
+
e.push(a[0], `${a[1]},`, a[2], a[3]);
|
|
7027
|
+
break;
|
|
7028
|
+
default:
|
|
7029
|
+
e.push(...a);
|
|
7030
|
+
break;
|
|
7031
|
+
}
|
|
7032
|
+
return e.join(" ");
|
|
7033
|
+
}
|
|
7034
|
+
function Y(c) {
|
|
7035
|
+
let e = 0, t = 0, a = 0, o = 0;
|
|
7036
|
+
const n = [];
|
|
7037
|
+
for (const { key: r, data: s } of c)
|
|
7038
|
+
switch (r) {
|
|
7039
|
+
case "M":
|
|
7040
|
+
n.push({ key: "M", data: [...s] }), [e, t] = s, [a, o] = s;
|
|
7041
|
+
break;
|
|
7042
|
+
case "m":
|
|
7043
|
+
e += s[0], t += s[1], n.push({ key: "M", data: [e, t] }), a = e, o = t;
|
|
7044
|
+
break;
|
|
7045
|
+
case "L":
|
|
7046
|
+
n.push({ key: "L", data: [...s] }), [e, t] = s;
|
|
7047
|
+
break;
|
|
7048
|
+
case "l":
|
|
7049
|
+
e += s[0], t += s[1], n.push({ key: "L", data: [e, t] });
|
|
7050
|
+
break;
|
|
7051
|
+
case "C":
|
|
7052
|
+
n.push({ key: "C", data: [...s] }), e = s[4], t = s[5];
|
|
7053
|
+
break;
|
|
7054
|
+
case "c": {
|
|
7055
|
+
const h = s.map((f, l) => l % 2 ? f + t : f + e);
|
|
7056
|
+
n.push({ key: "C", data: h }), e = h[4], t = h[5];
|
|
7057
|
+
break;
|
|
7058
|
+
}
|
|
7059
|
+
case "Q":
|
|
7060
|
+
n.push({ key: "Q", data: [...s] }), e = s[2], t = s[3];
|
|
7061
|
+
break;
|
|
7062
|
+
case "q": {
|
|
7063
|
+
const h = s.map((f, l) => l % 2 ? f + t : f + e);
|
|
7064
|
+
n.push({ key: "Q", data: h }), e = h[2], t = h[3];
|
|
7065
|
+
break;
|
|
7066
|
+
}
|
|
7067
|
+
case "A":
|
|
7068
|
+
n.push({ key: "A", data: [...s] }), e = s[5], t = s[6];
|
|
7069
|
+
break;
|
|
7070
|
+
case "a":
|
|
7071
|
+
e += s[5], t += s[6], n.push({ key: "A", data: [s[0], s[1], s[2], s[3], s[4], e, t] });
|
|
7072
|
+
break;
|
|
7073
|
+
case "H":
|
|
7074
|
+
n.push({ key: "H", data: [...s] }), e = s[0];
|
|
7075
|
+
break;
|
|
7076
|
+
case "h":
|
|
7077
|
+
e += s[0], n.push({ key: "H", data: [e] });
|
|
7078
|
+
break;
|
|
7079
|
+
case "V":
|
|
7080
|
+
n.push({ key: "V", data: [...s] }), t = s[0];
|
|
7081
|
+
break;
|
|
7082
|
+
case "v":
|
|
7083
|
+
t += s[0], n.push({ key: "V", data: [t] });
|
|
7084
|
+
break;
|
|
7085
|
+
case "S":
|
|
7086
|
+
n.push({ key: "S", data: [...s] }), e = s[2], t = s[3];
|
|
7087
|
+
break;
|
|
7088
|
+
case "s": {
|
|
7089
|
+
const h = s.map((f, l) => l % 2 ? f + t : f + e);
|
|
7090
|
+
n.push({ key: "S", data: h }), e = h[2], t = h[3];
|
|
7091
|
+
break;
|
|
7092
|
+
}
|
|
7093
|
+
case "T":
|
|
7094
|
+
n.push({ key: "T", data: [...s] }), e = s[0], t = s[1];
|
|
7095
|
+
break;
|
|
7096
|
+
case "t":
|
|
7097
|
+
e += s[0], t += s[1], n.push({ key: "T", data: [e, t] });
|
|
7098
|
+
break;
|
|
7099
|
+
case "Z":
|
|
7100
|
+
case "z":
|
|
7101
|
+
n.push({ key: "Z", data: [] }), e = a, t = o;
|
|
7102
|
+
break;
|
|
7103
|
+
}
|
|
7104
|
+
return n;
|
|
7105
|
+
}
|
|
7106
|
+
function J$1(c) {
|
|
7107
|
+
const e = [];
|
|
7108
|
+
let t = "", a = 0, o = 0, n = 0, r = 0, s = 0, h = 0;
|
|
7109
|
+
for (const { key: f, data: l } of c) {
|
|
7110
|
+
switch (f) {
|
|
7111
|
+
case "M":
|
|
7112
|
+
e.push({ key: "M", data: [...l] }), [a, o] = l, [n, r] = l;
|
|
7113
|
+
break;
|
|
7114
|
+
case "C":
|
|
7115
|
+
e.push({ key: "C", data: [...l] }), a = l[4], o = l[5], s = l[2], h = l[3];
|
|
7116
|
+
break;
|
|
7117
|
+
case "L":
|
|
7118
|
+
e.push({ key: "L", data: [...l] }), [a, o] = l;
|
|
7119
|
+
break;
|
|
7120
|
+
case "H":
|
|
7121
|
+
a = l[0], e.push({ key: "L", data: [a, o] });
|
|
7122
|
+
break;
|
|
7123
|
+
case "V":
|
|
7124
|
+
o = l[0], e.push({ key: "L", data: [a, o] });
|
|
7125
|
+
break;
|
|
7126
|
+
case "S": {
|
|
7127
|
+
let k = 0, i = 0;
|
|
7128
|
+
t === "C" || t === "S" ? (k = a + (a - s), i = o + (o - h)) : (k = a, i = o), e.push({ key: "C", data: [k, i, ...l] }), s = l[0], h = l[1], a = l[2], o = l[3];
|
|
7129
|
+
break;
|
|
7130
|
+
}
|
|
7131
|
+
case "T": {
|
|
7132
|
+
const [k, i] = l;
|
|
7133
|
+
let u = 0, y = 0;
|
|
7134
|
+
t === "Q" || t === "T" ? (u = a + (a - s), y = o + (o - h)) : (u = a, y = o);
|
|
7135
|
+
const M = a + 2 * (u - a) / 3, p = o + 2 * (y - o) / 3, d = k + 2 * (u - k) / 3, g = i + 2 * (y - i) / 3;
|
|
7136
|
+
e.push({ key: "C", data: [M, p, d, g, k, i] }), s = u, h = y, a = k, o = i;
|
|
7137
|
+
break;
|
|
7138
|
+
}
|
|
7139
|
+
case "Q": {
|
|
7140
|
+
const [k, i, u, y] = l, M = a + 2 * (k - a) / 3, p = o + 2 * (i - o) / 3, d = u + 2 * (k - u) / 3, g = y + 2 * (i - y) / 3;
|
|
7141
|
+
e.push({ key: "C", data: [M, p, d, g, u, y] }), s = k, h = i, a = u, o = y;
|
|
7142
|
+
break;
|
|
7143
|
+
}
|
|
7144
|
+
case "A": {
|
|
7145
|
+
const k = Math.abs(l[0]), i = Math.abs(l[1]), u = l[2], y = l[3], M = l[4], p = l[5], d = l[6];
|
|
7146
|
+
k === 0 || i === 0 ? (e.push({ key: "C", data: [a, o, p, d, p, d] }), a = p, o = d) : (a !== p || o !== d) && (F(a, o, p, d, k, i, u, y, M).forEach(function(L) {
|
|
7147
|
+
e.push({ key: "C", data: L });
|
|
7148
|
+
}), a = p, o = d);
|
|
7149
|
+
break;
|
|
7150
|
+
}
|
|
7151
|
+
case "Z":
|
|
7152
|
+
e.push({ key: "Z", data: [] }), a = n, o = r;
|
|
7153
|
+
break;
|
|
7154
|
+
}
|
|
7155
|
+
t = f;
|
|
7156
|
+
}
|
|
7157
|
+
return e;
|
|
7158
|
+
}
|
|
7159
|
+
function K$1(c) {
|
|
7160
|
+
return Math.PI * c / 180;
|
|
7161
|
+
}
|
|
7162
|
+
function T$1(c, e, t) {
|
|
7163
|
+
const a = c * Math.cos(t) - e * Math.sin(t), o = c * Math.sin(t) + e * Math.cos(t);
|
|
7164
|
+
return [a, o];
|
|
7165
|
+
}
|
|
7166
|
+
function F(c, e, t, a, o, n, r, s, h, f) {
|
|
7167
|
+
const l = K$1(r);
|
|
7168
|
+
let k = [], i = 0, u = 0, y = 0, M = 0;
|
|
7169
|
+
if (f)
|
|
7170
|
+
[i, u, y, M] = f;
|
|
7171
|
+
else {
|
|
7172
|
+
[c, e] = T$1(c, e, -l), [t, a] = T$1(t, a, -l);
|
|
7173
|
+
const x = (c - t) / 2, b = (e - a) / 2;
|
|
7174
|
+
let w = x * x / (o * o) + b * b / (n * n);
|
|
7175
|
+
w > 1 && (w = Math.sqrt(w), o = w * o, n = w * n);
|
|
7176
|
+
const S = s === h ? -1 : 1, A = o * o, R = n * n, j = A * R - A * b * b - R * x * x, D = A * b * b + R * x * x, Z = S * Math.sqrt(Math.abs(j / D));
|
|
7177
|
+
y = Z * o * b / n + (c + t) / 2, M = Z * -n * x / o + (e + a) / 2, i = Math.asin(parseFloat(((e - M) / n).toFixed(9))), u = Math.asin(parseFloat(((a - M) / n).toFixed(9))), c < y && (i = Math.PI - i), t < y && (u = Math.PI - u), i < 0 && (i = Math.PI * 2 + i), u < 0 && (u = Math.PI * 2 + u), h && i > u && (i = i - Math.PI * 2), !h && u > i && (u = u - Math.PI * 2);
|
|
7178
|
+
}
|
|
7179
|
+
let p = u - i;
|
|
7180
|
+
if (Math.abs(p) > Math.PI * 120 / 180) {
|
|
7181
|
+
const x = u, b = t, w = a;
|
|
7182
|
+
h && u > i ? u = i + Math.PI * 120 / 180 * 1 : u = i + Math.PI * 120 / 180 * -1, t = y + o * Math.cos(u), a = M + n * Math.sin(u), k = F(t, a, b, w, o, n, r, 0, h, [u, x, y, M]);
|
|
7183
|
+
}
|
|
7184
|
+
p = u - i;
|
|
7185
|
+
const d = Math.cos(i), g = Math.sin(i), L = Math.cos(u), _ = Math.sin(u), I = Math.tan(p / 4), Q = 4 / 3 * o * I, V = 4 / 3 * n * I, q = [c, e], C = [c + Q * g, e - V * d], H = [t + Q * _, a - V * L], P = [t, a];
|
|
7186
|
+
if (C[0] = 2 * q[0] - C[0], C[1] = 2 * q[1] - C[1], f)
|
|
7187
|
+
return [C, H, P].concat(k);
|
|
7188
|
+
{
|
|
7189
|
+
k = [C, H, P].concat(k);
|
|
7190
|
+
const x = [];
|
|
7191
|
+
for (let b = 0; b < k.length; b += 3) {
|
|
7192
|
+
const w = T$1(k[b][0], k[b][1], l), S = T$1(k[b + 1][0], k[b + 1][1], l), A = T$1(k[b + 2][0], k[b + 2][1], l);
|
|
7193
|
+
x.push([w[0], w[1], S[0], S[1], A[0], A[1]]);
|
|
7194
|
+
}
|
|
7195
|
+
return x;
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7198
|
+
const W$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7199
|
+
__proto__: null,
|
|
7200
|
+
absolutize: Y,
|
|
7201
|
+
normalize: J$1,
|
|
7202
|
+
parsePath: O$1,
|
|
7203
|
+
serialize: X$1
|
|
7204
|
+
}, Symbol.toStringTag, { value: "Module" })), { parsePath: v$1, absolutize: tt$1 } = W$1, et$1 = (c, e, t) => {
|
|
7205
|
+
let a, o = null, n = null;
|
|
7206
|
+
if (c.key === "M") {
|
|
7207
|
+
const [r, s] = c.data;
|
|
7208
|
+
return a = [r, s], { p: a };
|
|
7209
|
+
}
|
|
7210
|
+
if (c.key === "H") {
|
|
7211
|
+
const [r] = c.data;
|
|
7212
|
+
return a = [r, (e == null ? void 0 : e[1]) || 0], { p: a };
|
|
7213
|
+
}
|
|
7214
|
+
if (c.key === "V") {
|
|
7215
|
+
const [r] = c.data;
|
|
7216
|
+
return a = [(e == null ? void 0 : e[0]) || 0, r], { p: a };
|
|
7217
|
+
}
|
|
7218
|
+
if (c.key === "L") {
|
|
7219
|
+
const [r, s] = c.data;
|
|
7220
|
+
return a = [r, s], { p: a };
|
|
7221
|
+
}
|
|
7222
|
+
if (c.key === "C") {
|
|
7223
|
+
const [r, s, h, f, l, k] = c.data;
|
|
7224
|
+
return a = [l, k], o = [r, s], n = [h, f], {
|
|
7225
|
+
p: a,
|
|
7226
|
+
control1: o,
|
|
7227
|
+
control2: n
|
|
7228
|
+
};
|
|
7229
|
+
}
|
|
7230
|
+
if (c.key === "S") {
|
|
7231
|
+
const [r, s, h, f] = c.data;
|
|
7232
|
+
if (a = [h, f], n = [r, s], !e)
|
|
7233
|
+
throw new Error("S command without previous point");
|
|
7234
|
+
if (o = e, t.control2) {
|
|
7235
|
+
const l = e;
|
|
7236
|
+
o = [
|
|
7237
|
+
l[0] + (l[0] - t.control2[0]),
|
|
7238
|
+
l[1] + (l[1] - t.control2[1])
|
|
7239
|
+
];
|
|
7240
|
+
}
|
|
7241
|
+
return {
|
|
7242
|
+
p: a,
|
|
7243
|
+
control1: o,
|
|
7244
|
+
control2: n
|
|
7245
|
+
};
|
|
7246
|
+
}
|
|
7247
|
+
if (c.key === "Q") {
|
|
7248
|
+
const [r, s, h, f] = c.data;
|
|
7249
|
+
return a = [h, f], o = [r, s], {
|
|
7250
|
+
p: a,
|
|
7251
|
+
control1: o
|
|
7252
|
+
};
|
|
7253
|
+
}
|
|
7254
|
+
if (c.key === "T") {
|
|
7255
|
+
const [r, s] = c.data;
|
|
7256
|
+
if (a = [r, s], !e)
|
|
7257
|
+
throw new Error("T command without previous point");
|
|
7258
|
+
if (o = e, t.control1 && !t.control2) {
|
|
7259
|
+
const h = e;
|
|
7260
|
+
o = [
|
|
7261
|
+
h[0] + (h[0] - t.control1[0]),
|
|
7262
|
+
h[1] + (h[1] - t.control1[1])
|
|
7263
|
+
];
|
|
7264
|
+
}
|
|
7265
|
+
}
|
|
7266
|
+
if (c.key === "A") {
|
|
7267
|
+
const [r, s, h = 0, f = 0, l = 0, k, i] = c.data;
|
|
7268
|
+
if (a = [k, i], !e)
|
|
7269
|
+
throw new Error("A command without previous point");
|
|
7270
|
+
const u = Math.sqrt(
|
|
7271
|
+
(e[0] - k) ** 2 + (e[1] - i) ** 2
|
|
7272
|
+
), y = Math.max(r, s);
|
|
7273
|
+
let M = r, p = s;
|
|
7274
|
+
if (y < u / 2) {
|
|
7275
|
+
const d = u / 2 / y;
|
|
7276
|
+
M = r * d, p = s * d;
|
|
7277
|
+
}
|
|
7278
|
+
return {
|
|
7279
|
+
p: a,
|
|
7280
|
+
arcConfig: [M, p, h, !!f, !!l]
|
|
7281
|
+
};
|
|
7282
|
+
}
|
|
7283
|
+
throw new Error(`Unknown command ${c.key}`);
|
|
7284
|
+
};
|
|
7285
|
+
function* at$1(c) {
|
|
7286
|
+
const e = tt$1(v$1(c));
|
|
7287
|
+
let t = null, a = null, o = { control1: null, control2: null };
|
|
7288
|
+
for (const n of e) {
|
|
7289
|
+
if (n.key === "Z") {
|
|
7290
|
+
t && (yield t.close(!0)), t = null;
|
|
7291
|
+
continue;
|
|
7292
|
+
}
|
|
7293
|
+
const r = et$1(n, a, o), s = r.p, h = "control1" in r ? r.control1 : null, f = "control1" in r ? r.control2 : null, l = "arcConfig" in r ? r.arcConfig : null;
|
|
7294
|
+
if (n.key === "M") {
|
|
7295
|
+
t && (yield t.isClosed ? t.close() : t.asStrand()), t = lt$1(s), a = s;
|
|
7296
|
+
continue;
|
|
7297
|
+
}
|
|
7298
|
+
if (a && Math.abs(s[0] - a[0]) < 1e-9 && Math.abs(s[1] - a[1]) < 1e-9) {
|
|
7299
|
+
a = s, o = { control1: h, control2: f };
|
|
7300
|
+
continue;
|
|
7301
|
+
}
|
|
7302
|
+
(n.key === "L" || n.key === "H" || n.key === "V") && (t == null || t.lineTo(s)), (n.key === "C" || n.key === "S") && (t == null || t.cubicBezierCurveTo(s, h, f)), (n.key === "Q" || n.key === "T") && (t == null || t.quadraticBezierCurveTo(s, h)), n.key === "A" && (t == null || t.ellipseTo(s, ...l)), a = s, o = { control1: h, control2: f };
|
|
7303
|
+
}
|
|
7304
|
+
t && (yield t.isClosed ? t.close() : t.asStrand());
|
|
7305
|
+
}
|
|
7306
|
+
function ht(c) {
|
|
7307
|
+
return Array.from(at$1(c));
|
|
6952
7308
|
}
|
|
6953
7309
|
|
|
6954
7310
|
var drawShape = /*#__PURE__*/Object.freeze({
|
|
6955
7311
|
__proto__: null,
|
|
6956
|
-
drawCircle:
|
|
6957
|
-
|
|
7312
|
+
drawCircle: ct$1,
|
|
7313
|
+
drawEllipse: rt$1,
|
|
7314
|
+
drawPolysides: lt,
|
|
7315
|
+
drawRect: ot$1,
|
|
7316
|
+
drawSVGPath: ht
|
|
6958
7317
|
});
|
|
6959
7318
|
|
|
6960
7319
|
function i([t, n]) {
|
|
6961
7320
|
return `${t} ${n}`;
|
|
6962
7321
|
}
|
|
6963
7322
|
function s(t) {
|
|
6964
|
-
if (t instanceof at$
|
|
7323
|
+
if (t instanceof at$3)
|
|
6965
7324
|
return `L ${i(t.lastPoint)}`;
|
|
6966
|
-
if (t instanceof ct$
|
|
7325
|
+
if (t instanceof ct$3)
|
|
6967
7326
|
return `A ${t.radius} ${t.radius} 0 ${t.angularLength > Math.PI ? "1" : "0"} ${t.clockwise ? "0" : "1"} ${i(t.lastPoint)}`;
|
|
6968
7327
|
if (t instanceof jt$1)
|
|
6969
7328
|
return `A ${t.majorRadius} ${t.minorRadius} ${t.tiltAngle * Ue} ${t.deltaAngle > Math.PI ? "1" : "0"} ${t.clockwise ? "0" : "1"} ${i(t.lastPoint)}`;
|
|
@@ -7013,11 +7372,11 @@ var yt = Object.defineProperty;
|
|
|
7013
7372
|
var Ct = (n, t, e) => t in n ? yt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
7014
7373
|
var P = (n, t, e) => Ct(n, typeof t != "symbol" ? t + "" : t, e);
|
|
7015
7374
|
function L(n) {
|
|
7016
|
-
if (n instanceof v$
|
|
7375
|
+
if (n instanceof v$2)
|
|
7017
7376
|
return [n];
|
|
7018
7377
|
if (n instanceof _$2)
|
|
7019
|
-
return [new v$
|
|
7020
|
-
if (n instanceof O$
|
|
7378
|
+
return [new v$2(n)];
|
|
7379
|
+
if (n instanceof O$2)
|
|
7021
7380
|
return n.figures;
|
|
7022
7381
|
throw new Error("Unknown shape");
|
|
7023
7382
|
}
|
|
@@ -7083,32 +7442,32 @@ function j(n, t, e = !1) {
|
|
|
7083
7442
|
}), s;
|
|
7084
7443
|
}
|
|
7085
7444
|
function sn(n, t) {
|
|
7086
|
-
return new O$
|
|
7445
|
+
return new O$2(
|
|
7087
7446
|
G(L(n), L(t))
|
|
7088
7447
|
);
|
|
7089
7448
|
}
|
|
7090
7449
|
function z(n) {
|
|
7091
7450
|
return n.reduce(
|
|
7092
7451
|
(t, e) => sn(t, e),
|
|
7093
|
-
new O$
|
|
7452
|
+
new O$2()
|
|
7094
7453
|
);
|
|
7095
7454
|
}
|
|
7096
7455
|
function Pt(n, t) {
|
|
7097
|
-
return new O$
|
|
7456
|
+
return new O$2(
|
|
7098
7457
|
Q$1(L(n), L(t))
|
|
7099
7458
|
);
|
|
7100
7459
|
}
|
|
7101
7460
|
function yn(n, t) {
|
|
7102
|
-
return new O$
|
|
7103
|
-
lt$
|
|
7461
|
+
return new O$2(
|
|
7462
|
+
lt$2(L(n), L(t))
|
|
7104
7463
|
);
|
|
7105
7464
|
}
|
|
7106
7465
|
function Cn(n, t, e = !0) {
|
|
7107
7466
|
if (t instanceof _$2)
|
|
7108
7467
|
return J(n, t, e);
|
|
7109
|
-
if (t instanceof v$
|
|
7468
|
+
if (t instanceof v$2)
|
|
7110
7469
|
return W(n, t, e);
|
|
7111
|
-
let s = [new B$
|
|
7470
|
+
let s = [new B$3([...n.segments])];
|
|
7112
7471
|
return t.figures.forEach((r) => {
|
|
7113
7472
|
s = s.flatMap((i) => W(i, r, e));
|
|
7114
7473
|
}), s;
|
|
@@ -7116,9 +7475,9 @@ function Cn(n, t, e = !0) {
|
|
|
7116
7475
|
function xn(n, t, e = !1) {
|
|
7117
7476
|
if (t instanceof _$2)
|
|
7118
7477
|
return Q(n, t, e);
|
|
7119
|
-
if (t instanceof v$
|
|
7478
|
+
if (t instanceof v$2)
|
|
7120
7479
|
return j(n, t, e);
|
|
7121
|
-
let s = [new B$
|
|
7480
|
+
let s = [new B$3([...n.segments])];
|
|
7122
7481
|
return t.figures.forEach((r) => {
|
|
7123
7482
|
s = s.flatMap((i) => j(i, r, e));
|
|
7124
7483
|
}), s;
|
|
@@ -7148,21 +7507,21 @@ function rn(n, t) {
|
|
|
7148
7507
|
if (o === "between" && i !== "between")
|
|
7149
7508
|
return nt(t, n, i);
|
|
7150
7509
|
if (i === "before" && o === "before")
|
|
7151
|
-
return J$
|
|
7510
|
+
return J$3(n.firstPoint, t.firstPoint);
|
|
7152
7511
|
if (i === "after" && o === "after")
|
|
7153
|
-
return J$
|
|
7512
|
+
return J$3(n.lastPoint, t.lastPoint);
|
|
7154
7513
|
if (i === "before" && o === "after")
|
|
7155
|
-
return J$
|
|
7514
|
+
return J$3(n.firstPoint, t.lastPoint);
|
|
7156
7515
|
if (i === "after" && o === "before")
|
|
7157
|
-
return J$
|
|
7516
|
+
return J$3(n.lastPoint, t.firstPoint);
|
|
7158
7517
|
throw new Error("Invalid position");
|
|
7159
7518
|
}
|
|
7160
7519
|
function et(n, t) {
|
|
7161
|
-
if (K$
|
|
7520
|
+
if (K$2(n, t).length > 0)
|
|
7162
7521
|
return 0;
|
|
7163
7522
|
const e = dn$1(n, t.center);
|
|
7164
7523
|
if (n.isOnSegment(e)) {
|
|
7165
|
-
const s = J$
|
|
7524
|
+
const s = J$3(e, t.center);
|
|
7166
7525
|
if (Math.abs(s - t.radius) < n.precision && t.isOnSegment(e))
|
|
7167
7526
|
return 0;
|
|
7168
7527
|
if (s - t.radius > n.precision) {
|
|
@@ -7173,7 +7532,7 @@ function et(n, t) {
|
|
|
7173
7532
|
nt$2(r, t.radius)
|
|
7174
7533
|
);
|
|
7175
7534
|
if (t.isOnSegment(i))
|
|
7176
|
-
return J$
|
|
7535
|
+
return J$3(i, e);
|
|
7177
7536
|
}
|
|
7178
7537
|
}
|
|
7179
7538
|
return Math.min(
|
|
@@ -7191,14 +7550,14 @@ const on = (n, t) => {
|
|
|
7191
7550
|
};
|
|
7192
7551
|
function an(n, t) {
|
|
7193
7552
|
if (Dt(n, t, !0).length > 0) return 0;
|
|
7194
|
-
const e = J$
|
|
7553
|
+
const e = J$3(n.center, t.center);
|
|
7195
7554
|
if (e < n.precision && on(n, t))
|
|
7196
7555
|
return Math.abs(n.radius - t.radius);
|
|
7197
7556
|
const s = H$1(Q$2(t.center, n.center)), r = e - Math.abs(n.radius - t.radius) < n.precision;
|
|
7198
7557
|
let i = Ye(s);
|
|
7199
7558
|
r && t.radius > n.radius && (i += Math.PI);
|
|
7200
7559
|
const o = r ? i : i + Math.PI, a = n.angleToParam(i), f = t.angleToParam(o);
|
|
7201
|
-
return n.isValidParameter(a) && t.isValidParameter(f) ? J$
|
|
7560
|
+
return n.isValidParameter(a) && t.isValidParameter(f) ? J$3(n.paramPoint(a), t.paramPoint(f)) : Math.min(
|
|
7202
7561
|
n.distanceFrom(t.firstPoint),
|
|
7203
7562
|
n.distanceFrom(t.lastPoint),
|
|
7204
7563
|
t.distanceFrom(n.firstPoint),
|
|
@@ -7352,14 +7711,14 @@ function pn(n, t, e = 1e-9) {
|
|
|
7352
7711
|
return Math.sqrt(s.fMin);
|
|
7353
7712
|
}
|
|
7354
7713
|
function dn(n, t) {
|
|
7355
|
-
return n instanceof at$
|
|
7714
|
+
return n instanceof at$3 && t instanceof at$3 ? rn(n, t) : n instanceof at$3 && t instanceof ct$3 ? et(n, t) : n instanceof ct$3 && t instanceof at$3 ? et(t, n) : n instanceof ct$3 && t instanceof ct$3 ? an(n, t) : pn(n, t);
|
|
7356
7715
|
}
|
|
7357
7716
|
function wt(n) {
|
|
7358
7717
|
if (n instanceof Et$1) {
|
|
7359
7718
|
const r = Q$2(n.lastPoint, n.firstPoint), i = Q$2(n.firstControlPoint, n.firstPoint), o = Q$2(n.lastControlPoint, n.firstPoint), a = un$1(r, i), f = un$1(r, o);
|
|
7360
7719
|
if (a > 0 && f < 0 || a < 0 && f > 0) return !1;
|
|
7361
7720
|
}
|
|
7362
|
-
const t = tt$
|
|
7721
|
+
const t = tt$3(n.tangentAtFirstPoint), e = tt$3(n.tangentAtLastPoint);
|
|
7363
7722
|
let s = Pe(t, e);
|
|
7364
7723
|
return Math.abs(Math.acos(s)) < Math.PI / 3;
|
|
7365
7724
|
}
|
|
@@ -7380,7 +7739,7 @@ function mn(n) {
|
|
|
7380
7739
|
(f, c) => n.firstAngle + c * s * i
|
|
7381
7740
|
);
|
|
7382
7741
|
return o.slice(0, -1).map((f, c) => [f, o[c + 1]]).map(([f, c]) => {
|
|
7383
|
-
const l = Math.cos(f), p = Math.sin(f), g = Math.cos(c), d = Math.sin(c), [u, S] = n.center, M = n.minorRadius, v = n.majorRadius, k = new et$
|
|
7742
|
+
const l = Math.cos(f), p = Math.sin(f), g = Math.cos(c), d = Math.sin(c), [u, S] = n.center, M = n.minorRadius, v = n.majorRadius, k = new et$4().rotate(
|
|
7384
7743
|
n.tiltAngle,
|
|
7385
7744
|
n.center
|
|
7386
7745
|
), C = (Ft) => k.transform(Ft), D = C([u + v * l, S + M * p]), G = C([
|
|
@@ -7393,9 +7752,9 @@ function mn(n) {
|
|
|
7393
7752
|
return new Et$1(D, Et, G, kt);
|
|
7394
7753
|
});
|
|
7395
7754
|
}
|
|
7396
|
-
const X = 1e-8, Mt = (n) => n.flatMap((t) => t instanceof at$
|
|
7755
|
+
const X = 1e-8, Mt = (n) => n.flatMap((t) => t instanceof at$3 ? [t] : t instanceof ct$3 ? [t] : t instanceof jt$1 ? mn(t).flatMap(
|
|
7397
7756
|
(e) => st(e)
|
|
7398
|
-
) : t instanceof _t$1 || t instanceof Et$1 ? st(t) : [new at$
|
|
7757
|
+
) : t instanceof _t$1 || t instanceof Et$1 ? st(t) : [new at$3(t.firstPoint, t.lastPoint)]);
|
|
7399
7758
|
function q(n, t, e = !0) {
|
|
7400
7759
|
const s = n.map((c) => ({
|
|
7401
7760
|
offset: y(c, t),
|
|
@@ -7404,8 +7763,8 @@ function q(n, t, e = !0) {
|
|
|
7404
7763
|
let i = e ? null : s.at(-1), o = e ? s.at(-1) : null;
|
|
7405
7764
|
if (r.length === 1) return r;
|
|
7406
7765
|
const a = (c) => {
|
|
7407
|
-
i ? c.offset instanceof S ? Y$
|
|
7408
|
-
new at$
|
|
7766
|
+
i ? c.offset instanceof S ? Y$2(c.offset.firstPoint, c.offset.lastPoint) || r.push(
|
|
7767
|
+
new at$3(c.offset.firstPoint, c.offset.lastPoint)
|
|
7409
7768
|
) : r.push(c.offset) : i = c;
|
|
7410
7769
|
}, f = function* () {
|
|
7411
7770
|
for (const c of s.slice(0, -1))
|
|
@@ -7419,7 +7778,7 @@ function q(n, t, e = !0) {
|
|
|
7419
7778
|
continue;
|
|
7420
7779
|
}
|
|
7421
7780
|
const l = o.offset.lastPoint, p = c.offset.firstPoint;
|
|
7422
|
-
if (Y$
|
|
7781
|
+
if (Y$2(l, p)) {
|
|
7423
7782
|
a(o), o = c;
|
|
7424
7783
|
continue;
|
|
7425
7784
|
}
|
|
@@ -7456,7 +7815,7 @@ function q(n, t, e = !0) {
|
|
|
7456
7815
|
const d = o.original.lastPoint, u = St$2(
|
|
7457
7816
|
Q$2(p, d),
|
|
7458
7817
|
Q$2(l, d)
|
|
7459
|
-
) > 0, S$1 = new ct$
|
|
7818
|
+
) > 0, S$1 = new ct$3(l, p, d, u);
|
|
7460
7819
|
a(o), r.push(S$1), o = c;
|
|
7461
7820
|
}
|
|
7462
7821
|
return o && a(o), r;
|
|
@@ -7472,7 +7831,7 @@ function It(n) {
|
|
|
7472
7831
|
...a,
|
|
7473
7832
|
...f.flatMap((l) => [l.firstPoint, l.lastPoint])
|
|
7474
7833
|
].filter((l) => {
|
|
7475
|
-
const p = Y$
|
|
7834
|
+
const p = Y$2(l, s.firstPoint) || Y$2(l, s.lastPoint), g = Y$2(l, i.firstPoint) || Y$2(l, i.lastPoint);
|
|
7476
7835
|
return !(p && g);
|
|
7477
7836
|
});
|
|
7478
7837
|
c.length && (e(r, c), e(o + r + 1, c));
|
|
@@ -7491,19 +7850,19 @@ function bt(n, t, e) {
|
|
|
7491
7850
|
}
|
|
7492
7851
|
function T(n, t) {
|
|
7493
7852
|
const e = n.clockwise ? t : -t, s = Mt(n.segments), r = q(s, e);
|
|
7494
|
-
if (r.length < 2) return new O$
|
|
7853
|
+
if (r.length < 2) return new O$2();
|
|
7495
7854
|
const i = It(r);
|
|
7496
7855
|
if (!i.size) {
|
|
7497
7856
|
const l = new _$2(r);
|
|
7498
|
-
return new O$
|
|
7857
|
+
return new O$2([new v$2(l)]);
|
|
7499
7858
|
}
|
|
7500
7859
|
const o = St(
|
|
7501
7860
|
i,
|
|
7502
7861
|
r
|
|
7503
7862
|
), a = bt(o, n, t);
|
|
7504
|
-
if (!a.length) return new O$
|
|
7505
|
-
const c = Xt(a).filter((l) => l.length > 1).filter((l) => Y$
|
|
7506
|
-
return c.length ? new O$
|
|
7863
|
+
if (!a.length) return new O$2();
|
|
7864
|
+
const c = Xt(a).filter((l) => l.length > 1).filter((l) => Y$2(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new _$2(l));
|
|
7865
|
+
return c.length ? new O$2(c.map((l) => new v$2(l))) : new O$2();
|
|
7507
7866
|
}
|
|
7508
7867
|
function Pn(n, t, e = "round") {
|
|
7509
7868
|
const s = t / 2, r = Mt(n.segments), i = q(r, s, !1), o = q(
|
|
@@ -7516,7 +7875,7 @@ function Pn(n, t, e = "round") {
|
|
|
7516
7875
|
u.lastPoint,
|
|
7517
7876
|
S.firstPoint,
|
|
7518
7877
|
u.tangentAtLastPoint
|
|
7519
|
-
) : new at$
|
|
7878
|
+
) : new at$3(u.lastPoint, S.firstPoint), f = [
|
|
7520
7879
|
...i,
|
|
7521
7880
|
a(
|
|
7522
7881
|
i[i.length - 1],
|
|
@@ -7530,15 +7889,15 @@ function Pn(n, t, e = "round") {
|
|
|
7530
7889
|
], c = It(f);
|
|
7531
7890
|
if (!c.size) {
|
|
7532
7891
|
const u = new _$2(f);
|
|
7533
|
-
return new O$
|
|
7892
|
+
return new O$2([new v$2(u)]);
|
|
7534
7893
|
}
|
|
7535
7894
|
const l = St(
|
|
7536
7895
|
c,
|
|
7537
7896
|
f
|
|
7538
7897
|
), p = bt(l, n, s);
|
|
7539
|
-
if (!p.length) return new O$
|
|
7540
|
-
const d = Xt(p).filter((u) => u.length > 1).filter((u) => Y$
|
|
7541
|
-
return d.length ? new O$
|
|
7898
|
+
if (!p.length) return new O$2();
|
|
7899
|
+
const d = Xt(p).filter((u) => u.length > 1).filter((u) => Y$2(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new _$2(u));
|
|
7900
|
+
return d.length ? new O$2(d.map((u) => new v$2(u))) : new O$2();
|
|
7542
7901
|
}
|
|
7543
7902
|
function wn(n, t) {
|
|
7544
7903
|
const e = n.map((s) => {
|
|
@@ -7561,7 +7920,7 @@ function Dn(n, t) {
|
|
|
7561
7920
|
return wn(L(n), t);
|
|
7562
7921
|
}
|
|
7563
7922
|
function On(n, t, { endCap: e = "round" } = {}) {
|
|
7564
|
-
return n instanceof B$
|
|
7923
|
+
return n instanceof B$3 ? Pn(n, t, e) : Mn(L(n), t);
|
|
7565
7924
|
}
|
|
7566
7925
|
class In {
|
|
7567
7926
|
constructor() {
|
|
@@ -7614,7 +7973,7 @@ class x extends In {
|
|
|
7614
7973
|
*
|
|
7615
7974
|
*/
|
|
7616
7975
|
inList(t) {
|
|
7617
|
-
const e = ({ element: s }) => !!t.find((r) => Y$
|
|
7976
|
+
const e = ({ element: s }) => !!t.find((r) => Y$2(r, s.point));
|
|
7618
7977
|
return this.filters.push(e), this;
|
|
7619
7978
|
}
|
|
7620
7979
|
/**
|
|
@@ -7623,7 +7982,7 @@ class x extends In {
|
|
|
7623
7982
|
*/
|
|
7624
7983
|
atDistance(t, e = [0, 0]) {
|
|
7625
7984
|
function s({ element: r }) {
|
|
7626
|
-
return Math.abs(J$
|
|
7985
|
+
return Math.abs(J$3(e, r.point) - t) < 1e-9;
|
|
7627
7986
|
}
|
|
7628
7987
|
return this.filters.push(s), this;
|
|
7629
7988
|
}
|
|
@@ -7634,7 +7993,7 @@ class x extends In {
|
|
|
7634
7993
|
*/
|
|
7635
7994
|
atPoint(t) {
|
|
7636
7995
|
function e({ element: s }) {
|
|
7637
|
-
return Y$
|
|
7996
|
+
return Y$2(t, s.point);
|
|
7638
7997
|
}
|
|
7639
7998
|
return this.filters.push(e), this;
|
|
7640
7999
|
}
|
|
@@ -7711,33 +8070,33 @@ function At(n, t, e, s = () => !0) {
|
|
|
7711
8070
|
throw new Error("Bug in the filletting algo");
|
|
7712
8071
|
return i(a, f), new _$2(r, { ignoreChecks: !0 });
|
|
7713
8072
|
} else
|
|
7714
|
-
return new B$
|
|
8073
|
+
return new B$3(r, { ignoreChecks: !0 });
|
|
7715
8074
|
}
|
|
7716
8075
|
function B(n, t, e) {
|
|
7717
8076
|
const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
|
|
7718
|
-
if (n instanceof _$2 || n instanceof B$
|
|
8077
|
+
if (n instanceof _$2 || n instanceof B$3)
|
|
7719
8078
|
return At(V, n, t, r);
|
|
7720
|
-
if (n instanceof v$
|
|
8079
|
+
if (n instanceof v$2) {
|
|
7721
8080
|
const i = B(n.contour, t, s), o = n.holes.map((a) => B(a, t, s));
|
|
7722
|
-
return new v$
|
|
8081
|
+
return new v$2(i, o, { ignoreChecks: !0 });
|
|
7723
8082
|
}
|
|
7724
|
-
if (n instanceof O$
|
|
8083
|
+
if (n instanceof O$2) {
|
|
7725
8084
|
const i = n.figures.map((o) => B(o, t, s));
|
|
7726
|
-
return new O$
|
|
8085
|
+
return new O$2(i, { ignoreChecks: !0 });
|
|
7727
8086
|
}
|
|
7728
8087
|
throw new Error("invalid shape to fillet");
|
|
7729
8088
|
}
|
|
7730
8089
|
function R(n, t, e) {
|
|
7731
8090
|
const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
|
|
7732
|
-
if (n instanceof _$2 || n instanceof B$
|
|
8091
|
+
if (n instanceof _$2 || n instanceof B$3)
|
|
7733
8092
|
return At(V, n, t, r);
|
|
7734
|
-
if (n instanceof v$
|
|
8093
|
+
if (n instanceof v$2) {
|
|
7735
8094
|
const i = R(n.contour, t, s), o = n.holes.map((a) => R(a, t, s));
|
|
7736
|
-
return new v$
|
|
8095
|
+
return new v$2(i, o, { ignoreChecks: !0 });
|
|
7737
8096
|
}
|
|
7738
|
-
if (n instanceof O$
|
|
8097
|
+
if (n instanceof O$2) {
|
|
7739
8098
|
const i = n.figures.map((o) => R(o, t, s));
|
|
7740
|
-
return new O$
|
|
8099
|
+
return new O$2(i, { ignoreChecks: !0 });
|
|
7741
8100
|
}
|
|
7742
8101
|
throw new Error("invalid shape to chamfer");
|
|
7743
8102
|
}
|
|
@@ -7756,13 +8115,13 @@ function Bn(n) {
|
|
|
7756
8115
|
return new Sn(n);
|
|
7757
8116
|
}
|
|
7758
8117
|
function it(n) {
|
|
7759
|
-
if (n instanceof O$
|
|
8118
|
+
if (n instanceof O$2)
|
|
7760
8119
|
return d(n);
|
|
7761
|
-
if (n instanceof v$
|
|
8120
|
+
if (n instanceof v$2)
|
|
7762
8121
|
return p(n);
|
|
7763
8122
|
if (n instanceof _$2)
|
|
7764
8123
|
return `<path d="${w(n)}" />`;
|
|
7765
|
-
if (n instanceof B$
|
|
8124
|
+
if (n instanceof B$3)
|
|
7766
8125
|
return `<path d="${j$1(n)}" />`;
|
|
7767
8126
|
if (Hn(n))
|
|
7768
8127
|
return `<path d="${`M ${n.firstPoint.join(" ")}`} ${s(
|
|
@@ -7795,9 +8154,9 @@ function Rn(n, {
|
|
|
7795
8154
|
}
|
|
7796
8155
|
const vt = (n) => {
|
|
7797
8156
|
if (n.type === "LINE")
|
|
7798
|
-
return new at$
|
|
8157
|
+
return new at$3(n.firstPoint, n.lastPoint);
|
|
7799
8158
|
if (n.type === "ARC")
|
|
7800
|
-
return new ct$
|
|
8159
|
+
return new ct$3(
|
|
7801
8160
|
n.firstPoint,
|
|
7802
8161
|
n.lastPoint,
|
|
7803
8162
|
n.center,
|
|
@@ -7833,10 +8192,10 @@ const vt = (n) => {
|
|
|
7833
8192
|
return new _$2(t);
|
|
7834
8193
|
}, Lt = (n) => {
|
|
7835
8194
|
const t = H(n.contour), e = n.holes.map(H);
|
|
7836
|
-
return new v$
|
|
8195
|
+
return new v$2(t, e);
|
|
7837
8196
|
}, bn = (n) => {
|
|
7838
8197
|
const t = n.figures.map(Lt);
|
|
7839
|
-
return new O$
|
|
8198
|
+
return new O$2(t);
|
|
7840
8199
|
};
|
|
7841
8200
|
function zn(n) {
|
|
7842
8201
|
if (n.type === "DIAGRAM")
|
|
@@ -7862,13 +8221,13 @@ function $n([n, t]) {
|
|
|
7862
8221
|
var pantograph = /*#__PURE__*/Object.freeze({
|
|
7863
8222
|
__proto__: null,
|
|
7864
8223
|
DEG2RAD: ft,
|
|
7865
|
-
DrawingPen: ot$
|
|
8224
|
+
DrawingPen: ot$2,
|
|
7866
8225
|
RAD2DEG: An,
|
|
7867
8226
|
cartesianToPolar: $n,
|
|
7868
8227
|
chamfer: R,
|
|
7869
8228
|
confineStrand: xn,
|
|
7870
8229
|
cut: Pt,
|
|
7871
|
-
draw: lt,
|
|
8230
|
+
draw: lt$1,
|
|
7872
8231
|
eraseStrand: Cn,
|
|
7873
8232
|
exportJSON: It$1,
|
|
7874
8233
|
exportSVG: Rn,
|
|
@@ -7885,12 +8244,12 @@ var pantograph = /*#__PURE__*/Object.freeze({
|
|
|
7885
8244
|
});
|
|
7886
8245
|
|
|
7887
8246
|
function sketchSegment(segment, plane) {
|
|
7888
|
-
if (segment instanceof at$
|
|
8247
|
+
if (segment instanceof at$3) {
|
|
7889
8248
|
const firstPoint = plane.toWorldCoords(segment.firstPoint);
|
|
7890
8249
|
const lastPoint = plane.toWorldCoords(segment.lastPoint);
|
|
7891
8250
|
return makeLine(firstPoint, lastPoint);
|
|
7892
8251
|
}
|
|
7893
|
-
if (segment instanceof ct$
|
|
8252
|
+
if (segment instanceof ct$3) {
|
|
7894
8253
|
return makeThreePointArc(plane.toWorldCoords(segment.firstPoint), plane.toWorldCoords(segment.midPoint), plane.toWorldCoords(segment.lastPoint));
|
|
7895
8254
|
}
|
|
7896
8255
|
if (segment instanceof jt$1) {
|
|
@@ -7945,17 +8304,17 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
|
|
|
7945
8304
|
const plane = planeInput instanceof Plane
|
|
7946
8305
|
? makePlane(planeInput)
|
|
7947
8306
|
: makePlane(planeInput, origin);
|
|
7948
|
-
if (pantographObject instanceof O$
|
|
8307
|
+
if (pantographObject instanceof O$2) {
|
|
7949
8308
|
return sketchDiagram(pantographObject, plane);
|
|
7950
8309
|
}
|
|
7951
|
-
if (pantographObject instanceof v$
|
|
8310
|
+
if (pantographObject instanceof v$2) {
|
|
7952
8311
|
return sketchFigure(pantographObject, plane);
|
|
7953
8312
|
}
|
|
7954
8313
|
if (pantographObject instanceof _$2) {
|
|
7955
8314
|
return sketchStroke(pantographObject, plane);
|
|
7956
8315
|
}
|
|
7957
|
-
if (pantographObject instanceof at$
|
|
7958
|
-
pantographObject instanceof ct$
|
|
8316
|
+
if (pantographObject instanceof at$3 ||
|
|
8317
|
+
pantographObject instanceof ct$3 ||
|
|
7959
8318
|
pantographObject instanceof jt$1 ||
|
|
7960
8319
|
pantographObject instanceof _t$1 ||
|
|
7961
8320
|
pantographObject instanceof Et$1) {
|
|
@@ -7964,16 +8323,16 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
|
|
|
7964
8323
|
throw new Error(`Unsupported object type "${pantographObject.constructor.name}"`);
|
|
7965
8324
|
}
|
|
7966
8325
|
function svgPathsForShape(shape) {
|
|
7967
|
-
if (shape instanceof O$
|
|
8326
|
+
if (shape instanceof O$2) {
|
|
7968
8327
|
return shape.figures.flatMap(svgPathsForShape);
|
|
7969
8328
|
}
|
|
7970
|
-
else if (shape instanceof v$
|
|
8329
|
+
else if (shape instanceof v$2) {
|
|
7971
8330
|
return shape.allLoops.map((loop) => w(loop));
|
|
7972
8331
|
}
|
|
7973
8332
|
else if (shape instanceof _$2) {
|
|
7974
8333
|
return [w(shape)];
|
|
7975
8334
|
}
|
|
7976
|
-
else if (shape instanceof B$
|
|
8335
|
+
else if (shape instanceof B$3) {
|
|
7977
8336
|
return [j$1(shape)];
|
|
7978
8337
|
}
|
|
7979
8338
|
else if (Hn(shape)) {
|
|
@@ -7988,8 +8347,8 @@ function toSVGViewBox(shape) {
|
|
|
7988
8347
|
function wrapPantograph(pantographObject) {
|
|
7989
8348
|
const isPantograph = Hn(pantographObject) ||
|
|
7990
8349
|
pantographObject instanceof _$2 ||
|
|
7991
|
-
pantographObject instanceof v$
|
|
7992
|
-
pantographObject instanceof O$
|
|
8350
|
+
pantographObject instanceof v$2 ||
|
|
8351
|
+
pantographObject instanceof O$2 ||
|
|
7993
8352
|
pantographObject instanceof Drawing;
|
|
7994
8353
|
if (!isPantograph)
|
|
7995
8354
|
return pantographObject;
|
|
@@ -8008,7 +8367,7 @@ function initStudioIntegration() {
|
|
|
8008
8367
|
}
|
|
8009
8368
|
class Drawing {
|
|
8010
8369
|
diagram;
|
|
8011
|
-
constructor(diagram = new O$
|
|
8370
|
+
constructor(diagram = new O$2()) {
|
|
8012
8371
|
this.diagram = diagram;
|
|
8013
8372
|
}
|
|
8014
8373
|
clone() {
|
|
@@ -8084,7 +8443,7 @@ class Drawing {
|
|
|
8084
8443
|
return new Drawing(Dn(this.diagram, distance));
|
|
8085
8444
|
}
|
|
8086
8445
|
}
|
|
8087
|
-
class ReDrawingPen extends ot$
|
|
8446
|
+
class ReDrawingPen extends ot$2 {
|
|
8088
8447
|
// @ts-expect-error forcing a different type
|
|
8089
8448
|
close() {
|
|
8090
8449
|
return new Drawing(super.close());
|
|
@@ -8097,5 +8456,14 @@ class ReDrawingPen extends ot$1 {
|
|
|
8097
8456
|
function redraw(p) {
|
|
8098
8457
|
return new ReDrawingPen(p);
|
|
8099
8458
|
}
|
|
8459
|
+
function wrapDrawing(fn) {
|
|
8460
|
+
return function (...args) {
|
|
8461
|
+
return new Drawing(fn.apply(this, args));
|
|
8462
|
+
};
|
|
8463
|
+
}
|
|
8464
|
+
const drawCircle = wrapDrawing(ct$1);
|
|
8465
|
+
const drawRect = wrapDrawing(ot$1);
|
|
8466
|
+
const drawEllipse = wrapDrawing(rt$1);
|
|
8467
|
+
const drawPolysides = wrapDrawing(lt);
|
|
8100
8468
|
|
|
8101
|
-
export { Drawing, ReDrawingPen, drawShape, initStudioIntegration, pantograph, redraw, sketchDiagram, sketchFigure, sketchOnPlane, sketchSegment, sketchStroke };
|
|
8469
|
+
export { Drawing, ReDrawingPen, drawCircle, drawEllipse, drawPolysides, drawRect, drawShape, initStudioIntegration, pantograph, redraw, sketchDiagram, sketchFigure, sketchOnPlane, sketchSegment, sketchStroke, wrapDrawing };
|