@tscircuit/cli 0.1.151 → 0.1.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +2821 -175
  2. package/package.json +4 -4
package/dist/main.js CHANGED
@@ -227419,26 +227419,2229 @@ var require_svgson_cjs = __commonJS((exports2) => {
227419
227419
  exports2.stringify = stringify;
227420
227420
  });
227421
227421
 
227422
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/applyToPoint.js
227423
+ var require_applyToPoint = __commonJS((exports2) => {
227424
+ Object.defineProperty(exports2, "__esModule", {
227425
+ value: true
227426
+ });
227427
+ exports2.applyToPoint = applyToPoint;
227428
+ exports2.applyToPoints = applyToPoints;
227429
+ function applyToPoint(matrix, point2) {
227430
+ return Array.isArray(point2) ? [matrix.a * point2[0] + matrix.c * point2[1] + matrix.e, matrix.b * point2[0] + matrix.d * point2[1] + matrix.f] : {
227431
+ x: matrix.a * point2.x + matrix.c * point2.y + matrix.e,
227432
+ y: matrix.b * point2.x + matrix.d * point2.y + matrix.f
227433
+ };
227434
+ }
227435
+ function applyToPoints(matrix, points) {
227436
+ return points.map((point2) => applyToPoint(matrix, point2));
227437
+ }
227438
+ });
227439
+
227440
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/fromObject.js
227441
+ var require_fromObject = __commonJS((exports2) => {
227442
+ Object.defineProperty(exports2, "__esModule", {
227443
+ value: true
227444
+ });
227445
+ exports2.fromObject = fromObject;
227446
+ function fromObject(object) {
227447
+ return {
227448
+ a: parseFloat(object.a),
227449
+ b: parseFloat(object.b),
227450
+ c: parseFloat(object.c),
227451
+ d: parseFloat(object.d),
227452
+ e: parseFloat(object.e),
227453
+ f: parseFloat(object.f)
227454
+ };
227455
+ }
227456
+ });
227457
+
227458
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/fromString.js
227459
+ var require_fromString = __commonJS((exports2) => {
227460
+ Object.defineProperty(exports2, "__esModule", {
227461
+ value: true
227462
+ });
227463
+ exports2.fromString = fromString;
227464
+ var matrixRegex = /^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;
227465
+ function fromString(string) {
227466
+ const parsed = string.match(matrixRegex);
227467
+ if (parsed === null || parsed.length < 7)
227468
+ throw new Error(`'${string}' is not a matrix`);
227469
+ return {
227470
+ a: parseFloat(parsed[1]),
227471
+ b: parseFloat(parsed[2]),
227472
+ c: parseFloat(parsed[3]),
227473
+ d: parseFloat(parsed[4]),
227474
+ e: parseFloat(parsed[5]),
227475
+ f: parseFloat(parsed[6])
227476
+ };
227477
+ }
227478
+ });
227479
+
227480
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/identity.js
227481
+ var require_identity = __commonJS((exports2) => {
227482
+ Object.defineProperty(exports2, "__esModule", {
227483
+ value: true
227484
+ });
227485
+ exports2.identity = identity;
227486
+ function identity() {
227487
+ return {
227488
+ a: 1,
227489
+ c: 0,
227490
+ e: 0,
227491
+ b: 0,
227492
+ d: 1,
227493
+ f: 0
227494
+ };
227495
+ }
227496
+ });
227497
+
227498
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/inverse.js
227499
+ var require_inverse = __commonJS((exports2) => {
227500
+ Object.defineProperty(exports2, "__esModule", {
227501
+ value: true
227502
+ });
227503
+ exports2.inverse = inverse;
227504
+ function inverse(matrix) {
227505
+ const {
227506
+ a,
227507
+ b,
227508
+ c,
227509
+ d,
227510
+ e,
227511
+ f
227512
+ } = matrix;
227513
+ const denom = a * d - b * c;
227514
+ return {
227515
+ a: d / denom,
227516
+ b: b / -denom,
227517
+ c: c / -denom,
227518
+ d: a / denom,
227519
+ e: (d * e - c * f) / -denom,
227520
+ f: (b * e - a * f) / denom
227521
+ };
227522
+ }
227523
+ });
227524
+
227525
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/utils.js
227526
+ var require_utils6 = __commonJS((exports2) => {
227527
+ Object.defineProperty(exports2, "__esModule", {
227528
+ value: true
227529
+ });
227530
+ exports2.isNumeric = isNumeric;
227531
+ exports2.isObject = isObject3;
227532
+ exports2.isUndefined = isUndefined2;
227533
+ exports2.matchesShape = matchesShape;
227534
+ function isUndefined2(val) {
227535
+ return typeof val === "undefined";
227536
+ }
227537
+ function isNumeric(n) {
227538
+ return typeof n === "number" && !Number.isNaN(n) && Number.isFinite(n);
227539
+ }
227540
+ function isObject3(obj) {
227541
+ return typeof obj === "object" && obj !== null && !Array.isArray(obj);
227542
+ }
227543
+ function matchesShape(obj, keys) {
227544
+ return keys.every((key) => (key in obj));
227545
+ }
227546
+ });
227547
+
227548
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/isAffineMatrix.js
227549
+ var require_isAffineMatrix = __commonJS((exports2) => {
227550
+ Object.defineProperty(exports2, "__esModule", {
227551
+ value: true
227552
+ });
227553
+ exports2.isAffineMatrix = isAffineMatrix;
227554
+ var _utils = require_utils6();
227555
+ function isAffineMatrix(object) {
227556
+ return (0, _utils.isObject)(object) && "a" in object && (0, _utils.isNumeric)(object.a) && "b" in object && (0, _utils.isNumeric)(object.b) && "c" in object && (0, _utils.isNumeric)(object.c) && "d" in object && (0, _utils.isNumeric)(object.d) && "e" in object && (0, _utils.isNumeric)(object.e) && "f" in object && (0, _utils.isNumeric)(object.f);
227557
+ }
227558
+ });
227559
+
227560
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/translate.js
227561
+ var require_translate = __commonJS((exports2) => {
227562
+ Object.defineProperty(exports2, "__esModule", {
227563
+ value: true
227564
+ });
227565
+ exports2.translate = translate;
227566
+ function translate(tx, ty = 0) {
227567
+ return {
227568
+ a: 1,
227569
+ c: 0,
227570
+ e: tx,
227571
+ b: 0,
227572
+ d: 1,
227573
+ f: ty
227574
+ };
227575
+ }
227576
+ });
227577
+
227578
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/transform.js
227579
+ var require_transform = __commonJS((exports2) => {
227580
+ Object.defineProperty(exports2, "__esModule", {
227581
+ value: true
227582
+ });
227583
+ exports2.compose = compose;
227584
+ exports2.transform = transform;
227585
+ function transform(...matrices) {
227586
+ matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;
227587
+ const multiply = (m1, m2) => {
227588
+ return {
227589
+ a: m1.a * m2.a + m1.c * m2.b,
227590
+ c: m1.a * m2.c + m1.c * m2.d,
227591
+ e: m1.a * m2.e + m1.c * m2.f + m1.e,
227592
+ b: m1.b * m2.a + m1.d * m2.b,
227593
+ d: m1.b * m2.c + m1.d * m2.d,
227594
+ f: m1.b * m2.e + m1.d * m2.f + m1.f
227595
+ };
227596
+ };
227597
+ switch (matrices.length) {
227598
+ case 0:
227599
+ throw new Error("no matrices provided");
227600
+ case 1:
227601
+ return matrices[0];
227602
+ case 2:
227603
+ return multiply(matrices[0], matrices[1]);
227604
+ default: {
227605
+ const [m1, m2, ...rest] = matrices;
227606
+ const m = multiply(m1, m2);
227607
+ return transform(m, ...rest);
227608
+ }
227609
+ }
227610
+ }
227611
+ function compose(...matrices) {
227612
+ return transform(...matrices);
227613
+ }
227614
+ });
227615
+
227616
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/rotate.js
227617
+ var require_rotate = __commonJS((exports2) => {
227618
+ Object.defineProperty(exports2, "__esModule", {
227619
+ value: true
227620
+ });
227621
+ exports2.rotate = rotate;
227622
+ exports2.rotateDEG = rotateDEG;
227623
+ var _utils = require_utils6();
227624
+ var _translate = require_translate();
227625
+ var _transform = require_transform();
227626
+ var {
227627
+ cos,
227628
+ sin,
227629
+ PI
227630
+ } = Math;
227631
+ function rotate(angle, cx, cy) {
227632
+ const cosAngle = cos(angle);
227633
+ const sinAngle = sin(angle);
227634
+ const rotationMatrix = {
227635
+ a: cosAngle,
227636
+ c: -sinAngle,
227637
+ e: 0,
227638
+ b: sinAngle,
227639
+ d: cosAngle,
227640
+ f: 0
227641
+ };
227642
+ if ((0, _utils.isUndefined)(cx) || (0, _utils.isUndefined)(cy)) {
227643
+ return rotationMatrix;
227644
+ }
227645
+ return (0, _transform.transform)([(0, _translate.translate)(cx, cy), rotationMatrix, (0, _translate.translate)(-cx, -cy)]);
227646
+ }
227647
+ function rotateDEG(angle, cx = undefined, cy = undefined) {
227648
+ return rotate(angle * PI / 180, cx, cy);
227649
+ }
227650
+ });
227651
+
227652
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/scale.js
227653
+ var require_scale = __commonJS((exports2) => {
227654
+ Object.defineProperty(exports2, "__esModule", {
227655
+ value: true
227656
+ });
227657
+ exports2.scale = scale;
227658
+ var _utils = require_utils6();
227659
+ var _translate = require_translate();
227660
+ var _transform = require_transform();
227661
+ function scale(sx, sy = undefined, cx = undefined, cy = undefined) {
227662
+ if ((0, _utils.isUndefined)(sy))
227663
+ sy = sx;
227664
+ const scaleMatrix = {
227665
+ a: sx,
227666
+ c: 0,
227667
+ e: 0,
227668
+ b: 0,
227669
+ d: sy,
227670
+ f: 0
227671
+ };
227672
+ if ((0, _utils.isUndefined)(cx) || (0, _utils.isUndefined)(cy)) {
227673
+ return scaleMatrix;
227674
+ }
227675
+ return (0, _transform.transform)([(0, _translate.translate)(cx, cy), scaleMatrix, (0, _translate.translate)(-cx, -cy)]);
227676
+ }
227677
+ });
227678
+
227679
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/shear.js
227680
+ var require_shear = __commonJS((exports2) => {
227681
+ Object.defineProperty(exports2, "__esModule", {
227682
+ value: true
227683
+ });
227684
+ exports2.shear = shear;
227685
+ function shear(shx, shy) {
227686
+ return {
227687
+ a: 1,
227688
+ c: shx,
227689
+ e: 0,
227690
+ b: shy,
227691
+ d: 1,
227692
+ f: 0
227693
+ };
227694
+ }
227695
+ });
227696
+
227697
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/skew.js
227698
+ var require_skew = __commonJS((exports2) => {
227699
+ Object.defineProperty(exports2, "__esModule", {
227700
+ value: true
227701
+ });
227702
+ exports2.skew = skew;
227703
+ exports2.skewDEG = skewDEG;
227704
+ var {
227705
+ tan
227706
+ } = Math;
227707
+ function skew(ax, ay) {
227708
+ return {
227709
+ a: 1,
227710
+ c: tan(ax),
227711
+ e: 0,
227712
+ b: tan(ay),
227713
+ d: 1,
227714
+ f: 0
227715
+ };
227716
+ }
227717
+ function skewDEG(ax, ay) {
227718
+ return skew(ax * Math.PI / 180, ay * Math.PI / 180);
227719
+ }
227720
+ });
227721
+
227722
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/toString.js
227723
+ var require_toString = __commonJS((exports2) => {
227724
+ Object.defineProperty(exports2, "__esModule", {
227725
+ value: true
227726
+ });
227727
+ exports2.toCSS = toCSS;
227728
+ exports2.toSVG = toSVG;
227729
+ exports2.toString = toString;
227730
+ function toCSS(matrix) {
227731
+ return toString(matrix);
227732
+ }
227733
+ function toSVG(matrix) {
227734
+ return toString(matrix);
227735
+ }
227736
+ function toString(matrix) {
227737
+ return `matrix(${matrix.a},${matrix.b},${matrix.c},${matrix.d},${matrix.e},${matrix.f})`;
227738
+ }
227739
+ });
227740
+
227741
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/smoothMatrix.js
227742
+ var require_smoothMatrix = __commonJS((exports2) => {
227743
+ Object.defineProperty(exports2, "__esModule", {
227744
+ value: true
227745
+ });
227746
+ exports2.smoothMatrix = smoothMatrix;
227747
+ function smoothMatrix(matrix, precision = 10000000000) {
227748
+ return {
227749
+ a: Math.round(matrix.a * precision) / precision,
227750
+ b: Math.round(matrix.b * precision) / precision,
227751
+ c: Math.round(matrix.c * precision) / precision,
227752
+ d: Math.round(matrix.d * precision) / precision,
227753
+ e: Math.round(matrix.e * precision) / precision,
227754
+ f: Math.round(matrix.f * precision) / precision
227755
+ };
227756
+ }
227757
+ });
227758
+
227759
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/fromTriangles.js
227760
+ var require_fromTriangles = __commonJS((exports2) => {
227761
+ Object.defineProperty(exports2, "__esModule", {
227762
+ value: true
227763
+ });
227764
+ exports2.fromTriangles = fromTriangles;
227765
+ var _inverse = require_inverse();
227766
+ var _transform = require_transform();
227767
+ var _smoothMatrix = require_smoothMatrix();
227768
+ function fromTriangles(t1, t2) {
227769
+ const px1 = t1[0].x != null ? t1[0].x : t1[0][0];
227770
+ const py1 = t1[0].y != null ? t1[0].y : t1[0][1];
227771
+ const px2 = t2[0].x != null ? t2[0].x : t2[0][0];
227772
+ const py2 = t2[0].y != null ? t2[0].y : t2[0][1];
227773
+ const qx1 = t1[1].x != null ? t1[1].x : t1[1][0];
227774
+ const qy1 = t1[1].y != null ? t1[1].y : t1[1][1];
227775
+ const qx2 = t2[1].x != null ? t2[1].x : t2[1][0];
227776
+ const qy2 = t2[1].y != null ? t2[1].y : t2[1][1];
227777
+ const rx1 = t1[2].x != null ? t1[2].x : t1[2][0];
227778
+ const ry1 = t1[2].y != null ? t1[2].y : t1[2][1];
227779
+ const rx2 = t2[2].x != null ? t2[2].x : t2[2][0];
227780
+ const ry2 = t2[2].y != null ? t2[2].y : t2[2][1];
227781
+ const r1 = {
227782
+ a: px1 - rx1,
227783
+ b: py1 - ry1,
227784
+ c: qx1 - rx1,
227785
+ d: qy1 - ry1,
227786
+ e: rx1,
227787
+ f: ry1
227788
+ };
227789
+ const r2 = {
227790
+ a: px2 - rx2,
227791
+ b: py2 - ry2,
227792
+ c: qx2 - rx2,
227793
+ d: qy2 - ry2,
227794
+ e: rx2,
227795
+ f: ry2
227796
+ };
227797
+ const inverseR1 = (0, _inverse.inverse)(r1);
227798
+ const affineMatrix = (0, _transform.transform)([r2, inverseR1]);
227799
+ return (0, _smoothMatrix.smoothMatrix)(affineMatrix);
227800
+ }
227801
+ });
227802
+
227803
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/fromDefinition.js
227804
+ var require_fromDefinition = __commonJS((exports2) => {
227805
+ Object.defineProperty(exports2, "__esModule", {
227806
+ value: true
227807
+ });
227808
+ exports2.fromDefinition = fromDefinition;
227809
+ var _fromObject = require_fromObject();
227810
+ var _translate = require_translate();
227811
+ var _scale = require_scale();
227812
+ var _rotate = require_rotate();
227813
+ var _skew = require_skew();
227814
+ var _shear = require_shear();
227815
+ function fromDefinition(definitionOrArrayOfDefinition) {
227816
+ return Array.isArray(definitionOrArrayOfDefinition) ? definitionOrArrayOfDefinition.map(mapper) : mapper(definitionOrArrayOfDefinition);
227817
+ function mapper(descriptor) {
227818
+ switch (descriptor.type) {
227819
+ case "matrix":
227820
+ if ("a" in descriptor && "b" in descriptor && "c" in descriptor && "d" in descriptor && "e" in descriptor && "f" in descriptor) {
227821
+ return (0, _fromObject.fromObject)(descriptor);
227822
+ } else {
227823
+ throw new Error("MISSING_MANDATORY_PARAM");
227824
+ }
227825
+ case "translate":
227826
+ if (!("tx" in descriptor))
227827
+ throw new Error("MISSING_MANDATORY_PARAM");
227828
+ if ("ty" in descriptor)
227829
+ return (0, _translate.translate)(descriptor.tx, descriptor.ty);
227830
+ return (0, _translate.translate)(descriptor.tx);
227831
+ case "scale":
227832
+ if (!("sx" in descriptor))
227833
+ throw new Error("MISSING_MANDATORY_PARAM");
227834
+ if ("sy" in descriptor)
227835
+ return (0, _scale.scale)(descriptor.sx, descriptor.sy);
227836
+ return (0, _scale.scale)(descriptor.sx);
227837
+ case "rotate":
227838
+ if (!("angle" in descriptor))
227839
+ throw new Error("MISSING_MANDATORY_PARAM");
227840
+ if ("cx" in descriptor && "cy" in descriptor) {
227841
+ return (0, _rotate.rotateDEG)(descriptor.angle, descriptor.cx, descriptor.cy);
227842
+ }
227843
+ return (0, _rotate.rotateDEG)(descriptor.angle);
227844
+ case "skewX":
227845
+ if (!("angle" in descriptor))
227846
+ throw new Error("MISSING_MANDATORY_PARAM");
227847
+ return (0, _skew.skewDEG)(descriptor.angle, 0);
227848
+ case "skewY":
227849
+ if (!("angle" in descriptor))
227850
+ throw new Error("MISSING_MANDATORY_PARAM");
227851
+ return (0, _skew.skewDEG)(0, descriptor.angle);
227852
+ case "shear":
227853
+ if (!(("shx" in descriptor) && ("shy" in descriptor)))
227854
+ throw new Error("MISSING_MANDATORY_PARAM");
227855
+ return (0, _shear.shear)(descriptor.shx, descriptor.shy);
227856
+ default:
227857
+ throw new Error("UNSUPPORTED_DESCRIPTOR");
227858
+ }
227859
+ }
227860
+ }
227861
+ });
227862
+
227863
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/fromTransformAttribute.autogenerated.js
227864
+ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
227865
+ Object.defineProperty(exports2, "__esModule", {
227866
+ value: true
227867
+ });
227868
+ exports2.SyntaxError = peg$SyntaxError2;
227869
+ exports2.parse = peg$parse;
227870
+ function peg$subclass2(child, parent) {
227871
+ function C() {
227872
+ this.constructor = child;
227873
+ }
227874
+ C.prototype = parent.prototype;
227875
+ child.prototype = new C;
227876
+ }
227877
+ function peg$SyntaxError2(message, expected, found, location) {
227878
+ var self = Error.call(this, message);
227879
+ if (Object.setPrototypeOf) {
227880
+ Object.setPrototypeOf(self, peg$SyntaxError2.prototype);
227881
+ }
227882
+ self.expected = expected;
227883
+ self.found = found;
227884
+ self.location = location;
227885
+ self.name = "SyntaxError";
227886
+ return self;
227887
+ }
227888
+ peg$subclass2(peg$SyntaxError2, Error);
227889
+ function peg$padEnd2(str, targetLength, padString) {
227890
+ padString = padString || " ";
227891
+ if (str.length > targetLength) {
227892
+ return str;
227893
+ }
227894
+ targetLength -= str.length;
227895
+ padString += padString.repeat(targetLength);
227896
+ return str + padString.slice(0, targetLength);
227897
+ }
227898
+ peg$SyntaxError2.prototype.format = function(sources) {
227899
+ var str = "Error: " + this.message;
227900
+ if (this.location) {
227901
+ var src = null;
227902
+ var k;
227903
+ for (k = 0;k < sources.length; k++) {
227904
+ if (sources[k].source === this.location.source) {
227905
+ src = sources[k].text.split(/\r\n|\n|\r/g);
227906
+ break;
227907
+ }
227908
+ }
227909
+ var s = this.location.start;
227910
+ var offset_s = this.location.source && typeof this.location.source.offset === "function" ? this.location.source.offset(s) : s;
227911
+ var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
227912
+ if (src) {
227913
+ var e = this.location.end;
227914
+ var filler = peg$padEnd2("", offset_s.line.toString().length, " ");
227915
+ var line = src[s.line - 1];
227916
+ var last = s.line === e.line ? e.column : line.length + 1;
227917
+ var hatLen = last - s.column || 1;
227918
+ str += `
227919
+ --> ` + loc + `
227920
+ ` + filler + ` |
227921
+ ` + offset_s.line + " | " + line + `
227922
+ ` + filler + " | " + peg$padEnd2("", s.column - 1, " ") + peg$padEnd2("", hatLen, "^");
227923
+ } else {
227924
+ str += `
227925
+ at ` + loc;
227926
+ }
227927
+ }
227928
+ return str;
227929
+ };
227930
+ peg$SyntaxError2.buildMessage = function(expected, found) {
227931
+ var DESCRIBE_EXPECTATION_FNS = {
227932
+ literal: function(expectation) {
227933
+ return '"' + literalEscape(expectation.text) + '"';
227934
+ },
227935
+ class: function(expectation) {
227936
+ var escapedParts = expectation.parts.map(function(part) {
227937
+ return Array.isArray(part) ? classEscape(part[0]) + "-" + classEscape(part[1]) : classEscape(part);
227938
+ });
227939
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
227940
+ },
227941
+ any: function() {
227942
+ return "any character";
227943
+ },
227944
+ end: function() {
227945
+ return "end of input";
227946
+ },
227947
+ other: function(expectation) {
227948
+ return expectation.description;
227949
+ }
227950
+ };
227951
+ function hex(ch) {
227952
+ return ch.charCodeAt(0).toString(16).toUpperCase();
227953
+ }
227954
+ function literalEscape(s) {
227955
+ return s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
227956
+ return "\\x0" + hex(ch);
227957
+ }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
227958
+ return "\\x" + hex(ch);
227959
+ });
227960
+ }
227961
+ function classEscape(s) {
227962
+ return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
227963
+ return "\\x0" + hex(ch);
227964
+ }).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
227965
+ return "\\x" + hex(ch);
227966
+ });
227967
+ }
227968
+ function describeExpectation(expectation) {
227969
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
227970
+ }
227971
+ function describeExpected(expected2) {
227972
+ var descriptions = expected2.map(describeExpectation);
227973
+ var i, j;
227974
+ descriptions.sort();
227975
+ if (descriptions.length > 0) {
227976
+ for (i = 1, j = 1;i < descriptions.length; i++) {
227977
+ if (descriptions[i - 1] !== descriptions[i]) {
227978
+ descriptions[j] = descriptions[i];
227979
+ j++;
227980
+ }
227981
+ }
227982
+ descriptions.length = j;
227983
+ }
227984
+ switch (descriptions.length) {
227985
+ case 1:
227986
+ return descriptions[0];
227987
+ case 2:
227988
+ return descriptions[0] + " or " + descriptions[1];
227989
+ default:
227990
+ return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
227991
+ }
227992
+ }
227993
+ function describeFound(found2) {
227994
+ return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
227995
+ }
227996
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
227997
+ };
227998
+ function peg$parse(input, options) {
227999
+ options = options !== undefined ? options : {};
228000
+ var peg$FAILED = {};
228001
+ var peg$source = options.grammarSource;
228002
+ var peg$startRuleFunctions = {
228003
+ transformList: peg$parsetransformList
228004
+ };
228005
+ var peg$startRuleFunction = peg$parsetransformList;
228006
+ var peg$c0 = "matrix";
228007
+ var peg$c1 = "(";
228008
+ var peg$c2 = ")";
228009
+ var peg$c3 = "translate";
228010
+ var peg$c4 = "scale";
228011
+ var peg$c5 = "rotate";
228012
+ var peg$c6 = "skewX";
228013
+ var peg$c7 = "skewY";
228014
+ var peg$c8 = ",";
228015
+ var peg$c9 = ".";
228016
+ var peg$r0 = /^[eE]/;
228017
+ var peg$r1 = /^[+\-]/;
228018
+ var peg$r2 = /^[0-9]/;
228019
+ var peg$r3 = /^[ \t\r\n]/;
228020
+ var peg$e0 = peg$literalExpectation("matrix", false);
228021
+ var peg$e1 = peg$literalExpectation("(", false);
228022
+ var peg$e2 = peg$literalExpectation(")", false);
228023
+ var peg$e3 = peg$literalExpectation("translate", false);
228024
+ var peg$e4 = peg$literalExpectation("scale", false);
228025
+ var peg$e5 = peg$literalExpectation("rotate", false);
228026
+ var peg$e6 = peg$literalExpectation("skewX", false);
228027
+ var peg$e7 = peg$literalExpectation("skewY", false);
228028
+ var peg$e8 = peg$literalExpectation(",", false);
228029
+ var peg$e9 = peg$otherExpectation("fractionalConstant");
228030
+ var peg$e10 = peg$literalExpectation(".", false);
228031
+ var peg$e11 = peg$classExpectation(["e", "E"], false, false);
228032
+ var peg$e12 = peg$classExpectation(["+", "-"], false, false);
228033
+ var peg$e13 = peg$classExpectation([["0", "9"]], false, false);
228034
+ var peg$e14 = peg$classExpectation([" ", "\t", "\r", `
228035
+ `], false, false);
228036
+ var peg$f0 = function(ts3) {
228037
+ return ts3;
228038
+ };
228039
+ var peg$f1 = function(t, ts3) {
228040
+ return t.concat(ts3);
228041
+ };
228042
+ var peg$f2 = function(a, b, c, d, e, f) {
228043
+ return [{
228044
+ type: "matrix",
228045
+ a,
228046
+ b,
228047
+ c,
228048
+ d,
228049
+ e,
228050
+ f
228051
+ }];
228052
+ };
228053
+ var peg$f3 = function(tx, ty) {
228054
+ var t = {
228055
+ type: "translate",
228056
+ tx
228057
+ };
228058
+ if (ty)
228059
+ t.ty = ty;
228060
+ return [t];
228061
+ };
228062
+ var peg$f4 = function(sx, sy) {
228063
+ var s = {
228064
+ type: "scale",
228065
+ sx
228066
+ };
228067
+ if (sy)
228068
+ s.sy = sy;
228069
+ return [s];
228070
+ };
228071
+ var peg$f5 = function(angle, c) {
228072
+ var r = {
228073
+ type: "rotate",
228074
+ angle
228075
+ };
228076
+ if (c) {
228077
+ r.cx = c[0];
228078
+ r.cy = c[1];
228079
+ }
228080
+ return [r];
228081
+ };
228082
+ var peg$f6 = function(angle) {
228083
+ return [{
228084
+ type: "skewX",
228085
+ angle
228086
+ }];
228087
+ };
228088
+ var peg$f7 = function(angle) {
228089
+ return [{
228090
+ type: "skewY",
228091
+ angle
228092
+ }];
228093
+ };
228094
+ var peg$f8 = function(f) {
228095
+ return parseFloat(f.join(""));
228096
+ };
228097
+ var peg$f9 = function(i) {
228098
+ return parseInt(i.join(""));
228099
+ };
228100
+ var peg$f10 = function(n) {
228101
+ return n;
228102
+ };
228103
+ var peg$f11 = function(n1, n2) {
228104
+ return [n1, n2];
228105
+ };
228106
+ var peg$f12 = function(ds) {
228107
+ return ds.join("");
228108
+ };
228109
+ var peg$f13 = function(f, e) {
228110
+ return [f, e || null].join("");
228111
+ };
228112
+ var peg$f14 = function(d, e) {
228113
+ return [d, e].join("");
228114
+ };
228115
+ var peg$f15 = function(d1, d2) {
228116
+ return [d1 ? d1.join("") : null, ".", d2.join("")].join("");
228117
+ };
228118
+ var peg$f16 = function(d) {
228119
+ return d.join("");
228120
+ };
228121
+ var peg$f17 = function(s, d) {
228122
+ return ["e", s, d.join("")].join("");
228123
+ };
228124
+ var peg$currPos = 0;
228125
+ var peg$savedPos = 0;
228126
+ var peg$posDetailsCache = [{
228127
+ line: 1,
228128
+ column: 1
228129
+ }];
228130
+ var peg$maxFailPos = 0;
228131
+ var peg$maxFailExpected = [];
228132
+ var peg$silentFails = 0;
228133
+ var peg$result;
228134
+ if ("startRule" in options) {
228135
+ if (!(options.startRule in peg$startRuleFunctions)) {
228136
+ throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
228137
+ }
228138
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
228139
+ }
228140
+ function text() {
228141
+ return input.substring(peg$savedPos, peg$currPos);
228142
+ }
228143
+ function offset() {
228144
+ return peg$savedPos;
228145
+ }
228146
+ function range() {
228147
+ return {
228148
+ source: peg$source,
228149
+ start: peg$savedPos,
228150
+ end: peg$currPos
228151
+ };
228152
+ }
228153
+ function location() {
228154
+ return peg$computeLocation(peg$savedPos, peg$currPos);
228155
+ }
228156
+ function expected(description, location2) {
228157
+ location2 = location2 !== undefined ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
228158
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location2);
228159
+ }
228160
+ function error(message, location2) {
228161
+ location2 = location2 !== undefined ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
228162
+ throw peg$buildSimpleError(message, location2);
228163
+ }
228164
+ function peg$literalExpectation(text2, ignoreCase) {
228165
+ return {
228166
+ type: "literal",
228167
+ text: text2,
228168
+ ignoreCase
228169
+ };
228170
+ }
228171
+ function peg$classExpectation(parts, inverted, ignoreCase) {
228172
+ return {
228173
+ type: "class",
228174
+ parts,
228175
+ inverted,
228176
+ ignoreCase
228177
+ };
228178
+ }
228179
+ function peg$anyExpectation() {
228180
+ return {
228181
+ type: "any"
228182
+ };
228183
+ }
228184
+ function peg$endExpectation() {
228185
+ return {
228186
+ type: "end"
228187
+ };
228188
+ }
228189
+ function peg$otherExpectation(description) {
228190
+ return {
228191
+ type: "other",
228192
+ description
228193
+ };
228194
+ }
228195
+ function peg$computePosDetails(pos) {
228196
+ var details = peg$posDetailsCache[pos];
228197
+ var p;
228198
+ if (details) {
228199
+ return details;
228200
+ } else {
228201
+ p = pos - 1;
228202
+ while (!peg$posDetailsCache[p]) {
228203
+ p--;
228204
+ }
228205
+ details = peg$posDetailsCache[p];
228206
+ details = {
228207
+ line: details.line,
228208
+ column: details.column
228209
+ };
228210
+ while (p < pos) {
228211
+ if (input.charCodeAt(p) === 10) {
228212
+ details.line++;
228213
+ details.column = 1;
228214
+ } else {
228215
+ details.column++;
228216
+ }
228217
+ p++;
228218
+ }
228219
+ peg$posDetailsCache[pos] = details;
228220
+ return details;
228221
+ }
228222
+ }
228223
+ function peg$computeLocation(startPos, endPos, offset2) {
228224
+ var startPosDetails = peg$computePosDetails(startPos);
228225
+ var endPosDetails = peg$computePosDetails(endPos);
228226
+ var res = {
228227
+ source: peg$source,
228228
+ start: {
228229
+ offset: startPos,
228230
+ line: startPosDetails.line,
228231
+ column: startPosDetails.column
228232
+ },
228233
+ end: {
228234
+ offset: endPos,
228235
+ line: endPosDetails.line,
228236
+ column: endPosDetails.column
228237
+ }
228238
+ };
228239
+ if (offset2 && peg$source && typeof peg$source.offset === "function") {
228240
+ res.start = peg$source.offset(res.start);
228241
+ res.end = peg$source.offset(res.end);
228242
+ }
228243
+ return res;
228244
+ }
228245
+ function peg$fail(expected2) {
228246
+ if (peg$currPos < peg$maxFailPos) {
228247
+ return;
228248
+ }
228249
+ if (peg$currPos > peg$maxFailPos) {
228250
+ peg$maxFailPos = peg$currPos;
228251
+ peg$maxFailExpected = [];
228252
+ }
228253
+ peg$maxFailExpected.push(expected2);
228254
+ }
228255
+ function peg$buildSimpleError(message, location2) {
228256
+ return new peg$SyntaxError2(message, null, null, location2);
228257
+ }
228258
+ function peg$buildStructuredError(expected2, found, location2) {
228259
+ return new peg$SyntaxError2(peg$SyntaxError2.buildMessage(expected2, found), expected2, found, location2);
228260
+ }
228261
+ function peg$parsetransformList() {
228262
+ var s0, s1, s2, s3, s4;
228263
+ s0 = peg$currPos;
228264
+ s1 = [];
228265
+ s2 = peg$parsewsp();
228266
+ while (s2 !== peg$FAILED) {
228267
+ s1.push(s2);
228268
+ s2 = peg$parsewsp();
228269
+ }
228270
+ s2 = peg$parsetransforms();
228271
+ if (s2 === peg$FAILED) {
228272
+ s2 = null;
228273
+ }
228274
+ s3 = [];
228275
+ s4 = peg$parsewsp();
228276
+ while (s4 !== peg$FAILED) {
228277
+ s3.push(s4);
228278
+ s4 = peg$parsewsp();
228279
+ }
228280
+ peg$savedPos = s0;
228281
+ s0 = peg$f0(s2);
228282
+ return s0;
228283
+ }
228284
+ function peg$parsetransforms() {
228285
+ var s0, s1, s2, s3;
228286
+ s0 = peg$currPos;
228287
+ s1 = peg$parsetransform();
228288
+ if (s1 !== peg$FAILED) {
228289
+ s2 = [];
228290
+ s3 = peg$parsecommaWsp();
228291
+ if (s3 !== peg$FAILED) {
228292
+ while (s3 !== peg$FAILED) {
228293
+ s2.push(s3);
228294
+ s3 = peg$parsecommaWsp();
228295
+ }
228296
+ } else {
228297
+ s2 = peg$FAILED;
228298
+ }
228299
+ if (s2 !== peg$FAILED) {
228300
+ s3 = peg$parsetransforms();
228301
+ if (s3 !== peg$FAILED) {
228302
+ peg$savedPos = s0;
228303
+ s0 = peg$f1(s1, s3);
228304
+ } else {
228305
+ peg$currPos = s0;
228306
+ s0 = peg$FAILED;
228307
+ }
228308
+ } else {
228309
+ peg$currPos = s0;
228310
+ s0 = peg$FAILED;
228311
+ }
228312
+ } else {
228313
+ peg$currPos = s0;
228314
+ s0 = peg$FAILED;
228315
+ }
228316
+ if (s0 === peg$FAILED) {
228317
+ s0 = peg$parsetransform();
228318
+ }
228319
+ return s0;
228320
+ }
228321
+ function peg$parsetransform() {
228322
+ var s0;
228323
+ s0 = peg$parsematrix();
228324
+ if (s0 === peg$FAILED) {
228325
+ s0 = peg$parsetranslate();
228326
+ if (s0 === peg$FAILED) {
228327
+ s0 = peg$parsescale();
228328
+ if (s0 === peg$FAILED) {
228329
+ s0 = peg$parserotate();
228330
+ if (s0 === peg$FAILED) {
228331
+ s0 = peg$parseskewX();
228332
+ if (s0 === peg$FAILED) {
228333
+ s0 = peg$parseskewY();
228334
+ }
228335
+ }
228336
+ }
228337
+ }
228338
+ }
228339
+ return s0;
228340
+ }
228341
+ function peg$parsematrix() {
228342
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17;
228343
+ s0 = peg$currPos;
228344
+ if (input.substr(peg$currPos, 6) === peg$c0) {
228345
+ s1 = peg$c0;
228346
+ peg$currPos += 6;
228347
+ } else {
228348
+ s1 = peg$FAILED;
228349
+ if (peg$silentFails === 0) {
228350
+ peg$fail(peg$e0);
228351
+ }
228352
+ }
228353
+ if (s1 !== peg$FAILED) {
228354
+ s2 = [];
228355
+ s3 = peg$parsewsp();
228356
+ while (s3 !== peg$FAILED) {
228357
+ s2.push(s3);
228358
+ s3 = peg$parsewsp();
228359
+ }
228360
+ if (input.charCodeAt(peg$currPos) === 40) {
228361
+ s3 = peg$c1;
228362
+ peg$currPos++;
228363
+ } else {
228364
+ s3 = peg$FAILED;
228365
+ if (peg$silentFails === 0) {
228366
+ peg$fail(peg$e1);
228367
+ }
228368
+ }
228369
+ if (s3 !== peg$FAILED) {
228370
+ s4 = [];
228371
+ s5 = peg$parsewsp();
228372
+ while (s5 !== peg$FAILED) {
228373
+ s4.push(s5);
228374
+ s5 = peg$parsewsp();
228375
+ }
228376
+ s5 = peg$parsenumber();
228377
+ if (s5 !== peg$FAILED) {
228378
+ s6 = peg$parsecommaWsp();
228379
+ if (s6 !== peg$FAILED) {
228380
+ s7 = peg$parsenumber();
228381
+ if (s7 !== peg$FAILED) {
228382
+ s8 = peg$parsecommaWsp();
228383
+ if (s8 !== peg$FAILED) {
228384
+ s9 = peg$parsenumber();
228385
+ if (s9 !== peg$FAILED) {
228386
+ s10 = peg$parsecommaWsp();
228387
+ if (s10 !== peg$FAILED) {
228388
+ s11 = peg$parsenumber();
228389
+ if (s11 !== peg$FAILED) {
228390
+ s12 = peg$parsecommaWsp();
228391
+ if (s12 !== peg$FAILED) {
228392
+ s13 = peg$parsenumber();
228393
+ if (s13 !== peg$FAILED) {
228394
+ s14 = peg$parsecommaWsp();
228395
+ if (s14 !== peg$FAILED) {
228396
+ s15 = peg$parsenumber();
228397
+ if (s15 !== peg$FAILED) {
228398
+ s16 = [];
228399
+ s17 = peg$parsewsp();
228400
+ while (s17 !== peg$FAILED) {
228401
+ s16.push(s17);
228402
+ s17 = peg$parsewsp();
228403
+ }
228404
+ if (input.charCodeAt(peg$currPos) === 41) {
228405
+ s17 = peg$c2;
228406
+ peg$currPos++;
228407
+ } else {
228408
+ s17 = peg$FAILED;
228409
+ if (peg$silentFails === 0) {
228410
+ peg$fail(peg$e2);
228411
+ }
228412
+ }
228413
+ if (s17 !== peg$FAILED) {
228414
+ peg$savedPos = s0;
228415
+ s0 = peg$f2(s5, s7, s9, s11, s13, s15);
228416
+ } else {
228417
+ peg$currPos = s0;
228418
+ s0 = peg$FAILED;
228419
+ }
228420
+ } else {
228421
+ peg$currPos = s0;
228422
+ s0 = peg$FAILED;
228423
+ }
228424
+ } else {
228425
+ peg$currPos = s0;
228426
+ s0 = peg$FAILED;
228427
+ }
228428
+ } else {
228429
+ peg$currPos = s0;
228430
+ s0 = peg$FAILED;
228431
+ }
228432
+ } else {
228433
+ peg$currPos = s0;
228434
+ s0 = peg$FAILED;
228435
+ }
228436
+ } else {
228437
+ peg$currPos = s0;
228438
+ s0 = peg$FAILED;
228439
+ }
228440
+ } else {
228441
+ peg$currPos = s0;
228442
+ s0 = peg$FAILED;
228443
+ }
228444
+ } else {
228445
+ peg$currPos = s0;
228446
+ s0 = peg$FAILED;
228447
+ }
228448
+ } else {
228449
+ peg$currPos = s0;
228450
+ s0 = peg$FAILED;
228451
+ }
228452
+ } else {
228453
+ peg$currPos = s0;
228454
+ s0 = peg$FAILED;
228455
+ }
228456
+ } else {
228457
+ peg$currPos = s0;
228458
+ s0 = peg$FAILED;
228459
+ }
228460
+ } else {
228461
+ peg$currPos = s0;
228462
+ s0 = peg$FAILED;
228463
+ }
228464
+ } else {
228465
+ peg$currPos = s0;
228466
+ s0 = peg$FAILED;
228467
+ }
228468
+ } else {
228469
+ peg$currPos = s0;
228470
+ s0 = peg$FAILED;
228471
+ }
228472
+ return s0;
228473
+ }
228474
+ function peg$parsetranslate() {
228475
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8;
228476
+ s0 = peg$currPos;
228477
+ if (input.substr(peg$currPos, 9) === peg$c3) {
228478
+ s1 = peg$c3;
228479
+ peg$currPos += 9;
228480
+ } else {
228481
+ s1 = peg$FAILED;
228482
+ if (peg$silentFails === 0) {
228483
+ peg$fail(peg$e3);
228484
+ }
228485
+ }
228486
+ if (s1 !== peg$FAILED) {
228487
+ s2 = [];
228488
+ s3 = peg$parsewsp();
228489
+ while (s3 !== peg$FAILED) {
228490
+ s2.push(s3);
228491
+ s3 = peg$parsewsp();
228492
+ }
228493
+ if (input.charCodeAt(peg$currPos) === 40) {
228494
+ s3 = peg$c1;
228495
+ peg$currPos++;
228496
+ } else {
228497
+ s3 = peg$FAILED;
228498
+ if (peg$silentFails === 0) {
228499
+ peg$fail(peg$e1);
228500
+ }
228501
+ }
228502
+ if (s3 !== peg$FAILED) {
228503
+ s4 = [];
228504
+ s5 = peg$parsewsp();
228505
+ while (s5 !== peg$FAILED) {
228506
+ s4.push(s5);
228507
+ s5 = peg$parsewsp();
228508
+ }
228509
+ s5 = peg$parsenumber();
228510
+ if (s5 !== peg$FAILED) {
228511
+ s6 = peg$parsecommaWspNumber();
228512
+ if (s6 === peg$FAILED) {
228513
+ s6 = null;
228514
+ }
228515
+ s7 = [];
228516
+ s8 = peg$parsewsp();
228517
+ while (s8 !== peg$FAILED) {
228518
+ s7.push(s8);
228519
+ s8 = peg$parsewsp();
228520
+ }
228521
+ if (input.charCodeAt(peg$currPos) === 41) {
228522
+ s8 = peg$c2;
228523
+ peg$currPos++;
228524
+ } else {
228525
+ s8 = peg$FAILED;
228526
+ if (peg$silentFails === 0) {
228527
+ peg$fail(peg$e2);
228528
+ }
228529
+ }
228530
+ if (s8 !== peg$FAILED) {
228531
+ peg$savedPos = s0;
228532
+ s0 = peg$f3(s5, s6);
228533
+ } else {
228534
+ peg$currPos = s0;
228535
+ s0 = peg$FAILED;
228536
+ }
228537
+ } else {
228538
+ peg$currPos = s0;
228539
+ s0 = peg$FAILED;
228540
+ }
228541
+ } else {
228542
+ peg$currPos = s0;
228543
+ s0 = peg$FAILED;
228544
+ }
228545
+ } else {
228546
+ peg$currPos = s0;
228547
+ s0 = peg$FAILED;
228548
+ }
228549
+ return s0;
228550
+ }
228551
+ function peg$parsescale() {
228552
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8;
228553
+ s0 = peg$currPos;
228554
+ if (input.substr(peg$currPos, 5) === peg$c4) {
228555
+ s1 = peg$c4;
228556
+ peg$currPos += 5;
228557
+ } else {
228558
+ s1 = peg$FAILED;
228559
+ if (peg$silentFails === 0) {
228560
+ peg$fail(peg$e4);
228561
+ }
228562
+ }
228563
+ if (s1 !== peg$FAILED) {
228564
+ s2 = [];
228565
+ s3 = peg$parsewsp();
228566
+ while (s3 !== peg$FAILED) {
228567
+ s2.push(s3);
228568
+ s3 = peg$parsewsp();
228569
+ }
228570
+ if (input.charCodeAt(peg$currPos) === 40) {
228571
+ s3 = peg$c1;
228572
+ peg$currPos++;
228573
+ } else {
228574
+ s3 = peg$FAILED;
228575
+ if (peg$silentFails === 0) {
228576
+ peg$fail(peg$e1);
228577
+ }
228578
+ }
228579
+ if (s3 !== peg$FAILED) {
228580
+ s4 = [];
228581
+ s5 = peg$parsewsp();
228582
+ while (s5 !== peg$FAILED) {
228583
+ s4.push(s5);
228584
+ s5 = peg$parsewsp();
228585
+ }
228586
+ s5 = peg$parsenumber();
228587
+ if (s5 !== peg$FAILED) {
228588
+ s6 = peg$parsecommaWspNumber();
228589
+ if (s6 === peg$FAILED) {
228590
+ s6 = null;
228591
+ }
228592
+ s7 = [];
228593
+ s8 = peg$parsewsp();
228594
+ while (s8 !== peg$FAILED) {
228595
+ s7.push(s8);
228596
+ s8 = peg$parsewsp();
228597
+ }
228598
+ if (input.charCodeAt(peg$currPos) === 41) {
228599
+ s8 = peg$c2;
228600
+ peg$currPos++;
228601
+ } else {
228602
+ s8 = peg$FAILED;
228603
+ if (peg$silentFails === 0) {
228604
+ peg$fail(peg$e2);
228605
+ }
228606
+ }
228607
+ if (s8 !== peg$FAILED) {
228608
+ peg$savedPos = s0;
228609
+ s0 = peg$f4(s5, s6);
228610
+ } else {
228611
+ peg$currPos = s0;
228612
+ s0 = peg$FAILED;
228613
+ }
228614
+ } else {
228615
+ peg$currPos = s0;
228616
+ s0 = peg$FAILED;
228617
+ }
228618
+ } else {
228619
+ peg$currPos = s0;
228620
+ s0 = peg$FAILED;
228621
+ }
228622
+ } else {
228623
+ peg$currPos = s0;
228624
+ s0 = peg$FAILED;
228625
+ }
228626
+ return s0;
228627
+ }
228628
+ function peg$parserotate() {
228629
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8;
228630
+ s0 = peg$currPos;
228631
+ if (input.substr(peg$currPos, 6) === peg$c5) {
228632
+ s1 = peg$c5;
228633
+ peg$currPos += 6;
228634
+ } else {
228635
+ s1 = peg$FAILED;
228636
+ if (peg$silentFails === 0) {
228637
+ peg$fail(peg$e5);
228638
+ }
228639
+ }
228640
+ if (s1 !== peg$FAILED) {
228641
+ s2 = [];
228642
+ s3 = peg$parsewsp();
228643
+ while (s3 !== peg$FAILED) {
228644
+ s2.push(s3);
228645
+ s3 = peg$parsewsp();
228646
+ }
228647
+ if (input.charCodeAt(peg$currPos) === 40) {
228648
+ s3 = peg$c1;
228649
+ peg$currPos++;
228650
+ } else {
228651
+ s3 = peg$FAILED;
228652
+ if (peg$silentFails === 0) {
228653
+ peg$fail(peg$e1);
228654
+ }
228655
+ }
228656
+ if (s3 !== peg$FAILED) {
228657
+ s4 = [];
228658
+ s5 = peg$parsewsp();
228659
+ while (s5 !== peg$FAILED) {
228660
+ s4.push(s5);
228661
+ s5 = peg$parsewsp();
228662
+ }
228663
+ s5 = peg$parsenumber();
228664
+ if (s5 !== peg$FAILED) {
228665
+ s6 = peg$parsecommaWspTwoNumbers();
228666
+ if (s6 === peg$FAILED) {
228667
+ s6 = null;
228668
+ }
228669
+ s7 = [];
228670
+ s8 = peg$parsewsp();
228671
+ while (s8 !== peg$FAILED) {
228672
+ s7.push(s8);
228673
+ s8 = peg$parsewsp();
228674
+ }
228675
+ if (input.charCodeAt(peg$currPos) === 41) {
228676
+ s8 = peg$c2;
228677
+ peg$currPos++;
228678
+ } else {
228679
+ s8 = peg$FAILED;
228680
+ if (peg$silentFails === 0) {
228681
+ peg$fail(peg$e2);
228682
+ }
228683
+ }
228684
+ if (s8 !== peg$FAILED) {
228685
+ peg$savedPos = s0;
228686
+ s0 = peg$f5(s5, s6);
228687
+ } else {
228688
+ peg$currPos = s0;
228689
+ s0 = peg$FAILED;
228690
+ }
228691
+ } else {
228692
+ peg$currPos = s0;
228693
+ s0 = peg$FAILED;
228694
+ }
228695
+ } else {
228696
+ peg$currPos = s0;
228697
+ s0 = peg$FAILED;
228698
+ }
228699
+ } else {
228700
+ peg$currPos = s0;
228701
+ s0 = peg$FAILED;
228702
+ }
228703
+ return s0;
228704
+ }
228705
+ function peg$parseskewX() {
228706
+ var s0, s1, s2, s3, s4, s5, s6, s7;
228707
+ s0 = peg$currPos;
228708
+ if (input.substr(peg$currPos, 5) === peg$c6) {
228709
+ s1 = peg$c6;
228710
+ peg$currPos += 5;
228711
+ } else {
228712
+ s1 = peg$FAILED;
228713
+ if (peg$silentFails === 0) {
228714
+ peg$fail(peg$e6);
228715
+ }
228716
+ }
228717
+ if (s1 !== peg$FAILED) {
228718
+ s2 = [];
228719
+ s3 = peg$parsewsp();
228720
+ while (s3 !== peg$FAILED) {
228721
+ s2.push(s3);
228722
+ s3 = peg$parsewsp();
228723
+ }
228724
+ if (input.charCodeAt(peg$currPos) === 40) {
228725
+ s3 = peg$c1;
228726
+ peg$currPos++;
228727
+ } else {
228728
+ s3 = peg$FAILED;
228729
+ if (peg$silentFails === 0) {
228730
+ peg$fail(peg$e1);
228731
+ }
228732
+ }
228733
+ if (s3 !== peg$FAILED) {
228734
+ s4 = [];
228735
+ s5 = peg$parsewsp();
228736
+ while (s5 !== peg$FAILED) {
228737
+ s4.push(s5);
228738
+ s5 = peg$parsewsp();
228739
+ }
228740
+ s5 = peg$parsenumber();
228741
+ if (s5 !== peg$FAILED) {
228742
+ s6 = [];
228743
+ s7 = peg$parsewsp();
228744
+ while (s7 !== peg$FAILED) {
228745
+ s6.push(s7);
228746
+ s7 = peg$parsewsp();
228747
+ }
228748
+ if (input.charCodeAt(peg$currPos) === 41) {
228749
+ s7 = peg$c2;
228750
+ peg$currPos++;
228751
+ } else {
228752
+ s7 = peg$FAILED;
228753
+ if (peg$silentFails === 0) {
228754
+ peg$fail(peg$e2);
228755
+ }
228756
+ }
228757
+ if (s7 !== peg$FAILED) {
228758
+ peg$savedPos = s0;
228759
+ s0 = peg$f6(s5);
228760
+ } else {
228761
+ peg$currPos = s0;
228762
+ s0 = peg$FAILED;
228763
+ }
228764
+ } else {
228765
+ peg$currPos = s0;
228766
+ s0 = peg$FAILED;
228767
+ }
228768
+ } else {
228769
+ peg$currPos = s0;
228770
+ s0 = peg$FAILED;
228771
+ }
228772
+ } else {
228773
+ peg$currPos = s0;
228774
+ s0 = peg$FAILED;
228775
+ }
228776
+ return s0;
228777
+ }
228778
+ function peg$parseskewY() {
228779
+ var s0, s1, s2, s3, s4, s5, s6, s7;
228780
+ s0 = peg$currPos;
228781
+ if (input.substr(peg$currPos, 5) === peg$c7) {
228782
+ s1 = peg$c7;
228783
+ peg$currPos += 5;
228784
+ } else {
228785
+ s1 = peg$FAILED;
228786
+ if (peg$silentFails === 0) {
228787
+ peg$fail(peg$e7);
228788
+ }
228789
+ }
228790
+ if (s1 !== peg$FAILED) {
228791
+ s2 = [];
228792
+ s3 = peg$parsewsp();
228793
+ while (s3 !== peg$FAILED) {
228794
+ s2.push(s3);
228795
+ s3 = peg$parsewsp();
228796
+ }
228797
+ if (input.charCodeAt(peg$currPos) === 40) {
228798
+ s3 = peg$c1;
228799
+ peg$currPos++;
228800
+ } else {
228801
+ s3 = peg$FAILED;
228802
+ if (peg$silentFails === 0) {
228803
+ peg$fail(peg$e1);
228804
+ }
228805
+ }
228806
+ if (s3 !== peg$FAILED) {
228807
+ s4 = [];
228808
+ s5 = peg$parsewsp();
228809
+ while (s5 !== peg$FAILED) {
228810
+ s4.push(s5);
228811
+ s5 = peg$parsewsp();
228812
+ }
228813
+ s5 = peg$parsenumber();
228814
+ if (s5 !== peg$FAILED) {
228815
+ s6 = [];
228816
+ s7 = peg$parsewsp();
228817
+ while (s7 !== peg$FAILED) {
228818
+ s6.push(s7);
228819
+ s7 = peg$parsewsp();
228820
+ }
228821
+ if (input.charCodeAt(peg$currPos) === 41) {
228822
+ s7 = peg$c2;
228823
+ peg$currPos++;
228824
+ } else {
228825
+ s7 = peg$FAILED;
228826
+ if (peg$silentFails === 0) {
228827
+ peg$fail(peg$e2);
228828
+ }
228829
+ }
228830
+ if (s7 !== peg$FAILED) {
228831
+ peg$savedPos = s0;
228832
+ s0 = peg$f7(s5);
228833
+ } else {
228834
+ peg$currPos = s0;
228835
+ s0 = peg$FAILED;
228836
+ }
228837
+ } else {
228838
+ peg$currPos = s0;
228839
+ s0 = peg$FAILED;
228840
+ }
228841
+ } else {
228842
+ peg$currPos = s0;
228843
+ s0 = peg$FAILED;
228844
+ }
228845
+ } else {
228846
+ peg$currPos = s0;
228847
+ s0 = peg$FAILED;
228848
+ }
228849
+ return s0;
228850
+ }
228851
+ function peg$parsenumber() {
228852
+ var s0, s1, s2, s3;
228853
+ s0 = peg$currPos;
228854
+ s1 = peg$currPos;
228855
+ s2 = peg$parsesign();
228856
+ if (s2 === peg$FAILED) {
228857
+ s2 = null;
228858
+ }
228859
+ s3 = peg$parsefloatingPointConstant();
228860
+ if (s3 !== peg$FAILED) {
228861
+ s2 = [s2, s3];
228862
+ s1 = s2;
228863
+ } else {
228864
+ peg$currPos = s1;
228865
+ s1 = peg$FAILED;
228866
+ }
228867
+ if (s1 !== peg$FAILED) {
228868
+ peg$savedPos = s0;
228869
+ s1 = peg$f8(s1);
228870
+ }
228871
+ s0 = s1;
228872
+ if (s0 === peg$FAILED) {
228873
+ s0 = peg$currPos;
228874
+ s1 = peg$currPos;
228875
+ s2 = peg$parsesign();
228876
+ if (s2 === peg$FAILED) {
228877
+ s2 = null;
228878
+ }
228879
+ s3 = peg$parseintegerConstant();
228880
+ if (s3 !== peg$FAILED) {
228881
+ s2 = [s2, s3];
228882
+ s1 = s2;
228883
+ } else {
228884
+ peg$currPos = s1;
228885
+ s1 = peg$FAILED;
228886
+ }
228887
+ if (s1 !== peg$FAILED) {
228888
+ peg$savedPos = s0;
228889
+ s1 = peg$f9(s1);
228890
+ }
228891
+ s0 = s1;
228892
+ }
228893
+ return s0;
228894
+ }
228895
+ function peg$parsecommaWspNumber() {
228896
+ var s0, s1, s2;
228897
+ s0 = peg$currPos;
228898
+ s1 = peg$parsecommaWsp();
228899
+ if (s1 !== peg$FAILED) {
228900
+ s2 = peg$parsenumber();
228901
+ if (s2 !== peg$FAILED) {
228902
+ peg$savedPos = s0;
228903
+ s0 = peg$f10(s2);
228904
+ } else {
228905
+ peg$currPos = s0;
228906
+ s0 = peg$FAILED;
228907
+ }
228908
+ } else {
228909
+ peg$currPos = s0;
228910
+ s0 = peg$FAILED;
228911
+ }
228912
+ return s0;
228913
+ }
228914
+ function peg$parsecommaWspTwoNumbers() {
228915
+ var s0, s1, s2, s3, s4;
228916
+ s0 = peg$currPos;
228917
+ s1 = peg$parsecommaWsp();
228918
+ if (s1 !== peg$FAILED) {
228919
+ s2 = peg$parsenumber();
228920
+ if (s2 !== peg$FAILED) {
228921
+ s3 = peg$parsecommaWsp();
228922
+ if (s3 !== peg$FAILED) {
228923
+ s4 = peg$parsenumber();
228924
+ if (s4 !== peg$FAILED) {
228925
+ peg$savedPos = s0;
228926
+ s0 = peg$f11(s2, s4);
228927
+ } else {
228928
+ peg$currPos = s0;
228929
+ s0 = peg$FAILED;
228930
+ }
228931
+ } else {
228932
+ peg$currPos = s0;
228933
+ s0 = peg$FAILED;
228934
+ }
228935
+ } else {
228936
+ peg$currPos = s0;
228937
+ s0 = peg$FAILED;
228938
+ }
228939
+ } else {
228940
+ peg$currPos = s0;
228941
+ s0 = peg$FAILED;
228942
+ }
228943
+ return s0;
228944
+ }
228945
+ function peg$parsecommaWsp() {
228946
+ var s0, s1, s2, s3, s4;
228947
+ s0 = peg$currPos;
228948
+ s1 = [];
228949
+ s2 = peg$parsewsp();
228950
+ if (s2 !== peg$FAILED) {
228951
+ while (s2 !== peg$FAILED) {
228952
+ s1.push(s2);
228953
+ s2 = peg$parsewsp();
228954
+ }
228955
+ } else {
228956
+ s1 = peg$FAILED;
228957
+ }
228958
+ if (s1 !== peg$FAILED) {
228959
+ s2 = peg$parsecomma();
228960
+ if (s2 === peg$FAILED) {
228961
+ s2 = null;
228962
+ }
228963
+ s3 = [];
228964
+ s4 = peg$parsewsp();
228965
+ while (s4 !== peg$FAILED) {
228966
+ s3.push(s4);
228967
+ s4 = peg$parsewsp();
228968
+ }
228969
+ s1 = [s1, s2, s3];
228970
+ s0 = s1;
228971
+ } else {
228972
+ peg$currPos = s0;
228973
+ s0 = peg$FAILED;
228974
+ }
228975
+ if (s0 === peg$FAILED) {
228976
+ s0 = peg$currPos;
228977
+ s1 = peg$parsecomma();
228978
+ if (s1 !== peg$FAILED) {
228979
+ s2 = [];
228980
+ s3 = peg$parsewsp();
228981
+ while (s3 !== peg$FAILED) {
228982
+ s2.push(s3);
228983
+ s3 = peg$parsewsp();
228984
+ }
228985
+ s1 = [s1, s2];
228986
+ s0 = s1;
228987
+ } else {
228988
+ peg$currPos = s0;
228989
+ s0 = peg$FAILED;
228990
+ }
228991
+ }
228992
+ return s0;
228993
+ }
228994
+ function peg$parsecomma() {
228995
+ var s0;
228996
+ if (input.charCodeAt(peg$currPos) === 44) {
228997
+ s0 = peg$c8;
228998
+ peg$currPos++;
228999
+ } else {
229000
+ s0 = peg$FAILED;
229001
+ if (peg$silentFails === 0) {
229002
+ peg$fail(peg$e8);
229003
+ }
229004
+ }
229005
+ return s0;
229006
+ }
229007
+ function peg$parseintegerConstant() {
229008
+ var s0, s1;
229009
+ s0 = peg$currPos;
229010
+ s1 = peg$parsedigitSequence();
229011
+ if (s1 !== peg$FAILED) {
229012
+ peg$savedPos = s0;
229013
+ s1 = peg$f12(s1);
229014
+ }
229015
+ s0 = s1;
229016
+ return s0;
229017
+ }
229018
+ function peg$parsefloatingPointConstant() {
229019
+ var s0, s1, s2;
229020
+ s0 = peg$currPos;
229021
+ s1 = peg$parsefractionalConstant();
229022
+ if (s1 !== peg$FAILED) {
229023
+ s2 = peg$parseexponent();
229024
+ if (s2 === peg$FAILED) {
229025
+ s2 = null;
229026
+ }
229027
+ peg$savedPos = s0;
229028
+ s0 = peg$f13(s1, s2);
229029
+ } else {
229030
+ peg$currPos = s0;
229031
+ s0 = peg$FAILED;
229032
+ }
229033
+ if (s0 === peg$FAILED) {
229034
+ s0 = peg$currPos;
229035
+ s1 = peg$parsedigitSequence();
229036
+ if (s1 !== peg$FAILED) {
229037
+ s2 = peg$parseexponent();
229038
+ if (s2 !== peg$FAILED) {
229039
+ peg$savedPos = s0;
229040
+ s0 = peg$f14(s1, s2);
229041
+ } else {
229042
+ peg$currPos = s0;
229043
+ s0 = peg$FAILED;
229044
+ }
229045
+ } else {
229046
+ peg$currPos = s0;
229047
+ s0 = peg$FAILED;
229048
+ }
229049
+ }
229050
+ return s0;
229051
+ }
229052
+ function peg$parsefractionalConstant() {
229053
+ var s0, s1, s2, s3;
229054
+ peg$silentFails++;
229055
+ s0 = peg$currPos;
229056
+ s1 = peg$parsedigitSequence();
229057
+ if (s1 === peg$FAILED) {
229058
+ s1 = null;
229059
+ }
229060
+ if (input.charCodeAt(peg$currPos) === 46) {
229061
+ s2 = peg$c9;
229062
+ peg$currPos++;
229063
+ } else {
229064
+ s2 = peg$FAILED;
229065
+ if (peg$silentFails === 0) {
229066
+ peg$fail(peg$e10);
229067
+ }
229068
+ }
229069
+ if (s2 !== peg$FAILED) {
229070
+ s3 = peg$parsedigitSequence();
229071
+ if (s3 !== peg$FAILED) {
229072
+ peg$savedPos = s0;
229073
+ s0 = peg$f15(s1, s3);
229074
+ } else {
229075
+ peg$currPos = s0;
229076
+ s0 = peg$FAILED;
229077
+ }
229078
+ } else {
229079
+ peg$currPos = s0;
229080
+ s0 = peg$FAILED;
229081
+ }
229082
+ if (s0 === peg$FAILED) {
229083
+ s0 = peg$currPos;
229084
+ s1 = peg$parsedigitSequence();
229085
+ if (s1 !== peg$FAILED) {
229086
+ if (input.charCodeAt(peg$currPos) === 46) {
229087
+ s2 = peg$c9;
229088
+ peg$currPos++;
229089
+ } else {
229090
+ s2 = peg$FAILED;
229091
+ if (peg$silentFails === 0) {
229092
+ peg$fail(peg$e10);
229093
+ }
229094
+ }
229095
+ if (s2 !== peg$FAILED) {
229096
+ peg$savedPos = s0;
229097
+ s0 = peg$f16(s1);
229098
+ } else {
229099
+ peg$currPos = s0;
229100
+ s0 = peg$FAILED;
229101
+ }
229102
+ } else {
229103
+ peg$currPos = s0;
229104
+ s0 = peg$FAILED;
229105
+ }
229106
+ }
229107
+ peg$silentFails--;
229108
+ if (s0 === peg$FAILED) {
229109
+ s1 = peg$FAILED;
229110
+ if (peg$silentFails === 0) {
229111
+ peg$fail(peg$e9);
229112
+ }
229113
+ }
229114
+ return s0;
229115
+ }
229116
+ function peg$parseexponent() {
229117
+ var s0, s1, s2, s3;
229118
+ s0 = peg$currPos;
229119
+ if (peg$r0.test(input.charAt(peg$currPos))) {
229120
+ s1 = input.charAt(peg$currPos);
229121
+ peg$currPos++;
229122
+ } else {
229123
+ s1 = peg$FAILED;
229124
+ if (peg$silentFails === 0) {
229125
+ peg$fail(peg$e11);
229126
+ }
229127
+ }
229128
+ if (s1 !== peg$FAILED) {
229129
+ s2 = peg$parsesign();
229130
+ if (s2 === peg$FAILED) {
229131
+ s2 = null;
229132
+ }
229133
+ s3 = peg$parsedigitSequence();
229134
+ if (s3 !== peg$FAILED) {
229135
+ peg$savedPos = s0;
229136
+ s0 = peg$f17(s2, s3);
229137
+ } else {
229138
+ peg$currPos = s0;
229139
+ s0 = peg$FAILED;
229140
+ }
229141
+ } else {
229142
+ peg$currPos = s0;
229143
+ s0 = peg$FAILED;
229144
+ }
229145
+ return s0;
229146
+ }
229147
+ function peg$parsesign() {
229148
+ var s0;
229149
+ if (peg$r1.test(input.charAt(peg$currPos))) {
229150
+ s0 = input.charAt(peg$currPos);
229151
+ peg$currPos++;
229152
+ } else {
229153
+ s0 = peg$FAILED;
229154
+ if (peg$silentFails === 0) {
229155
+ peg$fail(peg$e12);
229156
+ }
229157
+ }
229158
+ return s0;
229159
+ }
229160
+ function peg$parsedigitSequence() {
229161
+ var s0, s1;
229162
+ s0 = [];
229163
+ s1 = peg$parsedigit();
229164
+ if (s1 !== peg$FAILED) {
229165
+ while (s1 !== peg$FAILED) {
229166
+ s0.push(s1);
229167
+ s1 = peg$parsedigit();
229168
+ }
229169
+ } else {
229170
+ s0 = peg$FAILED;
229171
+ }
229172
+ return s0;
229173
+ }
229174
+ function peg$parsedigit() {
229175
+ var s0;
229176
+ if (peg$r2.test(input.charAt(peg$currPos))) {
229177
+ s0 = input.charAt(peg$currPos);
229178
+ peg$currPos++;
229179
+ } else {
229180
+ s0 = peg$FAILED;
229181
+ if (peg$silentFails === 0) {
229182
+ peg$fail(peg$e13);
229183
+ }
229184
+ }
229185
+ return s0;
229186
+ }
229187
+ function peg$parsewsp() {
229188
+ var s0;
229189
+ if (peg$r3.test(input.charAt(peg$currPos))) {
229190
+ s0 = input.charAt(peg$currPos);
229191
+ peg$currPos++;
229192
+ } else {
229193
+ s0 = peg$FAILED;
229194
+ if (peg$silentFails === 0) {
229195
+ peg$fail(peg$e14);
229196
+ }
229197
+ }
229198
+ return s0;
229199
+ }
229200
+ peg$result = peg$startRuleFunction();
229201
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
229202
+ return peg$result;
229203
+ } else {
229204
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
229205
+ peg$fail(peg$endExpectation());
229206
+ }
229207
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
229208
+ }
229209
+ }
229210
+ });
229211
+
229212
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/fromTransformAttribute.js
229213
+ var require_fromTransformAttribute = __commonJS((exports2) => {
229214
+ Object.defineProperty(exports2, "__esModule", {
229215
+ value: true
229216
+ });
229217
+ exports2.fromTransformAttribute = fromTransformAttribute;
229218
+ var _fromTransformAttribute = require_fromTransformAttribute_autogenerated();
229219
+ function fromTransformAttribute(transformString) {
229220
+ return (0, _fromTransformAttribute.parse)(transformString);
229221
+ }
229222
+ });
229223
+
229224
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/decompose.js
229225
+ var require_decompose = __commonJS((exports2) => {
229226
+ Object.defineProperty(exports2, "__esModule", {
229227
+ value: true
229228
+ });
229229
+ exports2.decomposeTSR = decomposeTSR;
229230
+ var _scale = require_scale();
229231
+ var _transform = require_transform();
229232
+ function decomposeTSR(matrix, flipX = false, flipY = false) {
229233
+ if (flipX) {
229234
+ if (flipY) {
229235
+ matrix = (0, _transform.compose)(matrix, (0, _scale.scale)(-1, -1));
229236
+ } else {
229237
+ matrix = (0, _transform.compose)(matrix, (0, _scale.scale)(1, -1));
229238
+ }
229239
+ } else if (flipY) {
229240
+ matrix = (0, _transform.compose)(matrix, (0, _scale.scale)(-1, 1));
229241
+ }
229242
+ const a = matrix.a;
229243
+ const b = matrix.b;
229244
+ const c = matrix.c;
229245
+ const d = matrix.d;
229246
+ let scaleX, scaleY, rotation2;
229247
+ if (a !== 0 || c !== 0) {
229248
+ const hypotAc = Math.hypot(a, c);
229249
+ scaleX = hypotAc;
229250
+ scaleY = (a * d - b * c) / hypotAc;
229251
+ const acos = Math.acos(a / hypotAc);
229252
+ rotation2 = c > 0 ? -acos : acos;
229253
+ } else if (b !== 0 || d !== 0) {
229254
+ const hypotBd = Math.hypot(b, d);
229255
+ scaleX = (a * d - b * c) / hypotBd;
229256
+ scaleY = hypotBd;
229257
+ const acos = Math.acos(b / hypotBd);
229258
+ rotation2 = Math.PI / 2 + (d > 0 ? -acos : acos);
229259
+ } else {
229260
+ scaleX = 0;
229261
+ scaleY = 0;
229262
+ rotation2 = 0;
229263
+ }
229264
+ if (flipY) {
229265
+ scaleX = -scaleX;
229266
+ }
229267
+ if (flipX) {
229268
+ scaleY = -scaleY;
229269
+ }
229270
+ return {
229271
+ translate: {
229272
+ tx: matrix.e,
229273
+ ty: matrix.f
229274
+ },
229275
+ scale: {
229276
+ sx: scaleX,
229277
+ sy: scaleY
229278
+ },
229279
+ rotation: {
229280
+ angle: rotation2
229281
+ }
229282
+ };
229283
+ }
229284
+ });
229285
+
229286
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/flip.js
229287
+ var require_flip = __commonJS((exports2) => {
229288
+ Object.defineProperty(exports2, "__esModule", {
229289
+ value: true
229290
+ });
229291
+ exports2.flipOrigin = flipOrigin;
229292
+ exports2.flipX = flipX;
229293
+ exports2.flipY = flipY;
229294
+ function flipX() {
229295
+ return {
229296
+ a: 1,
229297
+ c: 0,
229298
+ e: 0,
229299
+ b: 0,
229300
+ d: -1,
229301
+ f: 0
229302
+ };
229303
+ }
229304
+ function flipY() {
229305
+ return {
229306
+ a: -1,
229307
+ c: 0,
229308
+ e: 0,
229309
+ b: 0,
229310
+ d: 1,
229311
+ f: 0
229312
+ };
229313
+ }
229314
+ function flipOrigin() {
229315
+ return {
229316
+ a: -1,
229317
+ c: 0,
229318
+ e: 0,
229319
+ b: 0,
229320
+ d: -1,
229321
+ f: 0
229322
+ };
229323
+ }
229324
+ });
229325
+
229326
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/fromMovingPoints.js
229327
+ var require_fromMovingPoints = __commonJS((exports2) => {
229328
+ Object.defineProperty(exports2, "__esModule", {
229329
+ value: true
229330
+ });
229331
+ exports2.fromOneMovingPoint = fromOneMovingPoint;
229332
+ exports2.fromTwoMovingPoints = fromTwoMovingPoints;
229333
+ var _translate = require_translate();
229334
+ var _applyToPoint = require_applyToPoint();
229335
+ var _rotate = require_rotate();
229336
+ var _scale = require_scale();
229337
+ var _transform = require_transform();
229338
+ function fromOneMovingPoint(startingPoint, endingPoint) {
229339
+ const tx = endingPoint.x - startingPoint.x;
229340
+ const ty = endingPoint.y - startingPoint.y;
229341
+ return (0, _translate.translate)(tx, ty);
229342
+ }
229343
+ function fromTwoMovingPoints(startingPoint1, startingPoint2, endingPoint1, endingPoint2) {
229344
+ const translationMatrix = fromOneMovingPoint(startingPoint1, endingPoint1);
229345
+ const pointA = (0, _applyToPoint.applyToPoint)(translationMatrix, startingPoint2);
229346
+ const center = endingPoint1;
229347
+ const pointB = endingPoint2;
229348
+ const angle = Math.atan2(pointB.y - center.y, pointB.x - center.x) - Math.atan2(pointA.y - center.y, pointA.x - center.x);
229349
+ const rotationMatrix = (0, _rotate.rotate)(angle, center.x, center.y);
229350
+ const d1 = Math.sqrt(Math.pow(pointA.x - center.x, 2) + Math.pow(pointA.y - center.y, 2));
229351
+ const d2 = Math.sqrt(Math.pow(pointB.x - center.x, 2) + Math.pow(pointB.y - center.y, 2));
229352
+ const scalingLevel = d2 / d1;
229353
+ const scalingMatrix = (0, _scale.scale)(scalingLevel, scalingLevel, center.x, center.y);
229354
+ return (0, _transform.compose)([translationMatrix, scalingMatrix, rotationMatrix]);
229355
+ }
229356
+ });
229357
+
229358
+ // node_modules/circuit-to-svg/node_modules/transformation-matrix/build-commonjs/index.js
229359
+ var require_build_commonjs = __commonJS((exports2) => {
229360
+ Object.defineProperty(exports2, "__esModule", {
229361
+ value: true
229362
+ });
229363
+ var _applyToPoint = require_applyToPoint();
229364
+ Object.keys(_applyToPoint).forEach(function(key) {
229365
+ if (key === "default" || key === "__esModule")
229366
+ return;
229367
+ if (key in exports2 && exports2[key] === _applyToPoint[key])
229368
+ return;
229369
+ Object.defineProperty(exports2, key, {
229370
+ enumerable: true,
229371
+ get: function() {
229372
+ return _applyToPoint[key];
229373
+ }
229374
+ });
229375
+ });
229376
+ var _fromObject = require_fromObject();
229377
+ Object.keys(_fromObject).forEach(function(key) {
229378
+ if (key === "default" || key === "__esModule")
229379
+ return;
229380
+ if (key in exports2 && exports2[key] === _fromObject[key])
229381
+ return;
229382
+ Object.defineProperty(exports2, key, {
229383
+ enumerable: true,
229384
+ get: function() {
229385
+ return _fromObject[key];
229386
+ }
229387
+ });
229388
+ });
229389
+ var _fromString = require_fromString();
229390
+ Object.keys(_fromString).forEach(function(key) {
229391
+ if (key === "default" || key === "__esModule")
229392
+ return;
229393
+ if (key in exports2 && exports2[key] === _fromString[key])
229394
+ return;
229395
+ Object.defineProperty(exports2, key, {
229396
+ enumerable: true,
229397
+ get: function() {
229398
+ return _fromString[key];
229399
+ }
229400
+ });
229401
+ });
229402
+ var _identity = require_identity();
229403
+ Object.keys(_identity).forEach(function(key) {
229404
+ if (key === "default" || key === "__esModule")
229405
+ return;
229406
+ if (key in exports2 && exports2[key] === _identity[key])
229407
+ return;
229408
+ Object.defineProperty(exports2, key, {
229409
+ enumerable: true,
229410
+ get: function() {
229411
+ return _identity[key];
229412
+ }
229413
+ });
229414
+ });
229415
+ var _inverse = require_inverse();
229416
+ Object.keys(_inverse).forEach(function(key) {
229417
+ if (key === "default" || key === "__esModule")
229418
+ return;
229419
+ if (key in exports2 && exports2[key] === _inverse[key])
229420
+ return;
229421
+ Object.defineProperty(exports2, key, {
229422
+ enumerable: true,
229423
+ get: function() {
229424
+ return _inverse[key];
229425
+ }
229426
+ });
229427
+ });
229428
+ var _isAffineMatrix = require_isAffineMatrix();
229429
+ Object.keys(_isAffineMatrix).forEach(function(key) {
229430
+ if (key === "default" || key === "__esModule")
229431
+ return;
229432
+ if (key in exports2 && exports2[key] === _isAffineMatrix[key])
229433
+ return;
229434
+ Object.defineProperty(exports2, key, {
229435
+ enumerable: true,
229436
+ get: function() {
229437
+ return _isAffineMatrix[key];
229438
+ }
229439
+ });
229440
+ });
229441
+ var _rotate = require_rotate();
229442
+ Object.keys(_rotate).forEach(function(key) {
229443
+ if (key === "default" || key === "__esModule")
229444
+ return;
229445
+ if (key in exports2 && exports2[key] === _rotate[key])
229446
+ return;
229447
+ Object.defineProperty(exports2, key, {
229448
+ enumerable: true,
229449
+ get: function() {
229450
+ return _rotate[key];
229451
+ }
229452
+ });
229453
+ });
229454
+ var _scale = require_scale();
229455
+ Object.keys(_scale).forEach(function(key) {
229456
+ if (key === "default" || key === "__esModule")
229457
+ return;
229458
+ if (key in exports2 && exports2[key] === _scale[key])
229459
+ return;
229460
+ Object.defineProperty(exports2, key, {
229461
+ enumerable: true,
229462
+ get: function() {
229463
+ return _scale[key];
229464
+ }
229465
+ });
229466
+ });
229467
+ var _shear = require_shear();
229468
+ Object.keys(_shear).forEach(function(key) {
229469
+ if (key === "default" || key === "__esModule")
229470
+ return;
229471
+ if (key in exports2 && exports2[key] === _shear[key])
229472
+ return;
229473
+ Object.defineProperty(exports2, key, {
229474
+ enumerable: true,
229475
+ get: function() {
229476
+ return _shear[key];
229477
+ }
229478
+ });
229479
+ });
229480
+ var _skew = require_skew();
229481
+ Object.keys(_skew).forEach(function(key) {
229482
+ if (key === "default" || key === "__esModule")
229483
+ return;
229484
+ if (key in exports2 && exports2[key] === _skew[key])
229485
+ return;
229486
+ Object.defineProperty(exports2, key, {
229487
+ enumerable: true,
229488
+ get: function() {
229489
+ return _skew[key];
229490
+ }
229491
+ });
229492
+ });
229493
+ var _toString = require_toString();
229494
+ Object.keys(_toString).forEach(function(key) {
229495
+ if (key === "default" || key === "__esModule")
229496
+ return;
229497
+ if (key in exports2 && exports2[key] === _toString[key])
229498
+ return;
229499
+ Object.defineProperty(exports2, key, {
229500
+ enumerable: true,
229501
+ get: function() {
229502
+ return _toString[key];
229503
+ }
229504
+ });
229505
+ });
229506
+ var _transform = require_transform();
229507
+ Object.keys(_transform).forEach(function(key) {
229508
+ if (key === "default" || key === "__esModule")
229509
+ return;
229510
+ if (key in exports2 && exports2[key] === _transform[key])
229511
+ return;
229512
+ Object.defineProperty(exports2, key, {
229513
+ enumerable: true,
229514
+ get: function() {
229515
+ return _transform[key];
229516
+ }
229517
+ });
229518
+ });
229519
+ var _translate = require_translate();
229520
+ Object.keys(_translate).forEach(function(key) {
229521
+ if (key === "default" || key === "__esModule")
229522
+ return;
229523
+ if (key in exports2 && exports2[key] === _translate[key])
229524
+ return;
229525
+ Object.defineProperty(exports2, key, {
229526
+ enumerable: true,
229527
+ get: function() {
229528
+ return _translate[key];
229529
+ }
229530
+ });
229531
+ });
229532
+ var _fromTriangles = require_fromTriangles();
229533
+ Object.keys(_fromTriangles).forEach(function(key) {
229534
+ if (key === "default" || key === "__esModule")
229535
+ return;
229536
+ if (key in exports2 && exports2[key] === _fromTriangles[key])
229537
+ return;
229538
+ Object.defineProperty(exports2, key, {
229539
+ enumerable: true,
229540
+ get: function() {
229541
+ return _fromTriangles[key];
229542
+ }
229543
+ });
229544
+ });
229545
+ var _smoothMatrix = require_smoothMatrix();
229546
+ Object.keys(_smoothMatrix).forEach(function(key) {
229547
+ if (key === "default" || key === "__esModule")
229548
+ return;
229549
+ if (key in exports2 && exports2[key] === _smoothMatrix[key])
229550
+ return;
229551
+ Object.defineProperty(exports2, key, {
229552
+ enumerable: true,
229553
+ get: function() {
229554
+ return _smoothMatrix[key];
229555
+ }
229556
+ });
229557
+ });
229558
+ var _fromDefinition = require_fromDefinition();
229559
+ Object.keys(_fromDefinition).forEach(function(key) {
229560
+ if (key === "default" || key === "__esModule")
229561
+ return;
229562
+ if (key in exports2 && exports2[key] === _fromDefinition[key])
229563
+ return;
229564
+ Object.defineProperty(exports2, key, {
229565
+ enumerable: true,
229566
+ get: function() {
229567
+ return _fromDefinition[key];
229568
+ }
229569
+ });
229570
+ });
229571
+ var _fromTransformAttribute = require_fromTransformAttribute();
229572
+ Object.keys(_fromTransformAttribute).forEach(function(key) {
229573
+ if (key === "default" || key === "__esModule")
229574
+ return;
229575
+ if (key in exports2 && exports2[key] === _fromTransformAttribute[key])
229576
+ return;
229577
+ Object.defineProperty(exports2, key, {
229578
+ enumerable: true,
229579
+ get: function() {
229580
+ return _fromTransformAttribute[key];
229581
+ }
229582
+ });
229583
+ });
229584
+ var _decompose = require_decompose();
229585
+ Object.keys(_decompose).forEach(function(key) {
229586
+ if (key === "default" || key === "__esModule")
229587
+ return;
229588
+ if (key in exports2 && exports2[key] === _decompose[key])
229589
+ return;
229590
+ Object.defineProperty(exports2, key, {
229591
+ enumerable: true,
229592
+ get: function() {
229593
+ return _decompose[key];
229594
+ }
229595
+ });
229596
+ });
229597
+ var _flip = require_flip();
229598
+ Object.keys(_flip).forEach(function(key) {
229599
+ if (key === "default" || key === "__esModule")
229600
+ return;
229601
+ if (key in exports2 && exports2[key] === _flip[key])
229602
+ return;
229603
+ Object.defineProperty(exports2, key, {
229604
+ enumerable: true,
229605
+ get: function() {
229606
+ return _flip[key];
229607
+ }
229608
+ });
229609
+ });
229610
+ var _fromMovingPoints = require_fromMovingPoints();
229611
+ Object.keys(_fromMovingPoints).forEach(function(key) {
229612
+ if (key === "default" || key === "__esModule")
229613
+ return;
229614
+ if (key in exports2 && exports2[key] === _fromMovingPoints[key])
229615
+ return;
229616
+ Object.defineProperty(exports2, key, {
229617
+ enumerable: true,
229618
+ get: function() {
229619
+ return _fromMovingPoints[key];
229620
+ }
229621
+ });
229622
+ });
229623
+ });
229624
+
227422
229625
  // node_modules/transformation-matrix/build-commonjs/applyToPoint.js
227423
- var require_applyToPoint = __commonJS((exports2) => {
229626
+ var require_applyToPoint2 = __commonJS((exports2) => {
227424
229627
  Object.defineProperty(exports2, "__esModule", {
227425
229628
  value: true
227426
229629
  });
227427
229630
  exports2.applyToPoint = applyToPoint;
227428
229631
  exports2.applyToPoints = applyToPoints;
227429
- function applyToPoint(matrix, point2) {
227430
- return Array.isArray(point2) ? [matrix.a * point2[0] + matrix.c * point2[1] + matrix.e, matrix.b * point2[0] + matrix.d * point2[1] + matrix.f] : {
227431
- x: matrix.a * point2.x + matrix.c * point2.y + matrix.e,
227432
- y: matrix.b * point2.x + matrix.d * point2.y + matrix.f
229632
+ function applyToPoint(matrix, point4) {
229633
+ return Array.isArray(point4) ? [matrix.a * point4[0] + matrix.c * point4[1] + matrix.e, matrix.b * point4[0] + matrix.d * point4[1] + matrix.f] : {
229634
+ x: matrix.a * point4.x + matrix.c * point4.y + matrix.e,
229635
+ y: matrix.b * point4.x + matrix.d * point4.y + matrix.f
227433
229636
  };
227434
229637
  }
227435
229638
  function applyToPoints(matrix, points) {
227436
- return points.map((point2) => applyToPoint(matrix, point2));
229639
+ return points.map((point4) => applyToPoint(matrix, point4));
227437
229640
  }
227438
229641
  });
227439
229642
 
227440
229643
  // node_modules/transformation-matrix/build-commonjs/fromObject.js
227441
- var require_fromObject = __commonJS((exports2) => {
229644
+ var require_fromObject2 = __commonJS((exports2) => {
227442
229645
  Object.defineProperty(exports2, "__esModule", {
227443
229646
  value: true
227444
229647
  });
@@ -227456,13 +229659,37 @@ var require_fromObject = __commonJS((exports2) => {
227456
229659
  });
227457
229660
 
227458
229661
  // node_modules/transformation-matrix/build-commonjs/fromString.js
227459
- var require_fromString = __commonJS((exports2) => {
229662
+ var require_fromString2 = __commonJS((exports2) => {
227460
229663
  Object.defineProperty(exports2, "__esModule", {
227461
229664
  value: true
227462
229665
  });
227463
229666
  exports2.fromString = fromString;
229667
+ exports2.fromStringLegacy = fromStringLegacy;
227464
229668
  var matrixRegex = /^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;
227465
229669
  function fromString(string) {
229670
+ const parseFloatOrThrow = (number) => {
229671
+ const n = parseFloat(number);
229672
+ if (Number.isFinite(n))
229673
+ return n;
229674
+ throw new Error(`'${string}' is not a matrix`);
229675
+ };
229676
+ const prefix = string.substring(0, 7).toLowerCase();
229677
+ const suffix = string.substring(string.length - 1);
229678
+ const body = string.substring(7, string.length - 1);
229679
+ const elements = body.split(",");
229680
+ if (prefix === "matrix(" && suffix === ")" && elements.length === 6) {
229681
+ return {
229682
+ a: parseFloatOrThrow(elements[0]),
229683
+ b: parseFloatOrThrow(elements[1]),
229684
+ c: parseFloatOrThrow(elements[2]),
229685
+ d: parseFloatOrThrow(elements[3]),
229686
+ e: parseFloatOrThrow(elements[4]),
229687
+ f: parseFloatOrThrow(elements[5])
229688
+ };
229689
+ }
229690
+ throw new Error(`'${string}' is not a matrix`);
229691
+ }
229692
+ function fromStringLegacy(string) {
227466
229693
  const parsed = string.match(matrixRegex);
227467
229694
  if (parsed === null || parsed.length < 7)
227468
229695
  throw new Error(`'${string}' is not a matrix`);
@@ -227478,7 +229705,7 @@ var require_fromString = __commonJS((exports2) => {
227478
229705
  });
227479
229706
 
227480
229707
  // node_modules/transformation-matrix/build-commonjs/identity.js
227481
- var require_identity = __commonJS((exports2) => {
229708
+ var require_identity2 = __commonJS((exports2) => {
227482
229709
  Object.defineProperty(exports2, "__esModule", {
227483
229710
  value: true
227484
229711
  });
@@ -227496,7 +229723,7 @@ var require_identity = __commonJS((exports2) => {
227496
229723
  });
227497
229724
 
227498
229725
  // node_modules/transformation-matrix/build-commonjs/inverse.js
227499
- var require_inverse = __commonJS((exports2) => {
229726
+ var require_inverse2 = __commonJS((exports2) => {
227500
229727
  Object.defineProperty(exports2, "__esModule", {
227501
229728
  value: true
227502
229729
  });
@@ -227523,7 +229750,7 @@ var require_inverse = __commonJS((exports2) => {
227523
229750
  });
227524
229751
 
227525
229752
  // node_modules/transformation-matrix/build-commonjs/utils.js
227526
- var require_utils6 = __commonJS((exports2) => {
229753
+ var require_utils7 = __commonJS((exports2) => {
227527
229754
  Object.defineProperty(exports2, "__esModule", {
227528
229755
  value: true
227529
229756
  });
@@ -227546,19 +229773,19 @@ var require_utils6 = __commonJS((exports2) => {
227546
229773
  });
227547
229774
 
227548
229775
  // node_modules/transformation-matrix/build-commonjs/isAffineMatrix.js
227549
- var require_isAffineMatrix = __commonJS((exports2) => {
229776
+ var require_isAffineMatrix2 = __commonJS((exports2) => {
227550
229777
  Object.defineProperty(exports2, "__esModule", {
227551
229778
  value: true
227552
229779
  });
227553
229780
  exports2.isAffineMatrix = isAffineMatrix;
227554
- var _utils = require_utils6();
229781
+ var _utils = require_utils7();
227555
229782
  function isAffineMatrix(object) {
227556
229783
  return (0, _utils.isObject)(object) && "a" in object && (0, _utils.isNumeric)(object.a) && "b" in object && (0, _utils.isNumeric)(object.b) && "c" in object && (0, _utils.isNumeric)(object.c) && "d" in object && (0, _utils.isNumeric)(object.d) && "e" in object && (0, _utils.isNumeric)(object.e) && "f" in object && (0, _utils.isNumeric)(object.f);
227557
229784
  }
227558
229785
  });
227559
229786
 
227560
229787
  // node_modules/transformation-matrix/build-commonjs/translate.js
227561
- var require_translate = __commonJS((exports2) => {
229788
+ var require_translate2 = __commonJS((exports2) => {
227562
229789
  Object.defineProperty(exports2, "__esModule", {
227563
229790
  value: true
227564
229791
  });
@@ -227576,7 +229803,7 @@ var require_translate = __commonJS((exports2) => {
227576
229803
  });
227577
229804
 
227578
229805
  // node_modules/transformation-matrix/build-commonjs/transform.js
227579
- var require_transform = __commonJS((exports2) => {
229806
+ var require_transform2 = __commonJS((exports2) => {
227580
229807
  Object.defineProperty(exports2, "__esModule", {
227581
229808
  value: true
227582
229809
  });
@@ -227614,15 +229841,15 @@ var require_transform = __commonJS((exports2) => {
227614
229841
  });
227615
229842
 
227616
229843
  // node_modules/transformation-matrix/build-commonjs/rotate.js
227617
- var require_rotate = __commonJS((exports2) => {
229844
+ var require_rotate2 = __commonJS((exports2) => {
227618
229845
  Object.defineProperty(exports2, "__esModule", {
227619
229846
  value: true
227620
229847
  });
227621
229848
  exports2.rotate = rotate;
227622
229849
  exports2.rotateDEG = rotateDEG;
227623
- var _utils = require_utils6();
227624
- var _translate = require_translate();
227625
- var _transform = require_transform();
229850
+ var _utils = require_utils7();
229851
+ var _translate = require_translate2();
229852
+ var _transform = require_transform2();
227626
229853
  var {
227627
229854
  cos,
227628
229855
  sin,
@@ -227650,14 +229877,14 @@ var require_rotate = __commonJS((exports2) => {
227650
229877
  });
227651
229878
 
227652
229879
  // node_modules/transformation-matrix/build-commonjs/scale.js
227653
- var require_scale = __commonJS((exports2) => {
229880
+ var require_scale2 = __commonJS((exports2) => {
227654
229881
  Object.defineProperty(exports2, "__esModule", {
227655
229882
  value: true
227656
229883
  });
227657
229884
  exports2.scale = scale;
227658
- var _utils = require_utils6();
227659
- var _translate = require_translate();
227660
- var _transform = require_transform();
229885
+ var _utils = require_utils7();
229886
+ var _translate = require_translate2();
229887
+ var _transform = require_transform2();
227661
229888
  function scale(sx, sy = undefined, cx = undefined, cy = undefined) {
227662
229889
  if ((0, _utils.isUndefined)(sy))
227663
229890
  sy = sx;
@@ -227677,7 +229904,7 @@ var require_scale = __commonJS((exports2) => {
227677
229904
  });
227678
229905
 
227679
229906
  // node_modules/transformation-matrix/build-commonjs/shear.js
227680
- var require_shear = __commonJS((exports2) => {
229907
+ var require_shear2 = __commonJS((exports2) => {
227681
229908
  Object.defineProperty(exports2, "__esModule", {
227682
229909
  value: true
227683
229910
  });
@@ -227695,7 +229922,7 @@ var require_shear = __commonJS((exports2) => {
227695
229922
  });
227696
229923
 
227697
229924
  // node_modules/transformation-matrix/build-commonjs/skew.js
227698
- var require_skew = __commonJS((exports2) => {
229925
+ var require_skew2 = __commonJS((exports2) => {
227699
229926
  Object.defineProperty(exports2, "__esModule", {
227700
229927
  value: true
227701
229928
  });
@@ -227720,7 +229947,7 @@ var require_skew = __commonJS((exports2) => {
227720
229947
  });
227721
229948
 
227722
229949
  // node_modules/transformation-matrix/build-commonjs/toString.js
227723
- var require_toString = __commonJS((exports2) => {
229950
+ var require_toString2 = __commonJS((exports2) => {
227724
229951
  Object.defineProperty(exports2, "__esModule", {
227725
229952
  value: true
227726
229953
  });
@@ -227739,7 +229966,7 @@ var require_toString = __commonJS((exports2) => {
227739
229966
  });
227740
229967
 
227741
229968
  // node_modules/transformation-matrix/build-commonjs/smoothMatrix.js
227742
- var require_smoothMatrix = __commonJS((exports2) => {
229969
+ var require_smoothMatrix2 = __commonJS((exports2) => {
227743
229970
  Object.defineProperty(exports2, "__esModule", {
227744
229971
  value: true
227745
229972
  });
@@ -227757,14 +229984,14 @@ var require_smoothMatrix = __commonJS((exports2) => {
227757
229984
  });
227758
229985
 
227759
229986
  // node_modules/transformation-matrix/build-commonjs/fromTriangles.js
227760
- var require_fromTriangles = __commonJS((exports2) => {
229987
+ var require_fromTriangles2 = __commonJS((exports2) => {
227761
229988
  Object.defineProperty(exports2, "__esModule", {
227762
229989
  value: true
227763
229990
  });
227764
229991
  exports2.fromTriangles = fromTriangles;
227765
- var _inverse = require_inverse();
227766
- var _transform = require_transform();
227767
- var _smoothMatrix = require_smoothMatrix();
229992
+ var _inverse = require_inverse2();
229993
+ var _transform = require_transform2();
229994
+ var _smoothMatrix = require_smoothMatrix2();
227768
229995
  function fromTriangles(t1, t2) {
227769
229996
  const px1 = t1[0].x != null ? t1[0].x : t1[0][0];
227770
229997
  const py1 = t1[0].y != null ? t1[0].y : t1[0][1];
@@ -227801,17 +230028,17 @@ var require_fromTriangles = __commonJS((exports2) => {
227801
230028
  });
227802
230029
 
227803
230030
  // node_modules/transformation-matrix/build-commonjs/fromDefinition.js
227804
- var require_fromDefinition = __commonJS((exports2) => {
230031
+ var require_fromDefinition2 = __commonJS((exports2) => {
227805
230032
  Object.defineProperty(exports2, "__esModule", {
227806
230033
  value: true
227807
230034
  });
227808
230035
  exports2.fromDefinition = fromDefinition;
227809
- var _fromObject = require_fromObject();
227810
- var _translate = require_translate();
227811
- var _scale = require_scale();
227812
- var _rotate = require_rotate();
227813
- var _skew = require_skew();
227814
- var _shear = require_shear();
230036
+ var _fromObject = require_fromObject2();
230037
+ var _translate = require_translate2();
230038
+ var _scale = require_scale2();
230039
+ var _rotate = require_rotate2();
230040
+ var _skew = require_skew2();
230041
+ var _shear = require_shear2();
227815
230042
  function fromDefinition(definitionOrArrayOfDefinition) {
227816
230043
  return Array.isArray(definitionOrArrayOfDefinition) ? definitionOrArrayOfDefinition.map(mapper) : mapper(definitionOrArrayOfDefinition);
227817
230044
  function mapper(descriptor) {
@@ -227861,10 +230088,11 @@ var require_fromDefinition = __commonJS((exports2) => {
227861
230088
  });
227862
230089
 
227863
230090
  // node_modules/transformation-matrix/build-commonjs/fromTransformAttribute.autogenerated.js
227864
- var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
230091
+ var require_fromTransformAttribute_autogenerated2 = __commonJS((exports2) => {
227865
230092
  Object.defineProperty(exports2, "__esModule", {
227866
230093
  value: true
227867
230094
  });
230095
+ exports2.StartRules = undefined;
227868
230096
  exports2.SyntaxError = peg$SyntaxError2;
227869
230097
  exports2.parse = peg$parse;
227870
230098
  function peg$subclass2(child, parent) {
@@ -228121,17 +230349,17 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
228121
230349
  var peg$f17 = function(s, d) {
228122
230350
  return ["e", s, d.join("")].join("");
228123
230351
  };
228124
- var peg$currPos = 0;
228125
- var peg$savedPos = 0;
230352
+ var peg$currPos = options.peg$currPos | 0;
230353
+ var peg$savedPos = peg$currPos;
228126
230354
  var peg$posDetailsCache = [{
228127
230355
  line: 1,
228128
230356
  column: 1
228129
230357
  }];
228130
- var peg$maxFailPos = 0;
228131
- var peg$maxFailExpected = [];
228132
- var peg$silentFails = 0;
230358
+ var peg$maxFailPos = peg$currPos;
230359
+ var peg$maxFailExpected = options.peg$maxFailExpected || [];
230360
+ var peg$silentFails = options.peg$silentFails | 0;
228133
230361
  var peg$result;
228134
- if ("startRule" in options) {
230362
+ if (options.startRule) {
228135
230363
  if (!(options.startRule in peg$startRuleFunctions)) {
228136
230364
  throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
228137
230365
  }
@@ -228198,9 +230426,11 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
228198
230426
  if (details) {
228199
230427
  return details;
228200
230428
  } else {
228201
- p = pos - 1;
228202
- while (!peg$posDetailsCache[p]) {
228203
- p--;
230429
+ if (pos >= peg$posDetailsCache.length) {
230430
+ p = peg$posDetailsCache.length - 1;
230431
+ } else {
230432
+ p = pos;
230433
+ while (!peg$posDetailsCache[--p]) {}
228204
230434
  }
228205
230435
  details = peg$posDetailsCache[p];
228206
230436
  details = {
@@ -229116,8 +231346,8 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
229116
231346
  function peg$parseexponent() {
229117
231347
  var s0, s1, s2, s3;
229118
231348
  s0 = peg$currPos;
229119
- if (peg$r0.test(input.charAt(peg$currPos))) {
229120
- s1 = input.charAt(peg$currPos);
231349
+ s1 = input.charAt(peg$currPos);
231350
+ if (peg$r0.test(s1)) {
229121
231351
  peg$currPos++;
229122
231352
  } else {
229123
231353
  s1 = peg$FAILED;
@@ -229146,8 +231376,8 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
229146
231376
  }
229147
231377
  function peg$parsesign() {
229148
231378
  var s0;
229149
- if (peg$r1.test(input.charAt(peg$currPos))) {
229150
- s0 = input.charAt(peg$currPos);
231379
+ s0 = input.charAt(peg$currPos);
231380
+ if (peg$r1.test(s0)) {
229151
231381
  peg$currPos++;
229152
231382
  } else {
229153
231383
  s0 = peg$FAILED;
@@ -229173,8 +231403,8 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
229173
231403
  }
229174
231404
  function peg$parsedigit() {
229175
231405
  var s0;
229176
- if (peg$r2.test(input.charAt(peg$currPos))) {
229177
- s0 = input.charAt(peg$currPos);
231406
+ s0 = input.charAt(peg$currPos);
231407
+ if (peg$r2.test(s0)) {
229178
231408
  peg$currPos++;
229179
231409
  } else {
229180
231410
  s0 = peg$FAILED;
@@ -229186,8 +231416,8 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
229186
231416
  }
229187
231417
  function peg$parsewsp() {
229188
231418
  var s0;
229189
- if (peg$r3.test(input.charAt(peg$currPos))) {
229190
- s0 = input.charAt(peg$currPos);
231419
+ s0 = input.charAt(peg$currPos);
231420
+ if (peg$r3.test(s0)) {
229191
231421
  peg$currPos++;
229192
231422
  } else {
229193
231423
  s0 = peg$FAILED;
@@ -229198,6 +231428,15 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
229198
231428
  return s0;
229199
231429
  }
229200
231430
  peg$result = peg$startRuleFunction();
231431
+ if (options.peg$library) {
231432
+ return {
231433
+ peg$result,
231434
+ peg$currPos,
231435
+ peg$FAILED,
231436
+ peg$maxFailExpected,
231437
+ peg$maxFailPos
231438
+ };
231439
+ }
229201
231440
  if (peg$result !== peg$FAILED && peg$currPos === input.length) {
229202
231441
  return peg$result;
229203
231442
  } else {
@@ -229207,28 +231446,29 @@ var require_fromTransformAttribute_autogenerated = __commonJS((exports2) => {
229207
231446
  throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
229208
231447
  }
229209
231448
  }
231449
+ var peg$allowedStartRules = exports2.StartRules = ["transformList"];
229210
231450
  });
229211
231451
 
229212
231452
  // node_modules/transformation-matrix/build-commonjs/fromTransformAttribute.js
229213
- var require_fromTransformAttribute = __commonJS((exports2) => {
231453
+ var require_fromTransformAttribute2 = __commonJS((exports2) => {
229214
231454
  Object.defineProperty(exports2, "__esModule", {
229215
231455
  value: true
229216
231456
  });
229217
231457
  exports2.fromTransformAttribute = fromTransformAttribute;
229218
- var _fromTransformAttribute = require_fromTransformAttribute_autogenerated();
231458
+ var _fromTransformAttribute = require_fromTransformAttribute_autogenerated2();
229219
231459
  function fromTransformAttribute(transformString) {
229220
231460
  return (0, _fromTransformAttribute.parse)(transformString);
229221
231461
  }
229222
231462
  });
229223
231463
 
229224
231464
  // node_modules/transformation-matrix/build-commonjs/decompose.js
229225
- var require_decompose = __commonJS((exports2) => {
231465
+ var require_decompose2 = __commonJS((exports2) => {
229226
231466
  Object.defineProperty(exports2, "__esModule", {
229227
231467
  value: true
229228
231468
  });
229229
231469
  exports2.decomposeTSR = decomposeTSR;
229230
- var _scale = require_scale();
229231
- var _transform = require_transform();
231470
+ var _scale = require_scale2();
231471
+ var _transform = require_transform2();
229232
231472
  function decomposeTSR(matrix, flipX = false, flipY = false) {
229233
231473
  if (flipX) {
229234
231474
  if (flipY) {
@@ -229243,23 +231483,23 @@ var require_decompose = __commonJS((exports2) => {
229243
231483
  const b = matrix.b;
229244
231484
  const c = matrix.c;
229245
231485
  const d = matrix.d;
229246
- let scaleX, scaleY, rotation2;
231486
+ let scaleX, scaleY, rotation3;
229247
231487
  if (a !== 0 || c !== 0) {
229248
231488
  const hypotAc = Math.hypot(a, c);
229249
231489
  scaleX = hypotAc;
229250
231490
  scaleY = (a * d - b * c) / hypotAc;
229251
231491
  const acos = Math.acos(a / hypotAc);
229252
- rotation2 = c > 0 ? -acos : acos;
231492
+ rotation3 = c > 0 ? -acos : acos;
229253
231493
  } else if (b !== 0 || d !== 0) {
229254
231494
  const hypotBd = Math.hypot(b, d);
229255
231495
  scaleX = (a * d - b * c) / hypotBd;
229256
231496
  scaleY = hypotBd;
229257
231497
  const acos = Math.acos(b / hypotBd);
229258
- rotation2 = Math.PI / 2 + (d > 0 ? -acos : acos);
231498
+ rotation3 = Math.PI / 2 + (d > 0 ? -acos : acos);
229259
231499
  } else {
229260
231500
  scaleX = 0;
229261
231501
  scaleY = 0;
229262
- rotation2 = 0;
231502
+ rotation3 = 0;
229263
231503
  }
229264
231504
  if (flipY) {
229265
231505
  scaleX = -scaleX;
@@ -229277,14 +231517,14 @@ var require_decompose = __commonJS((exports2) => {
229277
231517
  sy: scaleY
229278
231518
  },
229279
231519
  rotation: {
229280
- angle: rotation2
231520
+ angle: rotation3
229281
231521
  }
229282
231522
  };
229283
231523
  }
229284
231524
  });
229285
231525
 
229286
231526
  // node_modules/transformation-matrix/build-commonjs/flip.js
229287
- var require_flip = __commonJS((exports2) => {
231527
+ var require_flip2 = __commonJS((exports2) => {
229288
231528
  Object.defineProperty(exports2, "__esModule", {
229289
231529
  value: true
229290
231530
  });
@@ -229324,17 +231564,17 @@ var require_flip = __commonJS((exports2) => {
229324
231564
  });
229325
231565
 
229326
231566
  // node_modules/transformation-matrix/build-commonjs/fromMovingPoints.js
229327
- var require_fromMovingPoints = __commonJS((exports2) => {
231567
+ var require_fromMovingPoints2 = __commonJS((exports2) => {
229328
231568
  Object.defineProperty(exports2, "__esModule", {
229329
231569
  value: true
229330
231570
  });
229331
231571
  exports2.fromOneMovingPoint = fromOneMovingPoint;
229332
231572
  exports2.fromTwoMovingPoints = fromTwoMovingPoints;
229333
- var _translate = require_translate();
229334
- var _applyToPoint = require_applyToPoint();
229335
- var _rotate = require_rotate();
229336
- var _scale = require_scale();
229337
- var _transform = require_transform();
231573
+ var _translate = require_translate2();
231574
+ var _applyToPoint = require_applyToPoint2();
231575
+ var _rotate = require_rotate2();
231576
+ var _scale = require_scale2();
231577
+ var _transform = require_transform2();
229338
231578
  function fromOneMovingPoint(startingPoint, endingPoint) {
229339
231579
  const tx = endingPoint.x - startingPoint.x;
229340
231580
  const ty = endingPoint.y - startingPoint.y;
@@ -229356,11 +231596,11 @@ var require_fromMovingPoints = __commonJS((exports2) => {
229356
231596
  });
229357
231597
 
229358
231598
  // node_modules/transformation-matrix/build-commonjs/index.js
229359
- var require_build_commonjs = __commonJS((exports2) => {
231599
+ var require_build_commonjs2 = __commonJS((exports2) => {
229360
231600
  Object.defineProperty(exports2, "__esModule", {
229361
231601
  value: true
229362
231602
  });
229363
- var _applyToPoint = require_applyToPoint();
231603
+ var _applyToPoint = require_applyToPoint2();
229364
231604
  Object.keys(_applyToPoint).forEach(function(key) {
229365
231605
  if (key === "default" || key === "__esModule")
229366
231606
  return;
@@ -229373,7 +231613,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229373
231613
  }
229374
231614
  });
229375
231615
  });
229376
- var _fromObject = require_fromObject();
231616
+ var _fromObject = require_fromObject2();
229377
231617
  Object.keys(_fromObject).forEach(function(key) {
229378
231618
  if (key === "default" || key === "__esModule")
229379
231619
  return;
@@ -229386,7 +231626,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229386
231626
  }
229387
231627
  });
229388
231628
  });
229389
- var _fromString = require_fromString();
231629
+ var _fromString = require_fromString2();
229390
231630
  Object.keys(_fromString).forEach(function(key) {
229391
231631
  if (key === "default" || key === "__esModule")
229392
231632
  return;
@@ -229399,7 +231639,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229399
231639
  }
229400
231640
  });
229401
231641
  });
229402
- var _identity = require_identity();
231642
+ var _identity = require_identity2();
229403
231643
  Object.keys(_identity).forEach(function(key) {
229404
231644
  if (key === "default" || key === "__esModule")
229405
231645
  return;
@@ -229412,7 +231652,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229412
231652
  }
229413
231653
  });
229414
231654
  });
229415
- var _inverse = require_inverse();
231655
+ var _inverse = require_inverse2();
229416
231656
  Object.keys(_inverse).forEach(function(key) {
229417
231657
  if (key === "default" || key === "__esModule")
229418
231658
  return;
@@ -229425,7 +231665,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229425
231665
  }
229426
231666
  });
229427
231667
  });
229428
- var _isAffineMatrix = require_isAffineMatrix();
231668
+ var _isAffineMatrix = require_isAffineMatrix2();
229429
231669
  Object.keys(_isAffineMatrix).forEach(function(key) {
229430
231670
  if (key === "default" || key === "__esModule")
229431
231671
  return;
@@ -229438,7 +231678,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229438
231678
  }
229439
231679
  });
229440
231680
  });
229441
- var _rotate = require_rotate();
231681
+ var _rotate = require_rotate2();
229442
231682
  Object.keys(_rotate).forEach(function(key) {
229443
231683
  if (key === "default" || key === "__esModule")
229444
231684
  return;
@@ -229451,7 +231691,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229451
231691
  }
229452
231692
  });
229453
231693
  });
229454
- var _scale = require_scale();
231694
+ var _scale = require_scale2();
229455
231695
  Object.keys(_scale).forEach(function(key) {
229456
231696
  if (key === "default" || key === "__esModule")
229457
231697
  return;
@@ -229464,7 +231704,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229464
231704
  }
229465
231705
  });
229466
231706
  });
229467
- var _shear = require_shear();
231707
+ var _shear = require_shear2();
229468
231708
  Object.keys(_shear).forEach(function(key) {
229469
231709
  if (key === "default" || key === "__esModule")
229470
231710
  return;
@@ -229477,7 +231717,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229477
231717
  }
229478
231718
  });
229479
231719
  });
229480
- var _skew = require_skew();
231720
+ var _skew = require_skew2();
229481
231721
  Object.keys(_skew).forEach(function(key) {
229482
231722
  if (key === "default" || key === "__esModule")
229483
231723
  return;
@@ -229490,7 +231730,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229490
231730
  }
229491
231731
  });
229492
231732
  });
229493
- var _toString = require_toString();
231733
+ var _toString = require_toString2();
229494
231734
  Object.keys(_toString).forEach(function(key) {
229495
231735
  if (key === "default" || key === "__esModule")
229496
231736
  return;
@@ -229503,7 +231743,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229503
231743
  }
229504
231744
  });
229505
231745
  });
229506
- var _transform = require_transform();
231746
+ var _transform = require_transform2();
229507
231747
  Object.keys(_transform).forEach(function(key) {
229508
231748
  if (key === "default" || key === "__esModule")
229509
231749
  return;
@@ -229516,7 +231756,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229516
231756
  }
229517
231757
  });
229518
231758
  });
229519
- var _translate = require_translate();
231759
+ var _translate = require_translate2();
229520
231760
  Object.keys(_translate).forEach(function(key) {
229521
231761
  if (key === "default" || key === "__esModule")
229522
231762
  return;
@@ -229529,7 +231769,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229529
231769
  }
229530
231770
  });
229531
231771
  });
229532
- var _fromTriangles = require_fromTriangles();
231772
+ var _fromTriangles = require_fromTriangles2();
229533
231773
  Object.keys(_fromTriangles).forEach(function(key) {
229534
231774
  if (key === "default" || key === "__esModule")
229535
231775
  return;
@@ -229542,7 +231782,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229542
231782
  }
229543
231783
  });
229544
231784
  });
229545
- var _smoothMatrix = require_smoothMatrix();
231785
+ var _smoothMatrix = require_smoothMatrix2();
229546
231786
  Object.keys(_smoothMatrix).forEach(function(key) {
229547
231787
  if (key === "default" || key === "__esModule")
229548
231788
  return;
@@ -229555,7 +231795,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229555
231795
  }
229556
231796
  });
229557
231797
  });
229558
- var _fromDefinition = require_fromDefinition();
231798
+ var _fromDefinition = require_fromDefinition2();
229559
231799
  Object.keys(_fromDefinition).forEach(function(key) {
229560
231800
  if (key === "default" || key === "__esModule")
229561
231801
  return;
@@ -229568,7 +231808,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229568
231808
  }
229569
231809
  });
229570
231810
  });
229571
- var _fromTransformAttribute = require_fromTransformAttribute();
231811
+ var _fromTransformAttribute = require_fromTransformAttribute2();
229572
231812
  Object.keys(_fromTransformAttribute).forEach(function(key) {
229573
231813
  if (key === "default" || key === "__esModule")
229574
231814
  return;
@@ -229581,7 +231821,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229581
231821
  }
229582
231822
  });
229583
231823
  });
229584
- var _decompose = require_decompose();
231824
+ var _decompose = require_decompose2();
229585
231825
  Object.keys(_decompose).forEach(function(key) {
229586
231826
  if (key === "default" || key === "__esModule")
229587
231827
  return;
@@ -229594,7 +231834,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229594
231834
  }
229595
231835
  });
229596
231836
  });
229597
- var _flip = require_flip();
231837
+ var _flip = require_flip2();
229598
231838
  Object.keys(_flip).forEach(function(key) {
229599
231839
  if (key === "default" || key === "__esModule")
229600
231840
  return;
@@ -229607,7 +231847,7 @@ var require_build_commonjs = __commonJS((exports2) => {
229607
231847
  }
229608
231848
  });
229609
231849
  });
229610
- var _fromMovingPoints = require_fromMovingPoints();
231850
+ var _fromMovingPoints = require_fromMovingPoints2();
229611
231851
  Object.keys(_fromMovingPoints).forEach(function(key) {
229612
231852
  if (key === "default" || key === "__esModule")
229613
231853
  return;
@@ -238299,7 +240539,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
238299
240539
  import { execSync as execSync2 } from "node:child_process";
238300
240540
  var import_semver2 = __toESM2(require_semver2(), 1);
238301
240541
  // package.json
238302
- var version = "0.1.150";
240542
+ var version = "0.1.151";
238303
240543
  var package_default = {
238304
240544
  name: "@tscircuit/cli",
238305
240545
  version,
@@ -238307,14 +240547,14 @@ var package_default = {
238307
240547
  devDependencies: {
238308
240548
  "@babel/standalone": "^7.26.9",
238309
240549
  "@biomejs/biome": "^1.9.4",
238310
- "@tscircuit/circuit-json-util": "^0.0.47",
240550
+ "@tscircuit/circuit-json-util": "^0.0.50",
238311
240551
  "@tscircuit/fake-snippets": "^0.0.87",
238312
240552
  "@tscircuit/file-server": "^0.0.24",
238313
240553
  "@tscircuit/math-utils": "^0.0.18",
238314
- "@tscircuit/props": "^0.0.242",
240554
+ "@tscircuit/props": "^0.0.244",
238315
240555
  "@tscircuit/runframe": "^0.0.614",
238316
240556
  "@tscircuit/schematic-match-adapt": "^0.0.22",
238317
- "@tscircuit/simple-3d-svg": "^0.0.10",
240557
+ "@tscircuit/simple-3d-svg": "^0.0.22",
238318
240558
  "@types/bun": "^1.2.2",
238319
240559
  "@types/configstore": "^6.0.2",
238320
240560
  "@types/debug": "^4.1.12",
@@ -250865,22 +253105,88 @@ expectTypesMatch2(true);
250865
253105
  expectStringUnionsMatch2(true);
250866
253106
 
250867
253107
  // node_modules/@tscircuit/circuit-json-util/dist/index.js
250868
- var import_transformation_matrix = __toESM2(require_build_commonjs(), 1);
253108
+ var import_transformation_matrix = __toESM2(require_build_commonjs2(), 1);
250869
253109
 
250870
253110
  // node_modules/parsel-js/dist/parsel.min.js
250871
253111
  var t = new Set(["combinator", "comma"]);
250872
253112
  var n = new Set(["not", "is", "where", "has", "matches", "-moz-any", "-webkit-any", "nth-child", "nth-last-child"]);
250873
253113
 
250874
253114
  // node_modules/@tscircuit/circuit-json-util/dist/index.js
250875
- var cju = (soup, options = {}) => {
250876
- let internalStore = soup._internal_store;
253115
+ function connect(map, a, b) {
253116
+ if (!a || !b)
253117
+ return;
253118
+ let setA = map.get(a);
253119
+ if (!setA) {
253120
+ setA = /* @__PURE__ */ new Set;
253121
+ map.set(a, setA);
253122
+ }
253123
+ setA.add(b);
253124
+ let setB = map.get(b);
253125
+ if (!setB) {
253126
+ setB = /* @__PURE__ */ new Set;
253127
+ map.set(b, setB);
253128
+ }
253129
+ setB.add(a);
253130
+ }
253131
+ function buildSubtree(soup, opts) {
253132
+ if (!opts.subcircuit_id && !opts.source_group_id)
253133
+ return [...soup];
253134
+ const idMap = /* @__PURE__ */ new Map;
253135
+ for (const elm of soup) {
253136
+ const idVal = elm[`${elm.type}_id`];
253137
+ if (typeof idVal === "string") {
253138
+ idMap.set(idVal, elm);
253139
+ }
253140
+ }
253141
+ const adj = /* @__PURE__ */ new Map;
253142
+ for (const elm of soup) {
253143
+ const entries = Object.entries(elm);
253144
+ for (const [key, val] of entries) {
253145
+ if (key.endsWith("_id") && typeof val === "string") {
253146
+ const other = idMap.get(val);
253147
+ connect(adj, elm, other);
253148
+ } else if (key.endsWith("_ids") && Array.isArray(val)) {
253149
+ for (const v of val) {
253150
+ if (typeof v === "string") {
253151
+ const other = idMap.get(v);
253152
+ connect(adj, elm, other);
253153
+ }
253154
+ }
253155
+ }
253156
+ }
253157
+ }
253158
+ const queue = [];
253159
+ const included = /* @__PURE__ */ new Set;
253160
+ for (const elm of soup) {
253161
+ if (opts.subcircuit_id && elm.subcircuit_id === opts.subcircuit_id || opts.source_group_id && (elm.source_group_id === opts.source_group_id || Array.isArray(elm.member_source_group_ids) && elm.member_source_group_ids.includes(opts.source_group_id))) {
253162
+ queue.push(elm);
253163
+ included.add(elm);
253164
+ }
253165
+ }
253166
+ while (queue.length > 0) {
253167
+ const elm = queue.shift();
253168
+ const neighbors = adj.get(elm);
253169
+ if (!neighbors)
253170
+ continue;
253171
+ for (const n2 of neighbors) {
253172
+ if (!included.has(n2)) {
253173
+ included.add(n2);
253174
+ queue.push(n2);
253175
+ }
253176
+ }
253177
+ }
253178
+ return soup.filter((e) => included.has(e));
253179
+ }
253180
+ var cju = (circuitJsonInput, options = {}) => {
253181
+ const circuitJson = circuitJsonInput;
253182
+ let internalStore = circuitJson._internal_store;
250877
253183
  if (!internalStore) {
250878
253184
  internalStore = {
250879
253185
  counts: {},
250880
253186
  editCount: 0
250881
253187
  };
250882
- soup._internal_store = internalStore;
250883
- for (const elm of soup) {
253188
+ circuitJson._internal_store = internalStore;
253189
+ for (const elm of circuitJson) {
250884
253190
  const type = elm.type;
250885
253191
  const idVal = elm[`${type}_id`];
250886
253192
  if (!idVal)
@@ -250895,16 +253201,19 @@ var cju = (soup, options = {}) => {
250895
253201
  get: (proxy_target, prop) => {
250896
253202
  if (prop === "toArray") {
250897
253203
  return () => {
250898
- soup.editCount = internalStore.editCount;
250899
- return soup;
253204
+ circuitJson.editCount = internalStore.editCount;
253205
+ return circuitJson;
250900
253206
  };
250901
253207
  }
250902
253208
  if (prop === "editCount") {
250903
253209
  return internalStore.editCount;
250904
253210
  }
253211
+ if (prop === "subtree") {
253212
+ return (opts) => cju(buildSubtree(circuitJson, opts), options);
253213
+ }
250905
253214
  const component_type = prop;
250906
253215
  return {
250907
- get: (id) => soup.find((e) => e.type === component_type && e[`${component_type}_id`] === id),
253216
+ get: (id) => circuitJson.find((e) => e.type === component_type && e[`${component_type}_id`] === id),
250908
253217
  getUsing: (using) => {
250909
253218
  const keys = Object.keys(using);
250910
253219
  if (keys.length !== 1) {
@@ -250912,18 +253221,18 @@ var cju = (soup, options = {}) => {
250912
253221
  }
250913
253222
  const join_key = keys[0];
250914
253223
  const join_type = join_key.replace("_id", "");
250915
- const joiner = soup.find((e) => e.type === join_type && e[join_key] === using[join_key]);
253224
+ const joiner = circuitJson.find((e) => e.type === join_type && e[join_key] === using[join_key]);
250916
253225
  if (!joiner)
250917
253226
  return null;
250918
- return soup.find((e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]);
253227
+ return circuitJson.find((e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]);
250919
253228
  },
250920
253229
  getWhere: (where) => {
250921
253230
  const keys = Object.keys(where);
250922
- return soup.find((e) => e.type === component_type && keys.every((key) => e[key] === where[key]));
253231
+ return circuitJson.find((e) => e.type === component_type && keys.every((key) => e[key] === where[key]));
250923
253232
  },
250924
253233
  list: (where) => {
250925
253234
  const keys = !where ? [] : Object.keys(where);
250926
- return soup.filter((e) => e.type === component_type && keys.every((key) => e[key] === where[key]));
253235
+ return circuitJson.filter((e) => e.type === component_type && keys.every((key) => e[key] === where[key]));
250927
253236
  },
250928
253237
  insert: (elm) => {
250929
253238
  internalStore.counts[component_type] ??= -1;
@@ -250938,19 +253247,19 @@ var cju = (soup, options = {}) => {
250938
253247
  const parser = exports_dist[component_type] ?? any_soup_element2;
250939
253248
  parser.parse(newElm);
250940
253249
  }
250941
- soup.push(newElm);
253250
+ circuitJson.push(newElm);
250942
253251
  internalStore.editCount++;
250943
253252
  return newElm;
250944
253253
  },
250945
253254
  delete: (id) => {
250946
- const elm = soup.find((e) => e[`${component_type}_id`] === id);
253255
+ const elm = circuitJson.find((e) => e[`${component_type}_id`] === id);
250947
253256
  if (!elm)
250948
253257
  return;
250949
- soup.splice(soup.indexOf(elm), 1);
253258
+ circuitJson.splice(circuitJson.indexOf(elm), 1);
250950
253259
  internalStore.editCount++;
250951
253260
  },
250952
253261
  update: (id, newProps) => {
250953
- const elm = soup.find((e) => e.type === component_type && e[`${component_type}_id`] === id);
253262
+ const elm = circuitJson.find((e) => e.type === component_type && e[`${component_type}_id`] === id);
250954
253263
  if (!elm)
250955
253264
  return null;
250956
253265
  Object.assign(elm, newProps);
@@ -250959,21 +253268,21 @@ var cju = (soup, options = {}) => {
250959
253268
  },
250960
253269
  select: (selector) => {
250961
253270
  if (component_type === "source_component") {
250962
- return soup.find((e) => e.type === "source_component" && e.name === selector.replace(/\./g, ""));
253271
+ return circuitJson.find((e) => e.type === "source_component" && e.name === selector.replace(/\./g, ""));
250963
253272
  } else if (component_type === "pcb_port" || component_type === "source_port" || component_type === "schematic_port") {
250964
253273
  const [component_name, port_selector] = selector.replace(/\./g, "").split(/[\s\>]+/);
250965
- const source_component = soup.find((e) => e.type === "source_component" && e.name === component_name);
253274
+ const source_component = circuitJson.find((e) => e.type === "source_component" && e.name === component_name);
250966
253275
  if (!source_component)
250967
253276
  return null;
250968
- const source_port3 = soup.find((e) => e.type === "source_port" && e.source_component_id === source_component.source_component_id && (e.name === port_selector || (e.port_hints ?? []).includes(port_selector)));
253277
+ const source_port3 = circuitJson.find((e) => e.type === "source_port" && e.source_component_id === source_component.source_component_id && (e.name === port_selector || (e.port_hints ?? []).includes(port_selector)));
250969
253278
  if (!source_port3)
250970
253279
  return null;
250971
253280
  if (component_type === "source_port")
250972
253281
  return source_port3;
250973
253282
  if (component_type === "pcb_port") {
250974
- return soup.find((e) => e.type === "pcb_port" && e.source_port_id === source_port3.source_port_id);
253283
+ return circuitJson.find((e) => e.type === "pcb_port" && e.source_port_id === source_port3.source_port_id);
250975
253284
  } else if (component_type === "schematic_port") {
250976
- return soup.find((e) => e.type === "schematic_port" && e.source_port_id === source_port3.source_port_id);
253285
+ return circuitJson.find((e) => e.type === "schematic_port" && e.source_port_id === source_port3.source_port_id);
250977
253286
  }
250978
253287
  }
250979
253288
  }
@@ -251453,7 +253762,7 @@ var import_transformation_matrix28 = __toESM2(require_build_commonjs(), 1);
251453
253762
  var import_transformation_matrix29 = __toESM2(require_build_commonjs(), 1);
251454
253763
 
251455
253764
  // node_modules/schematic-symbols/dist/index.js
251456
- var import_transformation_matrix2 = __toESM2(require_build_commonjs(), 1);
253765
+ var import_transformation_matrix2 = __toESM2(require_build_commonjs2(), 1);
251457
253766
  function getBoundsOfPrimitives(primitives2) {
251458
253767
  if (primitives2.length === 0) {
251459
253768
  return { minX: 0, maxX: 0, minY: 0, maxY: 0 };
@@ -277089,10 +279398,10 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
277089
279398
  }
277090
279399
 
277091
279400
  // node_modules/dsn-converter/dist/index.js
277092
- var import_transformation_matrix48 = __toESM2(require_build_commonjs(), 1);
279401
+ var import_transformation_matrix48 = __toESM2(require_build_commonjs2(), 1);
277093
279402
 
277094
279403
  // node_modules/@tscircuit/soup-util/dist/index.js
277095
- var import_transformation_matrix47 = __toESM2(require_build_commonjs(), 1);
279404
+ var import_transformation_matrix47 = __toESM2(require_build_commonjs2(), 1);
277096
279405
  var su3 = (soup, options = {}) => {
277097
279406
  let internalStore = soup._internal_store;
277098
279407
  if (!internalStore) {
@@ -277197,24 +279506,24 @@ var su_default2 = su3;
277197
279506
 
277198
279507
  // node_modules/dsn-converter/dist/index.js
277199
279508
  var import_debug3 = __toESM2(require_src2(), 1);
277200
- var import_transformation_matrix49 = __toESM2(require_build_commonjs(), 1);
279509
+ var import_transformation_matrix49 = __toESM2(require_build_commonjs2(), 1);
277201
279510
  var import_debug4 = __toESM2(require_src2(), 1);
277202
- var import_transformation_matrix50 = __toESM2(require_build_commonjs(), 1);
277203
- var import_transformation_matrix51 = __toESM2(require_build_commonjs(), 1);
277204
- var import_transformation_matrix52 = __toESM2(require_build_commonjs(), 1);
279511
+ var import_transformation_matrix50 = __toESM2(require_build_commonjs2(), 1);
279512
+ var import_transformation_matrix51 = __toESM2(require_build_commonjs2(), 1);
279513
+ var import_transformation_matrix52 = __toESM2(require_build_commonjs2(), 1);
277205
279514
  var import_debug5 = __toESM2(require_src2(), 1);
277206
- var import_transformation_matrix53 = __toESM2(require_build_commonjs(), 1);
277207
- var import_transformation_matrix54 = __toESM2(require_build_commonjs(), 1);
277208
- var import_transformation_matrix55 = __toESM2(require_build_commonjs(), 1);
279515
+ var import_transformation_matrix53 = __toESM2(require_build_commonjs2(), 1);
279516
+ var import_transformation_matrix54 = __toESM2(require_build_commonjs2(), 1);
279517
+ var import_transformation_matrix55 = __toESM2(require_build_commonjs2(), 1);
277209
279518
  var import_debug6 = __toESM2(require_src2(), 1);
277210
279519
  var import_debug7 = __toESM2(require_src2(), 1);
277211
- var import_transformation_matrix56 = __toESM2(require_build_commonjs(), 1);
279520
+ var import_transformation_matrix56 = __toESM2(require_build_commonjs2(), 1);
277212
279521
  var import_debug8 = __toESM2(require_src2(), 1);
277213
- var import_transformation_matrix57 = __toESM2(require_build_commonjs(), 1);
277214
- var import_transformation_matrix58 = __toESM2(require_build_commonjs(), 1);
279522
+ var import_transformation_matrix57 = __toESM2(require_build_commonjs2(), 1);
279523
+ var import_transformation_matrix58 = __toESM2(require_build_commonjs2(), 1);
277215
279524
  var import_debug9 = __toESM2(require_src2(), 1);
277216
- var import_transformation_matrix59 = __toESM2(require_build_commonjs(), 1);
277217
- var import_transformation_matrix60 = __toESM2(require_build_commonjs(), 1);
279525
+ var import_transformation_matrix59 = __toESM2(require_build_commonjs2(), 1);
279526
+ var import_transformation_matrix60 = __toESM2(require_build_commonjs2(), 1);
277218
279527
  var import_debug10 = __toESM2(require_src2(), 1);
277219
279528
  var import_debug11 = __toESM2(require_src2(), 1);
277220
279529
  var import_debug12 = __toESM2(require_src2(), 1);
@@ -278823,8 +281132,235 @@ function calculateBoundingBox(triangles) {
278823
281132
  max: { x: maxX, y: maxY, z: maxZ }
278824
281133
  };
278825
281134
  }
281135
+ var objCache = /* @__PURE__ */ new Map;
281136
+ async function loadOBJ(url) {
281137
+ if (objCache.has(url)) {
281138
+ return objCache.get(url);
281139
+ }
281140
+ const response = await fetch(url);
281141
+ const text = await response.text();
281142
+ const mesh = parseOBJ(text);
281143
+ objCache.set(url, mesh);
281144
+ return mesh;
281145
+ }
281146
+ function parseOBJ(text) {
281147
+ const lines = text.split(/\r?\n/);
281148
+ const vertices = [];
281149
+ const vertexColors = [];
281150
+ const normals = [];
281151
+ const triangles = [];
281152
+ const materialColors = {};
281153
+ let activeMaterial;
281154
+ for (const line of lines) {
281155
+ const trimmed = line.trim();
281156
+ if (trimmed.startsWith("v ")) {
281157
+ const parts = trimmed.split(/\s+/);
281158
+ const x = parts[1];
281159
+ const y = parts[2];
281160
+ const z3 = parts[3];
281161
+ vertices.push({ x: parseFloat(x), y: parseFloat(y), z: parseFloat(z3) });
281162
+ if (parts.length >= 7) {
281163
+ const [rStr, gStr, bStr] = parts.slice(4, 7);
281164
+ let r = Number(rStr);
281165
+ let g = Number(gStr);
281166
+ let b = Number(bStr);
281167
+ if (r <= 1 && g <= 1 && b <= 1) {
281168
+ r *= 255;
281169
+ g *= 255;
281170
+ b *= 255;
281171
+ }
281172
+ vertexColors.push([r, g, b, 1]);
281173
+ } else {
281174
+ vertexColors.push(undefined);
281175
+ }
281176
+ } else if (trimmed.startsWith("vn ")) {
281177
+ const parts = trimmed.split(/\s+/);
281178
+ const x = parts[1];
281179
+ const y = parts[2];
281180
+ const z3 = parts[3];
281181
+ normals.push({ x: parseFloat(x), y: parseFloat(y), z: parseFloat(z3) });
281182
+ } else if (trimmed.startsWith("newmtl ")) {
281183
+ activeMaterial = trimmed.split(/\s+/)[1];
281184
+ } else if (trimmed.startsWith("Kd ") && activeMaterial) {
281185
+ const parts = trimmed.split(/\s+/);
281186
+ const rStr = parts[1];
281187
+ const gStr = parts[2];
281188
+ const bStr = parts[3];
281189
+ let r = parseFloat(rStr);
281190
+ let g = parseFloat(gStr);
281191
+ let b = parseFloat(bStr);
281192
+ if (r <= 1 && g <= 1 && b <= 1) {
281193
+ r *= 255;
281194
+ g *= 255;
281195
+ b *= 255;
281196
+ }
281197
+ materialColors[activeMaterial] = [r, g, b, 1];
281198
+ } else if (trimmed.startsWith("usemtl ")) {
281199
+ activeMaterial = trimmed.split(/\s+/)[1];
281200
+ } else if (trimmed.startsWith("f ")) {
281201
+ const parts = trimmed.slice(2).trim().split(/\s+/);
281202
+ const idxs = parts.map((p) => {
281203
+ const [vi, , ni] = p.split("/");
281204
+ return {
281205
+ v: parseInt(vi) - 1,
281206
+ n: ni ? parseInt(ni) - 1 : undefined
281207
+ };
281208
+ });
281209
+ for (let i = 1;i < idxs.length - 1; i++) {
281210
+ const a = idxs[0];
281211
+ const b = idxs[i];
281212
+ const c = idxs[i + 1];
281213
+ const v0 = vertices[a.v];
281214
+ const v1 = vertices[b.v];
281215
+ const v2 = vertices[c.v];
281216
+ let normal;
281217
+ if (a.n !== undefined && normals[a.n]) {
281218
+ normal = normals[a.n];
281219
+ } else if (b.n !== undefined && normals[b.n]) {
281220
+ normal = normals[b.n];
281221
+ } else if (c.n !== undefined && normals[c.n]) {
281222
+ normal = normals[c.n];
281223
+ } else {
281224
+ const edge1 = {
281225
+ x: v1.x - v0.x,
281226
+ y: v1.y - v0.y,
281227
+ z: v1.z - v0.z
281228
+ };
281229
+ const edge2 = {
281230
+ x: v2.x - v0.x,
281231
+ y: v2.y - v0.y,
281232
+ z: v2.z - v0.z
281233
+ };
281234
+ normal = {
281235
+ x: edge1.y * edge2.z - edge1.z * edge2.y,
281236
+ y: edge1.z * edge2.x - edge1.x * edge2.z,
281237
+ z: edge1.x * edge2.y - edge1.y * edge2.x
281238
+ };
281239
+ }
281240
+ let color;
281241
+ if (activeMaterial && materialColors[activeMaterial]) {
281242
+ color = materialColors[activeMaterial];
281243
+ } else {
281244
+ color = vertexColors[a.v] ?? vertexColors[b.v] ?? vertexColors[c.v];
281245
+ }
281246
+ triangles.push({ vertices: [v0, v1, v2], normal, color });
281247
+ }
281248
+ }
281249
+ }
281250
+ return {
281251
+ triangles,
281252
+ boundingBox: calculateBoundingBox2(triangles)
281253
+ };
281254
+ }
281255
+ function calculateBoundingBox2(triangles) {
281256
+ if (triangles.length === 0) {
281257
+ return { min: { x: 0, y: 0, z: 0 }, max: { x: 0, y: 0, z: 0 } };
281258
+ }
281259
+ let minX = Infinity;
281260
+ let minY = Infinity;
281261
+ let minZ = Infinity;
281262
+ let maxX = -Infinity;
281263
+ let maxY = -Infinity;
281264
+ let maxZ = -Infinity;
281265
+ for (const tri of triangles) {
281266
+ for (const v of tri.vertices) {
281267
+ if (v.x < minX)
281268
+ minX = v.x;
281269
+ if (v.y < minY)
281270
+ minY = v.y;
281271
+ if (v.z < minZ)
281272
+ minZ = v.z;
281273
+ if (v.x > maxX)
281274
+ maxX = v.x;
281275
+ if (v.y > maxY)
281276
+ maxY = v.y;
281277
+ if (v.z > maxZ)
281278
+ maxZ = v.z;
281279
+ }
281280
+ }
281281
+ return {
281282
+ min: { x: minX, y: minY, z: minZ },
281283
+ max: { x: maxX, y: maxY, z: maxZ }
281284
+ };
281285
+ }
278826
281286
  function colorToCss(c) {
278827
- return typeof c === "string" ? c : `rgba(${c[0]},${c[1]},${c[2]},${c[3]})`;
281287
+ if (typeof c === "string")
281288
+ return c;
281289
+ const [r, g, b, a] = c;
281290
+ return `rgba(${Math.round(r)},${Math.round(g)},${Math.round(b)},${a})`;
281291
+ }
281292
+ var NAMED_COLORS = {
281293
+ black: [0, 0, 0],
281294
+ silver: [192, 192, 192],
281295
+ gray: [128, 128, 128],
281296
+ grey: [128, 128, 128],
281297
+ white: [255, 255, 255],
281298
+ maroon: [128, 0, 0],
281299
+ red: [255, 0, 0],
281300
+ purple: [128, 0, 128],
281301
+ fuchsia: [255, 0, 255],
281302
+ green: [0, 128, 0],
281303
+ lime: [0, 255, 0],
281304
+ olive: [128, 128, 0],
281305
+ yellow: [255, 255, 0],
281306
+ navy: [0, 0, 128],
281307
+ blue: [0, 0, 255],
281308
+ teal: [0, 128, 128],
281309
+ aqua: [0, 255, 255],
281310
+ orange: [255, 165, 0]
281311
+ };
281312
+ function colorToRGBA(c) {
281313
+ if (Array.isArray(c))
281314
+ return c;
281315
+ const s = c.trim().toLowerCase();
281316
+ if (s.startsWith("#")) {
281317
+ const hex = s.slice(1);
281318
+ if (hex.length === 3) {
281319
+ const r = parseInt(hex.charAt(0) + hex.charAt(0), 16);
281320
+ const g = parseInt(hex.charAt(1) + hex.charAt(1), 16);
281321
+ const b = parseInt(hex.charAt(2) + hex.charAt(2), 16);
281322
+ return [r, g, b, 1];
281323
+ }
281324
+ if (hex.length === 6) {
281325
+ const r = parseInt(hex.slice(0, 2), 16);
281326
+ const g = parseInt(hex.slice(2, 4), 16);
281327
+ const b = parseInt(hex.slice(4, 6), 16);
281328
+ return [r, g, b, 1];
281329
+ }
281330
+ }
281331
+ const rgbm = s.match(/^rgba?\(([^)]+)\)$/);
281332
+ if (rgbm) {
281333
+ const content = rgbm[1];
281334
+ const parts = content.split(/\s*,\s*/).map(Number);
281335
+ const [r = 0, g = 0, b = 0, a = 1] = parts;
281336
+ return [r, g, b, a];
281337
+ }
281338
+ const named = NAMED_COLORS[s];
281339
+ if (named)
281340
+ return [named[0], named[1], named[2], 1];
281341
+ return [0, 0, 0, 1];
281342
+ }
281343
+ function lightenColor(c, f) {
281344
+ const [r, g, b, a] = colorToRGBA(c);
281345
+ return [r + (255 - r) * f, g + (255 - g) * f, b + (255 - b) * f, a];
281346
+ }
281347
+ function darkenColor(c, f) {
281348
+ const [r, g, b, a] = colorToRGBA(c);
281349
+ return [r * (1 - f), g * (1 - f), b * (1 - f), a];
281350
+ }
281351
+ function shadeByNormal(base, normal) {
281352
+ const n2 = norm(normal);
281353
+ if (n2.z >= 0) {
281354
+ return colorToCss(lightenColor(base, n2.z * 0.4));
281355
+ } else {
281356
+ return colorToCss(darkenColor(base, -n2.z * 0.4));
281357
+ }
281358
+ }
281359
+ function fmt(n2) {
281360
+ return Math.round(n2).toString();
281361
+ }
281362
+ function fmtPrecise(n2) {
281363
+ return (Math.round(n2 * 100) / 100).toString();
278828
281364
  }
278829
281365
  function add(a, b) {
278830
281366
  return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
@@ -278902,12 +281438,26 @@ function proj(p, w, h, focal) {
278902
281438
  }
278903
281439
  var FACES = [
278904
281440
  [0, 1, 2, 3],
278905
- [4, 5, 6, 7],
281441
+ [4, 7, 6, 5],
278906
281442
  [0, 1, 5, 4],
278907
281443
  [3, 2, 6, 7],
278908
281444
  [1, 2, 6, 5],
278909
281445
  [0, 3, 7, 4]
278910
281446
  ];
281447
+ var EDGES = [
281448
+ [0, 1],
281449
+ [1, 2],
281450
+ [2, 3],
281451
+ [3, 0],
281452
+ [4, 5],
281453
+ [5, 6],
281454
+ [6, 7],
281455
+ [7, 4],
281456
+ [0, 4],
281457
+ [1, 5],
281458
+ [2, 6],
281459
+ [3, 7]
281460
+ ];
278911
281461
  var TOP = [3, 2, 6, 7];
278912
281462
  function verts(b) {
278913
281463
  const {
@@ -278975,32 +281525,67 @@ function affineMatrix(src, dst) {
278975
281525
  const M = mul3(D, inv3(S));
278976
281526
  return `matrix(${M[0][0]} ${M[1][0]} ${M[0][1]} ${M[1][1]} ${M[0][2]} ${M[1][2]})`;
278977
281527
  }
278978
- function scaleAndPositionMesh(mesh, box) {
281528
+ function scaleAndPositionMesh(mesh, box, scaleToBox) {
278979
281529
  const { boundingBox } = mesh;
278980
- const meshSize = sub(boundingBox.max, boundingBox.min);
278981
- const boxSize = box.size;
278982
- const scaleX = boxSize.x / meshSize.x;
278983
- const scaleY = boxSize.y / meshSize.y;
278984
- const scaleZ = boxSize.z / meshSize.z;
278985
- const uniformScale = Math.min(scaleX, scaleY, scaleZ);
278986
281530
  const meshCenter = scale9(add(boundingBox.min, boundingBox.max), 0.5);
281531
+ const centerModel = box.centerModel !== false;
281532
+ const rotatedVerts = [];
281533
+ for (const tri of mesh.triangles) {
281534
+ for (const v of tri.vertices) {
281535
+ let p = sub(v, meshCenter);
281536
+ if (box.stlRotation)
281537
+ p = rotLocal(p, box.stlRotation);
281538
+ if (box.objRotation)
281539
+ p = rotLocal(p, box.objRotation);
281540
+ if (!centerModel)
281541
+ p = add(p, meshCenter);
281542
+ rotatedVerts.push(p);
281543
+ }
281544
+ }
281545
+ let uniformScale = 1;
281546
+ let rotatedCenter = { x: 0, y: 0, z: 0 };
281547
+ if (scaleToBox) {
281548
+ let min = { x: Infinity, y: Infinity, z: Infinity };
281549
+ let max = { x: -Infinity, y: -Infinity, z: -Infinity };
281550
+ for (const v of rotatedVerts) {
281551
+ if (v.x < min.x)
281552
+ min.x = v.x;
281553
+ if (v.y < min.y)
281554
+ min.y = v.y;
281555
+ if (v.z < min.z)
281556
+ min.z = v.z;
281557
+ if (v.x > max.x)
281558
+ max.x = v.x;
281559
+ if (v.y > max.y)
281560
+ max.y = v.y;
281561
+ if (v.z > max.z)
281562
+ max.z = v.z;
281563
+ }
281564
+ const rotatedSize = sub(max, min);
281565
+ const boxSize = box.size;
281566
+ const scaleX = boxSize.x / rotatedSize.x;
281567
+ const scaleY = boxSize.y / rotatedSize.y;
281568
+ const scaleZ = boxSize.z / rotatedSize.z;
281569
+ uniformScale = Math.min(scaleX, scaleY, scaleZ);
281570
+ rotatedCenter = scale9(add(min, max), 0.5);
281571
+ }
278987
281572
  const transformedVertices = [];
278988
- for (const triangle of mesh.triangles) {
278989
- for (const vertex of triangle.vertices) {
278990
- let transformed = sub(vertex, meshCenter);
278991
- transformed = scale9(transformed, uniformScale);
278992
- if (box.stlRotation) {
278993
- transformed = rotLocal(transformed, box.stlRotation);
278994
- }
278995
- if (box.stlPosition) {
278996
- transformed = add(transformed, box.stlPosition);
278997
- }
278998
- if (box.rotation) {
278999
- transformed = rotLocal(transformed, box.rotation);
279000
- }
279001
- transformed = add(transformed, box.center);
279002
- transformedVertices.push(transformed);
279003
- }
281573
+ for (const p of rotatedVerts) {
281574
+ let t2 = p;
281575
+ if (scaleToBox) {
281576
+ t2 = sub(t2, rotatedCenter);
281577
+ t2 = scale9(t2, uniformScale);
281578
+ if (!centerModel)
281579
+ t2 = add(t2, rotatedCenter);
281580
+ }
281581
+ if (box.stlPosition)
281582
+ t2 = add(t2, box.stlPosition);
281583
+ if (box.objPosition)
281584
+ t2 = add(t2, box.objPosition);
281585
+ if (box.rotation)
281586
+ t2 = rotLocal(t2, box.rotation);
281587
+ t2 = add(t2, box.center);
281588
+ transformedVertices.push(t2);
279004
281589
  }
279005
281590
  return transformedVertices;
279006
281591
  }
@@ -279011,9 +281596,11 @@ async function renderScene(scene, opt = {}) {
279011
281596
  const faces = [];
279012
281597
  const images = [];
279013
281598
  const labels = [];
281599
+ const edges = [];
279014
281600
  let clipSeq = 0;
279015
281601
  const texId = /* @__PURE__ */ new Map;
279016
281602
  const stlMeshes = /* @__PURE__ */ new Map;
281603
+ const objMeshes = /* @__PURE__ */ new Map;
279017
281604
  for (const box of scene.boxes) {
279018
281605
  if (box.stlUrl && !stlMeshes.has(box.stlUrl)) {
279019
281606
  try {
@@ -279023,11 +281610,32 @@ async function renderScene(scene, opt = {}) {
279023
281610
  console.warn(`Failed to load STL from ${box.stlUrl}:`, error);
279024
281611
  }
279025
281612
  }
281613
+ if (box.objUrl && !objMeshes.has(box.objUrl)) {
281614
+ try {
281615
+ const mesh = await loadOBJ(box.objUrl);
281616
+ objMeshes.set(box.objUrl, mesh);
281617
+ } catch (error) {
281618
+ console.warn(`Failed to load OBJ from ${box.objUrl}:`, error);
281619
+ }
281620
+ }
279026
281621
  }
279027
281622
  for (const box of scene.boxes) {
281623
+ const bw = verts(box);
281624
+ const bc = bw.map((v) => toCam(v, scene.camera));
281625
+ const bp = bc.map((v) => proj(v, W, H, focal));
281626
+ if (box.drawBoundingBox) {
281627
+ for (const [a, b] of EDGES) {
281628
+ const pa = bp[a];
281629
+ const pb = bp[b];
281630
+ if (pa && pb) {
281631
+ const depth = Math.max(bc[a].z, bc[b].z);
281632
+ edges.push({ pts: [pa, pb], depth, color: "rgba(0,0,0,0.5)" });
281633
+ }
281634
+ }
281635
+ }
279028
281636
  if (box.stlUrl && stlMeshes.has(box.stlUrl)) {
279029
281637
  const mesh = stlMeshes.get(box.stlUrl);
279030
- const transformedVertices = scaleAndPositionMesh(mesh, box);
281638
+ const transformedVertices = scaleAndPositionMesh(mesh, box, box.scaleStlToBox ?? false);
279031
281639
  for (let i = 0;i < mesh.triangles.length; i++) {
279032
281640
  const triangle = mesh.triangles[i];
279033
281641
  const vertexStart = i * 3;
@@ -279040,6 +281648,35 @@ async function renderScene(scene, opt = {}) {
279040
281648
  const v0p = proj(v0c, W, H, focal);
279041
281649
  const v1p = proj(v1c, W, H, focal);
279042
281650
  const v2p = proj(v2c, W, H, focal);
281651
+ if (v0p && v1p && v2p) {
281652
+ const edge1 = sub(v1c, v0c);
281653
+ const edge2 = sub(v2c, v0c);
281654
+ const normal = cross(edge1, edge2);
281655
+ const depth = Math.max(v0c.z, v1c.z, v2c.z);
281656
+ const baseColor = box.color ?? "gray";
281657
+ faces.push({
281658
+ pts: [v0p, v1p, v2p],
281659
+ depth,
281660
+ fill: shadeByNormal(baseColor, normal),
281661
+ stroke: false
281662
+ });
281663
+ }
281664
+ }
281665
+ } else if (box.objUrl && objMeshes.has(box.objUrl)) {
281666
+ const mesh = objMeshes.get(box.objUrl);
281667
+ const transformedVertices = scaleAndPositionMesh(mesh, box, box.scaleObjToBox ?? false);
281668
+ for (let i = 0;i < mesh.triangles.length; i++) {
281669
+ const vertexStart = i * 3;
281670
+ const triangle = mesh.triangles[i];
281671
+ const v0w = transformedVertices[vertexStart];
281672
+ const v1w = transformedVertices[vertexStart + 1];
281673
+ const v2w = transformedVertices[vertexStart + 2];
281674
+ const v0c = toCam(v0w, scene.camera);
281675
+ const v1c = toCam(v1w, scene.camera);
281676
+ const v2c = toCam(v2w, scene.camera);
281677
+ const v0p = proj(v0c, W, H, focal);
281678
+ const v1p = proj(v1c, W, H, focal);
281679
+ const v2p = proj(v2c, W, H, focal);
279043
281680
  if (v0p && v1p && v2p) {
279044
281681
  const edge1 = sub(v1c, v0c);
279045
281682
  const edge2 = sub(v2c, v0c);
@@ -279049,7 +281686,8 @@ async function renderScene(scene, opt = {}) {
279049
281686
  faces.push({
279050
281687
  pts: [v0p, v1p, v2p],
279051
281688
  depth,
279052
- fill: colorToCss(box.color)
281689
+ fill: shadeByNormal(box.color ?? triangle.color ?? "gray", faceNormal),
281690
+ stroke: false
279053
281691
  });
279054
281692
  }
279055
281693
  }
@@ -279073,18 +281711,15 @@ async function renderScene(scene, opt = {}) {
279073
281711
  }
279074
281712
  if (behind)
279075
281713
  continue;
279076
- const [a, b, c] = idx;
279077
- const n2 = cross(sub(vc[b], vc[a]), sub(vc[c], vc[a]));
279078
- if (n2.z >= 0)
279079
- continue;
279080
281714
  faces.push({
279081
281715
  pts: p4,
279082
281716
  depth: zMax,
279083
- fill: colorToCss(box.color)
281717
+ fill: colorToCss(box.color ?? "gray"),
281718
+ stroke: true
279084
281719
  });
279085
281720
  }
279086
281721
  if (box.faceImages?.top) {
279087
- const pts = TOP.map((i) => vp[i]);
281722
+ const pts = TOP.map((i) => vw[i]);
279088
281723
  if (pts.every(Boolean)) {
279089
281724
  const dst = pts;
279090
281725
  const cz = Math.max(...TOP.map((i) => vc[i].z));
@@ -279106,10 +281741,10 @@ async function renderScene(scene, opt = {}) {
279106
281741
  y: a.y * (1 - t2) + b.y * t2,
279107
281742
  z: a.z * (1 - t2) + b.z * t2
279108
281743
  });
279109
- const p00 = lerp(lerp(dst[0], dst[1], u0), lerp(dst[3], dst[2], u0), v0);
279110
- const p10 = lerp(lerp(dst[0], dst[1], u1), lerp(dst[3], dst[2], u1), v0);
279111
- const p01 = lerp(lerp(dst[0], dst[1], u0), lerp(dst[3], dst[2], u0), v1);
279112
- const p11 = lerp(lerp(dst[0], dst[1], u1), lerp(dst[3], dst[2], u1), v1);
281744
+ const p00 = proj(toCam(lerp(lerp(dst[0], dst[1], u0), lerp(dst[3], dst[2], u0), v0), scene.camera), W, H, focal);
281745
+ const p10 = proj(toCam(lerp(lerp(dst[0], dst[1], u1), lerp(dst[3], dst[2], u1), v0), scene.camera), W, H, focal);
281746
+ const p01 = proj(toCam(lerp(lerp(dst[0], dst[1], u0), lerp(dst[3], dst[2], u0), v1), scene.camera), W, H, focal);
281747
+ const p11 = proj(toCam(lerp(lerp(dst[0], dst[1], u1), lerp(dst[3], dst[2], u1), v1), scene.camera), W, H, focal);
279113
281748
  const tri0Mat = affineMatrix([
279114
281749
  { x: u0, y: v0 },
279115
281750
  { x: u1, y: v0 },
@@ -279121,7 +281756,7 @@ async function renderScene(scene, opt = {}) {
279121
281756
  depth: cz,
279122
281757
  href,
279123
281758
  clip: id0,
279124
- points: `${u0},${v0} ${u1},${v0} ${u1},${v1}`,
281759
+ points: `${fmtPrecise(u0)},${fmtPrecise(v0)} ${fmtPrecise(u1)},${fmtPrecise(v0)} ${fmtPrecise(u1)},${fmtPrecise(v1)}`,
279125
281760
  sym
279126
281761
  });
279127
281762
  const tri1Mat = affineMatrix([
@@ -279135,7 +281770,7 @@ async function renderScene(scene, opt = {}) {
279135
281770
  depth: cz,
279136
281771
  href,
279137
281772
  clip: id1,
279138
- points: `${u0},${v0} ${u1},${v1} ${u0},${v1}`,
281773
+ points: `${fmtPrecise(u0)},${fmtPrecise(v0)} ${fmtPrecise(u1)},${fmtPrecise(v1)} ${fmtPrecise(u0)},${fmtPrecise(v1)}`,
279139
281774
  sym
279140
281775
  });
279141
281776
  }
@@ -279174,7 +281809,8 @@ async function renderScene(scene, opt = {}) {
279174
281809
  const allElements = [
279175
281810
  ...faces.map((f) => ({ type: "face", data: f })),
279176
281811
  ...images.map((i) => ({ type: "image", data: i })),
279177
- ...labels.map((l) => ({ type: "label", data: l }))
281812
+ ...labels.map((l) => ({ type: "label", data: l })),
281813
+ ...edges.map((e) => ({ type: "edge", data: e }))
279178
281814
  ];
279179
281815
  allElements.sort((a, b) => b.data.depth - a.data.depth);
279180
281816
  const out = [];
@@ -279207,7 +281843,8 @@ async function renderScene(scene, opt = {}) {
279207
281843
  }
279208
281844
  if (element.type === "face") {
279209
281845
  const f = element.data;
279210
- out.push(` <polygon fill="${f.fill}" points="${f.pts.map((p) => `${p.x},${p.y}`).join(" ")}" />
281846
+ const strokeAttr = f.stroke ? "" : ' stroke="none"';
281847
+ out.push(` <polygon fill="${f.fill}"${strokeAttr} points="${f.pts.map((p) => `${fmt(p.x)},${fmt(p.y)}`).join(" ")}" />
279211
281848
  `);
279212
281849
  } else {
279213
281850
  const img = element.data;
@@ -279222,6 +281859,15 @@ async function renderScene(scene, opt = {}) {
279222
281859
  }
279223
281860
  const l = element.data;
279224
281861
  out.push(` <g font-family="sans-serif" font-size="14" text-anchor="middle" dominant-baseline="central" transform="${l.matrix}"><text x="0" y="0" fill="${l.fill}">${l.text}</text></g>
281862
+ `);
281863
+ } else if (element.type === "edge") {
281864
+ if (inStrokeGroup) {
281865
+ out.push(` </g>
281866
+ `);
281867
+ inStrokeGroup = false;
281868
+ }
281869
+ const e = element.data;
281870
+ out.push(` <polyline fill="none" stroke="${e.color}" points="${e.pts.map((p) => `${p.x},${p.y}`).join(" ")}" />
279225
281871
  `);
279226
281872
  }
279227
281873
  }