sldeditor 0.26.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/PropertyPanel.d.ts.map +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -1
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -1
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -1
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/fa.d.ts +1 -1
- package/dist/i18n/locales/fa.d.ts.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -1
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/he.d.ts +1 -1
- package/dist/i18n/locales/he.d.ts.map +1 -1
- package/dist/i18n/locales/index.d.ts +9 -9
- package/dist/i18n/locales/ja.d.ts +1 -1
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -1
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -1
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/messages.d.ts +17 -9
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/lib/element-labels.d.ts.map +1 -1
- package/dist/model/types.d.ts +11 -0
- package/dist/model/types.d.ts.map +1 -1
- package/dist/sldeditor.cjs +16 -16
- package/dist/sldeditor.cjs.map +1 -1
- package/dist/sldeditor.js +835 -804
- package/dist/sldeditor.js.map +1 -1
- package/package.json +1 -1
package/dist/sldeditor.js
CHANGED
|
@@ -3,7 +3,7 @@ var GS = (e, t, n) => t in e ? qS(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var Xe = (e, t, n) => GS(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsxs as P, jsx as u, Fragment as Ge } from "react/jsx-runtime";
|
|
5
5
|
import * as Pe from "react";
|
|
6
|
-
import Cn, { forwardRef as Ta, createElement as
|
|
6
|
+
import Cn, { forwardRef as Ta, createElement as qo, useState as fe, useRef as re, useCallback as Mt, useMemo as Pt, useLayoutEffect as Dt, useEffect as Q, createContext as ro, useContext as io, useId as VS, cloneElement as KS, Fragment as XS } from "react";
|
|
7
7
|
import { createPortal as Ia } from "react-dom";
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.469.0 - ISC
|
|
@@ -45,7 +45,7 @@ const ZS = Ta(
|
|
|
45
45
|
children: i,
|
|
46
46
|
iconNode: a,
|
|
47
47
|
...l
|
|
48
|
-
}, s) =>
|
|
48
|
+
}, s) => qo(
|
|
49
49
|
"svg",
|
|
50
50
|
{
|
|
51
51
|
ref: s,
|
|
@@ -58,7 +58,7 @@ const ZS = Ta(
|
|
|
58
58
|
...l
|
|
59
59
|
},
|
|
60
60
|
[
|
|
61
|
-
...a.map(([c, d]) =>
|
|
61
|
+
...a.map(([c, d]) => qo(c, d)),
|
|
62
62
|
...Array.isArray(i) ? i : [i]
|
|
63
63
|
]
|
|
64
64
|
)
|
|
@@ -71,7 +71,7 @@ const ZS = Ta(
|
|
|
71
71
|
*/
|
|
72
72
|
const le = (e, t) => {
|
|
73
73
|
const n = Ta(
|
|
74
|
-
({ className: o, ...r }, i) =>
|
|
74
|
+
({ className: o, ...r }, i) => qo(ZS, {
|
|
75
75
|
ref: i,
|
|
76
76
|
iconNode: t,
|
|
77
77
|
className: Pa(`lucide-${US(e)}`, o),
|
|
@@ -180,7 +180,7 @@ const t_ = le("Download", [
|
|
|
180
180
|
* This source code is licensed under the ISC license.
|
|
181
181
|
* See the LICENSE file in the root directory of this source tree.
|
|
182
182
|
*/
|
|
183
|
-
const
|
|
183
|
+
const Go = le("Ellipsis", [
|
|
184
184
|
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
185
185
|
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
186
186
|
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
@@ -342,7 +342,7 @@ const l_ = le("Maximize2", [
|
|
|
342
342
|
* This source code is licensed under the ISC license.
|
|
343
343
|
* See the LICENSE file in the root directory of this source tree.
|
|
344
344
|
*/
|
|
345
|
-
const
|
|
345
|
+
const hr = le("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
|
|
346
346
|
/**
|
|
347
347
|
* @license lucide-react v0.469.0 - ISC
|
|
348
348
|
*
|
|
@@ -385,7 +385,7 @@ const Ra = le("Plus", [
|
|
|
385
385
|
* This source code is licensed under the ISC license.
|
|
386
386
|
* See the LICENSE file in the root directory of this source tree.
|
|
387
387
|
*/
|
|
388
|
-
const
|
|
388
|
+
const fr = le("Redo2", [
|
|
389
389
|
["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
|
|
390
390
|
["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
|
|
391
391
|
]);
|
|
@@ -594,14 +594,14 @@ function Va() {
|
|
|
594
594
|
for (var e, t, n = 0, o = "", r = arguments.length; n < r; n++) (e = arguments[n]) && (t = Ga(e)) && (o && (o += " "), o += t);
|
|
595
595
|
return o;
|
|
596
596
|
}
|
|
597
|
-
const
|
|
597
|
+
const gr = "-", b_ = (e) => {
|
|
598
598
|
const t = w_(e), {
|
|
599
599
|
conflictingClassGroups: n,
|
|
600
600
|
conflictingClassGroupModifiers: o
|
|
601
601
|
} = e;
|
|
602
602
|
return {
|
|
603
603
|
getClassGroupId: (a) => {
|
|
604
|
-
const l = a.split(
|
|
604
|
+
const l = a.split(gr);
|
|
605
605
|
return l[0] === "" && l.length !== 1 && l.shift(), Ka(l, t) || y_(a);
|
|
606
606
|
},
|
|
607
607
|
getConflictingClassGroupIds: (a, l) => {
|
|
@@ -618,7 +618,7 @@ const fr = "-", b_ = (e) => {
|
|
|
618
618
|
return r;
|
|
619
619
|
if (t.validators.length === 0)
|
|
620
620
|
return;
|
|
621
|
-
const i = e.join(
|
|
621
|
+
const i = e.join(gr);
|
|
622
622
|
return (a = t.validators.find(({
|
|
623
623
|
validator: l
|
|
624
624
|
}) => l(i))) == null ? void 0 : a.classGroupId;
|
|
@@ -637,9 +637,9 @@ const fr = "-", b_ = (e) => {
|
|
|
637
637
|
validators: []
|
|
638
638
|
};
|
|
639
639
|
return x_(Object.entries(e.classGroups), n).forEach(([i, a]) => {
|
|
640
|
-
|
|
640
|
+
Vo(a, o, i, t);
|
|
641
641
|
}), o;
|
|
642
|
-
},
|
|
642
|
+
}, Vo = (e, t, n, o) => {
|
|
643
643
|
e.forEach((r) => {
|
|
644
644
|
if (typeof r == "string") {
|
|
645
645
|
const i = r === "" ? t : Zr(t, r);
|
|
@@ -648,7 +648,7 @@ const fr = "-", b_ = (e) => {
|
|
|
648
648
|
}
|
|
649
649
|
if (typeof r == "function") {
|
|
650
650
|
if (v_(r)) {
|
|
651
|
-
|
|
651
|
+
Vo(r(o), t, n, o);
|
|
652
652
|
return;
|
|
653
653
|
}
|
|
654
654
|
t.validators.push({
|
|
@@ -658,12 +658,12 @@ const fr = "-", b_ = (e) => {
|
|
|
658
658
|
return;
|
|
659
659
|
}
|
|
660
660
|
Object.entries(r).forEach(([i, a]) => {
|
|
661
|
-
|
|
661
|
+
Vo(a, Zr(t, i), n, o);
|
|
662
662
|
});
|
|
663
663
|
});
|
|
664
664
|
}, Zr = (e, t) => {
|
|
665
665
|
let n = e;
|
|
666
|
-
return t.split(
|
|
666
|
+
return t.split(gr).forEach((o) => {
|
|
667
667
|
n.nextPart.has(o) || n.nextPart.set(o, {
|
|
668
668
|
nextPart: /* @__PURE__ */ new Map(),
|
|
669
669
|
validators: []
|
|
@@ -717,12 +717,12 @@ const fr = "-", b_ = (e) => {
|
|
|
717
717
|
}
|
|
718
718
|
y === "[" ? c++ : y === "]" && c--;
|
|
719
719
|
}
|
|
720
|
-
const p = s.length === 0 ? l : l.substring(d),
|
|
720
|
+
const p = s.length === 0 ? l : l.substring(d), h = p.startsWith(Xa), g = h ? p.substring(1) : p, f = m && m > d ? m - d : void 0;
|
|
721
721
|
return {
|
|
722
722
|
modifiers: s,
|
|
723
|
-
hasImportantModifier:
|
|
723
|
+
hasImportantModifier: h,
|
|
724
724
|
baseClassName: g,
|
|
725
|
-
maybePostfixModifierPosition:
|
|
725
|
+
maybePostfixModifierPosition: f
|
|
726
726
|
};
|
|
727
727
|
};
|
|
728
728
|
return n ? (l) => n({
|
|
@@ -753,25 +753,25 @@ const fr = "-", b_ = (e) => {
|
|
|
753
753
|
modifiers: d,
|
|
754
754
|
hasImportantModifier: m,
|
|
755
755
|
baseClassName: p,
|
|
756
|
-
maybePostfixModifierPosition:
|
|
756
|
+
maybePostfixModifierPosition: h
|
|
757
757
|
} = n(c);
|
|
758
|
-
let g = !!
|
|
759
|
-
if (!
|
|
758
|
+
let g = !!h, f = o(g ? p.substring(0, h) : p);
|
|
759
|
+
if (!f) {
|
|
760
760
|
if (!g) {
|
|
761
761
|
l = c + (l.length > 0 ? " " + l : l);
|
|
762
762
|
continue;
|
|
763
763
|
}
|
|
764
|
-
if (
|
|
764
|
+
if (f = o(p), !f) {
|
|
765
765
|
l = c + (l.length > 0 ? " " + l : l);
|
|
766
766
|
continue;
|
|
767
767
|
}
|
|
768
768
|
g = !1;
|
|
769
769
|
}
|
|
770
|
-
const b = __(d).join(":"), y = m ? b + Xa : b, x = y +
|
|
770
|
+
const b = __(d).join(":"), y = m ? b + Xa : b, x = y + f;
|
|
771
771
|
if (i.includes(x))
|
|
772
772
|
continue;
|
|
773
773
|
i.push(x);
|
|
774
|
-
const C = r(
|
|
774
|
+
const C = r(f, g);
|
|
775
775
|
for (let S = 0; S < C.length; ++S) {
|
|
776
776
|
const N = C[S];
|
|
777
777
|
i.push(y + N);
|
|
@@ -814,7 +814,7 @@ function N_(e, ...t) {
|
|
|
814
814
|
const Se = (e) => {
|
|
815
815
|
const t = (n) => n[e] || [];
|
|
816
816
|
return t.isThemeGetter = !0, t;
|
|
817
|
-
}, Ya = /^\[(?:([a-z-]+):)?(.+)\]$/i, T_ = /^\d+\/\d+$/, I_ = /* @__PURE__ */ new Set(["px", "full", "screen"]), P_ = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, z_ = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, M_ = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, D_ = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, O_ = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, tt = (e) => zt(e) || I_.has(e) || T_.test(e), dt = (e) => Bt(e, "length", q_), zt = (e) => !!e && !Number.isNaN(Number(e)),
|
|
817
|
+
}, Ya = /^\[(?:([a-z-]+):)?(.+)\]$/i, T_ = /^\d+\/\d+$/, I_ = /* @__PURE__ */ new Set(["px", "full", "screen"]), P_ = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, z_ = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, M_ = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, D_ = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, O_ = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, tt = (e) => zt(e) || I_.has(e) || T_.test(e), dt = (e) => Bt(e, "length", q_), zt = (e) => !!e && !Number.isNaN(Number(e)), $o = (e) => Bt(e, "number", zt), Ut = (e) => !!e && Number.isInteger(Number(e)), L_ = (e) => e.endsWith("%") && zt(e.slice(0, -1)), ie = (e) => Ya.test(e), ut = (e) => P_.test(e), B_ = /* @__PURE__ */ new Set(["length", "size", "percentage"]), R_ = (e) => Bt(e, B_, Za), j_ = (e) => Bt(e, "position", Za), H_ = /* @__PURE__ */ new Set(["image", "url"]), F_ = (e) => Bt(e, H_, V_), W_ = (e) => Bt(e, "", G_), Yt = () => !0, Bt = (e, t, n) => {
|
|
818
818
|
const o = Ya.exec(e);
|
|
819
819
|
return o ? o[1] ? typeof t == "string" ? o[1] === t : t.has(o[1]) : n(o[2]) : !1;
|
|
820
820
|
}, q_ = (e) => (
|
|
@@ -823,7 +823,7 @@ const Se = (e) => {
|
|
|
823
823
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
824
824
|
z_.test(e) && !M_.test(e)
|
|
825
825
|
), Za = () => !1, G_ = (e) => D_.test(e), V_ = (e) => O_.test(e), K_ = () => {
|
|
826
|
-
const e = Se("colors"), t = Se("spacing"), n = Se("blur"), o = Se("brightness"), r = Se("borderColor"), i = Se("borderRadius"), a = Se("borderSpacing"), l = Se("borderWidth"), s = Se("contrast"), c = Se("grayscale"), d = Se("hueRotate"), m = Se("invert"), p = Se("gap"),
|
|
826
|
+
const e = Se("colors"), t = Se("spacing"), n = Se("blur"), o = Se("brightness"), r = Se("borderColor"), i = Se("borderRadius"), a = Se("borderSpacing"), l = Se("borderWidth"), s = Se("contrast"), c = Se("grayscale"), d = Se("hueRotate"), m = Se("invert"), p = Se("gap"), h = Se("gradientColorStops"), g = Se("gradientColorStopPositions"), f = Se("inset"), b = Se("margin"), y = Se("opacity"), x = Se("padding"), C = Se("saturate"), S = Se("scale"), N = Se("sepia"), W = Se("skew"), oe = Se("space"), ge = Se("translate"), A = () => ["auto", "contain", "none"], L = () => ["auto", "hidden", "clip", "visible", "scroll"], H = () => ["auto", ie, t], V = () => [ie, t], F = () => ["", tt, dt], K = () => ["auto", zt, ie], se = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], be = () => ["solid", "dashed", "dotted", "double", "none"], ce = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], ye = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], ue = () => ["", "0", ie], ve = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Ee = () => [zt, ie];
|
|
827
827
|
return {
|
|
828
828
|
cacheSize: 500,
|
|
829
829
|
separator: ":",
|
|
@@ -1000,63 +1000,63 @@ const Se = (e) => {
|
|
|
1000
1000
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1001
1001
|
*/
|
|
1002
1002
|
inset: [{
|
|
1003
|
-
inset: [
|
|
1003
|
+
inset: [f]
|
|
1004
1004
|
}],
|
|
1005
1005
|
/**
|
|
1006
1006
|
* Right / Left
|
|
1007
1007
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1008
1008
|
*/
|
|
1009
1009
|
"inset-x": [{
|
|
1010
|
-
"inset-x": [
|
|
1010
|
+
"inset-x": [f]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* Top / Bottom
|
|
1014
1014
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1015
1015
|
*/
|
|
1016
1016
|
"inset-y": [{
|
|
1017
|
-
"inset-y": [
|
|
1017
|
+
"inset-y": [f]
|
|
1018
1018
|
}],
|
|
1019
1019
|
/**
|
|
1020
1020
|
* Start
|
|
1021
1021
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1022
1022
|
*/
|
|
1023
1023
|
start: [{
|
|
1024
|
-
start: [
|
|
1024
|
+
start: [f]
|
|
1025
1025
|
}],
|
|
1026
1026
|
/**
|
|
1027
1027
|
* End
|
|
1028
1028
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1029
1029
|
*/
|
|
1030
1030
|
end: [{
|
|
1031
|
-
end: [
|
|
1031
|
+
end: [f]
|
|
1032
1032
|
}],
|
|
1033
1033
|
/**
|
|
1034
1034
|
* Top
|
|
1035
1035
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1036
1036
|
*/
|
|
1037
1037
|
top: [{
|
|
1038
|
-
top: [
|
|
1038
|
+
top: [f]
|
|
1039
1039
|
}],
|
|
1040
1040
|
/**
|
|
1041
1041
|
* Right
|
|
1042
1042
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1043
1043
|
*/
|
|
1044
1044
|
right: [{
|
|
1045
|
-
right: [
|
|
1045
|
+
right: [f]
|
|
1046
1046
|
}],
|
|
1047
1047
|
/**
|
|
1048
1048
|
* Bottom
|
|
1049
1049
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1050
1050
|
*/
|
|
1051
1051
|
bottom: [{
|
|
1052
|
-
bottom: [
|
|
1052
|
+
bottom: [f]
|
|
1053
1053
|
}],
|
|
1054
1054
|
/**
|
|
1055
1055
|
* Left
|
|
1056
1056
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
1057
1057
|
*/
|
|
1058
1058
|
left: [{
|
|
1059
|
-
left: [
|
|
1059
|
+
left: [f]
|
|
1060
1060
|
}],
|
|
1061
1061
|
/**
|
|
1062
1062
|
* Visibility
|
|
@@ -1511,7 +1511,7 @@ const Se = (e) => {
|
|
|
1511
1511
|
* @see https://tailwindcss.com/docs/font-weight
|
|
1512
1512
|
*/
|
|
1513
1513
|
"font-weight": [{
|
|
1514
|
-
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black",
|
|
1514
|
+
font: ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black", $o]
|
|
1515
1515
|
}],
|
|
1516
1516
|
/**
|
|
1517
1517
|
* Font Family
|
|
@@ -1562,7 +1562,7 @@ const Se = (e) => {
|
|
|
1562
1562
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
1563
1563
|
*/
|
|
1564
1564
|
"line-clamp": [{
|
|
1565
|
-
"line-clamp": ["none", zt,
|
|
1565
|
+
"line-clamp": ["none", zt, $o]
|
|
1566
1566
|
}],
|
|
1567
1567
|
/**
|
|
1568
1568
|
* Line Height
|
|
@@ -1815,21 +1815,21 @@ const Se = (e) => {
|
|
|
1815
1815
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1816
1816
|
*/
|
|
1817
1817
|
"gradient-from": [{
|
|
1818
|
-
from: [
|
|
1818
|
+
from: [h]
|
|
1819
1819
|
}],
|
|
1820
1820
|
/**
|
|
1821
1821
|
* Gradient Color Stops Via
|
|
1822
1822
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1823
1823
|
*/
|
|
1824
1824
|
"gradient-via": [{
|
|
1825
|
-
via: [
|
|
1825
|
+
via: [h]
|
|
1826
1826
|
}],
|
|
1827
1827
|
/**
|
|
1828
1828
|
* Gradient Color Stops To
|
|
1829
1829
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
1830
1830
|
*/
|
|
1831
1831
|
"gradient-to": [{
|
|
1832
|
-
to: [
|
|
1832
|
+
to: [h]
|
|
1833
1833
|
}],
|
|
1834
1834
|
// Borders
|
|
1835
1835
|
/**
|
|
@@ -2776,7 +2776,7 @@ const Se = (e) => {
|
|
|
2776
2776
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2777
2777
|
*/
|
|
2778
2778
|
"stroke-w": [{
|
|
2779
|
-
stroke: [tt, dt,
|
|
2779
|
+
stroke: [tt, dt, $o]
|
|
2780
2780
|
}],
|
|
2781
2781
|
/**
|
|
2782
2782
|
* Stroke
|
|
@@ -2886,10 +2886,10 @@ function Y_({ children: e }) {
|
|
|
2886
2886
|
d + c.width > window.innerWidth - $n && (d = Math.max($n, t.x - c.width)), m + c.height > window.innerHeight - $n && (m = Math.max($n, t.y - c.height)), r({ left: d, top: m });
|
|
2887
2887
|
}, [t]), Q(() => {
|
|
2888
2888
|
if (!t.open) return;
|
|
2889
|
-
const c = (
|
|
2890
|
-
i.current && !i.current.contains(
|
|
2891
|
-
}, d = (
|
|
2892
|
-
|
|
2889
|
+
const c = (h) => {
|
|
2890
|
+
i.current && !i.current.contains(h.target) && a();
|
|
2891
|
+
}, d = (h) => {
|
|
2892
|
+
h.key === "Escape" && (h.preventDefault(), a());
|
|
2893
2893
|
}, m = () => a(), p = () => a();
|
|
2894
2894
|
return document.addEventListener("pointerdown", c, !0), document.addEventListener("keydown", d, !0), window.addEventListener("wheel", m, { passive: !0 }), window.addEventListener("blur", p), () => {
|
|
2895
2895
|
document.removeEventListener("pointerdown", c, !0), document.removeEventListener("keydown", d, !0), window.removeEventListener("wheel", m), window.removeEventListener("blur", p);
|
|
@@ -2957,7 +2957,7 @@ const Qr = (e) => {
|
|
|
2957
2957
|
const m = typeof c == "function" ? c(t) : c;
|
|
2958
2958
|
if (!Object.is(m, t)) {
|
|
2959
2959
|
const p = t;
|
|
2960
|
-
t = d ?? (typeof m != "object" || m === null) ? m : Object.assign({}, t, m), n.forEach((
|
|
2960
|
+
t = d ?? (typeof m != "object" || m === null) ? m : Object.assign({}, t, m), n.forEach((h) => h(t, p));
|
|
2961
2961
|
}
|
|
2962
2962
|
}, r = () => t, l = { setState: o, getState: r, getInitialState: () => s, subscribe: (c) => (n.add(c), () => n.delete(c)) }, s = t = e(o, r, l);
|
|
2963
2963
|
return l;
|
|
@@ -3034,6 +3034,8 @@ const Jr = (e) => {
|
|
|
3034
3034
|
"props.color": "Color",
|
|
3035
3035
|
"props.size": "Tamaño",
|
|
3036
3036
|
"props.sizeReset": "Restablecer al 100 %",
|
|
3037
|
+
"props.labelShown": "Visible",
|
|
3038
|
+
"props.labelHidden": "Oculta",
|
|
3037
3039
|
"props.color.default": "Predeterminado",
|
|
3038
3040
|
"props.color.red": "Rojo",
|
|
3039
3041
|
"props.color.amber": "Ámbar",
|
|
@@ -3496,6 +3498,8 @@ const Jr = (e) => {
|
|
|
3496
3498
|
"props.color": "Couleur",
|
|
3497
3499
|
"props.size": "Taille",
|
|
3498
3500
|
"props.sizeReset": "Revenir à 100 %",
|
|
3501
|
+
"props.labelShown": "Visible",
|
|
3502
|
+
"props.labelHidden": "Masqué",
|
|
3499
3503
|
"props.color.default": "Par défaut",
|
|
3500
3504
|
"props.color.red": "Rouge",
|
|
3501
3505
|
"props.color.amber": "Ambre",
|
|
@@ -3964,6 +3968,8 @@ const Jr = (e) => {
|
|
|
3964
3968
|
"props.color": "Farbe",
|
|
3965
3969
|
"props.size": "Größe",
|
|
3966
3970
|
"props.sizeReset": "Auf 100 % zurücksetzen",
|
|
3971
|
+
"props.labelShown": "Sichtbar",
|
|
3972
|
+
"props.labelHidden": "Ausgeblendet",
|
|
3967
3973
|
"props.color.default": "Standard",
|
|
3968
3974
|
"props.color.red": "Rot",
|
|
3969
3975
|
"props.color.amber": "Bernstein",
|
|
@@ -4427,6 +4433,8 @@ const Jr = (e) => {
|
|
|
4427
4433
|
"props.color": "Cor",
|
|
4428
4434
|
"props.size": "Tamanho",
|
|
4429
4435
|
"props.sizeReset": "Voltar para 100%",
|
|
4436
|
+
"props.labelShown": "Visível",
|
|
4437
|
+
"props.labelHidden": "Oculto",
|
|
4430
4438
|
"props.color.default": "Padrão",
|
|
4431
4439
|
"props.color.red": "Vermelho",
|
|
4432
4440
|
"props.color.amber": "Âmbar",
|
|
@@ -4889,6 +4897,8 @@ const Jr = (e) => {
|
|
|
4889
4897
|
"props.color": "色",
|
|
4890
4898
|
"props.size": "サイズ",
|
|
4891
4899
|
"props.sizeReset": "100% に戻す",
|
|
4900
|
+
"props.labelShown": "表示",
|
|
4901
|
+
"props.labelHidden": "非表示",
|
|
4892
4902
|
"props.color.default": "既定",
|
|
4893
4903
|
"props.color.red": "赤",
|
|
4894
4904
|
"props.color.amber": "橙",
|
|
@@ -5361,6 +5371,8 @@ const Jr = (e) => {
|
|
|
5361
5371
|
"props.color": "Цвет",
|
|
5362
5372
|
"props.size": "Размер",
|
|
5363
5373
|
"props.sizeReset": "Сбросить до 100 %",
|
|
5374
|
+
"props.labelShown": "Показана",
|
|
5375
|
+
"props.labelHidden": "Скрыта",
|
|
5364
5376
|
"props.color.default": "По умолчанию",
|
|
5365
5377
|
"props.color.red": "Красный",
|
|
5366
5378
|
"props.color.amber": "Янтарный",
|
|
@@ -5823,6 +5835,8 @@ const Jr = (e) => {
|
|
|
5823
5835
|
"props.color": "رنگ",
|
|
5824
5836
|
"props.size": "اندازه",
|
|
5825
5837
|
"props.sizeReset": "بازگشت به ۱۰۰٪",
|
|
5838
|
+
"props.labelShown": "نمایان",
|
|
5839
|
+
"props.labelHidden": "پنهان",
|
|
5826
5840
|
"props.color.default": "پیشفرض",
|
|
5827
5841
|
"props.color.red": "قرمز",
|
|
5828
5842
|
"props.color.amber": "کهربایی",
|
|
@@ -6294,6 +6308,8 @@ const Jr = (e) => {
|
|
|
6294
6308
|
"props.color": "اللون",
|
|
6295
6309
|
"props.size": "الحجم",
|
|
6296
6310
|
"props.sizeReset": "إعادة إلى 100%",
|
|
6311
|
+
"props.labelShown": "ظاهرة",
|
|
6312
|
+
"props.labelHidden": "مخفية",
|
|
6297
6313
|
"props.color.default": "افتراضي",
|
|
6298
6314
|
"props.color.red": "أحمر",
|
|
6299
6315
|
"props.color.amber": "كهرماني",
|
|
@@ -6765,6 +6781,8 @@ const Jr = (e) => {
|
|
|
6765
6781
|
"props.color": "צבע",
|
|
6766
6782
|
"props.size": "גודל",
|
|
6767
6783
|
"props.sizeReset": "איפוס ל-100%",
|
|
6784
|
+
"props.labelShown": "מוצגת",
|
|
6785
|
+
"props.labelHidden": "מוסתרת",
|
|
6768
6786
|
"props.color.default": "ברירת מחדל",
|
|
6769
6787
|
"props.color.red": "אדום",
|
|
6770
6788
|
"props.color.amber": "ענבר",
|
|
@@ -7228,6 +7246,8 @@ const Jr = (e) => {
|
|
|
7228
7246
|
"props.color": "颜色",
|
|
7229
7247
|
"props.size": "大小",
|
|
7230
7248
|
"props.sizeReset": "恢复为 100%",
|
|
7249
|
+
"props.labelShown": "显示",
|
|
7250
|
+
"props.labelHidden": "隐藏",
|
|
7231
7251
|
"props.color.default": "默认",
|
|
7232
7252
|
"props.color.red": "红",
|
|
7233
7253
|
"props.color.amber": "橙",
|
|
@@ -7481,6 +7501,8 @@ const Jr = (e) => {
|
|
|
7481
7501
|
"props.color": "Color",
|
|
7482
7502
|
"props.size": "Size",
|
|
7483
7503
|
"props.sizeReset": "Reset to 100%",
|
|
7504
|
+
"props.labelShown": "Shown",
|
|
7505
|
+
"props.labelHidden": "Hidden",
|
|
7484
7506
|
"props.color.default": "Default",
|
|
7485
7507
|
"props.color.red": "Red",
|
|
7486
7508
|
"props.color.amber": "Amber",
|
|
@@ -7673,7 +7695,7 @@ const Jr = (e) => {
|
|
|
7673
7695
|
"onboard.step3.body": "Use the Busbar tool (B) only when several circuits share one rail. Don't use a bus to join two devices — just wire the pins (W).",
|
|
7674
7696
|
"onboard.dismiss": "Got it"
|
|
7675
7697
|
}
|
|
7676
|
-
},
|
|
7698
|
+
}, Ko = {
|
|
7677
7699
|
zh: ei.zh,
|
|
7678
7700
|
en: ei.en,
|
|
7679
7701
|
es: Ne.es.ui,
|
|
@@ -7685,7 +7707,7 @@ const Jr = (e) => {
|
|
|
7685
7707
|
fa: Ne.fa.ui,
|
|
7686
7708
|
ar: Ne.ar.ui,
|
|
7687
7709
|
he: Ne.he.ui
|
|
7688
|
-
}, ts = "ole-locale", CC = Object.keys(
|
|
7710
|
+
}, ts = "ole-locale", CC = Object.keys(Ko);
|
|
7689
7711
|
function ti(e) {
|
|
7690
7712
|
return CC.includes(e);
|
|
7691
7713
|
}
|
|
@@ -7727,7 +7749,7 @@ function ns(e, t) {
|
|
|
7727
7749
|
) : e;
|
|
7728
7750
|
}
|
|
7729
7751
|
function os(e, t) {
|
|
7730
|
-
return
|
|
7752
|
+
return Ko[e][t] ?? Ko.en[t] ?? t;
|
|
7731
7753
|
}
|
|
7732
7754
|
function Te(e, t) {
|
|
7733
7755
|
return ns(os(so.getState().locale, e), t);
|
|
@@ -7753,12 +7775,12 @@ function rs(e, t) {
|
|
|
7753
7775
|
removeItem: (r) => n.removeItem(r)
|
|
7754
7776
|
};
|
|
7755
7777
|
}
|
|
7756
|
-
const
|
|
7778
|
+
const Xo = (e) => (t) => {
|
|
7757
7779
|
try {
|
|
7758
7780
|
const n = e(t);
|
|
7759
7781
|
return n instanceof Promise ? n : {
|
|
7760
7782
|
then(o) {
|
|
7761
|
-
return
|
|
7783
|
+
return Xo(o)(n);
|
|
7762
7784
|
},
|
|
7763
7785
|
catch(o) {
|
|
7764
7786
|
return this;
|
|
@@ -7770,7 +7792,7 @@ const Ko = (e) => (t) => {
|
|
|
7770
7792
|
return this;
|
|
7771
7793
|
},
|
|
7772
7794
|
catch(o) {
|
|
7773
|
-
return
|
|
7795
|
+
return Xo(o)(n);
|
|
7774
7796
|
}
|
|
7775
7797
|
};
|
|
7776
7798
|
}
|
|
@@ -7805,23 +7827,23 @@ const Ko = (e) => (t) => {
|
|
|
7805
7827
|
});
|
|
7806
7828
|
}, p = r.setState;
|
|
7807
7829
|
r.setState = (b, y) => (p(b, y), m());
|
|
7808
|
-
const
|
|
7830
|
+
const h = e(
|
|
7809
7831
|
(...b) => (n(...b), m()),
|
|
7810
7832
|
o,
|
|
7811
7833
|
r
|
|
7812
7834
|
);
|
|
7813
|
-
r.getInitialState = () =>
|
|
7835
|
+
r.getInitialState = () => h;
|
|
7814
7836
|
let g;
|
|
7815
|
-
const
|
|
7837
|
+
const f = () => {
|
|
7816
7838
|
var b, y;
|
|
7817
7839
|
if (!d) return;
|
|
7818
7840
|
const x = ++l;
|
|
7819
7841
|
a = !1, s.forEach((S) => {
|
|
7820
7842
|
var N;
|
|
7821
|
-
return S((N = o()) != null ? N :
|
|
7843
|
+
return S((N = o()) != null ? N : h);
|
|
7822
7844
|
});
|
|
7823
|
-
const C = ((y = i.onRehydrateStorage) == null ? void 0 : y.call(i, (b = o()) != null ? b :
|
|
7824
|
-
return
|
|
7845
|
+
const C = ((y = i.onRehydrateStorage) == null ? void 0 : y.call(i, (b = o()) != null ? b : h)) || void 0;
|
|
7846
|
+
return Xo(d.getItem.bind(d))(i.name).then((S) => {
|
|
7825
7847
|
if (S)
|
|
7826
7848
|
if (typeof S.version == "number" && S.version !== i.version) {
|
|
7827
7849
|
if (i.migrate) {
|
|
@@ -7844,7 +7866,7 @@ const Ko = (e) => (t) => {
|
|
|
7844
7866
|
const [W, oe] = S;
|
|
7845
7867
|
if (g = i.merge(
|
|
7846
7868
|
oe,
|
|
7847
|
-
(N = o()) != null ? N :
|
|
7869
|
+
(N = o()) != null ? N : h
|
|
7848
7870
|
), n(g, !0), W)
|
|
7849
7871
|
return m();
|
|
7850
7872
|
}).then(() => {
|
|
@@ -7864,7 +7886,7 @@ const Ko = (e) => (t) => {
|
|
|
7864
7886
|
d == null || d.removeItem(i.name);
|
|
7865
7887
|
},
|
|
7866
7888
|
getOptions: () => i,
|
|
7867
|
-
rehydrate: () =>
|
|
7889
|
+
rehydrate: () => f(),
|
|
7868
7890
|
hasHydrated: () => a,
|
|
7869
7891
|
onHydrate: (b) => (s.add(b), () => {
|
|
7870
7892
|
s.delete(b);
|
|
@@ -7872,7 +7894,7 @@ const Ko = (e) => (t) => {
|
|
|
7872
7894
|
onFinishHydration: (b) => (c.add(b), () => {
|
|
7873
7895
|
c.delete(b);
|
|
7874
7896
|
})
|
|
7875
|
-
}, i.skipHydration ||
|
|
7897
|
+
}, i.skipHydration || f(), g || h;
|
|
7876
7898
|
}, EC = AC, nt = 0.5;
|
|
7877
7899
|
function is(e) {
|
|
7878
7900
|
if (e.length < 2) return e.map((r) => [r[0], r[1]]);
|
|
@@ -7898,11 +7920,11 @@ function is(e) {
|
|
|
7898
7920
|
}
|
|
7899
7921
|
return o.push(n[n.length - 1]), o;
|
|
7900
7922
|
}
|
|
7901
|
-
const
|
|
7902
|
-
function
|
|
7903
|
-
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(
|
|
7923
|
+
const br = 0.25, yr = 4;
|
|
7924
|
+
function Uo(e) {
|
|
7925
|
+
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(yr, Math.max(br, e));
|
|
7904
7926
|
}
|
|
7905
|
-
function
|
|
7927
|
+
function et(e) {
|
|
7906
7928
|
return e.type ?? "text";
|
|
7907
7929
|
}
|
|
7908
7930
|
function pP(e) {
|
|
@@ -10366,21 +10388,21 @@ unifilar` }, uE = {
|
|
|
10366
10388
|
(e[t = n.category] ?? (e[t] = [])).push(n);
|
|
10367
10389
|
return e;
|
|
10368
10390
|
})();
|
|
10369
|
-
const
|
|
10391
|
+
const Yo = new Map(
|
|
10370
10392
|
Object.entries(_t)
|
|
10371
10393
|
);
|
|
10372
10394
|
function hP(e) {
|
|
10373
10395
|
return _t[e];
|
|
10374
10396
|
}
|
|
10375
10397
|
const nN = "custom:";
|
|
10376
|
-
function
|
|
10398
|
+
function wr(e) {
|
|
10377
10399
|
return e.startsWith(nN);
|
|
10378
10400
|
}
|
|
10379
10401
|
function oN(e) {
|
|
10380
|
-
if (!(e != null && e.length)) return
|
|
10381
|
-
const t = new Map(
|
|
10402
|
+
if (!(e != null && e.length)) return Yo;
|
|
10403
|
+
const t = new Map(Yo);
|
|
10382
10404
|
for (const n of e)
|
|
10383
|
-
!(n != null && n.id) || !
|
|
10405
|
+
!(n != null && n.id) || !wr(n.id) || t.set(n.id, n);
|
|
10384
10406
|
return t;
|
|
10385
10407
|
}
|
|
10386
10408
|
function rN(e, t) {
|
|
@@ -10415,7 +10437,7 @@ function iN() {
|
|
|
10415
10437
|
terminalToNode: /* @__PURE__ */ new Map(),
|
|
10416
10438
|
elementToTerminals: /* @__PURE__ */ new Map(),
|
|
10417
10439
|
diagnostics: [],
|
|
10418
|
-
library:
|
|
10440
|
+
library: Yo
|
|
10419
10441
|
};
|
|
10420
10442
|
}
|
|
10421
10443
|
function aN(e) {
|
|
@@ -10423,10 +10445,10 @@ function aN(e) {
|
|
|
10423
10445
|
at: (e == null ? void 0 : e.at) ?? [0, 0],
|
|
10424
10446
|
rot: (e == null ? void 0 : e.rot) ?? 0,
|
|
10425
10447
|
mirror: (e == null ? void 0 : e.mirror) ?? !1,
|
|
10426
|
-
...(e == null ? void 0 : e.scale) !== void 0 &&
|
|
10448
|
+
...(e == null ? void 0 : e.scale) !== void 0 && Uo(e.scale) !== 1 ? { scale: Uo(e.scale) } : {}
|
|
10427
10449
|
};
|
|
10428
10450
|
}
|
|
10429
|
-
function
|
|
10451
|
+
function Zo(e) {
|
|
10430
10452
|
return e === 90 || e === 270 ? "y" : "x";
|
|
10431
10453
|
}
|
|
10432
10454
|
function We(e, t) {
|
|
@@ -10519,15 +10541,15 @@ function An(e, t) {
|
|
|
10519
10541
|
const n = ii.indexOf(e), r = ((ii.indexOf(t) - n) % 4 + 4) % 4;
|
|
10520
10542
|
return [0, 90, 180, 270][r];
|
|
10521
10543
|
}
|
|
10522
|
-
const
|
|
10544
|
+
const Ao = 320, En = 220, Zt = 260, Eo = 720, Qt = 30, si = 30, mt = 80, li = 10, cN = 60, dN = 520, uN = 80, mN = 80, ci = 8, di = /* @__PURE__ */ new Set(["source", "renewable"]);
|
|
10523
10545
|
function pN(e) {
|
|
10524
10546
|
var Hr, Fr, Wr, qr, Gr, Vr;
|
|
10525
|
-
const { elements: t, buses: n, junctions: o, wires: r, library: i, userLayout: a, userBusLayout: l } = e, s = new Map(a), c = new Map(l), d = /* @__PURE__ */ new Map(), m = new Set(a.keys()), p = new Set(l.keys()),
|
|
10526
|
-
for (const v of t)
|
|
10547
|
+
const { elements: t, buses: n, junctions: o, wires: r, library: i, userLayout: a, userBusLayout: l } = e, s = new Map(a), c = new Map(l), d = /* @__PURE__ */ new Map(), m = new Set(a.keys()), p = new Set(l.keys()), h = /* @__PURE__ */ new Map();
|
|
10548
|
+
for (const v of t) h.set(v.id, v);
|
|
10527
10549
|
const g = /* @__PURE__ */ new Map();
|
|
10528
10550
|
for (const v of n) g.set(v.id, v);
|
|
10529
|
-
const
|
|
10530
|
-
const k =
|
|
10551
|
+
const f = (v) => {
|
|
10552
|
+
const k = h.get(v);
|
|
10531
10553
|
if (k)
|
|
10532
10554
|
return i.get(k.kind);
|
|
10533
10555
|
}, b = new Set(n.map((v) => v.id)), y = (v) => b.has(v), x = new Set(o.map((v) => v.id)), C = new Set(
|
|
@@ -10560,7 +10582,7 @@ function pN(e) {
|
|
|
10560
10582
|
}
|
|
10561
10583
|
}
|
|
10562
10584
|
{
|
|
10563
|
-
const $ = (M) =>
|
|
10585
|
+
const $ = (M) => h.has(M) && !!f(M), T = (M) => {
|
|
10564
10586
|
if (y(M)) return null;
|
|
10565
10587
|
if (x.has(M)) return M;
|
|
10566
10588
|
const I = M.indexOf(".");
|
|
@@ -10592,7 +10614,7 @@ function pN(e) {
|
|
|
10592
10614
|
for (let ee = G + 1; ee < X.length; ee++) z(X[G], X[ee]);
|
|
10593
10615
|
}
|
|
10594
10616
|
const j = (M, I) => {
|
|
10595
|
-
const B =
|
|
10617
|
+
const B = f(M);
|
|
10596
10618
|
if (!B) return null;
|
|
10597
10619
|
for (const R of B.terminals) {
|
|
10598
10620
|
const q = `${M}.${R.id}`;
|
|
@@ -10606,7 +10628,7 @@ function pN(e) {
|
|
|
10606
10628
|
return ((ne = E.get(Z)) == null ? void 0 : ne.size) ?? 0;
|
|
10607
10629
|
}, B = (Z) => {
|
|
10608
10630
|
var ne;
|
|
10609
|
-
return ((ne =
|
|
10631
|
+
return ((ne = f(Z)) == null ? void 0 : ne.category) ?? "";
|
|
10610
10632
|
}, R = (Z) => {
|
|
10611
10633
|
const ne = B(Z);
|
|
10612
10634
|
return ne === "source" ? 0 : ne === "renewable" ? 1 : 2 + Math.min(I(Z), 9) / 10;
|
|
@@ -10632,7 +10654,7 @@ function pN(e) {
|
|
|
10632
10654
|
};
|
|
10633
10655
|
Ae(q);
|
|
10634
10656
|
for (const Z of te) {
|
|
10635
|
-
const ne = _e(
|
|
10657
|
+
const ne = _e(Ao + (we.get(Z) ?? 0) * 160), Me = _e(En + (G.get(Z) ?? 0) * 140);
|
|
10636
10658
|
if (x.has(Z)) {
|
|
10637
10659
|
d.set(Z, [ne, Me]);
|
|
10638
10660
|
continue;
|
|
@@ -10677,7 +10699,7 @@ function pN(e) {
|
|
|
10677
10699
|
const A = [], L = /* @__PURE__ */ new Set();
|
|
10678
10700
|
for (const [v, k] of ge)
|
|
10679
10701
|
if (new Set(k.map((T) => T.busId)).size >= 2) {
|
|
10680
|
-
const T = ((Fr = i.get(((Hr =
|
|
10702
|
+
const T = ((Fr = i.get(((Hr = h.get(v)) == null ? void 0 : Hr.kind) ?? "")) == null ? void 0 : Fr.category) === "transformer" ? "vertical" : "horizontal";
|
|
10681
10703
|
A.push({ elementId: v, attachments: k, orientation: T }), T === "vertical" && L.add(v);
|
|
10682
10704
|
}
|
|
10683
10705
|
const H = /* @__PURE__ */ new Map(), V = (v, k) => {
|
|
@@ -10730,11 +10752,11 @@ function pN(e) {
|
|
|
10730
10752
|
}
|
|
10731
10753
|
const F = (v, k) => {
|
|
10732
10754
|
var j;
|
|
10733
|
-
const $ =
|
|
10755
|
+
const $ = f(k), T = $ ? $.terminals.map((D) => `${k}.${D.id}`) : [], E = v, _ = /* @__PURE__ */ new Set([E, ...T]), z = [E];
|
|
10734
10756
|
for (; z.length > 0; ) {
|
|
10735
10757
|
const D = z.shift(), O = D.indexOf(".");
|
|
10736
10758
|
if (O > 0) {
|
|
10737
|
-
const I = D.slice(0, O), B =
|
|
10759
|
+
const I = D.slice(0, O), B = h.get(I);
|
|
10738
10760
|
if (B) {
|
|
10739
10761
|
const R = (j = i.get(B.kind)) == null ? void 0 : j.category;
|
|
10740
10762
|
if (R && di.has(R)) return !0;
|
|
@@ -10778,7 +10800,7 @@ function pN(e) {
|
|
|
10778
10800
|
if (R > 0) {
|
|
10779
10801
|
const q = B.slice(0, R);
|
|
10780
10802
|
if (q !== v.id) {
|
|
10781
|
-
const X =
|
|
10803
|
+
const X = h.get(q), G = X ? i.get(X.kind) : void 0;
|
|
10782
10804
|
if ((G == null ? void 0 : G.category) === "transformer") continue;
|
|
10783
10805
|
}
|
|
10784
10806
|
}
|
|
@@ -10817,7 +10839,7 @@ function pN(e) {
|
|
|
10817
10839
|
if (y($)) continue;
|
|
10818
10840
|
const T = $.indexOf(".");
|
|
10819
10841
|
if (T < 0) continue;
|
|
10820
|
-
const E = $.slice(0, T), _ =
|
|
10842
|
+
const E = $.slice(0, T), _ = h.get(E);
|
|
10821
10843
|
if (_ && se(_.kind)) {
|
|
10822
10844
|
be.push(v.id);
|
|
10823
10845
|
break;
|
|
@@ -10850,7 +10872,7 @@ function pN(e) {
|
|
|
10850
10872
|
$.push(v.id), ye.set(k, $);
|
|
10851
10873
|
}
|
|
10852
10874
|
const ue = [...ye.keys()].sort((v, k) => v - k), ve = (v, k, $) => {
|
|
10853
|
-
const T = `${v.elementId}.${$}`, E = k, _ =
|
|
10875
|
+
const T = `${v.elementId}.${$}`, E = k, _ = f(v.elementId), z = /* @__PURE__ */ new Set();
|
|
10854
10876
|
if (_)
|
|
10855
10877
|
for (const I of _.terminals)
|
|
10856
10878
|
I.id !== $ && z.add(`${v.elementId}.${I.id}`);
|
|
@@ -10878,7 +10900,7 @@ function pN(e) {
|
|
|
10878
10900
|
continue;
|
|
10879
10901
|
const q = I.slice(0, R), X = I.slice(R + 1);
|
|
10880
10902
|
if (!y(q) && !L.has(q)) {
|
|
10881
|
-
const G =
|
|
10903
|
+
const G = f(q), ee = G == null ? void 0 : G.terminals.find((te) => te.id === X);
|
|
10882
10904
|
if (G && ee)
|
|
10883
10905
|
for (const te of G.terminals) {
|
|
10884
10906
|
if (te.id === X) continue;
|
|
@@ -10898,7 +10920,7 @@ function pN(e) {
|
|
|
10898
10920
|
var I, B, R;
|
|
10899
10921
|
const $ = (I = K.get(v)) == null ? void 0 : I.get(k);
|
|
10900
10922
|
if (!$ || $.orientation === "horizontal") return Zt;
|
|
10901
|
-
const T =
|
|
10923
|
+
const T = f($.elementId);
|
|
10902
10924
|
if (!T) return Zt;
|
|
10903
10925
|
const E = (B = $.attachments.find((q) => q.busId === v)) == null ? void 0 : B.pin, _ = (R = $.attachments.find((q) => q.busId === k)) == null ? void 0 : R.pin;
|
|
10904
10926
|
if (!E || !_) return Zt;
|
|
@@ -10917,10 +10939,10 @@ function pN(e) {
|
|
|
10917
10939
|
Fe.set(z, { lowerBusId: T });
|
|
10918
10940
|
}
|
|
10919
10941
|
const qt = 30, Nr = (v) => {
|
|
10920
|
-
const k =
|
|
10942
|
+
const k = f(v);
|
|
10921
10943
|
return Math.max((k == null ? void 0 : k.width) ?? mt, mt);
|
|
10922
10944
|
}, MS = 2, Tr = (v, k, $, T = 0) => {
|
|
10923
|
-
const E =
|
|
10945
|
+
const E = f(k);
|
|
10924
10946
|
let _ = Nr(k);
|
|
10925
10947
|
if (E && !$.has(k) && T < MS) {
|
|
10926
10948
|
$.add(k);
|
|
@@ -10983,7 +11005,7 @@ function pN(e) {
|
|
|
10983
11005
|
if (j < 0) continue;
|
|
10984
11006
|
const D = z.slice(0, j), O = z.slice(j + 1);
|
|
10985
11007
|
if (Ir(D, v)) continue;
|
|
10986
|
-
const M =
|
|
11008
|
+
const M = f(D);
|
|
10987
11009
|
if (!M) continue;
|
|
10988
11010
|
const I = M.terminals.find((q) => q.id === O);
|
|
10989
11011
|
if (!I) continue;
|
|
@@ -11004,7 +11026,7 @@ function pN(e) {
|
|
|
11004
11026
|
};
|
|
11005
11027
|
for (const v of n) Pr(v.id, /* @__PURE__ */ new Set());
|
|
11006
11028
|
const ct = /* @__PURE__ */ new Map(), DS = (v, k, $) => {
|
|
11007
|
-
const T =
|
|
11029
|
+
const T = f(k);
|
|
11008
11030
|
if (!T) return;
|
|
11009
11031
|
const E = `${k}.${$}`, _ = T.terminals.filter((D) => D.id !== $).map((D) => `${k}.${D.id}`);
|
|
11010
11032
|
if (_.length === 0) return;
|
|
@@ -11022,7 +11044,7 @@ function pN(e) {
|
|
|
11022
11044
|
if (O > 0) {
|
|
11023
11045
|
const M = D.slice(0, O);
|
|
11024
11046
|
if (!y(M)) {
|
|
11025
|
-
const I =
|
|
11047
|
+
const I = f(M);
|
|
11026
11048
|
if (I)
|
|
11027
11049
|
for (const B of I.terminals) {
|
|
11028
11050
|
const R = `${M}.${B.id}`;
|
|
@@ -11043,7 +11065,7 @@ function pN(e) {
|
|
|
11043
11065
|
const R = I.slice(0, B), q = I.slice(B + 1);
|
|
11044
11066
|
if (s.has(R)) return [];
|
|
11045
11067
|
if (Ir(R, v)) return [];
|
|
11046
|
-
const X =
|
|
11068
|
+
const X = f(R);
|
|
11047
11069
|
if (!X) return [];
|
|
11048
11070
|
const G = X.terminals.find((ee) => ee.id === q);
|
|
11049
11071
|
return G ? [{
|
|
@@ -11093,7 +11115,7 @@ function pN(e) {
|
|
|
11093
11115
|
M(E, -1), M(_, 1);
|
|
11094
11116
|
}, LS = (v) => {
|
|
11095
11117
|
if (s.has(v.elementId) || v.orientation === "horizontal") return;
|
|
11096
|
-
const k =
|
|
11118
|
+
const k = f(v.elementId);
|
|
11097
11119
|
if (!k) return;
|
|
11098
11120
|
const $ = v.attachments.filter(
|
|
11099
11121
|
(te) => c.has(te.busId)
|
|
@@ -11157,7 +11179,7 @@ function pN(e) {
|
|
|
11157
11179
|
if (I < 0) break;
|
|
11158
11180
|
const B = O.slice(0, I), R = O.slice(I + 1);
|
|
11159
11181
|
if (y(B) || L.has(B) || s.has(B)) break;
|
|
11160
|
-
const q =
|
|
11182
|
+
const q = f(B);
|
|
11161
11183
|
if (!q) break;
|
|
11162
11184
|
const X = q.terminals.find((ne) => ne.id === R);
|
|
11163
11185
|
if (!X) break;
|
|
@@ -11182,7 +11204,7 @@ function pN(e) {
|
|
|
11182
11204
|
}
|
|
11183
11205
|
}, RS = (v) => {
|
|
11184
11206
|
if (s.has(v.elementId) || v.orientation !== "horizontal") return;
|
|
11185
|
-
const k =
|
|
11207
|
+
const k = f(v.elementId);
|
|
11186
11208
|
if (!k) return;
|
|
11187
11209
|
const $ = v.attachments.filter((B) => c.has(B.busId));
|
|
11188
11210
|
if ($.length < 2) return;
|
|
@@ -11215,7 +11237,7 @@ function pN(e) {
|
|
|
11215
11237
|
z === 0 && (z = Zt), T = Sn + z;
|
|
11216
11238
|
}
|
|
11217
11239
|
Sn = T;
|
|
11218
|
-
let E =
|
|
11240
|
+
let E = Ao;
|
|
11219
11241
|
for (const _ of $) {
|
|
11220
11242
|
if (c.has(_)) {
|
|
11221
11243
|
Sn = Math.max(Sn, c.get(_).at[1]);
|
|
@@ -11237,15 +11259,15 @@ function pN(e) {
|
|
|
11237
11259
|
O.length > 0 && (z = O.reduce((M, I) => M + I, 0) / O.length);
|
|
11238
11260
|
}
|
|
11239
11261
|
if (z === void 0) {
|
|
11240
|
-
const D = Ct.get(_) ??
|
|
11262
|
+
const D = Ct.get(_) ?? Eo;
|
|
11241
11263
|
z = E + D / 2, E += D + zr;
|
|
11242
11264
|
}
|
|
11243
|
-
const j = Ct.get(_) ??
|
|
11265
|
+
const j = Ct.get(_) ?? Eo;
|
|
11244
11266
|
c.set(_, {
|
|
11245
11267
|
at: [_e(z), _e(T)],
|
|
11246
11268
|
rot: 0,
|
|
11247
11269
|
span: j,
|
|
11248
|
-
axis:
|
|
11270
|
+
axis: Zo(0)
|
|
11249
11271
|
});
|
|
11250
11272
|
}
|
|
11251
11273
|
for (const _ of $)
|
|
@@ -11262,7 +11284,7 @@ function pN(e) {
|
|
|
11262
11284
|
}
|
|
11263
11285
|
if (n.length === 0 && s.size < t.length) {
|
|
11264
11286
|
const v = (E) => {
|
|
11265
|
-
const _ = /* @__PURE__ */ new Set(), z =
|
|
11287
|
+
const _ = /* @__PURE__ */ new Set(), z = f(E);
|
|
11266
11288
|
if (!z) return _;
|
|
11267
11289
|
for (const j of z.terminals) {
|
|
11268
11290
|
const D = `${E}.${j.id}`;
|
|
@@ -11278,7 +11300,7 @@ function pN(e) {
|
|
|
11278
11300
|
return _;
|
|
11279
11301
|
}, k = /* @__PURE__ */ new Set(), $ = [];
|
|
11280
11302
|
for (const E of t) {
|
|
11281
|
-
if (k.has(E.id) || !
|
|
11303
|
+
if (k.has(E.id) || !f(E.id)) continue;
|
|
11282
11304
|
const _ = [], z = [E.id];
|
|
11283
11305
|
for (k.add(E.id); z.length > 0; ) {
|
|
11284
11306
|
const j = z.pop();
|
|
@@ -11288,17 +11310,17 @@ function pN(e) {
|
|
|
11288
11310
|
}
|
|
11289
11311
|
_.length >= 2 && $.push(_);
|
|
11290
11312
|
}
|
|
11291
|
-
let T =
|
|
11313
|
+
let T = Ao;
|
|
11292
11314
|
for (const E of $) {
|
|
11293
11315
|
if (E.some((O) => s.has(O))) continue;
|
|
11294
11316
|
E.sort((O, M) => {
|
|
11295
11317
|
var X, G;
|
|
11296
|
-
const I = se(((X =
|
|
11318
|
+
const I = se(((X = h.get(O)) == null ? void 0 : X.kind) ?? "") ? 0 : 1, B = se(((G = h.get(M)) == null ? void 0 : G.kind) ?? "") ? 0 : 1;
|
|
11297
11319
|
if (I !== B) return I - B;
|
|
11298
11320
|
const R = v(O).size, q = v(M).size;
|
|
11299
11321
|
return R !== q ? R - q : O.localeCompare(M);
|
|
11300
11322
|
});
|
|
11301
|
-
const _ = E[0], z =
|
|
11323
|
+
const _ = E[0], z = f(_);
|
|
11302
11324
|
if (!z) continue;
|
|
11303
11325
|
const j = z.terminals.slice().sort((O, M) => M.y - O.y)[0], D = j ? We([j.x, j.y], {
|
|
11304
11326
|
at: [0, 0],
|
|
@@ -11309,7 +11331,7 @@ function pN(e) {
|
|
|
11309
11331
|
at: [_e(T - D[0]), _e(En - D[1])],
|
|
11310
11332
|
rot: 0,
|
|
11311
11333
|
mirror: !1
|
|
11312
|
-
}), T += Math.max(
|
|
11334
|
+
}), T += Math.max(Eo, E.length * mt) + zr;
|
|
11313
11335
|
}
|
|
11314
11336
|
}
|
|
11315
11337
|
const jS = (v) => {
|
|
@@ -11317,9 +11339,9 @@ function pN(e) {
|
|
|
11317
11339
|
const k = v.indexOf(".");
|
|
11318
11340
|
return k < 0 ? !1 : s.has(v.slice(0, k));
|
|
11319
11341
|
};
|
|
11320
|
-
let
|
|
11321
|
-
for (;
|
|
11322
|
-
|
|
11342
|
+
let xo = !0, HS = t.length + 4;
|
|
11343
|
+
for (; xo && HS-- > 0; ) {
|
|
11344
|
+
xo = !1;
|
|
11323
11345
|
for (const v of N) {
|
|
11324
11346
|
if (v.length < 2) continue;
|
|
11325
11347
|
const k = [], $ = /* @__PURE__ */ new Map();
|
|
@@ -11334,7 +11356,7 @@ function pN(e) {
|
|
|
11334
11356
|
continue;
|
|
11335
11357
|
}
|
|
11336
11358
|
if (L.has(J) || $.has(J)) continue;
|
|
11337
|
-
const Ae =
|
|
11359
|
+
const Ae = f(J);
|
|
11338
11360
|
if (!Ae) continue;
|
|
11339
11361
|
const Z = Ae.terminals.find((ne) => ne.id === we);
|
|
11340
11362
|
Z && $.set(J, {
|
|
@@ -11360,7 +11382,7 @@ function pN(e) {
|
|
|
11360
11382
|
(J > U || J === U && (_ === void 0 || Y < _)) && (U = J, _ = Y);
|
|
11361
11383
|
}
|
|
11362
11384
|
if (_ || (_ = [...k].sort()[0]), !_) continue;
|
|
11363
|
-
const z = _.indexOf("."), j = _.slice(0, z), D = _.slice(z + 1), O =
|
|
11385
|
+
const z = _.indexOf("."), j = _.slice(0, z), D = _.slice(z + 1), O = f(j), M = s.get(j);
|
|
11364
11386
|
if (!O || !M) continue;
|
|
11365
11387
|
const I = O.terminals.find((U) => U.id === D);
|
|
11366
11388
|
if (!I) continue;
|
|
@@ -11392,12 +11414,12 @@ function pN(e) {
|
|
|
11392
11414
|
_e(Me[0] - ne[0]),
|
|
11393
11415
|
_e(Me[1] - ne[1])
|
|
11394
11416
|
];
|
|
11395
|
-
s.set(Y.elId, { at: De, rot: Z, mirror: !1 }),
|
|
11417
|
+
s.set(Y.elId, { at: De, rot: Z, mirror: !1 }), xo = !0;
|
|
11396
11418
|
}
|
|
11397
11419
|
}
|
|
11398
11420
|
}
|
|
11399
11421
|
const Kt = (v) => {
|
|
11400
|
-
const k = s.get(v), $ =
|
|
11422
|
+
const k = s.get(v), $ = f(v);
|
|
11401
11423
|
if (!k || !$) return null;
|
|
11402
11424
|
const T = $.viewBox.split(/\s+/).map(Number);
|
|
11403
11425
|
if (T.length < 4 || T.some((I) => Number.isNaN(I))) {
|
|
@@ -11416,8 +11438,8 @@ function pN(e) {
|
|
|
11416
11438
|
O = Math.min(O, B[0]), M = Math.max(M, B[0]);
|
|
11417
11439
|
}
|
|
11418
11440
|
return { min: O, max: M };
|
|
11419
|
-
},
|
|
11420
|
-
const k = /* @__PURE__ */ new Set(), $ =
|
|
11441
|
+
}, ko = (v) => {
|
|
11442
|
+
const k = /* @__PURE__ */ new Set(), $ = f(v);
|
|
11421
11443
|
if (!$) return k;
|
|
11422
11444
|
for (const T of $.terminals) {
|
|
11423
11445
|
const E = `${v}.${T.id}`;
|
|
@@ -11431,8 +11453,8 @@ function pN(e) {
|
|
|
11431
11453
|
}
|
|
11432
11454
|
}
|
|
11433
11455
|
return k;
|
|
11434
|
-
}, Mr = 40,
|
|
11435
|
-
const k = s.get(v), $ =
|
|
11456
|
+
}, Mr = 40, So = (v) => {
|
|
11457
|
+
const k = s.get(v), $ = f(v);
|
|
11436
11458
|
if (!k || !$) return null;
|
|
11437
11459
|
const T = $.viewBox.split(/\s+/).map(Number);
|
|
11438
11460
|
if (T.length < 4 || T.some((I) => Number.isNaN(I))) {
|
|
@@ -11462,7 +11484,7 @@ function pN(e) {
|
|
|
11462
11484
|
}
|
|
11463
11485
|
for (; T.length > 0; ) {
|
|
11464
11486
|
const E = T.pop();
|
|
11465
|
-
for (const _ of
|
|
11487
|
+
for (const _ of ko(E)) {
|
|
11466
11488
|
if ($.has(_)) continue;
|
|
11467
11489
|
const z = s.get(_);
|
|
11468
11490
|
!z || z.at[1] >= k - 1 || ($.add(_), T.push(_));
|
|
@@ -11473,7 +11495,7 @@ function pN(e) {
|
|
|
11473
11495
|
const T = /* @__PURE__ */ new Set([v]), E = [v];
|
|
11474
11496
|
for (; E.length > 0; ) {
|
|
11475
11497
|
const _ = E.pop();
|
|
11476
|
-
for (const z of
|
|
11498
|
+
for (const z of ko(_))
|
|
11477
11499
|
z === k || T.has(z) || !$.has(z) || (T.add(z), E.push(z));
|
|
11478
11500
|
}
|
|
11479
11501
|
return T;
|
|
@@ -11483,7 +11505,7 @@ function pN(e) {
|
|
|
11483
11505
|
E = !1;
|
|
11484
11506
|
for (let _ = 0; _ < v.length && !E; _++)
|
|
11485
11507
|
for (let z = _ + 1; z < v.length; z++) {
|
|
11486
|
-
const j = v[_], D = v[z], O = Kt(j), M = Kt(D), I =
|
|
11508
|
+
const j = v[_], D = v[z], O = Kt(j), M = Kt(D), I = So(j), B = So(D);
|
|
11487
11509
|
if (!O || !M || !I || !B) continue;
|
|
11488
11510
|
const R = Math.min(O.max, M.max) - Math.max(O.min, M.min), q = Math.min(I.max, B.max) - Math.max(I.min, B.min);
|
|
11489
11511
|
if (R <= 0 || q <= 0) continue;
|
|
@@ -11541,7 +11563,7 @@ function pN(e) {
|
|
|
11541
11563
|
}
|
|
11542
11564
|
}
|
|
11543
11565
|
const Lr = () => {
|
|
11544
|
-
const k = t.map((T) => T.id).filter((T) => s.has(T)).map((T) => ({ x: Kt(T), y:
|
|
11566
|
+
const k = t.map((T) => T.id).filter((T) => s.has(T)).map((T) => ({ x: Kt(T), y: So(T) })).filter((T) => T.x && T.y);
|
|
11545
11567
|
let $ = 0;
|
|
11546
11568
|
for (let T = 0; T < k.length; T++)
|
|
11547
11569
|
for (let E = T + 1; E < k.length; E++) {
|
|
@@ -11554,7 +11576,7 @@ function pN(e) {
|
|
|
11554
11576
|
const Rr = /* @__PURE__ */ new Map();
|
|
11555
11577
|
for (const [v, k] of c)
|
|
11556
11578
|
Rr.set(v, { ...k, at: [...k.at] });
|
|
11557
|
-
const
|
|
11579
|
+
const _o = 120, jr = /* @__PURE__ */ new Map();
|
|
11558
11580
|
{
|
|
11559
11581
|
const v = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), $ = [];
|
|
11560
11582
|
for (const E of n)
|
|
@@ -11576,7 +11598,7 @@ function pN(e) {
|
|
|
11576
11598
|
continue;
|
|
11577
11599
|
} else
|
|
11578
11600
|
continue;
|
|
11579
|
-
for (const D of
|
|
11601
|
+
for (const D of ko(E))
|
|
11580
11602
|
s.has(D) && (v.has(D) || $.push({ el: D, bus: _, d: z + 1 }));
|
|
11581
11603
|
}
|
|
11582
11604
|
for (const [E, _] of k) _ && jr.set(E, _);
|
|
@@ -11603,8 +11625,8 @@ function pN(e) {
|
|
|
11603
11625
|
let E = 1 / 0, _ = -1 / 0;
|
|
11604
11626
|
for (const O of $)
|
|
11605
11627
|
E = Math.min(E, O.min), _ = Math.max(_, O.max);
|
|
11606
|
-
const z = _ - E, j = T +
|
|
11607
|
-
if (!(z > j +
|
|
11628
|
+
const z = _ - E, j = T + _o * ($.length - 1);
|
|
11629
|
+
if (!(z > j + _o)) continue;
|
|
11608
11630
|
$.sort((O, M) => (O.min + O.max) / 2 - (M.min + M.max) / 2);
|
|
11609
11631
|
let D = E;
|
|
11610
11632
|
for (const O of $) {
|
|
@@ -11618,7 +11640,7 @@ function pN(e) {
|
|
|
11618
11640
|
}
|
|
11619
11641
|
O.min += M, O.max += M;
|
|
11620
11642
|
}
|
|
11621
|
-
D = O.max +
|
|
11643
|
+
D = O.max + _o;
|
|
11622
11644
|
}
|
|
11623
11645
|
for (const O of $) {
|
|
11624
11646
|
const M = c.get(O.busId), I = Math.max(Gt, O.max - O.min);
|
|
@@ -11635,10 +11657,10 @@ function pN(e) {
|
|
|
11635
11657
|
c.clear();
|
|
11636
11658
|
for (const [v, k] of Rr) c.set(v, k);
|
|
11637
11659
|
}
|
|
11638
|
-
let
|
|
11660
|
+
let Co = 0;
|
|
11639
11661
|
for (const v of t) {
|
|
11640
11662
|
if (s.has(v.id)) continue;
|
|
11641
|
-
const k =
|
|
11663
|
+
const k = Co % ci, $ = Math.floor(Co / ci);
|
|
11642
11664
|
s.set(v.id, {
|
|
11643
11665
|
at: [
|
|
11644
11666
|
_e(cN + k * uN),
|
|
@@ -11646,7 +11668,7 @@ function pN(e) {
|
|
|
11646
11668
|
],
|
|
11647
11669
|
rot: 0,
|
|
11648
11670
|
mirror: !1
|
|
11649
|
-
}),
|
|
11671
|
+
}), Co++;
|
|
11650
11672
|
}
|
|
11651
11673
|
return { devices: s, buses: c, junctions: d };
|
|
11652
11674
|
}
|
|
@@ -11656,27 +11678,27 @@ function _e(e) {
|
|
|
11656
11678
|
function hN(e, t) {
|
|
11657
11679
|
const n = e.ends[0], o = e.ends[1], r = ui(n, t), i = ui(o, t);
|
|
11658
11680
|
if (r || i) {
|
|
11659
|
-
const s = r ? n : o, d =
|
|
11681
|
+
const s = r ? n : o, d = No(r ? o : n, t);
|
|
11660
11682
|
if (!d) return null;
|
|
11661
11683
|
const m = t.buses.get(s);
|
|
11662
11684
|
if (!m) return null;
|
|
11663
|
-
const { axis: p, at:
|
|
11685
|
+
const { axis: p, at: h, span: g } = m.geometry, f = g / 2;
|
|
11664
11686
|
let b;
|
|
11665
11687
|
if (p === "x")
|
|
11666
|
-
b = [Xn(d[0],
|
|
11688
|
+
b = [Xn(d[0], h[0] - f, h[0] + f), h[1]];
|
|
11667
11689
|
else {
|
|
11668
|
-
const y = Xn(d[1],
|
|
11669
|
-
b = [
|
|
11690
|
+
const y = Xn(d[1], h[1] - f, h[1] + f);
|
|
11691
|
+
b = [h[0], y];
|
|
11670
11692
|
}
|
|
11671
11693
|
return { wireId: e.id, path: pi(d, b) };
|
|
11672
11694
|
}
|
|
11673
|
-
const a =
|
|
11695
|
+
const a = No(n, t), l = No(o, t);
|
|
11674
11696
|
return !a || !l ? null : { wireId: e.id, path: pi(a, l) };
|
|
11675
11697
|
}
|
|
11676
11698
|
function ui(e, t) {
|
|
11677
11699
|
return !e.includes(".") && t.buses.has(e);
|
|
11678
11700
|
}
|
|
11679
|
-
function
|
|
11701
|
+
function No(e, t) {
|
|
11680
11702
|
if (!e.includes(".")) {
|
|
11681
11703
|
const o = t.buses.get(e);
|
|
11682
11704
|
if (o) return o.geometry.at;
|
|
@@ -11762,7 +11784,7 @@ function ot(e) {
|
|
|
11762
11784
|
at: A.layout.at,
|
|
11763
11785
|
span: A.layout.span,
|
|
11764
11786
|
rot: H,
|
|
11765
|
-
axis:
|
|
11787
|
+
axis: Zo(H)
|
|
11766
11788
|
});
|
|
11767
11789
|
}
|
|
11768
11790
|
});
|
|
@@ -11848,7 +11870,7 @@ function ot(e) {
|
|
|
11848
11870
|
at: ((S = L.layout) == null ? void 0 : S.at) ?? [0, 0],
|
|
11849
11871
|
span: ((N = L.layout) == null ? void 0 : N.span) ?? gN,
|
|
11850
11872
|
rot: ((W = L.layout) == null ? void 0 : W.rot) ?? 0,
|
|
11851
|
-
axis:
|
|
11873
|
+
axis: Zo(((oe = L.layout) == null ? void 0 : oe.rot) ?? 0)
|
|
11852
11874
|
}
|
|
11853
11875
|
});
|
|
11854
11876
|
for (const A of t.elements.values()) {
|
|
@@ -11868,13 +11890,13 @@ function ot(e) {
|
|
|
11868
11890
|
}
|
|
11869
11891
|
t.elementToTerminals.set(A.element.id, H);
|
|
11870
11892
|
}
|
|
11871
|
-
const
|
|
11893
|
+
const h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set();
|
|
11872
11894
|
for (const [A, L] of a)
|
|
11873
|
-
(ge = L.layout) != null && ge.at ? (
|
|
11874
|
-
const
|
|
11895
|
+
(ge = L.layout) != null && ge.at ? (h.set(A, [L.layout.at[0], L.layout.at[1]]), g.add(A)) : p.junctions.has(A) && (h.set(A, p.junctions.get(A)), g.add(A));
|
|
11896
|
+
const f = (A) => {
|
|
11875
11897
|
if (!A.includes(".")) {
|
|
11876
11898
|
const H = t.buses.get(A);
|
|
11877
|
-
return H ? H.geometry.at :
|
|
11899
|
+
return H ? H.geometry.at : h.get(A) ?? null;
|
|
11878
11900
|
}
|
|
11879
11901
|
const L = t.terminals.get(A);
|
|
11880
11902
|
return L ? L.world : null;
|
|
@@ -11889,12 +11911,12 @@ function ot(e) {
|
|
|
11889
11911
|
for (const [H, V] of b) {
|
|
11890
11912
|
let F = 0, K = 0, se = 0;
|
|
11891
11913
|
for (const ue of V) {
|
|
11892
|
-
const ve =
|
|
11914
|
+
const ve = f(ue);
|
|
11893
11915
|
ve && (F += ve[0], K += ve[1], se++);
|
|
11894
11916
|
}
|
|
11895
11917
|
if (!se) continue;
|
|
11896
|
-
const be = F / se, ce = K / se, ye =
|
|
11897
|
-
(!ye || Math.abs(ye[0] - be) > 0.01 || Math.abs(ye[1] - ce) > 0.01) && (
|
|
11918
|
+
const be = F / se, ce = K / se, ye = h.get(H);
|
|
11919
|
+
(!ye || Math.abs(ye[0] - be) > 0.01 || Math.abs(ye[1] - ce) > 0.01) && (h.set(H, [be, ce]), L = !0);
|
|
11898
11920
|
}
|
|
11899
11921
|
if (!L) break;
|
|
11900
11922
|
}
|
|
@@ -11908,7 +11930,7 @@ function ot(e) {
|
|
|
11908
11930
|
for (const [A, L] of a)
|
|
11909
11931
|
t.junctions.set(A, {
|
|
11910
11932
|
junction: L,
|
|
11911
|
-
world:
|
|
11933
|
+
world: h.get(A) ?? [0, 0],
|
|
11912
11934
|
degree: y.get(A) ?? 0
|
|
11913
11935
|
});
|
|
11914
11936
|
const x = new f2();
|
|
@@ -12001,7 +12023,7 @@ const bN = {
|
|
|
12001
12023
|
inverter: "INV",
|
|
12002
12024
|
"converter-bidir": "PCS"
|
|
12003
12025
|
}, hi = "B", fi = "J";
|
|
12004
|
-
function
|
|
12026
|
+
function vr(e) {
|
|
12005
12027
|
return /* @__PURE__ */ new Set([
|
|
12006
12028
|
...e.elements.map((t) => t.id),
|
|
12007
12029
|
...(e.buses ?? []).map((t) => t.id),
|
|
@@ -12009,19 +12031,19 @@ function wr(e) {
|
|
|
12009
12031
|
]);
|
|
12010
12032
|
}
|
|
12011
12033
|
function Un(e, t) {
|
|
12012
|
-
const n = bN[t] ?? t, o =
|
|
12034
|
+
const n = bN[t] ?? t, o = vr(e);
|
|
12013
12035
|
let r = 1;
|
|
12014
12036
|
for (; o.has(`${n}${r}`); ) r++;
|
|
12015
12037
|
return `${n}${r}`;
|
|
12016
12038
|
}
|
|
12017
12039
|
function gi(e) {
|
|
12018
|
-
const t =
|
|
12040
|
+
const t = vr(e);
|
|
12019
12041
|
let n = 1;
|
|
12020
12042
|
for (; t.has(`${hi}${n}`); ) n++;
|
|
12021
12043
|
return `${hi}${n}`;
|
|
12022
12044
|
}
|
|
12023
12045
|
function bi(e) {
|
|
12024
|
-
const t =
|
|
12046
|
+
const t = vr(e);
|
|
12025
12047
|
let n = 1;
|
|
12026
12048
|
for (; t.has(`${fi}${n}`); ) n++;
|
|
12027
12049
|
return `${fi}${n}`;
|
|
@@ -12056,7 +12078,7 @@ function yN(e, t) {
|
|
|
12056
12078
|
});
|
|
12057
12079
|
return n ? o : e;
|
|
12058
12080
|
}
|
|
12059
|
-
function
|
|
12081
|
+
function To(e, t, n) {
|
|
12060
12082
|
if (n.length === 0) return n;
|
|
12061
12083
|
const o = new Set(n.map((l) => l.id)), r = new Set(t.map((l) => l.id)), i = /* @__PURE__ */ new Set();
|
|
12062
12084
|
for (const l of e)
|
|
@@ -12148,7 +12170,7 @@ function g2(e, t) {
|
|
|
12148
12170
|
const n = { ...e };
|
|
12149
12171
|
return delete n.bindings, n;
|
|
12150
12172
|
}
|
|
12151
|
-
const vi = { version: "1", elements: [] }, xi = 100,
|
|
12173
|
+
const vi = { version: "1", elements: [] }, xi = 100, Io = 20;
|
|
12152
12174
|
function _N() {
|
|
12153
12175
|
if (typeof window > "u") return "select";
|
|
12154
12176
|
try {
|
|
@@ -12370,7 +12392,7 @@ const b2 = (e, t) => ({
|
|
|
12370
12392
|
selectedNode: n ? null : t().selectedNode
|
|
12371
12393
|
}),
|
|
12372
12394
|
copySelection: () => {
|
|
12373
|
-
var
|
|
12395
|
+
var f;
|
|
12374
12396
|
const { selection: n, selectedAnnotations: o, diagram: r, internal: i } = t();
|
|
12375
12397
|
if (n.length === 0 && o.length === 0) return;
|
|
12376
12398
|
const a = new Set(o), l = (r.annotations ?? []).filter((b) => a.has(b.id)).map((b) => structuredClone(b));
|
|
@@ -12401,7 +12423,7 @@ const b2 = (e, t) => ({
|
|
|
12401
12423
|
}), p = {};
|
|
12402
12424
|
for (const b of n)
|
|
12403
12425
|
if (s.has(b) && !i.buses.has(b)) {
|
|
12404
|
-
const y = (
|
|
12426
|
+
const y = (f = r.layout) == null ? void 0 : f[b];
|
|
12405
12427
|
if (y) {
|
|
12406
12428
|
p[b] = structuredClone(y);
|
|
12407
12429
|
continue;
|
|
@@ -12409,10 +12431,10 @@ const b2 = (e, t) => ({
|
|
|
12409
12431
|
const x = i.layout.get(b);
|
|
12410
12432
|
x && (p[b] = $t(x));
|
|
12411
12433
|
}
|
|
12412
|
-
const
|
|
12434
|
+
const h = {};
|
|
12413
12435
|
for (const b of n) {
|
|
12414
12436
|
const y = i.buses.get(b);
|
|
12415
|
-
y && (
|
|
12437
|
+
y && (h[b] = At(y.geometry));
|
|
12416
12438
|
}
|
|
12417
12439
|
const g = (r.wires ?? []).filter(
|
|
12418
12440
|
(b) => b.ends.every((y) => s.has(kt(y)))
|
|
@@ -12423,7 +12445,7 @@ const b2 = (e, t) => ({
|
|
|
12423
12445
|
buses: d,
|
|
12424
12446
|
junctions: m,
|
|
12425
12447
|
placements: p,
|
|
12426
|
-
busLayouts:
|
|
12448
|
+
busLayouts: h,
|
|
12427
12449
|
wires: g,
|
|
12428
12450
|
annotations: l
|
|
12429
12451
|
},
|
|
@@ -12440,12 +12462,12 @@ const b2 = (e, t) => ({
|
|
|
12440
12462
|
if (n.elements.length === 0 && n.buses.length === 0 && n.junctions.length === 0) {
|
|
12441
12463
|
const p = n.annotations ?? [];
|
|
12442
12464
|
if (p.length === 0) return;
|
|
12443
|
-
const
|
|
12465
|
+
const h = o + 1, g = Io * h, f = [];
|
|
12444
12466
|
t().dispatch((b) => {
|
|
12445
12467
|
let y = b;
|
|
12446
12468
|
for (const x of p) {
|
|
12447
12469
|
const C = Nn(y);
|
|
12448
|
-
|
|
12470
|
+
f.push(C);
|
|
12449
12471
|
const S = {
|
|
12450
12472
|
...structuredClone(x),
|
|
12451
12473
|
id: C,
|
|
@@ -12457,43 +12479,43 @@ const b2 = (e, t) => ({
|
|
|
12457
12479
|
};
|
|
12458
12480
|
}
|
|
12459
12481
|
return y;
|
|
12460
|
-
}),
|
|
12461
|
-
selectedAnnotations:
|
|
12482
|
+
}), f.length && e({
|
|
12483
|
+
selectedAnnotations: f,
|
|
12462
12484
|
selection: [],
|
|
12463
12485
|
selectedWire: null,
|
|
12464
12486
|
selectedNode: null,
|
|
12465
|
-
clipboardPasteIndex:
|
|
12487
|
+
clipboardPasteIndex: h
|
|
12466
12488
|
});
|
|
12467
12489
|
return;
|
|
12468
12490
|
}
|
|
12469
|
-
const i = o + 1, a =
|
|
12491
|
+
const i = o + 1, a = Io * i, l = Io * i, s = /* @__PURE__ */ new Map();
|
|
12470
12492
|
let c = r;
|
|
12471
12493
|
for (const p of n.elements) {
|
|
12472
|
-
const
|
|
12473
|
-
s.set(p.id,
|
|
12494
|
+
const h = Un(c, p.kind);
|
|
12495
|
+
s.set(p.id, h), c = {
|
|
12474
12496
|
...c,
|
|
12475
|
-
elements: [...c.elements, { id:
|
|
12497
|
+
elements: [...c.elements, { id: h, kind: p.kind }]
|
|
12476
12498
|
};
|
|
12477
12499
|
}
|
|
12478
12500
|
for (const p of n.buses) {
|
|
12479
|
-
const
|
|
12480
|
-
s.set(p.id,
|
|
12501
|
+
const h = gi(c);
|
|
12502
|
+
s.set(p.id, h), c = {
|
|
12481
12503
|
...c,
|
|
12482
|
-
buses: [...c.buses ?? [], { id:
|
|
12504
|
+
buses: [...c.buses ?? [], { id: h }]
|
|
12483
12505
|
};
|
|
12484
12506
|
}
|
|
12485
12507
|
for (const p of n.junctions) {
|
|
12486
|
-
const
|
|
12487
|
-
s.set(p.id,
|
|
12508
|
+
const h = bi(c);
|
|
12509
|
+
s.set(p.id, h), c = {
|
|
12488
12510
|
...c,
|
|
12489
|
-
junctions: [...c.junctions ?? [], { id:
|
|
12511
|
+
junctions: [...c.junctions ?? [], { id: h }]
|
|
12490
12512
|
};
|
|
12491
12513
|
}
|
|
12492
12514
|
const d = [];
|
|
12493
12515
|
for (const p of n.annotations ?? []) {
|
|
12494
|
-
const
|
|
12516
|
+
const h = Nn(c), g = {
|
|
12495
12517
|
...structuredClone(p),
|
|
12496
|
-
id:
|
|
12518
|
+
id: h,
|
|
12497
12519
|
at: [p.at[0] + a, p.at[1] + l]
|
|
12498
12520
|
};
|
|
12499
12521
|
d.push(g), c = {
|
|
@@ -12502,11 +12524,11 @@ const b2 = (e, t) => ({
|
|
|
12502
12524
|
};
|
|
12503
12525
|
}
|
|
12504
12526
|
const m = (p) => {
|
|
12505
|
-
const
|
|
12506
|
-
return
|
|
12527
|
+
const h = p.indexOf("."), g = h < 0 ? p : p.slice(0, h), f = s.get(g);
|
|
12528
|
+
return f ? h < 0 ? f : `${f}${p.slice(h)}` : p;
|
|
12507
12529
|
};
|
|
12508
12530
|
t().dispatch((p) => {
|
|
12509
|
-
const
|
|
12531
|
+
const h = n.elements.map((C) => {
|
|
12510
12532
|
const S = structuredClone(C);
|
|
12511
12533
|
return S.id = s.get(C.id), S;
|
|
12512
12534
|
}), g = n.buses.map((C) => {
|
|
@@ -12517,7 +12539,7 @@ const b2 = (e, t) => ({
|
|
|
12517
12539
|
...N,
|
|
12518
12540
|
at: [N.at[0] + a, N.at[1] + l]
|
|
12519
12541
|
}), S;
|
|
12520
|
-
}),
|
|
12542
|
+
}), f = n.junctions.map((C) => {
|
|
12521
12543
|
const S = structuredClone(C);
|
|
12522
12544
|
return S.id = s.get(C.id), S.layout && (S.layout = {
|
|
12523
12545
|
at: [S.layout.at[0] + a, S.layout.at[1] + l]
|
|
@@ -12543,9 +12565,9 @@ const b2 = (e, t) => ({
|
|
|
12543
12565
|
}), x = Si(p.wires ?? [], y);
|
|
12544
12566
|
return {
|
|
12545
12567
|
...p,
|
|
12546
|
-
elements: [...p.elements, ...
|
|
12568
|
+
elements: [...p.elements, ...h],
|
|
12547
12569
|
buses: g.length ? [...p.buses ?? [], ...g] : p.buses,
|
|
12548
|
-
junctions:
|
|
12570
|
+
junctions: f.length ? [...p.junctions ?? [], ...f] : p.junctions,
|
|
12549
12571
|
wires: x.length ? x : void 0,
|
|
12550
12572
|
layout: Object.keys(b).length ? b : void 0,
|
|
12551
12573
|
annotations: d.length ? [...p.annotations ?? [], ...d] : p.annotations
|
|
@@ -12656,49 +12678,49 @@ const b2 = (e, t) => ({
|
|
|
12656
12678
|
const r = t().internal;
|
|
12657
12679
|
t().dispatch((i) => {
|
|
12658
12680
|
const a = { ...i.layout ?? {} }, l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
12659
|
-
for (const [
|
|
12660
|
-
if (r.buses.has(
|
|
12661
|
-
l.set(
|
|
12681
|
+
for (const [h, g] of n) {
|
|
12682
|
+
if (r.buses.has(h)) {
|
|
12683
|
+
l.set(h, g);
|
|
12662
12684
|
continue;
|
|
12663
12685
|
}
|
|
12664
|
-
if (r.junctions.has(
|
|
12665
|
-
s.set(
|
|
12686
|
+
if (r.junctions.has(h)) {
|
|
12687
|
+
s.set(h, g);
|
|
12666
12688
|
continue;
|
|
12667
12689
|
}
|
|
12668
|
-
const
|
|
12669
|
-
a[
|
|
12690
|
+
const f = r.layout.get(h), b = a[h] ?? (f ? $t(f) : { at: [0, 0] });
|
|
12691
|
+
a[h] = {
|
|
12670
12692
|
...b,
|
|
12671
12693
|
at: [b.at[0] + g[0], b.at[1] + g[1]]
|
|
12672
12694
|
};
|
|
12673
12695
|
}
|
|
12674
12696
|
let c = i.buses;
|
|
12675
|
-
l.size > 0 && (c = (i.buses ?? []).map((
|
|
12676
|
-
const g = l.get(
|
|
12677
|
-
if (!g) return
|
|
12678
|
-
const
|
|
12697
|
+
l.size > 0 && (c = (i.buses ?? []).map((h) => {
|
|
12698
|
+
const g = l.get(h.id);
|
|
12699
|
+
if (!g) return h;
|
|
12700
|
+
const f = h.layout ?? At(r.buses.get(h.id).geometry);
|
|
12679
12701
|
return {
|
|
12680
|
-
...
|
|
12702
|
+
...h,
|
|
12681
12703
|
layout: {
|
|
12682
|
-
...
|
|
12683
|
-
at: [
|
|
12704
|
+
...f,
|
|
12705
|
+
at: [f.at[0] + g[0], f.at[1] + g[1]]
|
|
12684
12706
|
}
|
|
12685
12707
|
};
|
|
12686
12708
|
}));
|
|
12687
12709
|
let d = i.junctions;
|
|
12688
|
-
s.size > 0 && (d = (i.junctions ?? []).map((
|
|
12710
|
+
s.size > 0 && (d = (i.junctions ?? []).map((h) => {
|
|
12689
12711
|
var b, y;
|
|
12690
|
-
const g = s.get(
|
|
12691
|
-
if (!g) return
|
|
12692
|
-
const
|
|
12693
|
-
return { ...
|
|
12712
|
+
const g = s.get(h.id);
|
|
12713
|
+
if (!g) return h;
|
|
12714
|
+
const f = ((b = h.layout) == null ? void 0 : b.at) ?? ((y = r.junctions.get(h.id)) == null ? void 0 : y.world) ?? [0, 0];
|
|
12715
|
+
return { ...h, layout: { at: [f[0] + g[0], f[1] + g[1]] } };
|
|
12694
12716
|
}));
|
|
12695
12717
|
let m = i.annotations;
|
|
12696
|
-
o != null && o.size && m && (m = m.map((
|
|
12697
|
-
const g = o.get(
|
|
12718
|
+
o != null && o.size && m && (m = m.map((h) => {
|
|
12719
|
+
const g = o.get(h.id);
|
|
12698
12720
|
return g ? {
|
|
12699
|
-
...
|
|
12700
|
-
at: [
|
|
12701
|
-
} :
|
|
12721
|
+
...h,
|
|
12722
|
+
at: [h.at[0] + g[0], h.at[1] + g[1]]
|
|
12723
|
+
} : h;
|
|
12702
12724
|
}));
|
|
12703
12725
|
const p = yN(i.wires, n);
|
|
12704
12726
|
return { ...i, layout: a, buses: c, junctions: d, wires: p, annotations: m };
|
|
@@ -12711,7 +12733,7 @@ const b2 = (e, t) => ({
|
|
|
12711
12733
|
t().dispatch((a) => {
|
|
12712
12734
|
const l = a.elements.filter((g) => !r.has(g.id)), s = (a.buses ?? []).filter((g) => !r.has(g.id)), c = (a.junctions ?? []).filter((g) => !r.has(g.id)), d = (a.wires ?? []).filter(
|
|
12713
12735
|
(g) => !r.has(kt(g.ends[0])) && !r.has(kt(g.ends[1]))
|
|
12714
|
-
), m = i.size ? (a.annotations ?? []).filter((g) => !i.has(g.id)) : a.annotations, p =
|
|
12736
|
+
), m = i.size ? (a.annotations ?? []).filter((g) => !i.has(g.id)) : a.annotations, p = To(a.wires ?? [], d, c), h = a.layout ? Object.fromEntries(
|
|
12715
12737
|
Object.entries(a.layout).filter(([g]) => !r.has(g))
|
|
12716
12738
|
) : void 0;
|
|
12717
12739
|
return SN(
|
|
@@ -12721,7 +12743,7 @@ const b2 = (e, t) => ({
|
|
|
12721
12743
|
buses: s.length ? s : void 0,
|
|
12722
12744
|
junctions: p.length ? p : void 0,
|
|
12723
12745
|
wires: d.length ? d : void 0,
|
|
12724
|
-
layout:
|
|
12746
|
+
layout: h && Object.keys(h).length ? h : void 0,
|
|
12725
12747
|
annotations: m != null && m.length ? m : void 0
|
|
12726
12748
|
},
|
|
12727
12749
|
r
|
|
@@ -12751,7 +12773,7 @@ const b2 = (e, t) => ({
|
|
|
12751
12773
|
const p = o.layout.get(m);
|
|
12752
12774
|
p && (c[m] = $t(p));
|
|
12753
12775
|
}
|
|
12754
|
-
const d =
|
|
12776
|
+
const d = To(l, s, a.junctions ?? []);
|
|
12755
12777
|
return {
|
|
12756
12778
|
...a,
|
|
12757
12779
|
wires: s.length ? s : void 0,
|
|
@@ -12774,12 +12796,12 @@ const b2 = (e, t) => ({
|
|
|
12774
12796
|
const s = { ...l.layout ?? {} };
|
|
12775
12797
|
for (const p of a) {
|
|
12776
12798
|
if (s[p]) continue;
|
|
12777
|
-
const
|
|
12778
|
-
|
|
12799
|
+
const h = o.layout.get(p);
|
|
12800
|
+
h && (s[p] = $t(h));
|
|
12779
12801
|
}
|
|
12780
12802
|
const c = l.wires ?? [], d = c.filter(
|
|
12781
12803
|
(p) => !i.has(p.ends[0]) && !i.has(p.ends[1])
|
|
12782
|
-
), m =
|
|
12804
|
+
), m = To(c, d, l.junctions ?? []);
|
|
12783
12805
|
return {
|
|
12784
12806
|
...l,
|
|
12785
12807
|
wires: d.length ? d : void 0,
|
|
@@ -12793,21 +12815,21 @@ const b2 = (e, t) => ({
|
|
|
12793
12815
|
o.length !== 0 && t().dispatch((i) => {
|
|
12794
12816
|
var c, d, m, p;
|
|
12795
12817
|
const a = { ...i.layout ?? {} }, l = /* @__PURE__ */ new Map();
|
|
12796
|
-
for (const
|
|
12797
|
-
if (r.junctions.has(
|
|
12798
|
-
if (r.buses.has(
|
|
12799
|
-
const b = r.buses.get(
|
|
12800
|
-
l.set(
|
|
12818
|
+
for (const h of o) {
|
|
12819
|
+
if (r.junctions.has(h)) continue;
|
|
12820
|
+
if (r.buses.has(h)) {
|
|
12821
|
+
const b = r.buses.get(h), x = (((((m = (d = (c = i.buses) == null ? void 0 : c.find((C) => C.id === h)) == null ? void 0 : d.layout) == null ? void 0 : m.rot) ?? b.geometry.rot ?? 0) + n) % 360 + 360) % 360;
|
|
12822
|
+
l.set(h, x);
|
|
12801
12823
|
continue;
|
|
12802
12824
|
}
|
|
12803
|
-
const g = a[
|
|
12804
|
-
a[
|
|
12825
|
+
const g = a[h] ?? { at: ((p = r.layout.get(h)) == null ? void 0 : p.at) ?? [0, 0] }, f = (((g.rot ?? 0) + n) % 360 + 360) % 360;
|
|
12826
|
+
a[h] = { ...g, rot: f };
|
|
12805
12827
|
}
|
|
12806
12828
|
let s = i.buses;
|
|
12807
|
-
return l.size > 0 && (s = (i.buses ?? []).map((
|
|
12808
|
-
if (!l.has(
|
|
12809
|
-
const g =
|
|
12810
|
-
return { ...
|
|
12829
|
+
return l.size > 0 && (s = (i.buses ?? []).map((h) => {
|
|
12830
|
+
if (!l.has(h.id)) return h;
|
|
12831
|
+
const g = h.layout ?? At(r.buses.get(h.id).geometry);
|
|
12832
|
+
return { ...h, layout: { ...g, rot: l.get(h.id) } };
|
|
12811
12833
|
})), { ...i, layout: a, buses: s };
|
|
12812
12834
|
});
|
|
12813
12835
|
},
|
|
@@ -12825,7 +12847,7 @@ const b2 = (e, t) => ({
|
|
|
12825
12847
|
});
|
|
12826
12848
|
},
|
|
12827
12849
|
setSelectionColor: (n) => {
|
|
12828
|
-
var
|
|
12850
|
+
var f, b, y;
|
|
12829
12851
|
const { selection: o, selectedAnnotations: r, selectedWire: i } = t();
|
|
12830
12852
|
if (o.length === 0 && r.length === 0 && i == null)
|
|
12831
12853
|
return;
|
|
@@ -12836,8 +12858,8 @@ const b2 = (e, t) => ({
|
|
|
12836
12858
|
return S;
|
|
12837
12859
|
}
|
|
12838
12860
|
return x.color === n ? x : { ...x, color: n };
|
|
12839
|
-
}, c = t().diagram, d = a.size ? c.elements.map((x) => a.has(x.id) ? s(x) : x) : c.elements, m = a.size ? (
|
|
12840
|
-
g(d, c.elements) && g(m, c.buses) && g(p, c.wires) && g(
|
|
12861
|
+
}, c = t().diagram, d = a.size ? c.elements.map((x) => a.has(x.id) ? s(x) : x) : c.elements, m = a.size ? (f = c.buses) == null ? void 0 : f.map((x) => a.has(x.id) ? s(x) : x) : c.buses, p = i ? (b = c.wires) == null ? void 0 : b.map((x) => x.id === i ? s(x) : x) : c.wires, h = l.size ? (y = c.annotations) == null ? void 0 : y.map((x) => l.has(x.id) ? s(x) : x) : c.annotations, g = (x, C) => x === C || (x == null ? void 0 : x.length) === (C == null ? void 0 : C.length) && (x ?? []).every((S, N) => S === (C == null ? void 0 : C[N]));
|
|
12862
|
+
g(d, c.elements) && g(m, c.buses) && g(p, c.wires) && g(h, c.annotations) || t().dispatch((x) => ({ ...x, elements: d, buses: m, wires: p, annotations: h }));
|
|
12841
12863
|
},
|
|
12842
12864
|
resetSelectionLabelOffset: () => {
|
|
12843
12865
|
const n = new Set(t().selection);
|
|
@@ -12912,35 +12934,35 @@ const b2 = (e, t) => ({
|
|
|
12912
12934
|
]), l = () => {
|
|
12913
12935
|
let g = 1;
|
|
12914
12936
|
for (; a.has(`J${g}`); ) g++;
|
|
12915
|
-
const
|
|
12916
|
-
return a.add(
|
|
12937
|
+
const f = `J${g}`;
|
|
12938
|
+
return a.add(f), f;
|
|
12917
12939
|
}, s = (g) => {
|
|
12918
|
-
const
|
|
12940
|
+
const f = l();
|
|
12919
12941
|
return i = {
|
|
12920
12942
|
...i,
|
|
12921
|
-
junctions: [...i.junctions ?? [], { id:
|
|
12922
|
-
},
|
|
12943
|
+
junctions: [...i.junctions ?? [], { id: f, layout: { at: g } }]
|
|
12944
|
+
}, f;
|
|
12923
12945
|
}, c = (g) => {
|
|
12924
12946
|
if ("end" in g) return g.end;
|
|
12925
12947
|
if ("junctionAt" in g) return s(g.junctionAt);
|
|
12926
|
-
const
|
|
12927
|
-
if (!
|
|
12948
|
+
const f = (i.wires ?? []).find((C) => C.id === g.onWire), b = s(g.at);
|
|
12949
|
+
if (!f) return b;
|
|
12928
12950
|
const y = (i.wires ?? []).filter((C) => C.id !== g.onWire), x = (C, S) => ({
|
|
12929
12951
|
id: It(C, S),
|
|
12930
12952
|
ends: [C, S],
|
|
12931
|
-
...
|
|
12953
|
+
...f.label ? { label: f.label } : {}
|
|
12932
12954
|
});
|
|
12933
12955
|
return i = {
|
|
12934
12956
|
...i,
|
|
12935
12957
|
wires: Si(y, [
|
|
12936
|
-
x(
|
|
12937
|
-
x(b,
|
|
12958
|
+
x(f.ends[0], b),
|
|
12959
|
+
x(b, f.ends[1])
|
|
12938
12960
|
])
|
|
12939
12961
|
}, b;
|
|
12940
12962
|
}, d = c(n), m = c(o);
|
|
12941
12963
|
if (d === null || m === null || d === m) return i;
|
|
12942
|
-
const p = It(d, m),
|
|
12943
|
-
return
|
|
12964
|
+
const p = It(d, m), h = i.wires ?? [];
|
|
12965
|
+
return h.some((g) => g.id === p) ? i : { ...i, wires: [...h, { id: p, ends: [d, m] }] };
|
|
12944
12966
|
});
|
|
12945
12967
|
},
|
|
12946
12968
|
updateWirePath: (n, o) => {
|
|
@@ -13120,7 +13142,7 @@ function _i(e, t, n) {
|
|
|
13120
13142
|
}
|
|
13121
13143
|
function y2(e) {
|
|
13122
13144
|
if (e === void 0) return {};
|
|
13123
|
-
const t =
|
|
13145
|
+
const t = Uo(e);
|
|
13124
13146
|
return t === 1 ? {} : { scale: t };
|
|
13125
13147
|
}
|
|
13126
13148
|
function At(e) {
|
|
@@ -13163,20 +13185,20 @@ function S2(e, t) {
|
|
|
13163
13185
|
return { newElementId: o.addElement(e, t), attachedToBus: !1 };
|
|
13164
13186
|
const i = EN(r, t);
|
|
13165
13187
|
if (!i) {
|
|
13166
|
-
const
|
|
13188
|
+
const f = _2(n), b = f ? [me(t[0]) - f.x, me(t[1]) - f.y] : [me(t[0]), me(t[1])];
|
|
13167
13189
|
return { newElementId: o.addElement(e, b), attachedToBus: !1 };
|
|
13168
13190
|
}
|
|
13169
|
-
const { busId: a, busAt: l, axis: s } = i, c = NN(n, s), d = Un(r, e), m = n.terminals.find((
|
|
13170
|
-
return o.dispatch((
|
|
13191
|
+
const { busId: a, busAt: l, axis: s } = i, c = NN(n, s), d = Un(r, e), m = n.terminals.find((f) => f.id === c), p = s === "x" ? t[0] : l[0], h = s === "y" ? t[1] : l[1], g = m ? [me(p) - m.x, me(h) - m.y] : [me(t[0]), me(t[1])];
|
|
13192
|
+
return o.dispatch((f) => {
|
|
13171
13193
|
const b = { id: d, kind: e }, y = { at: g }, x = `${d}.${c}`, C = {
|
|
13172
13194
|
id: It(a, x),
|
|
13173
13195
|
ends: [a, x]
|
|
13174
13196
|
};
|
|
13175
13197
|
return {
|
|
13176
|
-
...
|
|
13177
|
-
elements: [...
|
|
13178
|
-
wires: [...
|
|
13179
|
-
layout: { ...
|
|
13198
|
+
...f,
|
|
13199
|
+
elements: [...f.elements, b],
|
|
13200
|
+
wires: [...f.wires ?? [], C],
|
|
13201
|
+
layout: { ...f.layout ?? {}, [d]: y }
|
|
13180
13202
|
};
|
|
13181
13203
|
}), o.setSelection([d]), { newElementId: d, attachedToBus: !0 };
|
|
13182
13204
|
}
|
|
@@ -13189,11 +13211,11 @@ function EN(e, t) {
|
|
|
13189
13211
|
const { axis: a, at: l, span: s } = i.geometry;
|
|
13190
13212
|
let c;
|
|
13191
13213
|
if (a === "x") {
|
|
13192
|
-
const d = l[0] - s / 2, m = l[0] + s / 2, p = t[0] < d ? d - t[0] : t[0] > m ? t[0] - m : 0,
|
|
13193
|
-
c = Math.sqrt(p * p +
|
|
13214
|
+
const d = l[0] - s / 2, m = l[0] + s / 2, p = t[0] < d ? d - t[0] : t[0] > m ? t[0] - m : 0, h = Math.abs(t[1] - l[1]);
|
|
13215
|
+
c = Math.sqrt(p * p + h * h);
|
|
13194
13216
|
} else {
|
|
13195
|
-
const d = l[1] - s / 2, m = l[1] + s / 2, p = t[1] < d ? d - t[1] : t[1] > m ? t[1] - m : 0,
|
|
13196
|
-
c = Math.sqrt(
|
|
13217
|
+
const d = l[1] - s / 2, m = l[1] + s / 2, p = t[1] < d ? d - t[1] : t[1] > m ? t[1] - m : 0, h = Math.abs(t[0] - l[0]);
|
|
13218
|
+
c = Math.sqrt(h * h + p * p);
|
|
13197
13219
|
}
|
|
13198
13220
|
c <= $N && (!o || c < o.dist) && (o = { busId: r.id, busAt: [l[0], l[1]], axis: a, dist: c });
|
|
13199
13221
|
}
|
|
@@ -13212,8 +13234,8 @@ function C2(e, t) {
|
|
|
13212
13234
|
if (!e.includes(".") && n.buses.has(e)) {
|
|
13213
13235
|
const r = n.buses.get(e), { axis: i, at: a, span: l } = r.geometry;
|
|
13214
13236
|
if (i === "x") {
|
|
13215
|
-
const
|
|
13216
|
-
return { ref: e, world: [
|
|
13237
|
+
const h = a[0] - l / 2, g = a[0] + l / 2, f = Math.max(h, Math.min(g, t[0])), b = a[1], y = t[1] >= b ? "s" : "n";
|
|
13238
|
+
return { ref: e, world: [f, b], orientation: y, isBus: !0, busId: e };
|
|
13217
13239
|
}
|
|
13218
13240
|
const s = a[1] - l / 2, c = a[1] + l / 2, d = Math.max(s, Math.min(c, t[1])), m = a[0], p = t[0] >= m ? "e" : "w";
|
|
13219
13241
|
return { ref: e, world: [m, d], orientation: p, isBus: !0, busId: e };
|
|
@@ -13256,29 +13278,29 @@ function IN(e, t, n) {
|
|
|
13256
13278
|
if (!o) return null;
|
|
13257
13279
|
const a = C2(t, n);
|
|
13258
13280
|
if (!a) return null;
|
|
13259
|
-
const l = n[0] - a.world[0], s = n[1] - a.world[1], c = l * l + s * s <= AN, d = [me(n[0]), me(n[1])], m = $2(o, a, d), p = c ? a.world : d,
|
|
13281
|
+
const l = n[0] - a.world[0], s = n[1] - a.world[1], c = l * l + s * s <= AN, d = [me(n[0]), me(n[1])], m = $2(o, a, d), p = c ? a.world : d, h = [
|
|
13260
13282
|
me(p[0] - m.x),
|
|
13261
13283
|
me(p[1] - m.y)
|
|
13262
13284
|
], g = Un(i, e);
|
|
13263
|
-
return r.dispatch((
|
|
13264
|
-
const b = { id: g, kind: e }, y = { at:
|
|
13285
|
+
return r.dispatch((f) => {
|
|
13286
|
+
const b = { id: g, kind: e }, y = { at: h }, x = `${g}.${m.id}`, C = a.isBus && a.busId ? a.busId : t, S = {
|
|
13265
13287
|
id: It(C, x),
|
|
13266
13288
|
ends: [C, x]
|
|
13267
13289
|
};
|
|
13268
13290
|
return {
|
|
13269
|
-
...
|
|
13270
|
-
elements: [...
|
|
13271
|
-
wires: [...
|
|
13272
|
-
layout: { ...
|
|
13291
|
+
...f,
|
|
13292
|
+
elements: [...f.elements, b],
|
|
13293
|
+
wires: [...f.wires ?? [], S],
|
|
13294
|
+
layout: { ...f.layout ?? {}, [g]: y }
|
|
13273
13295
|
};
|
|
13274
13296
|
}), r.setSelection([g]), { newElementId: g, attachedToBus: a.isBus };
|
|
13275
13297
|
}
|
|
13276
|
-
const PN = 9,
|
|
13298
|
+
const PN = 9, Je = 7, lo = 5, co = 32;
|
|
13277
13299
|
function Rt(e) {
|
|
13278
|
-
return typeof e != "number" || !Number.isFinite(e) ?
|
|
13300
|
+
return typeof e != "number" || !Number.isFinite(e) ? Je : Math.min(co, Math.max(lo, e));
|
|
13279
13301
|
}
|
|
13280
|
-
function bn(e =
|
|
13281
|
-
return e * PN /
|
|
13302
|
+
function bn(e = Je) {
|
|
13303
|
+
return e * PN / Je;
|
|
13282
13304
|
}
|
|
13283
13305
|
function uo(e, t) {
|
|
13284
13306
|
const n = (e ?? "").split(/\r\n|\r|\n/).map((o) => o.trim()).filter((o) => o !== "");
|
|
@@ -13286,6 +13308,7 @@ function uo(e, t) {
|
|
|
13286
13308
|
}
|
|
13287
13309
|
function mo(e, t) {
|
|
13288
13310
|
var r;
|
|
13311
|
+
if (e.element.labelHidden) return [];
|
|
13289
13312
|
const n = uo(e.element.name, e.element.id);
|
|
13290
13313
|
if (t !== "all" || !((r = e.libraryDef) != null && r.params)) return n;
|
|
13291
13314
|
const o = e.element.params ?? {};
|
|
@@ -13296,7 +13319,7 @@ function mo(e, t) {
|
|
|
13296
13319
|
}
|
|
13297
13320
|
return n;
|
|
13298
13321
|
}
|
|
13299
|
-
function po(e, t =
|
|
13322
|
+
function po(e, t = Je) {
|
|
13300
13323
|
const n = A2(e.viewBox);
|
|
13301
13324
|
return n ? {
|
|
13302
13325
|
x: n.x + n.w + 2,
|
|
@@ -13320,7 +13343,7 @@ function zN(e, t) {
|
|
|
13320
13343
|
}
|
|
13321
13344
|
return [o + t.at[0], r + t.at[1]];
|
|
13322
13345
|
}
|
|
13323
|
-
function ho(e, t, n, o, r =
|
|
13346
|
+
function ho(e, t, n, o, r = Je, i) {
|
|
13324
13347
|
const a = zN(e, n);
|
|
13325
13348
|
i && (a[0] += i[0], a[1] += i[1]);
|
|
13326
13349
|
const l = e.anchor ?? "start", s = A2(t.viewBox);
|
|
@@ -13342,7 +13365,7 @@ function ho(e, t, n, o, r = Qe, i) {
|
|
|
13342
13365
|
dy: -(o - 1) * bn(r)
|
|
13343
13366
|
};
|
|
13344
13367
|
}
|
|
13345
|
-
function
|
|
13368
|
+
function Qo(e, t) {
|
|
13346
13369
|
let n = 0;
|
|
13347
13370
|
for (const o of e) {
|
|
13348
13371
|
const r = o.length * t * 0.55;
|
|
@@ -13355,7 +13378,7 @@ function A2(e) {
|
|
|
13355
13378
|
return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : { x: t[0], y: t[1], w: t[2], h: t[3] };
|
|
13356
13379
|
}
|
|
13357
13380
|
const MN = 8;
|
|
13358
|
-
function fo(e, t =
|
|
13381
|
+
function fo(e, t = Je) {
|
|
13359
13382
|
if (e.length < 2) return null;
|
|
13360
13383
|
let n = -1, o = 0;
|
|
13361
13384
|
for (let m = 0; m < e.length - 1; m++) {
|
|
@@ -13366,13 +13389,13 @@ function fo(e, t = Qe) {
|
|
|
13366
13389
|
p > o && (o = p, n = m);
|
|
13367
13390
|
}
|
|
13368
13391
|
if (n < 0 || o <= 0) return null;
|
|
13369
|
-
const [r, i] = e[n], [a, l] = e[n + 1], s = (r + a) / 2, c = (i + l) / 2, d = MN * t /
|
|
13392
|
+
const [r, i] = e[n], [a, l] = e[n + 1], s = (r + a) / 2, c = (i + l) / 2, d = MN * t / Je;
|
|
13370
13393
|
return Math.abs(a - r) >= Math.abs(l - i) ? { world: [s, c - d], textAnchor: "middle" } : {
|
|
13371
13394
|
world: [s + d, c + t / 3],
|
|
13372
13395
|
textAnchor: "start"
|
|
13373
13396
|
};
|
|
13374
13397
|
}
|
|
13375
|
-
const
|
|
13398
|
+
const xr = {
|
|
13376
13399
|
// `light: 'black'` is exact, not approximate: every export path emitted the
|
|
13377
13400
|
// literal string `black` before colours existed, and a diagram with no
|
|
13378
13401
|
// colour fields has to keep producing byte-identical SVG.
|
|
@@ -13390,19 +13413,19 @@ const vr = {
|
|
|
13390
13413
|
"blue",
|
|
13391
13414
|
"gray"
|
|
13392
13415
|
];
|
|
13393
|
-
function
|
|
13394
|
-
return e !== void 0 && e in
|
|
13416
|
+
function kr(e) {
|
|
13417
|
+
return e !== void 0 && e in xr;
|
|
13395
13418
|
}
|
|
13396
13419
|
function He(e) {
|
|
13397
|
-
return
|
|
13420
|
+
return kr(e) && e !== "default" ? `ole-ink-${e}` : void 0;
|
|
13398
13421
|
}
|
|
13399
|
-
function
|
|
13400
|
-
return
|
|
13422
|
+
function Qe(e) {
|
|
13423
|
+
return kr(e) ? xr[e].light : "black";
|
|
13401
13424
|
}
|
|
13402
13425
|
function Jt(e) {
|
|
13403
|
-
return
|
|
13426
|
+
return kr(e) && e !== "default" ? xr[e].aci : void 0;
|
|
13404
13427
|
}
|
|
13405
|
-
const
|
|
13428
|
+
const Jo = { props: {}, units: {} }, N2 = ro(Jo);
|
|
13406
13429
|
function jt() {
|
|
13407
13430
|
return io(N2);
|
|
13408
13431
|
}
|
|
@@ -13411,7 +13434,7 @@ function DN(e, t) {
|
|
|
13411
13434
|
const n = e ?? "none", o = t ?? "none";
|
|
13412
13435
|
return Ai[n] >= Ai[o] ? n : o;
|
|
13413
13436
|
}
|
|
13414
|
-
function
|
|
13437
|
+
function Sr(e) {
|
|
13415
13438
|
return e != null && e.alarm && e.alarm !== "none" ? e.alarm : void 0;
|
|
13416
13439
|
}
|
|
13417
13440
|
function T2(e) {
|
|
@@ -13442,7 +13465,7 @@ function I2() {
|
|
|
13442
13465
|
if (!c || !s.libraryDef) return null;
|
|
13443
13466
|
const d = a[s.element.id];
|
|
13444
13467
|
if ((d == null ? void 0 : d.visible) === !1) return null;
|
|
13445
|
-
const m = s.libraryDef.label ?? po(s.libraryDef, r), p = (d == null ? void 0 : d.labelText) !== void 0 ? uo(d.labelText, "") : mo(s, o), { world:
|
|
13468
|
+
const m = s.libraryDef.label ?? po(s.libraryDef, r), p = (d == null ? void 0 : d.labelText) !== void 0 ? uo(d.labelText, "") : mo(s, o), { world: h, textAnchor: g, dy: f } = ho(
|
|
13446
13469
|
m,
|
|
13447
13470
|
s.libraryDef,
|
|
13448
13471
|
c,
|
|
@@ -13456,27 +13479,27 @@ function I2() {
|
|
|
13456
13479
|
{
|
|
13457
13480
|
elementId: s.element.id,
|
|
13458
13481
|
currentName: ((x = s.element.name) == null ? void 0 : x.trim()) || s.element.id,
|
|
13459
|
-
world:
|
|
13482
|
+
world: h,
|
|
13460
13483
|
anchor: g,
|
|
13461
13484
|
fontSize: r
|
|
13462
13485
|
},
|
|
13463
13486
|
s.element.id
|
|
13464
13487
|
);
|
|
13465
13488
|
if (o === "off" || p.length === 0) return null;
|
|
13466
|
-
const b =
|
|
13489
|
+
const b = Qo(p, r), y = g === "middle" ? -b / 2 : g === "end" ? -b : 0;
|
|
13467
13490
|
return /* @__PURE__ */ u(
|
|
13468
13491
|
"g",
|
|
13469
13492
|
{
|
|
13470
13493
|
className: "ole-annotation ole-element-label",
|
|
13471
13494
|
"data-element-label": s.element.id,
|
|
13472
|
-
transform: `translate(${
|
|
13495
|
+
transform: `translate(${h[0]} ${h[1]})`,
|
|
13473
13496
|
children: /* @__PURE__ */ P("g", { "data-element-label-body": "", children: [
|
|
13474
13497
|
/* @__PURE__ */ u(
|
|
13475
13498
|
"rect",
|
|
13476
13499
|
{
|
|
13477
13500
|
className: "ole-element-label-hit",
|
|
13478
13501
|
x: y - 2,
|
|
13479
|
-
y:
|
|
13502
|
+
y: f - r,
|
|
13480
13503
|
width: b + 4,
|
|
13481
13504
|
height: p.length * l + r * 0.4
|
|
13482
13505
|
}
|
|
@@ -13485,7 +13508,7 @@ function I2() {
|
|
|
13485
13508
|
"text",
|
|
13486
13509
|
{
|
|
13487
13510
|
x: 0,
|
|
13488
|
-
y:
|
|
13511
|
+
y: f + S * l,
|
|
13489
13512
|
textAnchor: g,
|
|
13490
13513
|
className: "ole-annotation-text",
|
|
13491
13514
|
children: C
|
|
@@ -13519,7 +13542,7 @@ function I2() {
|
|
|
13519
13542
|
}
|
|
13520
13543
|
);
|
|
13521
13544
|
}
|
|
13522
|
-
const
|
|
13545
|
+
const Po = 200, ON = 9;
|
|
13523
13546
|
function LN({
|
|
13524
13547
|
elementId: e,
|
|
13525
13548
|
currentName: t,
|
|
@@ -13535,21 +13558,21 @@ function LN({
|
|
|
13535
13558
|
const p = a.current;
|
|
13536
13559
|
if (!p) return;
|
|
13537
13560
|
p.focus();
|
|
13538
|
-
const
|
|
13539
|
-
|
|
13561
|
+
const h = document.createRange();
|
|
13562
|
+
h.selectNodeContents(p);
|
|
13540
13563
|
const g = window.getSelection();
|
|
13541
|
-
g == null || g.removeAllRanges(), g == null || g.addRange(
|
|
13564
|
+
g == null || g.removeAllRanges(), g == null || g.addRange(h);
|
|
13542
13565
|
}, [e]);
|
|
13543
13566
|
function c() {
|
|
13544
13567
|
var y;
|
|
13545
|
-
const p = w.getState(),
|
|
13546
|
-
if (!
|
|
13568
|
+
const p = w.getState(), h = p.diagram.elements.find((x) => x.id === e);
|
|
13569
|
+
if (!h) {
|
|
13547
13570
|
p.setEditingElement(null);
|
|
13548
13571
|
return;
|
|
13549
13572
|
}
|
|
13550
|
-
const g = (((y = a.current) == null ? void 0 : y.innerText) ?? "").replace(/\u00a0/g, " "),
|
|
13551
|
-
`), b =
|
|
13552
|
-
b !==
|
|
13573
|
+
const g = (((y = a.current) == null ? void 0 : y.innerText) ?? "").replace(/\u00a0/g, " "), f = uo(g, "").join(`
|
|
13574
|
+
`), b = f === "" || f === e ? void 0 : f;
|
|
13575
|
+
b !== h.name && p.updateElement(e, { name: b }), p.setEditingElement(null);
|
|
13553
13576
|
}
|
|
13554
13577
|
function d(p) {
|
|
13555
13578
|
if (p.key === "Escape" || p.key === "Enter" && (p.metaKey || p.ctrlKey)) {
|
|
@@ -13559,12 +13582,12 @@ function LN({
|
|
|
13559
13582
|
p.stopPropagation();
|
|
13560
13583
|
}
|
|
13561
13584
|
let m = n[0];
|
|
13562
|
-
return o === "middle" ? m -=
|
|
13585
|
+
return o === "middle" ? m -= Po / 2 : o === "end" && (m -= Po), /* @__PURE__ */ u(
|
|
13563
13586
|
"foreignObject",
|
|
13564
13587
|
{
|
|
13565
13588
|
x: m,
|
|
13566
13589
|
y: n[1] - i,
|
|
13567
|
-
width:
|
|
13590
|
+
width: Po,
|
|
13568
13591
|
height: i * 1.3 * l + i,
|
|
13569
13592
|
className: "ole-element-name-editor",
|
|
13570
13593
|
children: /* @__PURE__ */ u(
|
|
@@ -13612,7 +13635,7 @@ function go(e) {
|
|
|
13612
13635
|
function Ht(e) {
|
|
13613
13636
|
return e ?? 1;
|
|
13614
13637
|
}
|
|
13615
|
-
const z2 = 0.05, Ei = 8, Tn = 3, pt = 4, cn = 3, dn = 60, un = 20,
|
|
13638
|
+
const z2 = 0.05, Ei = 8, Tn = 3, pt = 4, cn = 3, dn = 60, un = 20, er = 16, tr = 12, Ot = 10, jN = 10;
|
|
13616
13639
|
function HN(e, t) {
|
|
13617
13640
|
const n = e === "" ? [""] : e.split(`
|
|
13618
13641
|
`);
|
|
@@ -13621,7 +13644,7 @@ function HN(e, t) {
|
|
|
13621
13644
|
function yn(e) {
|
|
13622
13645
|
return e.points.map(([t, n]) => [e.at[0] + t, e.at[1] + n]);
|
|
13623
13646
|
}
|
|
13624
|
-
function
|
|
13647
|
+
function _r(e, t) {
|
|
13625
13648
|
if (!t || t === "none" || e.length < 2) return [];
|
|
13626
13649
|
const n = [];
|
|
13627
13650
|
return (t === "end" || t === "both") && n.push(Ni(e[e.length - 2], e[e.length - 1])), t === "both" && n.push(Ni(e[1], e[0])), n;
|
|
@@ -13634,12 +13657,12 @@ function Ni(e, t) {
|
|
|
13634
13657
|
[l - c * Tn, s - d * Tn]
|
|
13635
13658
|
];
|
|
13636
13659
|
}
|
|
13637
|
-
function
|
|
13660
|
+
function Cr(e) {
|
|
13638
13661
|
const [t, n] = e.at, [o, r] = e.size;
|
|
13639
13662
|
return { cx: t + o / 2, cy: n + r / 2, rx: o / 2, ry: r / 2 };
|
|
13640
13663
|
}
|
|
13641
13664
|
function FN(e, t = 48) {
|
|
13642
|
-
const { cx: n, cy: o, rx: r, ry: i } =
|
|
13665
|
+
const { cx: n, cy: o, rx: r, ry: i } = Cr(e), a = [];
|
|
13643
13666
|
for (let l = 0; l < t; l++) {
|
|
13644
13667
|
const s = l / t * Math.PI * 2;
|
|
13645
13668
|
a.push([n + r * Math.cos(s), o + i * Math.sin(s)]);
|
|
@@ -13764,7 +13787,7 @@ function j2() {
|
|
|
13764
13787
|
const i = new Set(t);
|
|
13765
13788
|
return /* @__PURE__ */ u("g", { className: "ole-free-annotation-layer", children: e.map((a) => {
|
|
13766
13789
|
const l = (r == null ? void 0 : r.id) === a.id ? r : a, s = i.has(a.id);
|
|
13767
|
-
switch (
|
|
13790
|
+
switch (et(l)) {
|
|
13768
13791
|
case "rect":
|
|
13769
13792
|
return /* @__PURE__ */ u(
|
|
13770
13793
|
qN,
|
|
@@ -13849,7 +13872,7 @@ function GN({
|
|
|
13849
13872
|
ann: e,
|
|
13850
13873
|
isSelected: t
|
|
13851
13874
|
}) {
|
|
13852
|
-
const { cx: n, cy: o, rx: r, ry: i } =
|
|
13875
|
+
const { cx: n, cy: o, rx: r, ry: i } = Cr(e);
|
|
13853
13876
|
return /* @__PURE__ */ P(
|
|
13854
13877
|
"g",
|
|
13855
13878
|
{
|
|
@@ -13922,7 +13945,7 @@ function VN({
|
|
|
13922
13945
|
strokeWidth: Ht(e.strokeWidth)
|
|
13923
13946
|
}
|
|
13924
13947
|
),
|
|
13925
|
-
|
|
13948
|
+
_r(n, e.arrow).map((r, i) => /* @__PURE__ */ u(
|
|
13926
13949
|
"polygon",
|
|
13927
13950
|
{
|
|
13928
13951
|
className: "ole-ann-arrow",
|
|
@@ -13939,7 +13962,7 @@ function KN({
|
|
|
13939
13962
|
isSelected: t,
|
|
13940
13963
|
editingCell: n
|
|
13941
13964
|
}) {
|
|
13942
|
-
var
|
|
13965
|
+
var h;
|
|
13943
13966
|
const [o, r] = e.at, [i, a] = at(e), l = Ft(e), s = Wt(e), c = e.fontSize ?? Lt;
|
|
13944
13967
|
let d = "";
|
|
13945
13968
|
for (let g = 1; g < e.colWidths.length; g++)
|
|
@@ -13948,15 +13971,15 @@ function KN({
|
|
|
13948
13971
|
d += `M${o} ${r + s[g]}H${o + i}`;
|
|
13949
13972
|
const m = [], p = [];
|
|
13950
13973
|
for (let g = 0; g < e.rowHeights.length; g++)
|
|
13951
|
-
for (let
|
|
13952
|
-
const b = ((
|
|
13974
|
+
for (let f = 0; f < e.colWidths.length; f++) {
|
|
13975
|
+
const b = ((h = e.cells[g]) == null ? void 0 : h[f]) ?? "";
|
|
13953
13976
|
if (b === "") continue;
|
|
13954
|
-
const y = e.colWidths[
|
|
13977
|
+
const y = e.colWidths[f], x = o + l[f] + cn, C = r + s[g] + e.rowHeights[g] / 2 + c * 0.35, S = b.length * c * 0.55 > y - 2 * cn, N = `ole-ann-clip-${e.id}-${g}-${f}`;
|
|
13955
13978
|
S && p.push(
|
|
13956
13979
|
/* @__PURE__ */ u("clipPath", { id: N, children: /* @__PURE__ */ u(
|
|
13957
13980
|
"rect",
|
|
13958
13981
|
{
|
|
13959
|
-
x: o + l[
|
|
13982
|
+
x: o + l[f],
|
|
13960
13983
|
y: r + s[g],
|
|
13961
13984
|
width: y,
|
|
13962
13985
|
height: e.rowHeights[g]
|
|
@@ -13973,7 +13996,7 @@ function KN({
|
|
|
13973
13996
|
clipPath: S ? `url(#${N})` : void 0,
|
|
13974
13997
|
children: b
|
|
13975
13998
|
},
|
|
13976
|
-
`${g}-${
|
|
13999
|
+
`${g}-${f}`
|
|
13977
14000
|
)
|
|
13978
14001
|
);
|
|
13979
14002
|
}
|
|
@@ -13998,31 +14021,31 @@ function XN({
|
|
|
13998
14021
|
ann: e,
|
|
13999
14022
|
cell: t
|
|
14000
14023
|
}) {
|
|
14001
|
-
var
|
|
14002
|
-
const [n, o] = t, r = re(null), i = Ft(e), a = Wt(e), l = e.fontSize ?? Lt, s = ((
|
|
14024
|
+
var h;
|
|
14025
|
+
const [n, o] = t, r = re(null), i = Ft(e), a = Wt(e), l = e.fontSize ?? Lt, s = ((h = e.cells[n]) == null ? void 0 : h[o]) ?? "";
|
|
14003
14026
|
Q(() => {
|
|
14004
14027
|
const g = r.current;
|
|
14005
14028
|
g && (g.focus(), g.select());
|
|
14006
14029
|
}, [n, o]);
|
|
14007
14030
|
function c() {
|
|
14008
14031
|
var b;
|
|
14009
|
-
const g = w.getState(),
|
|
14010
|
-
if (
|
|
14032
|
+
const g = w.getState(), f = ((b = r.current) == null ? void 0 : b.value) ?? "";
|
|
14033
|
+
if (f !== s) {
|
|
14011
14034
|
const y = e.cells.map((x) => [...x]);
|
|
14012
14035
|
for (; y.length <= n; ) y.push([]);
|
|
14013
|
-
y[n][o] =
|
|
14036
|
+
y[n][o] = f, g.updateAnnotation(e.id, { cells: y });
|
|
14014
14037
|
}
|
|
14015
14038
|
}
|
|
14016
14039
|
function d() {
|
|
14017
14040
|
w.getState().setEditingAnnotation(null);
|
|
14018
14041
|
}
|
|
14019
|
-
function m(g,
|
|
14042
|
+
function m(g, f) {
|
|
14020
14043
|
const b = e.rowHeights.length, y = e.colWidths.length;
|
|
14021
|
-
if (
|
|
14044
|
+
if (f >= y ? (f = 0, g += 1) : f < 0 && (f = y - 1, g -= 1), g < 0 || g >= b) {
|
|
14022
14045
|
d();
|
|
14023
14046
|
return;
|
|
14024
14047
|
}
|
|
14025
|
-
w.getState().setEditingCell([g,
|
|
14048
|
+
w.getState().setEditingCell([g, f]);
|
|
14026
14049
|
}
|
|
14027
14050
|
function p(g) {
|
|
14028
14051
|
if (g.key === "Enter") {
|
|
@@ -14250,7 +14273,7 @@ function QN() {
|
|
|
14250
14273
|
const r = (t ?? []).find((a) => a.id === e);
|
|
14251
14274
|
if (!r) return null;
|
|
14252
14275
|
const i = (n == null ? void 0 : n.id) === e ? n : r;
|
|
14253
|
-
switch (
|
|
14276
|
+
switch (et(i)) {
|
|
14254
14277
|
// Rect and ellipse are both anchored by `at` + `size`, so one set of box
|
|
14255
14278
|
// grips drives both — no ellipse-specific resize maths.
|
|
14256
14279
|
case "rect":
|
|
@@ -14278,8 +14301,8 @@ function vn(e, t, n) {
|
|
|
14278
14301
|
}, onPointerMove: (s) => {
|
|
14279
14302
|
const c = o.current, d = Ye();
|
|
14280
14303
|
if (!c || s.pointerId !== c.pointerId || !d) return;
|
|
14281
|
-
const m = d.screenToSvg(s.clientX, s.clientY), p = me(m[0] - c.startSvg[0]),
|
|
14282
|
-
w.getState().setAnnotationPreview(t(c.orig, p,
|
|
14304
|
+
const m = d.screenToSvg(s.clientX, s.clientY), p = me(m[0] - c.startSvg[0]), h = me(m[1] - c.startSvg[1]);
|
|
14305
|
+
w.getState().setAnnotationPreview(t(c.orig, p, h, s.nativeEvent));
|
|
14283
14306
|
}, onPointerUp: (s) => {
|
|
14284
14307
|
const c = o.current;
|
|
14285
14308
|
if (!c || s.pointerId !== c.pointerId) return;
|
|
@@ -14396,11 +14419,11 @@ function n6({
|
|
|
14396
14419
|
e.dirY,
|
|
14397
14420
|
a,
|
|
14398
14421
|
l,
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
), d = Pi(i.colWidths, c.size[0] / s[0],
|
|
14422
|
+
er * i.colWidths.length,
|
|
14423
|
+
tr * i.rowHeights.length
|
|
14424
|
+
), d = Pi(i.colWidths, c.size[0] / s[0], er), m = Pi(i.rowHeights, c.size[1] / s[1], tr), p = d.reduce((f, b) => f + b, 0), h = m.reduce((f, b) => f + b, 0), g = [
|
|
14402
14425
|
e.dirX === -1 ? i.at[0] + s[0] - p : i.at[0],
|
|
14403
|
-
e.dirY === -1 ? i.at[1] + s[1] -
|
|
14426
|
+
e.dirY === -1 ? i.at[1] + s[1] - h : i.at[1]
|
|
14404
14427
|
];
|
|
14405
14428
|
return { ...i, at: g, colWidths: d, rowHeights: m };
|
|
14406
14429
|
},
|
|
@@ -14432,7 +14455,7 @@ function o6({
|
|
|
14432
14455
|
o,
|
|
14433
14456
|
(a, l) => {
|
|
14434
14457
|
const s = [...a.colWidths];
|
|
14435
|
-
return s[e] = Math.max(
|
|
14458
|
+
return s[e] = Math.max(er, a.colWidths[e] + l), { ...a, colWidths: s };
|
|
14436
14459
|
},
|
|
14437
14460
|
(a) => ({ colWidths: a.colWidths })
|
|
14438
14461
|
);
|
|
@@ -14462,7 +14485,7 @@ function r6({
|
|
|
14462
14485
|
o,
|
|
14463
14486
|
(a, l, s) => {
|
|
14464
14487
|
const c = [...a.rowHeights];
|
|
14465
|
-
return c[e] = Math.max(
|
|
14488
|
+
return c[e] = Math.max(tr, a.rowHeights[e] + s), { ...a, rowHeights: c };
|
|
14466
14489
|
},
|
|
14467
14490
|
(a) => ({ rowHeights: a.rowHeights })
|
|
14468
14491
|
);
|
|
@@ -14574,10 +14597,10 @@ function zi({
|
|
|
14574
14597
|
}, s = (d) => {
|
|
14575
14598
|
const m = a.current;
|
|
14576
14599
|
if (!m || d.pointerId !== m.pointerId || !i) return;
|
|
14577
|
-
const p = i.screenToSvg(d.clientX, d.clientY),
|
|
14578
|
-
if (
|
|
14600
|
+
const p = i.screenToSvg(d.clientX, d.clientY), h = r === "x" ? p[0] - m.startSvg[0] : p[1] - m.startSvg[1], g = k2() ? Math.round(h / Yn) * Yn : h, f = m.startSpan + (o === "end" ? g : -g);
|
|
14601
|
+
if (f < s6) return;
|
|
14579
14602
|
const b = r === "x" ? [m.startAt[0] + g / 2, m.startAt[1]] : [m.startAt[0], m.startAt[1] + g / 2];
|
|
14580
|
-
w.getState().updateBus(n, { span:
|
|
14603
|
+
w.getState().updateBus(n, { span: f, at: b });
|
|
14581
14604
|
}, c = (d) => {
|
|
14582
14605
|
const m = a.current;
|
|
14583
14606
|
!m || d.pointerId !== m.pointerId || (d.target.hasPointerCapture(d.pointerId) && d.target.releasePointerCapture(d.pointerId), a.current = null);
|
|
@@ -14597,9 +14620,9 @@ function zi({
|
|
|
14597
14620
|
}
|
|
14598
14621
|
);
|
|
14599
14622
|
}
|
|
14600
|
-
const
|
|
14623
|
+
const nr = 0.5;
|
|
14601
14624
|
function rn(e, t) {
|
|
14602
|
-
return Math.abs(e[1] - t[1]) <
|
|
14625
|
+
return Math.abs(e[1] - t[1]) < nr ? "h" : "v";
|
|
14603
14626
|
}
|
|
14604
14627
|
function c6() {
|
|
14605
14628
|
const e = w((l) => l.selectedWire), t = w((l) => l.internal.wireRenders);
|
|
@@ -14608,15 +14631,15 @@ function c6() {
|
|
|
14608
14631
|
if (!n || n.path.length < 2) return null;
|
|
14609
14632
|
const o = n.path, r = o.length, i = [];
|
|
14610
14633
|
for (let l = 1; l < r - 1; l++) {
|
|
14611
|
-
const s = rn(o[l - 1], o[l]), c = rn(o[l], o[l + 1]), d = l - 1 === 0, m = l + 1 === r - 1, p = d && s === "v" || m && c === "v",
|
|
14612
|
-
p &&
|
|
14634
|
+
const s = rn(o[l - 1], o[l]), c = rn(o[l], o[l + 1]), d = l - 1 === 0, m = l + 1 === r - 1, p = d && s === "v" || m && c === "v", h = d && s === "h" || m && c === "h";
|
|
14635
|
+
p && h || i.push(
|
|
14613
14636
|
/* @__PURE__ */ u(
|
|
14614
14637
|
d6,
|
|
14615
14638
|
{
|
|
14616
14639
|
wireId: e,
|
|
14617
14640
|
index: l,
|
|
14618
14641
|
xLocked: p,
|
|
14619
|
-
yLocked:
|
|
14642
|
+
yLocked: h
|
|
14620
14643
|
},
|
|
14621
14644
|
`v-${l}`
|
|
14622
14645
|
)
|
|
@@ -14625,7 +14648,7 @@ function c6() {
|
|
|
14625
14648
|
const a = [];
|
|
14626
14649
|
for (let l = 0; l < r - 1; l++) {
|
|
14627
14650
|
const s = o[l], c = o[l + 1];
|
|
14628
|
-
Math.abs(s[0] - c[0]) <
|
|
14651
|
+
Math.abs(s[0] - c[0]) < nr && Math.abs(s[1] - c[1]) < nr || a.push(
|
|
14629
14652
|
/* @__PURE__ */ u(
|
|
14630
14653
|
u6,
|
|
14631
14654
|
{
|
|
@@ -14649,29 +14672,29 @@ function d6({
|
|
|
14649
14672
|
yLocked: o
|
|
14650
14673
|
}) {
|
|
14651
14674
|
const r = Ye(), i = re(null), a = w((g) => {
|
|
14652
|
-
var
|
|
14653
|
-
return (
|
|
14675
|
+
var f;
|
|
14676
|
+
return (f = g.internal.wireRenders.get(e)) == null ? void 0 : f.path;
|
|
14654
14677
|
});
|
|
14655
14678
|
if (!a || t <= 0 || t >= a.length - 1) return null;
|
|
14656
14679
|
const [l, s] = a[t], c = n && !o ? "ns-resize" : !n && o ? "ew-resize" : "move", d = (g) => {
|
|
14657
14680
|
if (g.button !== 0 || (g.stopPropagation(), g.preventDefault(), !r)) return;
|
|
14658
|
-
const
|
|
14659
|
-
|
|
14681
|
+
const f = w.getState().internal.wireRenders.get(e);
|
|
14682
|
+
f && (i.current = {
|
|
14660
14683
|
pointerId: g.pointerId,
|
|
14661
|
-
startPath:
|
|
14684
|
+
startPath: f.path.map((b) => [b[0], b[1]]),
|
|
14662
14685
|
startSvg: r.screenToSvg(g.clientX, g.clientY),
|
|
14663
14686
|
index: t,
|
|
14664
14687
|
xLocked: n,
|
|
14665
14688
|
yLocked: o
|
|
14666
14689
|
}, document.body.style.cursor = c, g.target.setPointerCapture(g.pointerId));
|
|
14667
14690
|
}, m = (g) => {
|
|
14668
|
-
const
|
|
14669
|
-
if (!
|
|
14670
|
-
const b = r.screenToSvg(g.clientX, g.clientY), y =
|
|
14691
|
+
const f = i.current;
|
|
14692
|
+
if (!f || g.pointerId !== f.pointerId || !r) return;
|
|
14693
|
+
const b = r.screenToSvg(g.clientX, g.clientY), y = f.startPath, x = f.index;
|
|
14671
14694
|
if (x <= 0 || x >= y.length - 1) return;
|
|
14672
14695
|
const C = y[x], S = [
|
|
14673
|
-
|
|
14674
|
-
|
|
14696
|
+
f.xLocked ? C[0] : me(C[0] + (b[0] - f.startSvg[0])),
|
|
14697
|
+
f.yLocked ? C[1] : me(C[1] + (b[1] - f.startSvg[1]))
|
|
14675
14698
|
];
|
|
14676
14699
|
if (S[0] === C[0] && S[1] === C[1]) return;
|
|
14677
14700
|
const N = y.map((ge) => [ge[0], ge[1]]);
|
|
@@ -14681,8 +14704,8 @@ function d6({
|
|
|
14681
14704
|
const oe = rn(y[x], y[x + 1]);
|
|
14682
14705
|
x + 1 < y.length - 1 && (oe === "h" ? N[x + 1] = [y[x + 1][0], S[1]] : N[x + 1] = [S[0], y[x + 1][1]]), w.getState().updateWirePath(e, N);
|
|
14683
14706
|
}, p = (g) => {
|
|
14684
|
-
const
|
|
14685
|
-
!
|
|
14707
|
+
const f = i.current;
|
|
14708
|
+
!f || g.pointerId !== f.pointerId || (g.target.hasPointerCapture(g.pointerId) && g.target.releasePointerCapture(g.pointerId), i.current = null, document.body.style.cursor = "");
|
|
14686
14709
|
};
|
|
14687
14710
|
return /* @__PURE__ */ u(
|
|
14688
14711
|
"circle",
|
|
@@ -14698,9 +14721,9 @@ function d6({
|
|
|
14698
14721
|
onPointerCancel: p,
|
|
14699
14722
|
onDoubleClick: (g) => {
|
|
14700
14723
|
g.stopPropagation(), g.preventDefault();
|
|
14701
|
-
const
|
|
14702
|
-
if (!
|
|
14703
|
-
const b =
|
|
14724
|
+
const f = w.getState().internal.wireRenders.get(e);
|
|
14725
|
+
if (!f || f.path.length <= 2 || t <= 0 || t >= f.path.length - 1) return;
|
|
14726
|
+
const b = f.path.filter((y, x) => x !== t);
|
|
14704
14727
|
w.getState().updateWirePath(e, b);
|
|
14705
14728
|
}
|
|
14706
14729
|
}
|
|
@@ -14712,39 +14735,39 @@ function u6({
|
|
|
14712
14735
|
axis: n
|
|
14713
14736
|
}) {
|
|
14714
14737
|
const o = Ye(), r = re(null), i = w((g) => {
|
|
14715
|
-
var
|
|
14716
|
-
return (
|
|
14738
|
+
var f;
|
|
14739
|
+
return (f = g.internal.wireRenders.get(e)) == null ? void 0 : f.path;
|
|
14717
14740
|
});
|
|
14718
14741
|
if (!i || t < 0 || t >= i.length - 1) return null;
|
|
14719
14742
|
const a = i[t], l = i[t + 1], s = (a[0] + l[0]) / 2, c = (a[1] + l[1]) / 2, d = n === "h" ? "ns-resize" : "ew-resize", m = (g) => {
|
|
14720
14743
|
if (g.button !== 0 || (g.stopPropagation(), g.preventDefault(), !o)) return;
|
|
14721
|
-
const
|
|
14722
|
-
|
|
14744
|
+
const f = w.getState().internal.wireRenders.get(e);
|
|
14745
|
+
f && (r.current = {
|
|
14723
14746
|
pointerId: g.pointerId,
|
|
14724
|
-
startPath:
|
|
14747
|
+
startPath: f.path.map((b) => [b[0], b[1]]),
|
|
14725
14748
|
startSvg: o.screenToSvg(g.clientX, g.clientY),
|
|
14726
14749
|
axis: n,
|
|
14727
14750
|
segIndex: t
|
|
14728
14751
|
}, document.body.style.cursor = d, g.currentTarget.setPointerCapture(g.pointerId));
|
|
14729
14752
|
}, p = (g) => {
|
|
14730
|
-
const
|
|
14731
|
-
if (!
|
|
14732
|
-
const b = o.screenToSvg(g.clientX, g.clientY), y =
|
|
14753
|
+
const f = r.current;
|
|
14754
|
+
if (!f || g.pointerId !== f.pointerId || !o) return;
|
|
14755
|
+
const b = o.screenToSvg(g.clientX, g.clientY), y = f.startPath, x = f.segIndex;
|
|
14733
14756
|
if (x >= y.length - 1) return;
|
|
14734
14757
|
const C = y[x], S = y[x + 1], N = [];
|
|
14735
14758
|
for (let W = 0; W <= x; W++) N.push(y[W]);
|
|
14736
|
-
if (
|
|
14737
|
-
const W = me(C[1] + (b[1] -
|
|
14759
|
+
if (f.axis === "h") {
|
|
14760
|
+
const W = me(C[1] + (b[1] - f.startSvg[1]));
|
|
14738
14761
|
N.push([C[0], W]), N.push([S[0], W]);
|
|
14739
14762
|
} else {
|
|
14740
|
-
const W = me(C[0] + (b[0] -
|
|
14763
|
+
const W = me(C[0] + (b[0] - f.startSvg[0]));
|
|
14741
14764
|
N.push([W, C[1]]), N.push([W, S[1]]);
|
|
14742
14765
|
}
|
|
14743
14766
|
for (let W = x + 1; W < y.length; W++) N.push(y[W]);
|
|
14744
14767
|
w.getState().updateWirePath(e, N);
|
|
14745
|
-
},
|
|
14746
|
-
const
|
|
14747
|
-
if (!
|
|
14768
|
+
}, h = (g) => {
|
|
14769
|
+
const f = r.current;
|
|
14770
|
+
if (!f || g.pointerId !== f.pointerId) return;
|
|
14748
14771
|
const b = g.currentTarget;
|
|
14749
14772
|
b.hasPointerCapture(g.pointerId) && b.releasePointerCapture(g.pointerId), r.current = null, document.body.style.cursor = "";
|
|
14750
14773
|
};
|
|
@@ -14755,8 +14778,8 @@ function u6({
|
|
|
14755
14778
|
style: { cursor: d },
|
|
14756
14779
|
onPointerDown: m,
|
|
14757
14780
|
onPointerMove: p,
|
|
14758
|
-
onPointerUp:
|
|
14759
|
-
onPointerCancel:
|
|
14781
|
+
onPointerUp: h,
|
|
14782
|
+
onPointerCancel: h,
|
|
14760
14783
|
children: [
|
|
14761
14784
|
/* @__PURE__ */ u(
|
|
14762
14785
|
"circle",
|
|
@@ -14780,7 +14803,7 @@ function u6({
|
|
|
14780
14803
|
}
|
|
14781
14804
|
);
|
|
14782
14805
|
}
|
|
14783
|
-
const m6 = 3,
|
|
14806
|
+
const m6 = 3, zo = 12;
|
|
14784
14807
|
function V2() {
|
|
14785
14808
|
const e = de((s) => s.internal.buses), t = de((s) => s.selection), n = de((s) => s.selectedNode), o = de((s) => s.internal.nodes), r = de((s) => s.internal.terminalToNode), i = jt().props, a = new Set(t), l = /* @__PURE__ */ new Set();
|
|
14786
14809
|
if (n) {
|
|
@@ -14790,9 +14813,9 @@ function V2() {
|
|
|
14790
14813
|
!c.includes(".") && e.has(c) && l.add(c);
|
|
14791
14814
|
}
|
|
14792
14815
|
return /* @__PURE__ */ u("g", { className: "ole-bus-layer", children: Array.from(e.values()).map(({ bus: s, geometry: c }) => {
|
|
14793
|
-
const { axis: d, at: m, span: p } = c,
|
|
14816
|
+
const { axis: d, at: m, span: p } = c, h = p / 2, g = d === "x" ? m[0] - h : m[0], f = d === "x" ? m[1] : m[1] - h, b = d === "x" ? m[0] + h : m[0], y = d === "x" ? m[1] : m[1] + h, x = a.has(s.id), C = l.has(s.id), S = i[s.id];
|
|
14794
14817
|
if ((S == null ? void 0 : S.visible) === !1) return null;
|
|
14795
|
-
const N = r.get(s.id) ?? void 0, W =
|
|
14818
|
+
const N = r.get(s.id) ?? void 0, W = zo / 2, oe = d === "x" ? m[0] - h : m[0] - W, ge = d === "x" ? m[1] - W : m[1] - h, A = d === "x" ? p : zo, L = d === "x" ? zo : p;
|
|
14796
14819
|
return /* @__PURE__ */ P(
|
|
14797
14820
|
"g",
|
|
14798
14821
|
{
|
|
@@ -14801,7 +14824,7 @@ function V2() {
|
|
|
14801
14824
|
"data-node-id": N,
|
|
14802
14825
|
"data-selected": x ? "true" : void 0,
|
|
14803
14826
|
"data-node-related": C ? "true" : void 0,
|
|
14804
|
-
"data-alarm":
|
|
14827
|
+
"data-alarm": Sr(S),
|
|
14805
14828
|
"data-quality": T2(S),
|
|
14806
14829
|
className: He(s.color) ? `ole-bus ${He(s.color)}` : "ole-bus",
|
|
14807
14830
|
children: [
|
|
@@ -14820,7 +14843,7 @@ function V2() {
|
|
|
14820
14843
|
"line",
|
|
14821
14844
|
{
|
|
14822
14845
|
x1: g,
|
|
14823
|
-
y1:
|
|
14846
|
+
y1: f,
|
|
14824
14847
|
x2: b,
|
|
14825
14848
|
y2: y,
|
|
14826
14849
|
stroke: "currentColor",
|
|
@@ -14878,7 +14901,7 @@ function K2() {
|
|
|
14878
14901
|
if (l) for (const s of l.terminals) a.add(s);
|
|
14879
14902
|
}
|
|
14880
14903
|
return /* @__PURE__ */ u("g", { className: "ole-junction-layer", children: Array.from(e.values()).map(({ junction: l, world: s, degree: c }) => {
|
|
14881
|
-
const d = r.get(l.id) ?? void 0, m = t.length === 1 && t[0] === l.id, p = s[0] + g6,
|
|
14904
|
+
const d = r.get(l.id) ?? void 0, m = t.length === 1 && t[0] === l.id, p = s[0] + g6, h = s[1] + b6;
|
|
14882
14905
|
return /* @__PURE__ */ P(
|
|
14883
14906
|
"g",
|
|
14884
14907
|
{
|
|
@@ -14893,9 +14916,9 @@ function K2() {
|
|
|
14893
14916
|
/* @__PURE__ */ u("circle", { cx: s[0], cy: s[1], r: f6, fill: "transparent", className: "ole-junction-hit" }),
|
|
14894
14917
|
/* @__PURE__ */ u("circle", { cx: s[0], cy: s[1], r: h6, className: "ole-junction-dot" }),
|
|
14895
14918
|
m && /* @__PURE__ */ P("g", { className: "ole-junction-wire-handle-group", children: [
|
|
14896
|
-
/* @__PURE__ */ u("line", { x1: s[0], y1: s[1], x2: p, y2:
|
|
14897
|
-
/* @__PURE__ */ u("circle", { cx: p, cy:
|
|
14898
|
-
/* @__PURE__ */ u("circle", { cx: p, cy:
|
|
14919
|
+
/* @__PURE__ */ u("line", { x1: s[0], y1: s[1], x2: p, y2: h, className: "ole-junction-wire-handle-stem" }),
|
|
14920
|
+
/* @__PURE__ */ u("circle", { cx: p, cy: h, r: w6, fill: "transparent", className: "ole-junction-wire-handle" }),
|
|
14921
|
+
/* @__PURE__ */ u("circle", { cx: p, cy: h, r: y6, className: "ole-junction-wire-handle-dot" })
|
|
14899
14922
|
] })
|
|
14900
14923
|
]
|
|
14901
14924
|
},
|
|
@@ -14961,7 +14984,7 @@ function U2() {
|
|
|
14961
14984
|
"data-element-id": s.element.id,
|
|
14962
14985
|
"data-selected": d ? "true" : void 0,
|
|
14963
14986
|
"data-node-related": m ? "true" : void 0,
|
|
14964
|
-
"data-alarm":
|
|
14987
|
+
"data-alarm": Sr(p),
|
|
14965
14988
|
"data-quality": T2(p),
|
|
14966
14989
|
transform: ft(c),
|
|
14967
14990
|
className: He(s.element.color) ? `ole-element ${He(s.element.color)}` : "ole-element",
|
|
@@ -15029,17 +15052,17 @@ function U2() {
|
|
|
15029
15052
|
}) });
|
|
15030
15053
|
}
|
|
15031
15054
|
let Y2 = null;
|
|
15032
|
-
const
|
|
15055
|
+
const or = /* @__PURE__ */ new Set();
|
|
15033
15056
|
function zn(e) {
|
|
15034
15057
|
Y2 = e;
|
|
15035
|
-
for (const t of
|
|
15058
|
+
for (const t of or) t(e);
|
|
15036
15059
|
}
|
|
15037
15060
|
function S6() {
|
|
15038
15061
|
return Y2;
|
|
15039
15062
|
}
|
|
15040
15063
|
function _6(e) {
|
|
15041
|
-
return
|
|
15042
|
-
|
|
15064
|
+
return or.add(e), () => {
|
|
15065
|
+
or.delete(e);
|
|
15043
15066
|
};
|
|
15044
15067
|
}
|
|
15045
15068
|
function C6() {
|
|
@@ -15108,14 +15131,14 @@ function Z2() {
|
|
|
15108
15131
|
if (((d = r[i]) == null ? void 0 : d.visible) === !1) return null;
|
|
15109
15132
|
const a = o.get(i);
|
|
15110
15133
|
if (a) {
|
|
15111
|
-
const { axis: m, at: p, span:
|
|
15134
|
+
const { axis: m, at: p, span: h } = a.geometry, g = h / 2, f = m === "x" ? p[0] - g : p[0] - 4, b = m === "x" ? p[1] - 4 : p[1] - g;
|
|
15112
15135
|
return /* @__PURE__ */ u(
|
|
15113
15136
|
"rect",
|
|
15114
15137
|
{
|
|
15115
|
-
x:
|
|
15138
|
+
x: f,
|
|
15116
15139
|
y: b,
|
|
15117
|
-
width: m === "x" ?
|
|
15118
|
-
height: m === "x" ? 8 :
|
|
15140
|
+
width: m === "x" ? h : 8,
|
|
15141
|
+
height: m === "x" ? 8 : h,
|
|
15119
15142
|
fill: "none",
|
|
15120
15143
|
className: "ole-selection-rect"
|
|
15121
15144
|
},
|
|
@@ -15152,12 +15175,12 @@ function N6() {
|
|
|
15152
15175
|
if (!(a != null && a.libraryDef) || !l) return null;
|
|
15153
15176
|
const s = a.libraryDef.viewBox.trim().split(/\s+/).map(Number);
|
|
15154
15177
|
if (s.length !== 4 || s.some((S) => Number.isNaN(S))) return null;
|
|
15155
|
-
const [c, d, m, p] = s,
|
|
15178
|
+
const [c, d, m, p] = s, h = [[c, d], [c + m, d], [c + m, d + p], [c, d + p]].map(
|
|
15156
15179
|
(S) => We(S, l)
|
|
15157
|
-
), g = Math.min(...
|
|
15180
|
+
), g = Math.min(...h.map((S) => S[0])), f = Math.max(...h.map((S) => S[0])), b = Math.min(...h.map((S) => S[1])), y = Math.max(...h.map((S) => S[1])), x = [
|
|
15158
15181
|
[g, b],
|
|
15159
|
-
[
|
|
15160
|
-
[
|
|
15182
|
+
[f, b],
|
|
15183
|
+
[f, y],
|
|
15161
15184
|
[g, y]
|
|
15162
15185
|
], C = ["nwse-resize", "nesw-resize", "nwse-resize", "nesw-resize"];
|
|
15163
15186
|
return /* @__PURE__ */ P("g", { className: "ole-element-scale-handles", pointerEvents: "auto", children: [
|
|
@@ -15201,20 +15224,20 @@ function T6({
|
|
|
15201
15224
|
d.stopPropagation(), d.preventDefault();
|
|
15202
15225
|
const m = Ye();
|
|
15203
15226
|
if (!m) return;
|
|
15204
|
-
const p = m.screenToSvg(d.clientX, d.clientY),
|
|
15205
|
-
|
|
15227
|
+
const p = m.screenToSvg(d.clientX, d.clientY), h = Math.hypot(p[0] - o[0], p[1] - o[1]);
|
|
15228
|
+
h < 1 || (a.current = { pointerId: d.pointerId, startScale: r, startDist: h, opposite: o }, d.target.setPointerCapture(d.pointerId));
|
|
15206
15229
|
}, s = (d) => {
|
|
15207
15230
|
const m = a.current, p = Ye();
|
|
15208
15231
|
if (!m || d.pointerId !== m.pointerId || !p) return;
|
|
15209
|
-
const
|
|
15210
|
-
let
|
|
15211
|
-
|
|
15232
|
+
const h = p.screenToSvg(d.clientX, d.clientY), g = Math.hypot(h[0] - m.opposite[0], h[1] - m.opposite[1]);
|
|
15233
|
+
let f = m.startScale * g / m.startDist;
|
|
15234
|
+
f = Math.min(yr, Math.max(br, f)), f = Math.round(f * 100) / 100, Math.abs(f - 1) < E6 && (f = 1), w.getState().previewPlacement(e, { scale: f }), i({ scale: f, at: [h[0], h[1] - 10] });
|
|
15212
15235
|
}, c = (d, m) => {
|
|
15213
15236
|
const p = a.current;
|
|
15214
15237
|
if (!p || d.pointerId !== p.pointerId) return;
|
|
15215
15238
|
a.current = null;
|
|
15216
|
-
const
|
|
15217
|
-
|
|
15239
|
+
const h = d.target;
|
|
15240
|
+
h.hasPointerCapture(d.pointerId) && h.releasePointerCapture(d.pointerId), i(null), w.getState().endGesture(m);
|
|
15218
15241
|
};
|
|
15219
15242
|
return /* @__PURE__ */ u(
|
|
15220
15243
|
"rect",
|
|
@@ -15270,9 +15293,9 @@ function z6(e, t) {
|
|
|
15270
15293
|
o.push(a);
|
|
15271
15294
|
continue;
|
|
15272
15295
|
}
|
|
15273
|
-
const s = a[0] - i[0], c = a[1] - i[1], d = Math.hypot(s, c) || 1, m = s / d, p = c / d,
|
|
15274
|
-
for (const
|
|
15275
|
-
const b = f
|
|
15296
|
+
const s = a[0] - i[0], c = a[1] - i[1], d = Math.hypot(s, c) || 1, m = s / d, p = c / d, h = (f) => (f[0] - i[0]) * m + (f[1] - i[1]) * p, g = l.slice().sort((f, b) => h(f) - h(b));
|
|
15297
|
+
for (const f of g) {
|
|
15298
|
+
const b = h(f), y = Math.max(0, b - Mi), x = Math.min(d, b + Mi);
|
|
15276
15299
|
o.push([i[0] + m * y, i[1] + p * y]), n.push(o), o = [[i[0] + m * x, i[1] + p * x]];
|
|
15277
15300
|
}
|
|
15278
15301
|
o.push(a);
|
|
@@ -15281,78 +15304,78 @@ function z6(e, t) {
|
|
|
15281
15304
|
}
|
|
15282
15305
|
function Q2() {
|
|
15283
15306
|
var m, p;
|
|
15284
|
-
const e = de((
|
|
15285
|
-
for (const
|
|
15286
|
-
const g = t.get(
|
|
15287
|
-
g && a.set(
|
|
15288
|
-
const
|
|
15289
|
-
(m = i[kt(
|
|
15290
|
-
(p = i[kt(
|
|
15307
|
+
const e = de((h) => h.internal.wireRenders), t = de((h) => h.internal.terminalToNode), n = de((h) => h.diagram.wires), o = de((h) => h.selectedWire), r = de((h) => h.selectedNode), i = jt().props, a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
15308
|
+
for (const h of n ?? []) {
|
|
15309
|
+
const g = t.get(h.ends[0]);
|
|
15310
|
+
g && a.set(h.id, g);
|
|
15311
|
+
const f = DN(
|
|
15312
|
+
(m = i[kt(h.ends[0])]) == null ? void 0 : m.alarm,
|
|
15313
|
+
(p = i[kt(h.ends[1])]) == null ? void 0 : p.alarm
|
|
15291
15314
|
);
|
|
15292
|
-
|
|
15315
|
+
f !== "none" && l.set(h.id, f);
|
|
15293
15316
|
}
|
|
15294
|
-
const s = Array.from(e.values()).filter((
|
|
15295
|
-
for (const
|
|
15296
|
-
const g = a.get(
|
|
15297
|
-
for (let
|
|
15298
|
-
c.push({ wireId:
|
|
15317
|
+
const s = Array.from(e.values()).filter((h) => h.path.length >= 2), c = [];
|
|
15318
|
+
for (const h of s) {
|
|
15319
|
+
const g = a.get(h.wireId);
|
|
15320
|
+
for (let f = 0; f < h.path.length - 1; f++)
|
|
15321
|
+
c.push({ wireId: h.wireId, node: g, i: f, a: h.path[f], b: h.path[f + 1] });
|
|
15299
15322
|
}
|
|
15300
15323
|
const d = /* @__PURE__ */ new Map();
|
|
15301
|
-
for (let
|
|
15302
|
-
for (let g =
|
|
15303
|
-
const
|
|
15304
|
-
if (
|
|
15305
|
-
const y = P6(
|
|
15324
|
+
for (let h = 0; h < c.length; h++)
|
|
15325
|
+
for (let g = h + 1; g < c.length; g++) {
|
|
15326
|
+
const f = c[h], b = c[g];
|
|
15327
|
+
if (f.wireId === b.wireId || !(f.node && b.node && f.node !== b.node)) continue;
|
|
15328
|
+
const y = P6(f.a, f.b, b.a, b.b);
|
|
15306
15329
|
if (!y) continue;
|
|
15307
|
-
const x =
|
|
15330
|
+
const x = f.wireId < b.wireId ? f : b;
|
|
15308
15331
|
let C = d.get(x.wireId);
|
|
15309
15332
|
C || (C = /* @__PURE__ */ new Map(), d.set(x.wireId, C));
|
|
15310
15333
|
const S = C.get(x.i) ?? [];
|
|
15311
15334
|
S.push(y), C.set(x.i, S);
|
|
15312
15335
|
}
|
|
15313
|
-
return /* @__PURE__ */ u("g", { className: "ole-wire-layer", fill: "none", stroke: "currentColor", strokeWidth: 1, children: s.flatMap((
|
|
15314
|
-
const g =
|
|
15336
|
+
return /* @__PURE__ */ u("g", { className: "ole-wire-layer", fill: "none", stroke: "currentColor", strokeWidth: 1, children: s.flatMap((h) => {
|
|
15337
|
+
const g = h.path, f = g.map((W) => `${W[0]},${W[1]}`).join(" "), b = a.get(h.wireId), y = o === h.wireId, x = r != null && r === b, C = y || x ? "true" : void 0, S = d.get(h.wireId), N = S ? z6(g, S) : [g];
|
|
15315
15338
|
return [
|
|
15316
15339
|
/* @__PURE__ */ u(
|
|
15317
15340
|
"polyline",
|
|
15318
15341
|
{
|
|
15319
|
-
"data-wire-id":
|
|
15342
|
+
"data-wire-id": h.wireId,
|
|
15320
15343
|
"data-node-id": b,
|
|
15321
15344
|
className: "ole-wire-hit",
|
|
15322
|
-
points:
|
|
15345
|
+
points: f
|
|
15323
15346
|
},
|
|
15324
|
-
`hit-${
|
|
15347
|
+
`hit-${h.wireId}`
|
|
15325
15348
|
),
|
|
15326
15349
|
...N.map((W, oe) => /* @__PURE__ */ u(
|
|
15327
15350
|
"polyline",
|
|
15328
15351
|
{
|
|
15329
|
-
"data-wire-id":
|
|
15352
|
+
"data-wire-id": h.wireId,
|
|
15330
15353
|
"data-node-id": b,
|
|
15331
|
-
"data-manual":
|
|
15354
|
+
"data-manual": h.userEdited ? "true" : void 0,
|
|
15332
15355
|
"data-selected": C,
|
|
15333
|
-
"data-alarm": l.get(
|
|
15334
|
-
className: He(
|
|
15356
|
+
"data-alarm": l.get(h.wireId),
|
|
15357
|
+
className: He(h.color) ? `ole-wire ${He(h.color)}` : "ole-wire",
|
|
15335
15358
|
points: W.map((ge) => `${ge[0]},${ge[1]}`).join(" ")
|
|
15336
15359
|
},
|
|
15337
|
-
`${
|
|
15360
|
+
`${h.wireId}-${oe}`
|
|
15338
15361
|
))
|
|
15339
15362
|
];
|
|
15340
15363
|
}) });
|
|
15341
15364
|
}
|
|
15342
15365
|
let vt = null;
|
|
15343
|
-
const
|
|
15366
|
+
const rr = /* @__PURE__ */ new Set();
|
|
15344
15367
|
function ht(e) {
|
|
15345
15368
|
if (!(e === null && vt === null || e && vt && e.ref === vt.ref && e.world[0] === vt.world[0] && e.world[1] === vt.world[1])) {
|
|
15346
15369
|
vt = e;
|
|
15347
|
-
for (const t of
|
|
15370
|
+
for (const t of rr) t(e);
|
|
15348
15371
|
}
|
|
15349
15372
|
}
|
|
15350
15373
|
function M6() {
|
|
15351
15374
|
return vt;
|
|
15352
15375
|
}
|
|
15353
15376
|
function D6(e) {
|
|
15354
|
-
return
|
|
15355
|
-
|
|
15377
|
+
return rr.add(e), () => {
|
|
15378
|
+
rr.delete(e);
|
|
15356
15379
|
};
|
|
15357
15380
|
}
|
|
15358
15381
|
function O6() {
|
|
@@ -15430,7 +15453,7 @@ function yo(e) {
|
|
|
15430
15453
|
var t;
|
|
15431
15454
|
return ((t = bt(e, "data-node-id")) == null ? void 0 : t.getAttribute("data-node-id")) ?? null;
|
|
15432
15455
|
}
|
|
15433
|
-
function
|
|
15456
|
+
function ir(e) {
|
|
15434
15457
|
var t;
|
|
15435
15458
|
return ((t = bt(e, "data-wire-id")) == null ? void 0 : t.getAttribute("data-wire-id")) ?? null;
|
|
15436
15459
|
}
|
|
@@ -15587,20 +15610,20 @@ function j6() {
|
|
|
15587
15610
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
15588
15611
|
}, []);
|
|
15589
15612
|
}
|
|
15590
|
-
let
|
|
15591
|
-
const
|
|
15613
|
+
let ar = null;
|
|
15614
|
+
const sr = /* @__PURE__ */ new Set();
|
|
15592
15615
|
function H6(e) {
|
|
15593
|
-
if (e !==
|
|
15594
|
-
|
|
15595
|
-
for (const t of
|
|
15616
|
+
if (e !== ar) {
|
|
15617
|
+
ar = e;
|
|
15618
|
+
for (const t of sr) t(e);
|
|
15596
15619
|
}
|
|
15597
15620
|
}
|
|
15598
15621
|
function F6() {
|
|
15599
|
-
return
|
|
15622
|
+
return ar;
|
|
15600
15623
|
}
|
|
15601
15624
|
function W6(e) {
|
|
15602
|
-
return
|
|
15603
|
-
|
|
15625
|
+
return sr.add(e), () => {
|
|
15626
|
+
sr.delete(e);
|
|
15604
15627
|
};
|
|
15605
15628
|
}
|
|
15606
15629
|
const Di = "ole-hover-element-host", q6 = "ole-hover-terminal-on", G6 = "ole-hover-node-on";
|
|
@@ -15610,34 +15633,34 @@ function V6(e) {
|
|
|
15610
15633
|
const n = e.current;
|
|
15611
15634
|
if (!n) return;
|
|
15612
15635
|
let o = null, r = null;
|
|
15613
|
-
const i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = (p,
|
|
15614
|
-
for (const
|
|
15636
|
+
const i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = (p, h, g) => {
|
|
15637
|
+
for (const f of p) f.classList.remove(g);
|
|
15615
15638
|
p.clear();
|
|
15616
|
-
for (const
|
|
15617
|
-
|
|
15639
|
+
for (const f of h)
|
|
15640
|
+
f.classList.add(g), p.add(f);
|
|
15618
15641
|
}, s = (p) => {
|
|
15619
|
-
var g,
|
|
15642
|
+
var g, f;
|
|
15620
15643
|
if (p === o) return;
|
|
15621
|
-
o && ((g = n.querySelector(`[data-element-id="${Dn(o)}"]`)) == null || g.classList.remove(Di)), p && ((
|
|
15622
|
-
const
|
|
15644
|
+
o && ((g = n.querySelector(`[data-element-id="${Dn(o)}"]`)) == null || g.classList.remove(Di)), p && ((f = n.querySelector(`[data-element-id="${Dn(p)}"]`)) == null || f.classList.add(Di));
|
|
15645
|
+
const h = p ? Array.from(
|
|
15623
15646
|
n.querySelectorAll(
|
|
15624
15647
|
`.ole-terminal[data-element-id="${Dn(p)}"]`
|
|
15625
15648
|
)
|
|
15626
15649
|
) : [];
|
|
15627
|
-
l(i,
|
|
15650
|
+
l(i, h, q6), o = p, p ? n.setAttribute("data-hover-element", "") : n.removeAttribute("data-hover-element"), H6(p);
|
|
15628
15651
|
}, c = (p) => {
|
|
15629
15652
|
if (p === r) return;
|
|
15630
|
-
const
|
|
15653
|
+
const h = p ? Array.from(
|
|
15631
15654
|
n.querySelectorAll(
|
|
15632
15655
|
`[data-node-id="${Dn(p)}"]`
|
|
15633
15656
|
)
|
|
15634
15657
|
) : [];
|
|
15635
|
-
l(a,
|
|
15658
|
+
l(a, h, G6), r = p, p ? n.setAttribute("data-hover-node", "") : n.removeAttribute("data-hover-node");
|
|
15636
15659
|
}, d = (p) => {
|
|
15637
15660
|
s(gt(p.target));
|
|
15638
|
-
const
|
|
15661
|
+
const h = bo(p.target);
|
|
15639
15662
|
let g = null;
|
|
15640
|
-
|
|
15663
|
+
h ? g = t.getState().internal.terminalToNode.get(h) ?? null : g = yo(p.target), c(g);
|
|
15641
15664
|
}, m = () => {
|
|
15642
15665
|
s(null), c(null);
|
|
15643
15666
|
};
|
|
@@ -15662,15 +15685,15 @@ function K6(e, t, n) {
|
|
|
15662
15685
|
[l.x + l.w, l.y],
|
|
15663
15686
|
[l.x, l.y + l.h],
|
|
15664
15687
|
[l.x + l.w, l.y + l.h]
|
|
15665
|
-
].map(([
|
|
15688
|
+
].map(([h, g]) => X6([h, g], a));
|
|
15666
15689
|
let c = 1 / 0, d = -1 / 0, m = 1 / 0, p = -1 / 0;
|
|
15667
|
-
for (const [
|
|
15668
|
-
|
|
15690
|
+
for (const [h, g] of s)
|
|
15691
|
+
h < c && (c = h), h > d && (d = h), g < m && (m = g), g > p && (p = g);
|
|
15669
15692
|
On(n, c, m, d, p) && o.push(i.element.id);
|
|
15670
15693
|
}
|
|
15671
15694
|
for (const { bus: i, geometry: a } of e.buses.values()) {
|
|
15672
|
-
const { axis: l, at: s, span: c } = a, d = c / 2, m = l === "x" ? s[0] - d : s[0], p = l === "x" ? s[0] + d : s[0],
|
|
15673
|
-
On(n, m,
|
|
15695
|
+
const { axis: l, at: s, span: c } = a, d = c / 2, m = l === "x" ? s[0] - d : s[0], p = l === "x" ? s[0] + d : s[0], h = l === "x" ? s[1] : s[1] - d, g = l === "x" ? s[1] : s[1] + d;
|
|
15696
|
+
On(n, m, h, p, g) && o.push(i.id);
|
|
15674
15697
|
}
|
|
15675
15698
|
for (const { junction: i, world: a } of e.junctions.values())
|
|
15676
15699
|
On(n, a[0], a[1], a[0], a[1]) && o.push(i.id);
|
|
@@ -15713,7 +15736,7 @@ function Y6(e, t) {
|
|
|
15713
15736
|
if (r) {
|
|
15714
15737
|
const { axis: a, at: l, span: s } = r.geometry;
|
|
15715
15738
|
if (a === "x") {
|
|
15716
|
-
const p = l[0] - s / 2,
|
|
15739
|
+
const p = l[0] - s / 2, h = l[0] + s / 2, g = Math.max(p, Math.min(h, t[0]));
|
|
15717
15740
|
return { ref: e, world: [g, l[1]], isBus: !0 };
|
|
15718
15741
|
}
|
|
15719
15742
|
const c = l[1] - s / 2, d = l[1] + s / 2, m = Math.max(c, Math.min(d, t[1]));
|
|
@@ -15729,8 +15752,8 @@ const Oi = 10, Ln = (e) => Math.round(e / Oi) * Oi, Z6 = 16;
|
|
|
15729
15752
|
function tS(e, t) {
|
|
15730
15753
|
let n = e[0], o = 1 / 0;
|
|
15731
15754
|
for (let r = 0; r < e.length - 1; r++) {
|
|
15732
|
-
const [i, a] = e[r], [l, s] = e[r + 1], c = l - i, d = s - a, m = c * c + d * d, p = m === 0 ? 0 : Math.max(0, Math.min(1, ((t[0] - i) * c + (t[1] - a) * d) / m)),
|
|
15733
|
-
|
|
15755
|
+
const [i, a] = e[r], [l, s] = e[r + 1], c = l - i, d = s - a, m = c * c + d * d, p = m === 0 ? 0 : Math.max(0, Math.min(1, ((t[0] - i) * c + (t[1] - a) * d) / m)), h = i + p * c, g = a + p * d, f = (h - t[0]) ** 2 + (g - t[1]) ** 2;
|
|
15756
|
+
f < o && (o = f, n = [h, g]);
|
|
15734
15757
|
}
|
|
15735
15758
|
return n;
|
|
15736
15759
|
}
|
|
@@ -15753,7 +15776,7 @@ function an(e, t, n) {
|
|
|
15753
15776
|
const l = Y6(o, t);
|
|
15754
15777
|
if (l) return { spec: { end: o }, world: l.world, ref: o, isBus: l.isBus, create: !1 };
|
|
15755
15778
|
}
|
|
15756
|
-
let r = e ?
|
|
15779
|
+
let r = e ? ir(e) : null, i = null;
|
|
15757
15780
|
if (r) {
|
|
15758
15781
|
const l = w.getState().internal.wireRenders.get(r);
|
|
15759
15782
|
i = l ? tS(l.path, t) : t;
|
|
@@ -15784,7 +15807,7 @@ function to(e, t) {
|
|
|
15784
15807
|
return e.ref && t.ref ? e.ref === t.ref : !e.ref && !t.ref ? e.world[0] === t.world[0] && e.world[1] === t.world[1] : !1;
|
|
15785
15808
|
}
|
|
15786
15809
|
const Li = 3;
|
|
15787
|
-
function
|
|
15810
|
+
function Mo(e, t) {
|
|
15788
15811
|
return e.hostEl.querySelector(
|
|
15789
15812
|
`[data-element-label="${Be(t)}"] [data-element-label-body]`
|
|
15790
15813
|
);
|
|
@@ -15794,7 +15817,7 @@ const J6 = {
|
|
|
15794
15817
|
id: "select",
|
|
15795
15818
|
cursor: "default",
|
|
15796
15819
|
onPointerDown(e, t) {
|
|
15797
|
-
var p,
|
|
15820
|
+
var p, h, g, f, b, y, x, C, S, N, W, oe, ge, A;
|
|
15798
15821
|
if (e.button !== 0 || e.target instanceof Element && e.target.closest(".ole-bus-handle, .ole-wire-handle, .ole-annotation-handle"))
|
|
15799
15822
|
return;
|
|
15800
15823
|
const n = w.getState(), o = mn(e.target);
|
|
@@ -15806,7 +15829,7 @@ const J6 = {
|
|
|
15806
15829
|
pointerId: e.pointerId,
|
|
15807
15830
|
id: o,
|
|
15808
15831
|
startSvg: t.viewport.screenToSvg(e.clientX, e.clientY),
|
|
15809
|
-
origin: [((p = L.labelOffset) == null ? void 0 : p[0]) ?? 0, ((
|
|
15832
|
+
origin: [((p = L.labelOffset) == null ? void 0 : p[0]) ?? 0, ((h = L.labelOffset) == null ? void 0 : h[1]) ?? 0],
|
|
15810
15833
|
moved: !1
|
|
15811
15834
|
};
|
|
15812
15835
|
return;
|
|
@@ -15837,7 +15860,7 @@ const J6 = {
|
|
|
15837
15860
|
}
|
|
15838
15861
|
const i = e.target instanceof Element ? e.target.closest(".ole-junction-wire-handle") : null;
|
|
15839
15862
|
if (i) {
|
|
15840
|
-
const L = (
|
|
15863
|
+
const L = (f = i.closest("[data-junction-id]")) == null ? void 0 : f.getAttribute("data-junction-id");
|
|
15841
15864
|
if (L) {
|
|
15842
15865
|
e.preventDefault(), e.stopPropagation(), e.target instanceof Element && ((y = (b = e.target).hasPointerCapture) != null && y.call(b, e.pointerId)) && e.target.releasePointerCapture(e.pointerId), t.hostEl.classList.add("tool-wire"), n.setWireFromTerminal(L);
|
|
15843
15866
|
const H = (x = n.internal.junctions.get(L)) == null ? void 0 : x.world;
|
|
@@ -15859,7 +15882,7 @@ const J6 = {
|
|
|
15859
15882
|
}
|
|
15860
15883
|
let s = gt(e.target);
|
|
15861
15884
|
if (!s) {
|
|
15862
|
-
const L =
|
|
15885
|
+
const L = ir(e.target);
|
|
15863
15886
|
if (L && typeof document < "u") {
|
|
15864
15887
|
const H = document.elementsFromPoint(e.clientX, e.clientY);
|
|
15865
15888
|
for (const V of H) {
|
|
@@ -15872,7 +15895,7 @@ const J6 = {
|
|
|
15872
15895
|
}
|
|
15873
15896
|
}
|
|
15874
15897
|
if (!s) {
|
|
15875
|
-
const L =
|
|
15898
|
+
const L = ir(e.target);
|
|
15876
15899
|
if (L) {
|
|
15877
15900
|
if (e.preventDefault(), e.altKey) {
|
|
15878
15901
|
const H = yo(e.target);
|
|
@@ -15902,7 +15925,7 @@ const J6 = {
|
|
|
15902
15925
|
if (Ce && e.pointerId === Ce.pointerId) {
|
|
15903
15926
|
const n = t.viewport.screenToSvg(e.clientX, e.clientY), o = me(n[0] - Ce.startSvg[0]), r = me(n[1] - Ce.startSvg[1]);
|
|
15904
15927
|
!Ce.moved && (o !== 0 || r !== 0) && (Ce.moved = !0, t.hostEl.hasPointerCapture(e.pointerId) || t.hostEl.setPointerCapture(e.pointerId));
|
|
15905
|
-
const i =
|
|
15928
|
+
const i = Mo(t, Ce.id);
|
|
15906
15929
|
i && i.setAttribute("transform", `translate(${o} ${r})`);
|
|
15907
15930
|
return;
|
|
15908
15931
|
}
|
|
@@ -15970,7 +15993,7 @@ const J6 = {
|
|
|
15970
15993
|
var n;
|
|
15971
15994
|
if (Ce && e.pointerId === Ce.pointerId) {
|
|
15972
15995
|
t.hostEl.hasPointerCapture(e.pointerId) && t.hostEl.releasePointerCapture(e.pointerId);
|
|
15973
|
-
const o = t.viewport.screenToSvg(e.clientX, e.clientY), r = me(o[0] - Ce.startSvg[0]), i = me(o[1] - Ce.startSvg[1]), a =
|
|
15996
|
+
const o = t.viewport.screenToSvg(e.clientX, e.clientY), r = me(o[0] - Ce.startSvg[0]), i = me(o[1] - Ce.startSvg[1]), a = Mo(t, Ce.id);
|
|
15974
15997
|
if (a && a.removeAttribute("transform"), Ce.moved && (r !== 0 || i !== 0)) {
|
|
15975
15998
|
const l = [
|
|
15976
15999
|
Ce.origin[0] + r,
|
|
@@ -16061,7 +16084,7 @@ const J6 = {
|
|
|
16061
16084
|
onPointerCancel(e, t) {
|
|
16062
16085
|
var n, o, r, i, a, l, s, c;
|
|
16063
16086
|
if (Ce && e.pointerId === Ce.pointerId) {
|
|
16064
|
-
const d =
|
|
16087
|
+
const d = Mo(t, Ce.id);
|
|
16065
16088
|
if (d && d.removeAttribute("transform"), (o = (n = t.hostEl).hasPointerCapture) != null && o.call(n, e.pointerId))
|
|
16066
16089
|
try {
|
|
16067
16090
|
t.hostEl.releasePointerCapture(e.pointerId);
|
|
@@ -16156,9 +16179,9 @@ function Bi(e, t, n, o) {
|
|
|
16156
16179
|
l.set(m, [p.geometry.at[0], p.geometry.at[1]]);
|
|
16157
16180
|
continue;
|
|
16158
16181
|
}
|
|
16159
|
-
const
|
|
16160
|
-
if (
|
|
16161
|
-
s.set(m, [
|
|
16182
|
+
const h = i.junctions.get(m);
|
|
16183
|
+
if (h) {
|
|
16184
|
+
s.set(m, [h.world[0], h.world[1]]);
|
|
16162
16185
|
continue;
|
|
16163
16186
|
}
|
|
16164
16187
|
const g = i.layout.get(m);
|
|
@@ -16166,7 +16189,7 @@ function Bi(e, t, n, o) {
|
|
|
16166
16189
|
}
|
|
16167
16190
|
const d = r.diagram.annotations ?? [];
|
|
16168
16191
|
for (const m of o) {
|
|
16169
|
-
const p = d.find((
|
|
16192
|
+
const p = d.find((h) => h.id === m);
|
|
16170
16193
|
p && c.set(m, [p.at[0], p.at[1]]);
|
|
16171
16194
|
}
|
|
16172
16195
|
return a.size === 0 && l.size === 0 && s.size === 0 && c.size === 0 ? !1 : (he = {
|
|
@@ -16180,7 +16203,7 @@ function Bi(e, t, n, o) {
|
|
|
16180
16203
|
}, !0);
|
|
16181
16204
|
}
|
|
16182
16205
|
function Ri(e, t, n) {
|
|
16183
|
-
const o =
|
|
16206
|
+
const o = et(t);
|
|
16184
16207
|
if (o === "table") {
|
|
16185
16208
|
const r = WN(t, n);
|
|
16186
16209
|
r && (e.setEditingAnnotation(t.id), e.setEditingCell(r));
|
|
@@ -16751,48 +16774,48 @@ function b4(e, t) {
|
|
|
16751
16774
|
if (!r) return;
|
|
16752
16775
|
const i = o ? "pan" : n, a = o ? Zi.pan : Zi[n], l = { viewport: t, hostEl: r };
|
|
16753
16776
|
r.dataset.tool = i, (g = a.onActivate) == null || g.call(a, l), a.cursor && (r.style.cursor = a.cursor);
|
|
16754
|
-
const s = (
|
|
16777
|
+
const s = (f) => {
|
|
16755
16778
|
var b;
|
|
16756
|
-
return (b = a.onPointerDown) == null ? void 0 : b.call(a,
|
|
16757
|
-
}, c = (
|
|
16779
|
+
return (b = a.onPointerDown) == null ? void 0 : b.call(a, f, l);
|
|
16780
|
+
}, c = (f) => {
|
|
16758
16781
|
var b;
|
|
16759
|
-
return (b = a.onPointerMove) == null ? void 0 : b.call(a,
|
|
16760
|
-
}, d = (
|
|
16782
|
+
return (b = a.onPointerMove) == null ? void 0 : b.call(a, f, l);
|
|
16783
|
+
}, d = (f) => {
|
|
16761
16784
|
var b;
|
|
16762
|
-
return (b = a.onPointerUp) == null ? void 0 : b.call(a,
|
|
16763
|
-
}, m = (
|
|
16785
|
+
return (b = a.onPointerUp) == null ? void 0 : b.call(a, f, l);
|
|
16786
|
+
}, m = (f) => {
|
|
16764
16787
|
var b;
|
|
16765
|
-
return a.onPointerCancel ? a.onPointerCancel(
|
|
16766
|
-
}, p = (
|
|
16788
|
+
return a.onPointerCancel ? a.onPointerCancel(f, l) : (b = a.onPointerUp) == null ? void 0 : b.call(a, f, l);
|
|
16789
|
+
}, p = (f) => {
|
|
16767
16790
|
var b;
|
|
16768
|
-
return (b = a.onPointerLeave) == null ? void 0 : b.call(a,
|
|
16769
|
-
},
|
|
16791
|
+
return (b = a.onPointerLeave) == null ? void 0 : b.call(a, f, l);
|
|
16792
|
+
}, h = (f) => {
|
|
16770
16793
|
var b;
|
|
16771
|
-
return (b = a.onDoubleClick) == null ? void 0 : b.call(a,
|
|
16794
|
+
return (b = a.onDoubleClick) == null ? void 0 : b.call(a, f, l);
|
|
16772
16795
|
};
|
|
16773
|
-
return r.addEventListener("pointerdown", s), r.addEventListener("pointermove", c), r.addEventListener("pointerup", d), r.addEventListener("pointercancel", m), r.addEventListener("pointerleave", p), r.addEventListener("dblclick",
|
|
16774
|
-
var
|
|
16775
|
-
r.removeEventListener("pointerdown", s), r.removeEventListener("pointermove", c), r.removeEventListener("pointerup", d), r.removeEventListener("pointercancel", m), r.removeEventListener("pointerleave", p), r.removeEventListener("dblclick",
|
|
16796
|
+
return r.addEventListener("pointerdown", s), r.addEventListener("pointermove", c), r.addEventListener("pointerup", d), r.addEventListener("pointercancel", m), r.addEventListener("pointerleave", p), r.addEventListener("dblclick", h), () => {
|
|
16797
|
+
var f;
|
|
16798
|
+
r.removeEventListener("pointerdown", s), r.removeEventListener("pointermove", c), r.removeEventListener("pointerup", d), r.removeEventListener("pointercancel", m), r.removeEventListener("pointerleave", p), r.removeEventListener("dblclick", h), (f = a.onDeactivate) == null || f.call(a, l), r.style.cursor = "", delete r.dataset.tool;
|
|
16776
16799
|
};
|
|
16777
16800
|
}, [n, o, e, t]);
|
|
16778
16801
|
}
|
|
16779
|
-
let
|
|
16780
|
-
const
|
|
16802
|
+
let lr = 1;
|
|
16803
|
+
const cr = /* @__PURE__ */ new Set();
|
|
16781
16804
|
function y4(e) {
|
|
16782
|
-
if (e !==
|
|
16783
|
-
|
|
16784
|
-
for (const t of
|
|
16805
|
+
if (e !== lr) {
|
|
16806
|
+
lr = e;
|
|
16807
|
+
for (const t of cr) t(e);
|
|
16785
16808
|
}
|
|
16786
16809
|
}
|
|
16787
16810
|
function w4() {
|
|
16788
|
-
return
|
|
16811
|
+
return lr;
|
|
16789
16812
|
}
|
|
16790
16813
|
function v4(e) {
|
|
16791
|
-
return
|
|
16792
|
-
|
|
16814
|
+
return cr.add(e), () => {
|
|
16815
|
+
cr.delete(e);
|
|
16793
16816
|
};
|
|
16794
16817
|
}
|
|
16795
|
-
const
|
|
16818
|
+
const Do = 0.1, Oo = 8, x4 = 1.0015, k4 = 1.02;
|
|
16796
16819
|
function iS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
|
|
16797
16820
|
const r = o.shared ?? !0, i = re({ ...n }), a = re(/* @__PURE__ */ new Set()), l = () => {
|
|
16798
16821
|
const s = t.current, c = e.current;
|
|
@@ -16807,7 +16830,7 @@ function iS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
|
|
|
16807
16830
|
return Q(() => {
|
|
16808
16831
|
const s = e.current;
|
|
16809
16832
|
if (!s) return;
|
|
16810
|
-
let c = !1, d = -1, m = 0, p = 0,
|
|
16833
|
+
let c = !1, d = -1, m = 0, p = 0, h = 0, g = 0, f = !1;
|
|
16811
16834
|
const b = /* @__PURE__ */ new Map();
|
|
16812
16835
|
let y = null, x = !1;
|
|
16813
16836
|
const C = () => {
|
|
@@ -16845,7 +16868,7 @@ function iS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
|
|
|
16845
16868
|
F.stopPropagation();
|
|
16846
16869
|
const K = [...b.values()];
|
|
16847
16870
|
if (K.length < 2) return;
|
|
16848
|
-
const se = K[1].x - K[0].x, be = K[1].y - K[0].y, ce = Math.hypot(se, be) || 1, ye = s.getBoundingClientRect(), ue = (K[0].x + K[1].x) / 2 - ye.left, ve = (K[0].y + K[1].y) / 2 - ye.top, Ee = ce / y.startDist, Fe =
|
|
16871
|
+
const se = K[1].x - K[0].x, be = K[1].y - K[0].y, ce = Math.hypot(se, be) || 1, ye = s.getBoundingClientRect(), ue = (K[0].x + K[1].x) / 2 - ye.left, ve = (K[0].y + K[1].y) / 2 - ye.top, Ee = ce / y.startDist, Fe = Lo(y.startScale * Ee, Do, Oo), qt = Fe / y.startScale;
|
|
16849
16872
|
i.current.tx = y.startMidX - (y.startMidX - y.startTx) * qt + (ue - y.startMidX), i.current.ty = y.startMidY - (y.startMidY - y.startTy) * qt + (ve - y.startMidY), i.current.scale = Fe, l();
|
|
16850
16873
|
}, W = (F) => {
|
|
16851
16874
|
var K;
|
|
@@ -16861,26 +16884,26 @@ function iS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
|
|
|
16861
16884
|
F.preventDefault();
|
|
16862
16885
|
const K = s.getBoundingClientRect(), se = F.clientX - K.left, be = F.clientY - K.top, ce = F.ctrlKey || F.metaKey;
|
|
16863
16886
|
if (F.deltaX === 0 || ce) {
|
|
16864
|
-
const ve = Math.pow(ce ? k4 : x4, -F.deltaY), Ee =
|
|
16887
|
+
const ve = Math.pow(ce ? k4 : x4, -F.deltaY), Ee = Lo(i.current.scale * ve, Do, Oo), Fe = Ee / i.current.scale;
|
|
16865
16888
|
i.current.tx = se - (se - i.current.tx) * Fe, i.current.ty = be - (be - i.current.ty) * Fe, i.current.scale = Ee;
|
|
16866
16889
|
} else
|
|
16867
16890
|
i.current.tx -= F.deltaX, i.current.ty -= F.deltaY;
|
|
16868
16891
|
l();
|
|
16869
16892
|
}, ge = (F) => {
|
|
16870
|
-
const K = F.button === 1, se =
|
|
16871
|
-
!K && !se || (F.preventDefault(), c = !0, d = F.pointerId, m = F.clientX, p = F.clientY,
|
|
16893
|
+
const K = F.button === 1, se = f && F.button === 0;
|
|
16894
|
+
!K && !se || (F.preventDefault(), c = !0, d = F.pointerId, m = F.clientX, p = F.clientY, h = i.current.tx, g = i.current.ty, s.setPointerCapture(F.pointerId), s.style.cursor = "grabbing");
|
|
16872
16895
|
}, A = (F) => {
|
|
16873
|
-
!c || F.pointerId !== d || (i.current.tx =
|
|
16896
|
+
!c || F.pointerId !== d || (i.current.tx = h + (F.clientX - m), i.current.ty = g + (F.clientY - p), l());
|
|
16874
16897
|
}, L = (F) => {
|
|
16875
|
-
c && F.pointerId === d && (c = !1, s.releasePointerCapture(F.pointerId), s.style.cursor =
|
|
16898
|
+
c && F.pointerId === d && (c = !1, s.releasePointerCapture(F.pointerId), s.style.cursor = f ? "grab" : "");
|
|
16876
16899
|
}, H = (F) => {
|
|
16877
|
-
if (F.code === "Space" && !
|
|
16900
|
+
if (F.code === "Space" && !f) {
|
|
16878
16901
|
const K = F.target;
|
|
16879
16902
|
if (K && (K.tagName === "INPUT" || K.tagName === "TEXTAREA" || K.isContentEditable)) return;
|
|
16880
|
-
|
|
16903
|
+
f = !0, s.style.cursor = "grab", F.preventDefault();
|
|
16881
16904
|
}
|
|
16882
16905
|
}, V = (F) => {
|
|
16883
|
-
F.code === "Space" && (
|
|
16906
|
+
F.code === "Space" && (f = !1, c || (s.style.cursor = ""));
|
|
16884
16907
|
};
|
|
16885
16908
|
return s.addEventListener("wheel", oe, { passive: !1 }), s.addEventListener("pointerdown", ge), s.addEventListener("pointermove", A), s.addEventListener("pointerup", L), s.addEventListener("pointercancel", L), s.addEventListener("pointerdown", S, { capture: !0 }), s.addEventListener("pointermove", N, { capture: !0 }), s.addEventListener("pointerup", W, { capture: !0 }), s.addEventListener("pointercancel", W, { capture: !0 }), window.addEventListener("keydown", H), window.addEventListener("keyup", V), l(), () => {
|
|
16886
16909
|
s.removeEventListener("wheel", oe), s.removeEventListener("pointerdown", ge), s.removeEventListener("pointermove", A), s.removeEventListener("pointerup", L), s.removeEventListener("pointercancel", L), s.removeEventListener("pointerdown", S, { capture: !0 }), s.removeEventListener("pointermove", N, { capture: !0 }), s.removeEventListener("pointerup", W, { capture: !0 }), s.removeEventListener("pointercancel", W, { capture: !0 }), window.removeEventListener("keydown", H), window.removeEventListener("keyup", V);
|
|
@@ -16889,14 +16912,14 @@ function iS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
|
|
|
16889
16912
|
screenToSvg(s, c) {
|
|
16890
16913
|
const d = e.current;
|
|
16891
16914
|
if (!d) return [s, c];
|
|
16892
|
-
const m = d.getBoundingClientRect(), p = (s - m.left - i.current.tx) / i.current.scale,
|
|
16893
|
-
return [p,
|
|
16915
|
+
const m = d.getBoundingClientRect(), p = (s - m.left - i.current.tx) / i.current.scale, h = (c - m.top - i.current.ty) / i.current.scale;
|
|
16916
|
+
return [p, h];
|
|
16894
16917
|
},
|
|
16895
16918
|
getViewport() {
|
|
16896
16919
|
return { ...i.current };
|
|
16897
16920
|
},
|
|
16898
16921
|
setViewport(s) {
|
|
16899
|
-
s.tx !== void 0 && (i.current.tx = s.tx), s.ty !== void 0 && (i.current.ty = s.ty), s.scale !== void 0 && (i.current.scale =
|
|
16922
|
+
s.tx !== void 0 && (i.current.tx = s.tx), s.ty !== void 0 && (i.current.ty = s.ty), s.scale !== void 0 && (i.current.scale = Lo(s.scale, Do, Oo)), l();
|
|
16900
16923
|
},
|
|
16901
16924
|
subscribe(s) {
|
|
16902
16925
|
return a.current.add(s), () => {
|
|
@@ -16906,14 +16929,14 @@ function iS(e, t, n = { tx: 0, ty: 0, scale: 1 }, o = {}) {
|
|
|
16906
16929
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16907
16930
|
}), []);
|
|
16908
16931
|
}
|
|
16909
|
-
function
|
|
16932
|
+
function Lo(e, t, n) {
|
|
16910
16933
|
return e < t ? t : e > n ? n : e;
|
|
16911
16934
|
}
|
|
16912
|
-
const aS = typeof navigator < "u" && /Mac|iP(ad|hone|od)/.test(navigator.platform), Nt = aS ? "⌘" : "Ctrl+", S4 = aS ? "⇧" : "Shift+",
|
|
16935
|
+
const aS = typeof navigator < "u" && /Mac|iP(ad|hone|od)/.test(navigator.platform), Nt = aS ? "⌘" : "Ctrl+", S4 = aS ? "⇧" : "Shift+", Bo = [10, 20, 50, 100, 200, 500, 1e3, 2e3, 5e3, 1e4], _4 = 18;
|
|
16913
16936
|
function C4(e) {
|
|
16914
|
-
for (const t of
|
|
16937
|
+
for (const t of Bo)
|
|
16915
16938
|
if (t * e >= _4) return t;
|
|
16916
|
-
return
|
|
16939
|
+
return Bo[Bo.length - 1];
|
|
16917
16940
|
}
|
|
16918
16941
|
function $4() {
|
|
16919
16942
|
const e = ae(), t = re(null), n = re(null), o = re(null), r = iS(t, n);
|
|
@@ -16928,21 +16951,21 @@ function $4() {
|
|
|
16928
16951
|
}, [r]);
|
|
16929
16952
|
const i = U_(), a = Mt(
|
|
16930
16953
|
(d, m, p) => {
|
|
16931
|
-
const
|
|
16932
|
-
if (
|
|
16933
|
-
const g =
|
|
16954
|
+
const h = w.getState();
|
|
16955
|
+
if (h.readOnly) return;
|
|
16956
|
+
const g = h.activeTool;
|
|
16934
16957
|
if (g === "wire" || g === "busbar" || g === "junction" || g === "place") {
|
|
16935
16958
|
eS();
|
|
16936
16959
|
return;
|
|
16937
16960
|
}
|
|
16938
|
-
const
|
|
16939
|
-
if (
|
|
16940
|
-
|
|
16961
|
+
const f = pn(p), b = f ? null : mn(p) ?? gt(p);
|
|
16962
|
+
if (f)
|
|
16963
|
+
h.selectedAnnotations.includes(f) || h.setSelectedAnnotation(f);
|
|
16941
16964
|
else if (b)
|
|
16942
|
-
|
|
16965
|
+
h.selection.includes(b) || h.setSelection([b]);
|
|
16943
16966
|
else {
|
|
16944
16967
|
const H = yo(p);
|
|
16945
|
-
H &&
|
|
16968
|
+
H && h.selectedNode !== H && h.setSelectedNode(H);
|
|
16946
16969
|
}
|
|
16947
16970
|
const y = w.getState(), x = y.selection.length > 0, C = y.selectedAnnotations.length > 0, S = x || C, N = y.selectedNode != null, W = !!y.clipboard, oe = y.diagram.elements.length > 0, ge = new Set(y.selection), A = y.diagram.elements.some(
|
|
16948
16971
|
(H) => ge.has(H.id) && H.labelOffset !== void 0
|
|
@@ -16957,7 +16980,7 @@ function $4() {
|
|
|
16957
16980
|
{
|
|
16958
16981
|
label: e("menu.redo"),
|
|
16959
16982
|
shortcut: `${Nt}${S4}Z`,
|
|
16960
|
-
icon:
|
|
16983
|
+
icon: fr,
|
|
16961
16984
|
onSelect: () => w.getState().redo(),
|
|
16962
16985
|
disabled: y.future.length === 0
|
|
16963
16986
|
},
|
|
@@ -17036,28 +17059,28 @@ function $4() {
|
|
|
17036
17059
|
const d = t.current;
|
|
17037
17060
|
if (!d) return;
|
|
17038
17061
|
const m = 700, p = 4;
|
|
17039
|
-
let
|
|
17040
|
-
const
|
|
17041
|
-
|
|
17062
|
+
let h, g = null;
|
|
17063
|
+
const f = () => {
|
|
17064
|
+
h !== void 0 && window.clearTimeout(h), h = void 0, g = null;
|
|
17042
17065
|
}, b = (C) => {
|
|
17043
|
-
C.pointerType === "touch" && (
|
|
17066
|
+
C.pointerType === "touch" && (f(), g = {
|
|
17044
17067
|
pointerId: C.pointerId,
|
|
17045
17068
|
x: C.clientX,
|
|
17046
17069
|
y: C.clientY,
|
|
17047
17070
|
target: C.target
|
|
17048
|
-
},
|
|
17071
|
+
}, h = window.setTimeout(() => {
|
|
17049
17072
|
const S = g;
|
|
17050
|
-
g = null,
|
|
17073
|
+
g = null, h = void 0, S && (J2(d, S.pointerId), a(S.x, S.y, S.target));
|
|
17051
17074
|
}, m));
|
|
17052
17075
|
}, y = (C) => {
|
|
17053
17076
|
if (!g || C.pointerId !== g.pointerId) return;
|
|
17054
17077
|
const S = C.clientX - g.x, N = C.clientY - g.y;
|
|
17055
|
-
Math.hypot(S, N) > p &&
|
|
17078
|
+
Math.hypot(S, N) > p && f();
|
|
17056
17079
|
}, x = (C) => {
|
|
17057
|
-
!g || C.pointerId !== g.pointerId ||
|
|
17080
|
+
!g || C.pointerId !== g.pointerId || f();
|
|
17058
17081
|
};
|
|
17059
17082
|
return d.addEventListener("pointerdown", b), d.addEventListener("pointermove", y), d.addEventListener("pointerup", x), d.addEventListener("pointercancel", x), () => {
|
|
17060
|
-
|
|
17083
|
+
f(), d.removeEventListener("pointerdown", b), d.removeEventListener("pointermove", y), d.removeEventListener("pointerup", x), d.removeEventListener("pointercancel", x);
|
|
17061
17084
|
};
|
|
17062
17085
|
}, [a]), /* @__PURE__ */ u(
|
|
17063
17086
|
"div",
|
|
@@ -17154,18 +17177,18 @@ function Wn(e, t) {
|
|
|
17154
17177
|
Array.from(o, (x) => x.getBoundingClientRect())
|
|
17155
17178
|
);
|
|
17156
17179
|
if (!r) return !1;
|
|
17157
|
-
const { left: i, top: a, right: l, bottom: s } = r, [c, d] = e.screenToSvg(i, a), [m, p] = e.screenToSvg(l, s),
|
|
17180
|
+
const { left: i, top: a, right: l, bottom: s } = r, [c, d] = e.screenToSvg(i, a), [m, p] = e.screenToSvg(l, s), h = Math.max(m - c, 1), g = Math.max(p - d, 1), f = P4(
|
|
17158
17181
|
Math.min(
|
|
17159
|
-
(n.width - Qi * 2) /
|
|
17182
|
+
(n.width - Qi * 2) / h,
|
|
17160
17183
|
(n.height - Qi * 2) / g
|
|
17161
17184
|
),
|
|
17162
17185
|
A4,
|
|
17163
17186
|
E4
|
|
17164
17187
|
), b = (c + m) / 2, y = (d + p) / 2;
|
|
17165
17188
|
return e.setViewport({
|
|
17166
|
-
tx: n.width / 2 -
|
|
17167
|
-
ty: n.height / 2 -
|
|
17168
|
-
scale:
|
|
17189
|
+
tx: n.width / 2 - f * b,
|
|
17190
|
+
ty: n.height / 2 - f * y,
|
|
17191
|
+
scale: f
|
|
17169
17192
|
}), !0;
|
|
17170
17193
|
}
|
|
17171
17194
|
function lS() {
|
|
@@ -17185,10 +17208,10 @@ function ea() {
|
|
|
17185
17208
|
if (window.clearTimeout(l.current), o(!1), i(null), !!e)
|
|
17186
17209
|
return l.current = window.setTimeout(() => o(!0), M4), () => window.clearTimeout(l.current);
|
|
17187
17210
|
}, [e]);
|
|
17188
|
-
const c = w((g) => e ? g.diagram.elements.find((
|
|
17211
|
+
const c = w((g) => e ? g.diagram.elements.find((f) => f.id === e) ?? null : null);
|
|
17189
17212
|
if (Dt(() => {
|
|
17190
17213
|
if (!n || !e) return;
|
|
17191
|
-
let g = 0,
|
|
17214
|
+
let g = 0, f = -1, b = -1;
|
|
17192
17215
|
const y = () => {
|
|
17193
17216
|
const x = document.querySelector(
|
|
17194
17217
|
`[data-element-id="${O4(e)}"]`
|
|
@@ -17198,13 +17221,13 @@ function ea() {
|
|
|
17198
17221
|
let N = S.bottom + Ji;
|
|
17199
17222
|
N + C.offsetHeight > window.innerHeight - 4 && (N = S.top - C.offsetHeight - Ji);
|
|
17200
17223
|
let W = S.left + S.width / 2 - C.offsetWidth / 2;
|
|
17201
|
-
W = Math.max(4, Math.min(W, window.innerWidth - C.offsetWidth - 4)), (N !==
|
|
17224
|
+
W = Math.max(4, Math.min(W, window.innerWidth - C.offsetWidth - 4)), (N !== f || W !== b) && (i({ top: N, left: W }), f = N, b = W);
|
|
17202
17225
|
}
|
|
17203
17226
|
g = requestAnimationFrame(y);
|
|
17204
17227
|
};
|
|
17205
17228
|
return g = requestAnimationFrame(y), () => cancelAnimationFrame(g);
|
|
17206
17229
|
}, [n, e]), s || !n || !e || !c) return null;
|
|
17207
|
-
const d = _t[c.kind], m = c.name ?? c.id, p = (d == null ? void 0 : d.name) ?? c.kind,
|
|
17230
|
+
const d = _t[c.kind], m = c.name ?? c.id, p = (d == null ? void 0 : d.name) ?? c.kind, h = c.name && c.name !== c.id;
|
|
17208
17231
|
return typeof document > "u" ? null : Ia(
|
|
17209
17232
|
/* @__PURE__ */ P(
|
|
17210
17233
|
"div",
|
|
@@ -17220,7 +17243,7 @@ function ea() {
|
|
|
17220
17243
|
},
|
|
17221
17244
|
children: [
|
|
17222
17245
|
/* @__PURE__ */ u("span", { className: "font-medium text-foreground", children: m }),
|
|
17223
|
-
|
|
17246
|
+
h && /* @__PURE__ */ u("span", { className: "font-mono text-[10px] text-muted-foreground", children: c.id }),
|
|
17224
17247
|
/* @__PURE__ */ u("span", { className: "text-muted-foreground/80", children: "·" }),
|
|
17225
17248
|
/* @__PURE__ */ u("span", { className: "text-muted-foreground", children: p })
|
|
17226
17249
|
]
|
|
@@ -17326,16 +17349,16 @@ const na = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, oa = Va, X
|
|
|
17326
17349
|
let [m, p] = d;
|
|
17327
17350
|
return p === void 0 || (c[m] = p), c;
|
|
17328
17351
|
}, {}), s = t == null || (o = t.compoundVariants) === null || o === void 0 ? void 0 : o.reduce((c, d) => {
|
|
17329
|
-
let { class: m, className: p, ...
|
|
17330
|
-
return Object.entries(
|
|
17331
|
-
let [
|
|
17352
|
+
let { class: m, className: p, ...h } = d;
|
|
17353
|
+
return Object.entries(h).every((g) => {
|
|
17354
|
+
let [f, b] = g;
|
|
17332
17355
|
return Array.isArray(b) ? b.includes({
|
|
17333
17356
|
...i,
|
|
17334
17357
|
...l
|
|
17335
|
-
}[
|
|
17358
|
+
}[f]) : {
|
|
17336
17359
|
...i,
|
|
17337
17360
|
...l
|
|
17338
|
-
}[
|
|
17361
|
+
}[f] === b;
|
|
17339
17362
|
}) ? [
|
|
17340
17363
|
...c,
|
|
17341
17364
|
m,
|
|
@@ -17387,7 +17410,7 @@ function ze({
|
|
|
17387
17410
|
}) {
|
|
17388
17411
|
const r = re(null), i = re(null), [a, l] = fe(!1), [s, c] = fe(null), d = VS(), m = re(void 0), p = () => {
|
|
17389
17412
|
n || (window.clearTimeout(m.current), m.current = window.setTimeout(() => l(!0), o));
|
|
17390
|
-
},
|
|
17413
|
+
}, h = () => {
|
|
17391
17414
|
window.clearTimeout(m.current), l(!1);
|
|
17392
17415
|
};
|
|
17393
17416
|
Dt(() => {
|
|
@@ -17406,7 +17429,7 @@ function ze({
|
|
|
17406
17429
|
window.removeEventListener("keydown", y), window.removeEventListener("scroll", x, !0), window.removeEventListener("resize", x);
|
|
17407
17430
|
};
|
|
17408
17431
|
}, [a]);
|
|
17409
|
-
const g = t,
|
|
17432
|
+
const g = t, f = g.props, b = KS(g, {
|
|
17410
17433
|
ref: (y) => {
|
|
17411
17434
|
r.current = y;
|
|
17412
17435
|
const x = g.ref;
|
|
@@ -17414,21 +17437,21 @@ function ze({
|
|
|
17414
17437
|
},
|
|
17415
17438
|
onPointerEnter: (y) => {
|
|
17416
17439
|
var x;
|
|
17417
|
-
(x =
|
|
17440
|
+
(x = f.onPointerEnter) == null || x.call(f, y), p();
|
|
17418
17441
|
},
|
|
17419
17442
|
onPointerLeave: (y) => {
|
|
17420
17443
|
var x;
|
|
17421
|
-
(x =
|
|
17444
|
+
(x = f.onPointerLeave) == null || x.call(f, y), h();
|
|
17422
17445
|
},
|
|
17423
17446
|
onFocus: (y) => {
|
|
17424
17447
|
var x;
|
|
17425
|
-
(x =
|
|
17448
|
+
(x = f.onFocus) == null || x.call(f, y), p();
|
|
17426
17449
|
},
|
|
17427
17450
|
onBlur: (y) => {
|
|
17428
17451
|
var x;
|
|
17429
|
-
(x =
|
|
17452
|
+
(x = f.onBlur) == null || x.call(f, y), h();
|
|
17430
17453
|
},
|
|
17431
|
-
"aria-describedby": a ? d :
|
|
17454
|
+
"aria-describedby": a ? d : f["aria-describedby"]
|
|
17432
17455
|
});
|
|
17433
17456
|
return /* @__PURE__ */ P(Ge, { children: [
|
|
17434
17457
|
b,
|
|
@@ -17464,9 +17487,9 @@ const ra = {
|
|
|
17464
17487
|
}, ia = 12, Z4 = 56;
|
|
17465
17488
|
function Q4() {
|
|
17466
17489
|
var S;
|
|
17467
|
-
const e = ae(), t = w((N) => N.selection), n = w((N) => N.selectedNode), o = w((N) => N.selectedWire), r = w((N) => N.activeTool), i = w((N) => N.rotateSelection), a = w((N) => N.mirrorSelection), l = w((N) => N.deleteSelection), s = w((N) => N.setSelectionColor), c = w((N) => N.selectedAnnotations), d = w((N) => N.deleteSelectedNode), m = w((N) => N.deleteSelectedWire), p = w((N) => N.resetWirePath),
|
|
17490
|
+
const e = ae(), t = w((N) => N.selection), n = w((N) => N.selectedNode), o = w((N) => N.selectedWire), r = w((N) => N.activeTool), i = w((N) => N.rotateSelection), a = w((N) => N.mirrorSelection), l = w((N) => N.deleteSelection), s = w((N) => N.setSelectionColor), c = w((N) => N.selectedAnnotations), d = w((N) => N.deleteSelectedNode), m = w((N) => N.deleteSelectedWire), p = w((N) => N.resetWirePath), h = w((N) => N.internal.wireRenders), g = o != null && ((S = h.get(o)) == null ? void 0 : S.userEdited) === !0, f = re(null);
|
|
17468
17491
|
Q(() => {
|
|
17469
|
-
const N =
|
|
17492
|
+
const N = f.current;
|
|
17470
17493
|
if (!N) return;
|
|
17471
17494
|
const W = t.length > 0, oe = !W && o != null, ge = !W && !oe && n != null;
|
|
17472
17495
|
if (!((W || oe || ge) && (r === "select" || r === "pan"))) {
|
|
@@ -17513,7 +17536,7 @@ function Q4() {
|
|
|
17513
17536
|
return /* @__PURE__ */ P(
|
|
17514
17537
|
"div",
|
|
17515
17538
|
{
|
|
17516
|
-
ref:
|
|
17539
|
+
ref: f,
|
|
17517
17540
|
role: "toolbar",
|
|
17518
17541
|
"aria-label": e(b ? "ctx.ariaWire" : y ? "ctx.ariaNode" : "ctx.ariaElement"),
|
|
17519
17542
|
className: "ole-glass pointer-events-auto fixed left-0 top-0 z-30 hidden items-center gap-0.5 rounded-2xl border border-border p-1 shadow-md",
|
|
@@ -17644,9 +17667,9 @@ function Q4() {
|
|
|
17644
17667
|
}
|
|
17645
17668
|
);
|
|
17646
17669
|
}
|
|
17647
|
-
const aa = 8, J4 = 56,
|
|
17670
|
+
const aa = 8, J4 = 56, dr = ".ole-ann-cell-edit-fo", ur = ".ole-free-annotation-edit-fo";
|
|
17648
17671
|
function sa() {
|
|
17649
|
-
return document.querySelector(`${
|
|
17672
|
+
return document.querySelector(`${dr} input`) ?? document.querySelector(`${ur} [contenteditable]`);
|
|
17650
17673
|
}
|
|
17651
17674
|
function eT() {
|
|
17652
17675
|
const e = ae(), t = w((a) => a.editingAnnotation), n = w((a) => a.editingCell), o = re(null);
|
|
@@ -17660,12 +17683,12 @@ function eT() {
|
|
|
17660
17683
|
a.style.display = "flex";
|
|
17661
17684
|
let l = 0, s = "";
|
|
17662
17685
|
const c = () => {
|
|
17663
|
-
const d = sa() ?? document.querySelector(
|
|
17686
|
+
const d = sa() ?? document.querySelector(dr) ?? document.querySelector(ur) ?? document.querySelector(`[data-annotation-id="${CSS.escape(t)}"]`);
|
|
17664
17687
|
if (d) {
|
|
17665
17688
|
const m = d.getBoundingClientRect();
|
|
17666
|
-
let p = m.top - aa,
|
|
17667
|
-
p < J4 && (p = m.bottom + aa,
|
|
17668
|
-
const g = `translate3d(${m.left}px, ${p}px, 0) translate(0, ${
|
|
17689
|
+
let p = m.top - aa, h = "-100%";
|
|
17690
|
+
p < J4 && (p = m.bottom + aa, h = "0%");
|
|
17691
|
+
const g = `translate3d(${m.left}px, ${p}px, 0) translate(0, ${h})`;
|
|
17669
17692
|
g !== s && (a.style.transform = g, s = g);
|
|
17670
17693
|
}
|
|
17671
17694
|
l = requestAnimationFrame(c);
|
|
@@ -17682,14 +17705,14 @@ function eT() {
|
|
|
17682
17705
|
a.setEditingAnnotation(null);
|
|
17683
17706
|
return;
|
|
17684
17707
|
}
|
|
17685
|
-
if (
|
|
17686
|
-
const m = document.querySelector(`${
|
|
17708
|
+
if (et(s) === "table" && a.editingCell) {
|
|
17709
|
+
const m = document.querySelector(`${dr} input`), [p, h] = a.editingCell;
|
|
17687
17710
|
if (m) {
|
|
17688
|
-
m.value = ((d = s.cells[p]) == null ? void 0 : d[
|
|
17711
|
+
m.value = ((d = s.cells[p]) == null ? void 0 : d[h]) ?? "", m.blur();
|
|
17689
17712
|
return;
|
|
17690
17713
|
}
|
|
17691
17714
|
} else {
|
|
17692
|
-
const m = document.querySelector(`${
|
|
17715
|
+
const m = document.querySelector(`${ur} [contenteditable]`);
|
|
17693
17716
|
if (m) {
|
|
17694
17717
|
m.innerText = s.text ?? "", m.blur();
|
|
17695
17718
|
return;
|
|
@@ -17816,7 +17839,7 @@ function rT(e, t, n) {
|
|
|
17816
17839
|
function hS() {
|
|
17817
17840
|
return document.querySelector(".ole-canvas-root");
|
|
17818
17841
|
}
|
|
17819
|
-
function
|
|
17842
|
+
function $r(e) {
|
|
17820
17843
|
const t = Ye(), n = hS();
|
|
17821
17844
|
if (!t || !n) return;
|
|
17822
17845
|
const o = n.getBoundingClientRect(), r = o.width / 2, i = o.height / 2, a = t.getViewport(), l = rT(e, uS, mS), s = l / a.scale;
|
|
@@ -17830,7 +17853,7 @@ function iT() {
|
|
|
17830
17853
|
const e = Ye();
|
|
17831
17854
|
if (!e) return;
|
|
17832
17855
|
const t = e.getViewport().scale, n = qn.find((o) => o > t + 1e-6) ?? mS;
|
|
17833
|
-
|
|
17856
|
+
$r(n);
|
|
17834
17857
|
}
|
|
17835
17858
|
function aT() {
|
|
17836
17859
|
const e = Ye();
|
|
@@ -17842,12 +17865,12 @@ function aT() {
|
|
|
17842
17865
|
n = qn[o];
|
|
17843
17866
|
break;
|
|
17844
17867
|
}
|
|
17845
|
-
|
|
17868
|
+
$r(n);
|
|
17846
17869
|
}
|
|
17847
17870
|
const Bn = [
|
|
17848
17871
|
lo,
|
|
17849
17872
|
6,
|
|
17850
|
-
|
|
17873
|
+
Je,
|
|
17851
17874
|
8,
|
|
17852
17875
|
9,
|
|
17853
17876
|
10,
|
|
@@ -17865,10 +17888,10 @@ function sT(e) {
|
|
|
17865
17888
|
return { ...t, meta: n };
|
|
17866
17889
|
});
|
|
17867
17890
|
}
|
|
17868
|
-
function
|
|
17891
|
+
function mr(e) {
|
|
17869
17892
|
w.getState().dispatch((t) => {
|
|
17870
17893
|
const n = { ...t.meta ?? {} };
|
|
17871
|
-
return e ===
|
|
17894
|
+
return e === Je ? delete n.labelFontSize : n.labelFontSize = e, { ...t, meta: n };
|
|
17872
17895
|
});
|
|
17873
17896
|
}
|
|
17874
17897
|
function ca(e) {
|
|
@@ -17877,7 +17900,7 @@ function ca(e) {
|
|
|
17877
17900
|
(o = w.getState().diagram.meta) == null ? void 0 : o.labelFontSize
|
|
17878
17901
|
);
|
|
17879
17902
|
if (e > 0) {
|
|
17880
|
-
|
|
17903
|
+
mr(
|
|
17881
17904
|
Bn.find((r) => r > t) ?? co
|
|
17882
17905
|
);
|
|
17883
17906
|
return;
|
|
@@ -17888,7 +17911,7 @@ function ca(e) {
|
|
|
17888
17911
|
n = Bn[r];
|
|
17889
17912
|
break;
|
|
17890
17913
|
}
|
|
17891
|
-
|
|
17914
|
+
mr(n);
|
|
17892
17915
|
}
|
|
17893
17916
|
function fS() {
|
|
17894
17917
|
const [e, t] = fe(() => nT());
|
|
@@ -17920,7 +17943,7 @@ function gS() {
|
|
|
17920
17943
|
size: "icon",
|
|
17921
17944
|
onClick: aT,
|
|
17922
17945
|
"aria-label": e("view.zoomOut"),
|
|
17923
|
-
children: /* @__PURE__ */ u(
|
|
17946
|
+
children: /* @__PURE__ */ u(hr, {})
|
|
17924
17947
|
}
|
|
17925
17948
|
)
|
|
17926
17949
|
}
|
|
@@ -17961,7 +17984,7 @@ function yS() {
|
|
|
17961
17984
|
"button",
|
|
17962
17985
|
{
|
|
17963
17986
|
type: "button",
|
|
17964
|
-
onClick: () =>
|
|
17987
|
+
onClick: () => $r(1),
|
|
17965
17988
|
className: "min-w-12 rounded-md px-2 py-1 text-center text-xs tabular-nums text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
17966
17989
|
"aria-label": e("view.reset"),
|
|
17967
17990
|
children: [
|
|
@@ -18078,7 +18101,7 @@ function xS() {
|
|
|
18078
18101
|
{
|
|
18079
18102
|
type: "button",
|
|
18080
18103
|
"aria-label": e("view.labelSizeReset"),
|
|
18081
|
-
onClick: () =>
|
|
18104
|
+
onClick: () => mr(Je),
|
|
18082
18105
|
className: "w-9 rounded-md py-1 text-center font-mono text-[11px] tabular-nums hover:bg-accent hover:text-accent-foreground",
|
|
18083
18106
|
children: n
|
|
18084
18107
|
}
|
|
@@ -18190,7 +18213,7 @@ function dT({ stacked: e } = {}) {
|
|
|
18190
18213
|
n ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground"
|
|
18191
18214
|
),
|
|
18192
18215
|
children: [
|
|
18193
|
-
/* @__PURE__ */ u(
|
|
18216
|
+
/* @__PURE__ */ u(Go, { className: "size-4" }),
|
|
18194
18217
|
/* @__PURE__ */ u("span", { className: "max-w-full truncate", children: t("view.menu") })
|
|
18195
18218
|
]
|
|
18196
18219
|
}
|
|
@@ -18202,7 +18225,7 @@ function dT({ stacked: e } = {}) {
|
|
|
18202
18225
|
onClick: () => o((s) => !s),
|
|
18203
18226
|
"aria-label": t("view.menu"),
|
|
18204
18227
|
"aria-pressed": n,
|
|
18205
|
-
children: /* @__PURE__ */ u(
|
|
18228
|
+
children: /* @__PURE__ */ u(Go, {})
|
|
18206
18229
|
}
|
|
18207
18230
|
) });
|
|
18208
18231
|
return /* @__PURE__ */ u(
|
|
@@ -18291,7 +18314,7 @@ const SS = [
|
|
|
18291
18314
|
labelKey: "tool.bus",
|
|
18292
18315
|
hotkey: "B",
|
|
18293
18316
|
descriptionKey: "tool.busHint",
|
|
18294
|
-
icon:
|
|
18317
|
+
icon: hr,
|
|
18295
18318
|
switchTo: "busbar"
|
|
18296
18319
|
},
|
|
18297
18320
|
{
|
|
@@ -18376,11 +18399,11 @@ function mT() {
|
|
|
18376
18399
|
const e = ae(), t = w((p) => p.activeTool), n = w((p) => p.placeKind), o = w((p) => p.placeFromTerminal), r = w((p) => p.wireDragFrom), i = w((p) => p.busbarDrawStart), a = w(
|
|
18377
18400
|
(p) => p.selection.length > 0 || p.selectedNode != null
|
|
18378
18401
|
), l = w((p) => p.editingAnnotation), s = w((p) => {
|
|
18379
|
-
var
|
|
18380
|
-
const
|
|
18381
|
-
if (!
|
|
18382
|
-
const g = (
|
|
18383
|
-
return g ?
|
|
18402
|
+
var f;
|
|
18403
|
+
const h = gn(p);
|
|
18404
|
+
if (!h) return null;
|
|
18405
|
+
const g = (f = p.diagram.annotations) == null ? void 0 : f.find((b) => b.id === h);
|
|
18406
|
+
return g ? et(g) : null;
|
|
18384
18407
|
});
|
|
18385
18408
|
if (l)
|
|
18386
18409
|
return /* @__PURE__ */ u("div", { className: "ole-glass pointer-events-none flex items-center gap-2 rounded-full border border-border px-3 py-1 text-xs text-muted-foreground shadow-sm", children: /* @__PURE__ */ u("span", { children: e("mode.annEditing") }) });
|
|
@@ -18435,7 +18458,7 @@ function mT() {
|
|
|
18435
18458
|
] });
|
|
18436
18459
|
}
|
|
18437
18460
|
function pT() {
|
|
18438
|
-
const e = ae(), t = w((y) => y.activeTool), n = w((y) => y.placeKind), o = w((y) => y.setActiveTool), r = w((y) => y.past.length), i = w((y) => y.future.length), a = w((y) => y.undo), l = w((y) => y.redo), s = yt(), c = Ke(s, "tight"), d = !Ke(s, "dense"), m = Ke(s, "dense"), p = /* @__PURE__ */ new Set(["select"]),
|
|
18461
|
+
const e = ae(), t = w((y) => y.activeTool), n = w((y) => y.placeKind), o = w((y) => y.setActiveTool), r = w((y) => y.past.length), i = w((y) => y.future.length), a = w((y) => y.undo), l = w((y) => y.redo), s = yt(), c = Ke(s, "tight"), d = !Ke(s, "dense"), m = Ke(s, "dense"), p = /* @__PURE__ */ new Set(["select"]), h = m ? ma.filter((y) => !p.has(y.id)) : ma, g = (y) => t === y.switchTo, [f, b] = fe(!1);
|
|
18439
18462
|
return /* @__PURE__ */ P(
|
|
18440
18463
|
"div",
|
|
18441
18464
|
{
|
|
@@ -18447,7 +18470,7 @@ function pT() {
|
|
|
18447
18470
|
{
|
|
18448
18471
|
className: $e(
|
|
18449
18472
|
"transition-opacity duration-150",
|
|
18450
|
-
|
|
18473
|
+
f && "pointer-events-none opacity-0"
|
|
18451
18474
|
),
|
|
18452
18475
|
children: /* @__PURE__ */ u(mT, {})
|
|
18453
18476
|
}
|
|
@@ -18463,7 +18486,7 @@ function pT() {
|
|
|
18463
18486
|
),
|
|
18464
18487
|
children: [
|
|
18465
18488
|
m && /* @__PURE__ */ u(hT, { stacked: !0 }),
|
|
18466
|
-
|
|
18489
|
+
h.map((y) => {
|
|
18467
18490
|
const x = y.icon, C = g(y), S = y.id === "place" && C && n == null ? e("tool.placeNoKindTooltip") : e(y.descriptionKey);
|
|
18468
18491
|
return /* @__PURE__ */ P(XS, { children: [
|
|
18469
18492
|
/* @__PURE__ */ u(
|
|
@@ -18504,7 +18527,7 @@ function pT() {
|
|
|
18504
18527
|
/* @__PURE__ */ u(
|
|
18505
18528
|
St,
|
|
18506
18529
|
{
|
|
18507
|
-
icon:
|
|
18530
|
+
icon: fr,
|
|
18508
18531
|
label: e("tool.redo"),
|
|
18509
18532
|
hotkey: "⌘⇧Z",
|
|
18510
18533
|
description: e("tool.redoHint"),
|
|
@@ -18757,7 +18780,7 @@ function yT({ stacked: e }) {
|
|
|
18757
18780
|
trigger: /* @__PURE__ */ u(
|
|
18758
18781
|
St,
|
|
18759
18782
|
{
|
|
18760
|
-
icon:
|
|
18783
|
+
icon: Go,
|
|
18761
18784
|
label: t("tool.more"),
|
|
18762
18785
|
description: t("tool.moreHint"),
|
|
18763
18786
|
active: n,
|
|
@@ -18780,7 +18803,7 @@ function yT({ stacked: e }) {
|
|
|
18780
18803
|
je,
|
|
18781
18804
|
{
|
|
18782
18805
|
onClick: m(l),
|
|
18783
|
-
icon: /* @__PURE__ */ u(
|
|
18806
|
+
icon: /* @__PURE__ */ u(fr, {}),
|
|
18784
18807
|
disabled: i === 0,
|
|
18785
18808
|
children: t("tool.redo")
|
|
18786
18809
|
}
|
|
@@ -19372,7 +19395,7 @@ function AT(e) {
|
|
|
19372
19395
|
const t = {};
|
|
19373
19396
|
for (const n of e.values()) {
|
|
19374
19397
|
if ($T.has(n.id)) continue;
|
|
19375
|
-
const o =
|
|
19398
|
+
const o = wr(n.id) ? ln : n.category;
|
|
19376
19399
|
(t[o] ?? (t[o] = [])).push(n);
|
|
19377
19400
|
}
|
|
19378
19401
|
return t;
|
|
@@ -19456,22 +19479,22 @@ function IT() {
|
|
|
19456
19479
|
function PT({ sheet: e }) {
|
|
19457
19480
|
const t = ae(), n = kn(), [o, r] = fe(""), [i, a] = fe(
|
|
19458
19481
|
() => NT()
|
|
19459
|
-
), l = w((
|
|
19460
|
-
const
|
|
19461
|
-
if (!
|
|
19482
|
+
), l = w((f) => f.internal.library), s = CS((f) => f.onCreateComponent), c = Pt(() => AT(l), [l]), d = Pt(() => ET(c), [c]), m = Pt(() => {
|
|
19483
|
+
const f = o.trim().toLowerCase();
|
|
19484
|
+
if (!f) return c;
|
|
19462
19485
|
const b = {};
|
|
19463
19486
|
for (const [y, x] of Object.entries(c)) {
|
|
19464
19487
|
const C = x.filter((S) => {
|
|
19465
19488
|
const N = n(`${S.id}.name`, S.name).toLowerCase(), W = n(`${S.id}.desc`, S.description ?? "").toLowerCase();
|
|
19466
|
-
return N.includes(
|
|
19489
|
+
return N.includes(f) || S.id.toLowerCase().includes(f) || W.includes(f);
|
|
19467
19490
|
});
|
|
19468
19491
|
C.length && (b[y] = C);
|
|
19469
19492
|
}
|
|
19470
19493
|
return b;
|
|
19471
|
-
}, [o, n, c]), p = o.trim().length > 0,
|
|
19494
|
+
}, [o, n, c]), p = o.trim().length > 0, h = p && Object.values(m).every((f) => !(f != null && f.length)), g = Mt((f, b) => {
|
|
19472
19495
|
a((y) => {
|
|
19473
19496
|
const x = new Set(y);
|
|
19474
|
-
return b ? x.delete(
|
|
19497
|
+
return b ? x.delete(f) : x.add(f), TT(x), x;
|
|
19475
19498
|
});
|
|
19476
19499
|
}, []);
|
|
19477
19500
|
return /* @__PURE__ */ P(Ge, { children: [
|
|
@@ -19492,11 +19515,11 @@ function PT({ sheet: e }) {
|
|
|
19492
19515
|
}
|
|
19493
19516
|
)
|
|
19494
19517
|
] }),
|
|
19495
|
-
/* @__PURE__ */ u("div", { className: "flex-1 overflow-y-auto px-2 pb-2", children:
|
|
19518
|
+
/* @__PURE__ */ u("div", { className: "flex-1 overflow-y-auto px-2 pb-2", children: h ? /* @__PURE__ */ u("p", { className: "px-3 py-6 text-center text-xs text-muted-foreground", children: t("library.empty") }) : d.map((f) => {
|
|
19496
19519
|
var S;
|
|
19497
|
-
const b = m[
|
|
19520
|
+
const b = m[f];
|
|
19498
19521
|
if (!(b != null && b.length)) return null;
|
|
19499
|
-
const y = ((S = c[
|
|
19522
|
+
const y = ((S = c[f]) == null ? void 0 : S.length) ?? b.length, x = t(f === ln ? "cat.custom" : `cat.${f}`), C = p || !i.has(f);
|
|
19500
19523
|
return /* @__PURE__ */ P(
|
|
19501
19524
|
"details",
|
|
19502
19525
|
{
|
|
@@ -19504,7 +19527,7 @@ function PT({ sheet: e }) {
|
|
|
19504
19527
|
className: "group mb-2 last:mb-0",
|
|
19505
19528
|
onToggle: (N) => {
|
|
19506
19529
|
p || g(
|
|
19507
|
-
|
|
19530
|
+
f,
|
|
19508
19531
|
N.currentTarget.open
|
|
19509
19532
|
);
|
|
19510
19533
|
},
|
|
@@ -19517,7 +19540,7 @@ function PT({ sheet: e }) {
|
|
|
19517
19540
|
/* @__PURE__ */ u("ul", { className: "mt-0.5 space-y-px", children: b.map((N) => /* @__PURE__ */ u(MT, { entry: N, sheet: e }, N.id)) })
|
|
19518
19541
|
]
|
|
19519
19542
|
},
|
|
19520
|
-
|
|
19543
|
+
f
|
|
19521
19544
|
);
|
|
19522
19545
|
}) })
|
|
19523
19546
|
] });
|
|
@@ -19556,7 +19579,7 @@ function MT({
|
|
|
19556
19579
|
entry: e,
|
|
19557
19580
|
sheet: t
|
|
19558
19581
|
}) {
|
|
19559
|
-
const n = ae(), o = kn(), r = o(`${e.id}.name`, e.name), i =
|
|
19582
|
+
const n = ae(), o = kn(), r = o(`${e.id}.name`, e.name), i = wr(e.id), a = o(`${e.id}.desc`, e.description ?? ""), l = w((p) => p.setActiveTool), s = w(
|
|
19560
19583
|
(p) => p.activeTool === "place" && p.placeKind === e.id
|
|
19561
19584
|
), c = w(
|
|
19562
19585
|
(p) => t && p.activeTool === "place" && p.placeKind == null && p.lastPlaceKind === e.id
|
|
@@ -19572,8 +19595,8 @@ function MT({
|
|
|
19572
19595
|
draggable: !0,
|
|
19573
19596
|
onDragStart: (p) => {
|
|
19574
19597
|
p.dataTransfer.effectAllowed = "copy", p.dataTransfer.setData("application/x-oneline-kind", e.id), p.dataTransfer.setData("text/plain", e.id);
|
|
19575
|
-
const
|
|
19576
|
-
|
|
19598
|
+
const h = document.createElement("div");
|
|
19599
|
+
h.className = "ole-glass", h.style.cssText = [
|
|
19577
19600
|
"position:absolute",
|
|
19578
19601
|
"top:-9999px",
|
|
19579
19602
|
"left:-9999px",
|
|
@@ -19587,7 +19610,7 @@ function MT({
|
|
|
19587
19610
|
"box-shadow:0 4px 12px rgba(0,0,0,0.12)",
|
|
19588
19611
|
"color:var(--foreground)",
|
|
19589
19612
|
"padding:8px"
|
|
19590
|
-
].join(";"),
|
|
19613
|
+
].join(";"), h.innerHTML = `<svg class="ole-symbol" viewBox="${e.viewBox}" width="48" height="48" preserveAspectRatio="xMidYMid meet">${e.svg}</svg>`, document.body.appendChild(h), p.dataTransfer.setDragImage(h, 32, 32), setTimeout(() => h.remove(), 0);
|
|
19591
19614
|
},
|
|
19592
19615
|
onClick: () => l("place", { placeKind: e.id }),
|
|
19593
19616
|
"data-kind": e.id,
|
|
@@ -19621,18 +19644,18 @@ function MT({
|
|
|
19621
19644
|
function DT({ children: e }) {
|
|
19622
19645
|
return /* @__PURE__ */ u("span", { className: "rounded bg-muted/50 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-muted-foreground/80", children: e });
|
|
19623
19646
|
}
|
|
19624
|
-
const
|
|
19647
|
+
const pr = "ole-onboarding-dismissed";
|
|
19625
19648
|
function OT() {
|
|
19626
19649
|
if (typeof window > "u") return !1;
|
|
19627
19650
|
try {
|
|
19628
|
-
return window.localStorage.getItem(
|
|
19651
|
+
return window.localStorage.getItem(pr) === "1";
|
|
19629
19652
|
} catch {
|
|
19630
19653
|
return !1;
|
|
19631
19654
|
}
|
|
19632
19655
|
}
|
|
19633
19656
|
function fa(e) {
|
|
19634
19657
|
try {
|
|
19635
|
-
e ? window.localStorage.setItem(
|
|
19658
|
+
e ? window.localStorage.setItem(pr, "1") : window.localStorage.removeItem(pr);
|
|
19636
19659
|
} catch {
|
|
19637
19660
|
}
|
|
19638
19661
|
}
|
|
@@ -19669,7 +19692,7 @@ function LT() {
|
|
|
19669
19692
|
] }),
|
|
19670
19693
|
/* @__PURE__ */ P("ol", { className: "mt-3 space-y-2.5", children: [
|
|
19671
19694
|
/* @__PURE__ */ u(
|
|
19672
|
-
|
|
19695
|
+
Ro,
|
|
19673
19696
|
{
|
|
19674
19697
|
n: 1,
|
|
19675
19698
|
icon: /* @__PURE__ */ u(Fa, {}),
|
|
@@ -19678,7 +19701,7 @@ function LT() {
|
|
|
19678
19701
|
}
|
|
19679
19702
|
),
|
|
19680
19703
|
/* @__PURE__ */ u(
|
|
19681
|
-
|
|
19704
|
+
Ro,
|
|
19682
19705
|
{
|
|
19683
19706
|
n: 2,
|
|
19684
19707
|
icon: /* @__PURE__ */ u(za, {}),
|
|
@@ -19687,10 +19710,10 @@ function LT() {
|
|
|
19687
19710
|
}
|
|
19688
19711
|
),
|
|
19689
19712
|
/* @__PURE__ */ u(
|
|
19690
|
-
|
|
19713
|
+
Ro,
|
|
19691
19714
|
{
|
|
19692
19715
|
n: 3,
|
|
19693
|
-
icon: /* @__PURE__ */ u(
|
|
19716
|
+
icon: /* @__PURE__ */ u(hr, {}),
|
|
19694
19717
|
title: e("onboard.step3.title"),
|
|
19695
19718
|
body: e("onboard.step3.body")
|
|
19696
19719
|
}
|
|
@@ -19709,7 +19732,7 @@ function LT() {
|
|
|
19709
19732
|
}
|
|
19710
19733
|
);
|
|
19711
19734
|
}
|
|
19712
|
-
function
|
|
19735
|
+
function Ro({
|
|
19713
19736
|
n: e,
|
|
19714
19737
|
icon: t,
|
|
19715
19738
|
title: n,
|
|
@@ -19734,7 +19757,7 @@ function Bo({
|
|
|
19734
19757
|
] });
|
|
19735
19758
|
}
|
|
19736
19759
|
function BT() {
|
|
19737
|
-
const e = ae(), t = w((
|
|
19760
|
+
const e = ae(), t = w((f) => f.selection), n = w((f) => f.diagram.elements), o = w((f) => f.diagram.buses), r = w((f) => f.diagram.junctions), i = w((f) => f.selectedNode), a = w((f) => f.selectedWire), l = w((f) => f.selectedAnnotations), s = w(gn);
|
|
19738
19761
|
if (a) return /* @__PURE__ */ u(ZT, { wireId: a });
|
|
19739
19762
|
if (i) return /* @__PURE__ */ u(JT, { nodeId: i });
|
|
19740
19763
|
if (s) return /* @__PURE__ */ u(qT, { annId: s });
|
|
@@ -19743,34 +19766,42 @@ function BT() {
|
|
|
19743
19766
|
return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: e("props.empty") });
|
|
19744
19767
|
if (c > 1)
|
|
19745
19768
|
return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: e("props.multi", { n: c }) });
|
|
19746
|
-
const d = t[0], m = (o ?? []).find((
|
|
19769
|
+
const d = t[0], m = (o ?? []).find((f) => f.id === d);
|
|
19747
19770
|
if (m) return /* @__PURE__ */ u(FT, { bus: m });
|
|
19748
|
-
const p = (r ?? []).find((
|
|
19771
|
+
const p = (r ?? []).find((f) => f.id === d);
|
|
19749
19772
|
if (p) return /* @__PURE__ */ u(QT, { junction: p });
|
|
19750
|
-
const
|
|
19751
|
-
if (!
|
|
19752
|
-
const g = _t[
|
|
19773
|
+
const h = n.find((f) => f.id === d);
|
|
19774
|
+
if (!h) return null;
|
|
19775
|
+
const g = _t[h.kind];
|
|
19753
19776
|
return /* @__PURE__ */ P("div", { className: "flex flex-col gap-2.5 overflow-y-auto px-3 py-3 text-xs", children: [
|
|
19754
19777
|
/* @__PURE__ */ u(
|
|
19755
19778
|
st,
|
|
19756
19779
|
{
|
|
19757
19780
|
label: e("props.name"),
|
|
19758
|
-
value:
|
|
19759
|
-
placeholder:
|
|
19781
|
+
value: h.name ?? "",
|
|
19782
|
+
placeholder: h.id,
|
|
19760
19783
|
multiline: !0,
|
|
19761
|
-
onCommit: (
|
|
19762
|
-
const b = uo(
|
|
19784
|
+
onCommit: (f) => {
|
|
19785
|
+
const b = uo(f, "").join(`
|
|
19763
19786
|
`);
|
|
19764
19787
|
w.getState().updateElement(d, { name: b === "" ? void 0 : b });
|
|
19765
19788
|
}
|
|
19766
19789
|
}
|
|
19767
19790
|
),
|
|
19791
|
+
/* @__PURE__ */ u(Ze, { label: e("props.label"), children: /* @__PURE__ */ u(
|
|
19792
|
+
vo,
|
|
19793
|
+
{
|
|
19794
|
+
active: !h.labelHidden,
|
|
19795
|
+
onClick: () => w.getState().updateElement(d, { labelHidden: h.labelHidden ? void 0 : !0 }),
|
|
19796
|
+
children: h.labelHidden ? e("props.labelHidden") : e("props.labelShown")
|
|
19797
|
+
}
|
|
19798
|
+
) }),
|
|
19768
19799
|
/* @__PURE__ */ u(
|
|
19769
|
-
|
|
19800
|
+
Ar,
|
|
19770
19801
|
{
|
|
19771
19802
|
label: e("props.note"),
|
|
19772
|
-
value:
|
|
19773
|
-
onCommit: (
|
|
19803
|
+
value: h.note ?? "",
|
|
19804
|
+
onCommit: (f) => w.getState().updateElement(d, { note: f.trim() === "" ? void 0 : f.trim() })
|
|
19774
19805
|
},
|
|
19775
19806
|
d
|
|
19776
19807
|
),
|
|
@@ -19778,17 +19809,17 @@ function BT() {
|
|
|
19778
19809
|
xt,
|
|
19779
19810
|
{
|
|
19780
19811
|
label: e("props.color"),
|
|
19781
|
-
value:
|
|
19782
|
-
onChange: (
|
|
19812
|
+
value: h.color,
|
|
19813
|
+
onChange: (f) => w.getState().updateElement(d, { color: f === "default" ? void 0 : f })
|
|
19783
19814
|
}
|
|
19784
19815
|
),
|
|
19785
19816
|
g && /* @__PURE__ */ u(KT, { id: d }),
|
|
19786
|
-
(g == null ? void 0 : g.state) && g.state.length > 0 && /* @__PURE__ */ u("div", { className: "mt-1 flex flex-col gap-1.5 border-t border-border/40 pt-2.5", children: g.state.map((
|
|
19817
|
+
(g == null ? void 0 : g.state) && g.state.length > 0 && /* @__PURE__ */ u("div", { className: "mt-1 flex flex-col gap-1.5 border-t border-border/40 pt-2.5", children: g.state.map((f) => /* @__PURE__ */ u(nI, { id: d, element: h, field: f }, f.name)) }),
|
|
19787
19818
|
/* @__PURE__ */ u(
|
|
19788
19819
|
RT,
|
|
19789
19820
|
{
|
|
19790
19821
|
id: d,
|
|
19791
|
-
element:
|
|
19822
|
+
element: h,
|
|
19792
19823
|
schema: (g == null ? void 0 : g.params) ?? []
|
|
19793
19824
|
}
|
|
19794
19825
|
)
|
|
@@ -19834,7 +19865,7 @@ function jT({
|
|
|
19834
19865
|
params: Object.keys(d).length > 0 ? d : void 0
|
|
19835
19866
|
});
|
|
19836
19867
|
};
|
|
19837
|
-
return n.type === "boolean" ? /* @__PURE__ */ u(
|
|
19868
|
+
return n.type === "boolean" ? /* @__PURE__ */ u(Ze, { label: a, children: /* @__PURE__ */ u(vo, { active: !!i, onClick: () => l(!i), children: o(i ? "common.yes" : "common.no") }) }) : n.type === "number" ? /* @__PURE__ */ u(
|
|
19838
19869
|
wo,
|
|
19839
19870
|
{
|
|
19840
19871
|
label: a,
|
|
@@ -19864,7 +19895,7 @@ function HT({
|
|
|
19864
19895
|
params: Object.keys(l).length > 0 ? l : void 0
|
|
19865
19896
|
});
|
|
19866
19897
|
};
|
|
19867
|
-
return typeof o == "boolean" ? /* @__PURE__ */ u(
|
|
19898
|
+
return typeof o == "boolean" ? /* @__PURE__ */ u(Ze, { label: n, children: /* @__PURE__ */ u(vo, { active: o, onClick: () => i(!o), children: r(o ? "common.yes" : "common.no") }) }) : typeof o == "number" ? /* @__PURE__ */ u(wo, { label: n, value: o, onCommit: i }) : /* @__PURE__ */ u(
|
|
19868
19899
|
st,
|
|
19869
19900
|
{
|
|
19870
19901
|
label: n,
|
|
@@ -19889,7 +19920,7 @@ function FT({ bus: e }) {
|
|
|
19889
19920
|
}
|
|
19890
19921
|
),
|
|
19891
19922
|
/* @__PURE__ */ u(
|
|
19892
|
-
|
|
19923
|
+
Ar,
|
|
19893
19924
|
{
|
|
19894
19925
|
label: t("props.note"),
|
|
19895
19926
|
value: e.note ?? "",
|
|
@@ -19937,7 +19968,7 @@ function qT({ annId: e }) {
|
|
|
19937
19968
|
);
|
|
19938
19969
|
if (!n)
|
|
19939
19970
|
return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: t("props.annNotFound", { id: e }) });
|
|
19940
|
-
const o = (i) => w.getState().updateAnnotation(e, i), r =
|
|
19971
|
+
const o = (i) => w.getState().updateAnnotation(e, i), r = et(n);
|
|
19941
19972
|
switch (r) {
|
|
19942
19973
|
// Rect and ellipse expose the same controls; only the stroke default
|
|
19943
19974
|
// differs (a rect is a group frame, an ellipse is a drawn shape).
|
|
@@ -20105,7 +20136,7 @@ function xt({
|
|
|
20105
20136
|
onChange: n
|
|
20106
20137
|
}) {
|
|
20107
20138
|
const o = ae(), r = t ?? "default";
|
|
20108
|
-
return /* @__PURE__ */ u(
|
|
20139
|
+
return /* @__PURE__ */ u(Ze, { label: e, children: /* @__PURE__ */ u("div", { className: "flex gap-1", children: E2.map((i) => /* @__PURE__ */ u(
|
|
20109
20140
|
"button",
|
|
20110
20141
|
{
|
|
20111
20142
|
type: "button",
|
|
@@ -20172,7 +20203,7 @@ function oo({
|
|
|
20172
20203
|
options: n,
|
|
20173
20204
|
onChange: o
|
|
20174
20205
|
}) {
|
|
20175
|
-
return /* @__PURE__ */ u(
|
|
20206
|
+
return /* @__PURE__ */ u(Ze, { label: e, children: /* @__PURE__ */ u("div", { className: "flex overflow-hidden rounded-md border border-border/60", children: n.map((r) => /* @__PURE__ */ u(
|
|
20176
20207
|
"button",
|
|
20177
20208
|
{
|
|
20178
20209
|
type: "button",
|
|
@@ -20210,14 +20241,14 @@ function KT({ id: e }) {
|
|
|
20210
20241
|
var d;
|
|
20211
20242
|
return ((d = c.internal.layout.get(e)) == null ? void 0 : d.scale) ?? 1;
|
|
20212
20243
|
}), o = Math.round(n * 100), [r, i] = fe(null), a = (c) => {
|
|
20213
|
-
const d = Math.min(
|
|
20244
|
+
const d = Math.min(yr, Math.max(br, c / 100));
|
|
20214
20245
|
w.getState().updatePlacement(e, { scale: Math.round(d * 100) / 100 });
|
|
20215
20246
|
}, l = () => {
|
|
20216
20247
|
if (r === null) return;
|
|
20217
20248
|
const c = parseFloat(r.replace(",", "."));
|
|
20218
20249
|
i(null), Number.isFinite(c) && c > 0 && Math.round(c) !== o && a(c);
|
|
20219
20250
|
}, s = t("props.size");
|
|
20220
|
-
return /* @__PURE__ */ u(
|
|
20251
|
+
return /* @__PURE__ */ u(Ze, { label: s, children: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
|
|
20221
20252
|
/* @__PURE__ */ P("div", { className: "relative min-w-0 flex-1", children: [
|
|
20222
20253
|
/* @__PURE__ */ u(
|
|
20223
20254
|
"input",
|
|
@@ -20254,7 +20285,7 @@ function ya({
|
|
|
20254
20285
|
min: n,
|
|
20255
20286
|
onChange: o
|
|
20256
20287
|
}) {
|
|
20257
|
-
return /* @__PURE__ */ u(
|
|
20288
|
+
return /* @__PURE__ */ u(Ze, { label: e, children: /* @__PURE__ */ P("div", { className: "flex items-center gap-1", children: [
|
|
20258
20289
|
/* @__PURE__ */ u(
|
|
20259
20290
|
"button",
|
|
20260
20291
|
{
|
|
@@ -20308,7 +20339,7 @@ function ZT({ wireId: e }) {
|
|
|
20308
20339
|
const t = ae(), n = w((b) => b.diagram.wires), o = w((b) => b.diagram.elements), r = w((b) => b.diagram.buses), i = w((b) => b.diagram.junctions), a = w((b) => b.internal.terminalToNode), l = w((b) => b.setSelectedNode), s = (n ?? []).find((b) => b.id === e);
|
|
20309
20340
|
if (!s)
|
|
20310
20341
|
return /* @__PURE__ */ u("div", { className: "px-4 py-5 text-center text-xs text-muted-foreground", children: t("props.wireNotFound", { id: e }) });
|
|
20311
|
-
const c = a.get(s.ends[0]), d = new Map(o.map((b) => [b.id, b])), m = new Map((r ?? []).map((b) => [b.id, b])), p = new Map((i ?? []).map((b) => [b.id, b])),
|
|
20342
|
+
const c = a.get(s.ends[0]), d = new Map(o.map((b) => [b.id, b])), m = new Map((r ?? []).map((b) => [b.id, b])), p = new Map((i ?? []).map((b) => [b.id, b])), h = (b) => {
|
|
20312
20343
|
if (!b.includes(".")) {
|
|
20313
20344
|
const N = m.get(b);
|
|
20314
20345
|
if (N) return { id: b, label: N.name ?? b };
|
|
@@ -20317,7 +20348,7 @@ function ZT({ wireId: e }) {
|
|
|
20317
20348
|
}
|
|
20318
20349
|
const y = b.indexOf("."), x = b.slice(0, y), C = b.slice(y + 1), S = d.get(x);
|
|
20319
20350
|
return { id: x, label: (S == null ? void 0 : S.name) ?? x, pin: C };
|
|
20320
|
-
}, g =
|
|
20351
|
+
}, g = h(s.ends[0]), f = h(s.ends[1]);
|
|
20321
20352
|
return /* @__PURE__ */ P("div", { className: "flex flex-col gap-3 px-3 py-3 text-xs", children: [
|
|
20322
20353
|
/* @__PURE__ */ P("div", { className: "space-y-1", children: [
|
|
20323
20354
|
/* @__PURE__ */ u("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: t("props.wire") }),
|
|
@@ -20340,7 +20371,7 @@ function ZT({ wireId: e }) {
|
|
|
20340
20371
|
onChange: (b) => w.getState().updateWire(e, { color: b === "default" ? void 0 : b })
|
|
20341
20372
|
}
|
|
20342
20373
|
),
|
|
20343
|
-
/* @__PURE__ */ u("ul", { className: "space-y-0.5 border-t border-border/40 pt-2", children: [g,
|
|
20374
|
+
/* @__PURE__ */ u("ul", { className: "space-y-0.5 border-t border-border/40 pt-2", children: [g, f].map((b, y) => /* @__PURE__ */ P(
|
|
20344
20375
|
"li",
|
|
20345
20376
|
{
|
|
20346
20377
|
className: "flex cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 hover:bg-accent",
|
|
@@ -20385,7 +20416,7 @@ function QT({ junction: e }) {
|
|
|
20385
20416
|
}
|
|
20386
20417
|
),
|
|
20387
20418
|
/* @__PURE__ */ u(
|
|
20388
|
-
|
|
20419
|
+
Ar,
|
|
20389
20420
|
{
|
|
20390
20421
|
label: t("props.note"),
|
|
20391
20422
|
value: e.note ?? "",
|
|
@@ -20443,7 +20474,7 @@ function JT({ nodeId: e }) {
|
|
|
20443
20474
|
}) })
|
|
20444
20475
|
] });
|
|
20445
20476
|
}
|
|
20446
|
-
function
|
|
20477
|
+
function Ze({
|
|
20447
20478
|
label: e,
|
|
20448
20479
|
children: t
|
|
20449
20480
|
}) {
|
|
@@ -20476,7 +20507,7 @@ function st({
|
|
|
20476
20507
|
r ? "resize-none py-1.5 leading-snug" : "h-7"
|
|
20477
20508
|
)
|
|
20478
20509
|
};
|
|
20479
|
-
return /* @__PURE__ */ u(
|
|
20510
|
+
return /* @__PURE__ */ u(Ze, { label: e, children: /* @__PURE__ */ P("div", { className: "relative", children: [
|
|
20480
20511
|
r ? /* @__PURE__ */ u(
|
|
20481
20512
|
"textarea",
|
|
20482
20513
|
{
|
|
@@ -20508,7 +20539,7 @@ function st({
|
|
|
20508
20539
|
] }) });
|
|
20509
20540
|
}
|
|
20510
20541
|
const tI = 350;
|
|
20511
|
-
function
|
|
20542
|
+
function Ar({
|
|
20512
20543
|
label: e,
|
|
20513
20544
|
value: t,
|
|
20514
20545
|
onCommit: n
|
|
@@ -20524,7 +20555,7 @@ function $r({
|
|
|
20524
20555
|
const m = l.current;
|
|
20525
20556
|
m.local === m.value || m.local === s.current || (s.current = m.local, m.onCommit(m.local));
|
|
20526
20557
|
}, d = re(c);
|
|
20527
|
-
return d.current = c, Q(() => () => d.current(), []), /* @__PURE__ */ u(
|
|
20558
|
+
return d.current = c, Q(() => () => d.current(), []), /* @__PURE__ */ u(Ze, { label: e, children: /* @__PURE__ */ u(
|
|
20528
20559
|
"textarea",
|
|
20529
20560
|
{
|
|
20530
20561
|
rows: 2,
|
|
@@ -20552,7 +20583,7 @@ function wo({
|
|
|
20552
20583
|
onCommit: r
|
|
20553
20584
|
}) {
|
|
20554
20585
|
const [i, a] = fe(String(t)), l = re(null);
|
|
20555
|
-
return Q(() => a(String(t)), [t]), /* @__PURE__ */ u(
|
|
20586
|
+
return Q(() => a(String(t)), [t]), /* @__PURE__ */ u(Ze, { label: e, children: /* @__PURE__ */ P("div", { className: "relative", children: [
|
|
20556
20587
|
/* @__PURE__ */ u(
|
|
20557
20588
|
"input",
|
|
20558
20589
|
{
|
|
@@ -20578,7 +20609,7 @@ function wo({
|
|
|
20578
20609
|
o && /* @__PURE__ */ u("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: o })
|
|
20579
20610
|
] }) });
|
|
20580
20611
|
}
|
|
20581
|
-
function
|
|
20612
|
+
function vo({
|
|
20582
20613
|
active: e,
|
|
20583
20614
|
onClick: t,
|
|
20584
20615
|
children: n
|
|
@@ -20609,7 +20640,7 @@ function nI({
|
|
|
20609
20640
|
state: Object.keys(d).length > 0 ? d : void 0
|
|
20610
20641
|
});
|
|
20611
20642
|
};
|
|
20612
|
-
return n.type === "boolean" ? /* @__PURE__ */ u(
|
|
20643
|
+
return n.type === "boolean" ? /* @__PURE__ */ u(Ze, { label: i, children: /* @__PURE__ */ u(vo, { active: !!a, onClick: () => l(!a), children: o(a ? "common.yes" : "common.no") }) }) : n.type === "number" ? /* @__PURE__ */ u(
|
|
20613
20644
|
wo,
|
|
20614
20645
|
{
|
|
20615
20646
|
label: i,
|
|
@@ -20629,24 +20660,24 @@ function oI() {
|
|
|
20629
20660
|
const e = ae(), t = kn(), n = w((g) => g.selection), o = w((g) => g.selectedNode), r = w((g) => g.selectedWire), i = w((g) => g.selectedAnnotations), a = w(gn), l = w((g) => g.diagram.annotations), s = w((g) => g.diagram.elements), c = w((g) => g.diagram.buses), d = yt(), m = Ke(d, "dense");
|
|
20630
20661
|
if (n.length === 0 && i.length === 0 && !o && !r)
|
|
20631
20662
|
return null;
|
|
20632
|
-
let p = e("props.title"),
|
|
20663
|
+
let p = e("props.title"), h = null;
|
|
20633
20664
|
if (r)
|
|
20634
20665
|
p = e("props.wire");
|
|
20635
20666
|
else if (o)
|
|
20636
20667
|
p = e("props.node");
|
|
20637
20668
|
else if (a) {
|
|
20638
|
-
const g = (l ?? []).find((y) => y.id === a),
|
|
20669
|
+
const g = (l ?? []).find((y) => y.id === a), f = g ? et(g) : "text";
|
|
20639
20670
|
p = e({
|
|
20640
20671
|
rect: "props.annRect",
|
|
20641
20672
|
ellipse: "props.annEllipse",
|
|
20642
20673
|
line: "props.annLine",
|
|
20643
20674
|
table: "props.annTable",
|
|
20644
20675
|
text: "props.annText"
|
|
20645
|
-
}[
|
|
20676
|
+
}[f]);
|
|
20646
20677
|
} else if (n.length === 1 && i.length === 0) {
|
|
20647
|
-
const g = n[0],
|
|
20648
|
-
if (
|
|
20649
|
-
p =
|
|
20678
|
+
const g = n[0], f = (c ?? []).find((b) => b.id === g);
|
|
20679
|
+
if (f)
|
|
20680
|
+
p = f.name ?? e("props.bus");
|
|
20650
20681
|
else {
|
|
20651
20682
|
const b = s.find((y) => y.id === g);
|
|
20652
20683
|
if (b) {
|
|
@@ -20655,7 +20686,7 @@ function oI() {
|
|
|
20655
20686
|
}
|
|
20656
20687
|
}
|
|
20657
20688
|
} else
|
|
20658
|
-
|
|
20689
|
+
h = n.length + i.length;
|
|
20659
20690
|
return /* @__PURE__ */ P(
|
|
20660
20691
|
"aside",
|
|
20661
20692
|
{
|
|
@@ -20671,7 +20702,7 @@ function oI() {
|
|
|
20671
20702
|
children: [
|
|
20672
20703
|
/* @__PURE__ */ P("div", { className: "flex items-center gap-1.5 border-b border-border/40 px-3 py-2", children: [
|
|
20673
20704
|
/* @__PURE__ */ u("span", { className: "flex-1 truncate text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: p }),
|
|
20674
|
-
|
|
20705
|
+
h != null && /* @__PURE__ */ u("span", { className: "rounded bg-muted/50 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-muted-foreground/80", children: e("props.nSelected", { n: h }) })
|
|
20675
20706
|
] }),
|
|
20676
20707
|
/* @__PURE__ */ u(BT, {})
|
|
20677
20708
|
]
|
|
@@ -20776,7 +20807,7 @@ function wP({
|
|
|
20776
20807
|
lS();
|
|
20777
20808
|
}, []), j6(), /* @__PURE__ */ u("div", { className: `ole-root ${e ?? "h-full w-full"}`, children: /* @__PURE__ */ u(iI, {}) });
|
|
20778
20809
|
}
|
|
20779
|
-
const AS = 6, dI = 3,
|
|
20810
|
+
const AS = 6, dI = 3, jo = AS + 3, uI = 3, va = 4, xa = 2;
|
|
20780
20811
|
function mI(e) {
|
|
20781
20812
|
const t = e.trim().split(/\s+/).map(Number);
|
|
20782
20813
|
return t.length !== 4 || t.some((n) => Number.isNaN(n)) ? null : [t[0], t[1], t[2], t[3]];
|
|
@@ -20808,7 +20839,7 @@ function fI({
|
|
|
20808
20839
|
const r = n.quality === "bad" || n.quality === "stale", i = n.value !== void 0 && n.value !== null ? `${hI(n.value)}${o ? ` ${o}` : ""}` : "", a = n.badge ?? "";
|
|
20809
20840
|
if (!r && !i && !a) return null;
|
|
20810
20841
|
const l = a.length * AS * 0.6 + dI * 2;
|
|
20811
|
-
return /* @__PURE__ */ P("g", { className: "ole-rt", "data-rt-for": e, "data-alarm":
|
|
20842
|
+
return /* @__PURE__ */ P("g", { className: "ole-rt", "data-rt-for": e, "data-alarm": Sr(n), children: [
|
|
20812
20843
|
i && /* @__PURE__ */ u(
|
|
20813
20844
|
"text",
|
|
20814
20845
|
{
|
|
@@ -20829,10 +20860,10 @@ function fI({
|
|
|
20829
20860
|
"rect",
|
|
20830
20861
|
{
|
|
20831
20862
|
x: -l / 2,
|
|
20832
|
-
y: -
|
|
20863
|
+
y: -jo / 2,
|
|
20833
20864
|
width: l,
|
|
20834
|
-
height:
|
|
20835
|
-
rx:
|
|
20865
|
+
height: jo,
|
|
20866
|
+
rx: jo / 2,
|
|
20836
20867
|
className: "ole-rt-badge-bg"
|
|
20837
20868
|
}
|
|
20838
20869
|
),
|
|
@@ -20866,8 +20897,8 @@ function gI() {
|
|
|
20866
20897
|
else {
|
|
20867
20898
|
const m = r.get(a);
|
|
20868
20899
|
if (m) {
|
|
20869
|
-
const { axis: p, at:
|
|
20870
|
-
s = p === "x" ? { minX:
|
|
20900
|
+
const { axis: p, at: h, span: g } = m.geometry, f = g / 2;
|
|
20901
|
+
s = p === "x" ? { minX: h[0] - f, maxX: h[0] + f, minY: h[1] - 4, maxY: h[1] + 4 } : { minX: h[0] - 4, maxX: h[0] + 4, minY: h[1] - f, maxY: h[1] + f };
|
|
20871
20902
|
}
|
|
20872
20903
|
}
|
|
20873
20904
|
return s ? /* @__PURE__ */ u(fI, { id: a, box: s, rt: l, unit: t[a] }, a) : null;
|
|
@@ -20887,11 +20918,11 @@ function xI(e) {
|
|
|
20887
20918
|
return t;
|
|
20888
20919
|
}
|
|
20889
20920
|
function kI(e, t) {
|
|
20890
|
-
const [n, o] = fe(
|
|
20921
|
+
const [n, o] = fe(Jo);
|
|
20891
20922
|
return Q(() => {
|
|
20892
20923
|
const r = e.bindings ?? [];
|
|
20893
20924
|
if (!t || r.length === 0) {
|
|
20894
|
-
o(
|
|
20925
|
+
o(Jo);
|
|
20895
20926
|
return;
|
|
20896
20927
|
}
|
|
20897
20928
|
const i = xI(e), a = () => o({ props: kN(e, t), units: i });
|
|
@@ -20922,21 +20953,21 @@ function vP({
|
|
|
20922
20953
|
onReady: m
|
|
20923
20954
|
}) {
|
|
20924
20955
|
const [p] = fe(() => {
|
|
20925
|
-
const
|
|
20926
|
-
return
|
|
20956
|
+
const f = CN();
|
|
20957
|
+
return f.getState().setReadOnly(!0), f.getState().setActiveTool("pan"), f.getState().setDiagram(e), f;
|
|
20927
20958
|
});
|
|
20928
20959
|
Dt(() => {
|
|
20929
20960
|
p.getState().diagram !== e && p.getState().setDiagram(e);
|
|
20930
20961
|
}, [e, p]), Dt(() => {
|
|
20931
20962
|
n !== void 0 && p.getState().setSelection(n);
|
|
20932
20963
|
}, [n, e, p]);
|
|
20933
|
-
const
|
|
20964
|
+
const h = kI(e, t), g = [
|
|
20934
20965
|
"ole-root",
|
|
20935
20966
|
"ole-viewer",
|
|
20936
20967
|
l === "dark" ? "dark" : "",
|
|
20937
20968
|
s ?? "h-full w-full"
|
|
20938
20969
|
].filter(Boolean).join(" ");
|
|
20939
|
-
return /* @__PURE__ */ u("div", { className: g, style: c, children: /* @__PURE__ */ u(w2.Provider, { value: p, children: /* @__PURE__ */ u(N2.Provider, { value:
|
|
20970
|
+
return /* @__PURE__ */ u("div", { className: g, style: c, children: /* @__PURE__ */ u(w2.Provider, { value: p, children: /* @__PURE__ */ u(N2.Provider, { value: h, children: /* @__PURE__ */ u("div", { className: "relative h-full w-full overflow-hidden", children: /* @__PURE__ */ u(
|
|
20940
20971
|
SI,
|
|
20941
20972
|
{
|
|
20942
20973
|
store: p,
|
|
@@ -20964,8 +20995,8 @@ function SI({
|
|
|
20964
20995
|
}) {
|
|
20965
20996
|
const c = re(null), d = re(null), m = iS(c, d, void 0, { shared: !1 });
|
|
20966
20997
|
CI(c, n, i);
|
|
20967
|
-
const p = $I(c, m),
|
|
20968
|
-
|
|
20998
|
+
const p = $I(c, m), h = re(o);
|
|
20999
|
+
h.current = o;
|
|
20969
21000
|
const g = Pt(
|
|
20970
21001
|
() => ({
|
|
20971
21002
|
fit() {
|
|
@@ -20985,7 +21016,7 @@ function SI({
|
|
|
20985
21016
|
});
|
|
20986
21017
|
},
|
|
20987
21018
|
select(y) {
|
|
20988
|
-
|
|
21019
|
+
h.current || e.getState().setSelection(y);
|
|
20989
21020
|
}
|
|
20990
21021
|
}),
|
|
20991
21022
|
[m, e]
|
|
@@ -21006,10 +21037,10 @@ function SI({
|
|
|
21006
21037
|
});
|
|
21007
21038
|
return x.observe(y), () => x.disconnect();
|
|
21008
21039
|
}, [l, m]);
|
|
21009
|
-
const
|
|
21010
|
-
|
|
21040
|
+
const f = re(s);
|
|
21041
|
+
f.current = s, Q(() => {
|
|
21011
21042
|
var y;
|
|
21012
|
-
(y =
|
|
21043
|
+
(y = f.current) == null || y.call(f, g);
|
|
21013
21044
|
}, [g]);
|
|
21014
21045
|
const b = Mt(
|
|
21015
21046
|
(y) => {
|
|
@@ -21073,8 +21104,8 @@ function CI(e, t, n) {
|
|
|
21073
21104
|
const s = e.current;
|
|
21074
21105
|
if (!s) return;
|
|
21075
21106
|
const c = (p) => {
|
|
21076
|
-
var
|
|
21077
|
-
p !== r.current && (r.current = p, (
|
|
21107
|
+
var h;
|
|
21108
|
+
p !== r.current && (r.current = p, (h = a.current) == null || h.call(a, p), i.current === void 0 && l(p));
|
|
21078
21109
|
}, d = (p) => c(gt(p.target) ?? mn(p.target)), m = () => c(null);
|
|
21079
21110
|
return s.addEventListener("pointermove", d), s.addEventListener("pointerleave", m), () => {
|
|
21080
21111
|
s.removeEventListener("pointermove", d), s.removeEventListener("pointerleave", m), l(null);
|
|
@@ -21126,12 +21157,12 @@ function $I(e, t) {
|
|
|
21126
21157
|
};
|
|
21127
21158
|
}, [e, t]), n;
|
|
21128
21159
|
}
|
|
21129
|
-
function
|
|
21160
|
+
function Ho(e) {
|
|
21130
21161
|
return e !== null && typeof e == "object" && "v" in e ? e : { v: e };
|
|
21131
21162
|
}
|
|
21132
21163
|
function xP(e = {}) {
|
|
21133
21164
|
const t = /* @__PURE__ */ new Map();
|
|
21134
|
-
for (const [r, i] of Object.entries(e)) t.set(r,
|
|
21165
|
+
for (const [r, i] of Object.entries(e)) t.set(r, Ho(i));
|
|
21135
21166
|
const n = /* @__PURE__ */ new Set(), o = (r) => {
|
|
21136
21167
|
for (const i of n) {
|
|
21137
21168
|
let a = null;
|
|
@@ -21149,13 +21180,13 @@ function xP(e = {}) {
|
|
|
21149
21180
|
};
|
|
21150
21181
|
},
|
|
21151
21182
|
set(r, i) {
|
|
21152
|
-
const a =
|
|
21183
|
+
const a = Ho(i);
|
|
21153
21184
|
t.set(r, a), o({ [r]: a });
|
|
21154
21185
|
},
|
|
21155
21186
|
setMany(r) {
|
|
21156
21187
|
const i = {};
|
|
21157
21188
|
for (const [a, l] of Object.entries(r)) {
|
|
21158
|
-
const s =
|
|
21189
|
+
const s = Ho(l);
|
|
21159
21190
|
t.set(a, s), i[a] = s;
|
|
21160
21191
|
}
|
|
21161
21192
|
o(i);
|
|
@@ -21231,7 +21262,7 @@ function kP(e) {
|
|
|
21231
21262
|
const Rn = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
21232
21263
|
function SP(e) {
|
|
21233
21264
|
var l, s, c, d, m;
|
|
21234
|
-
const t = [], n = (p,
|
|
21265
|
+
const t = [], n = (p, h) => t.push({ field: p, message: h });
|
|
21235
21266
|
(l = e.id) != null && l.startsWith("custom:") || n("id", "a document-defined kind must have a `custom:` id so it can never shadow a built-in"), (s = e.name) != null && s.trim() || n("name", "name is required — it is what the user sees in the palette"), (c = e.category) != null && c.trim() || n("category", "category is required for palette grouping");
|
|
21236
21267
|
const o = (e.viewBox ?? "").trim().split(/[\s,]+/).map(Number), r = o.length === 4 && o.every((p) => Number.isFinite(p)) && o[2] > 0 && o[3] > 0;
|
|
21237
21268
|
r || n("viewBox", 'viewBox must be four finite numbers "minX minY width height" with positive extent'), (d = e.svg) != null && d.trim() || n("svg", "svg is empty — a symbol with no geometry is invisible on the canvas");
|
|
@@ -21248,18 +21279,18 @@ function SP(e) {
|
|
|
21248
21279
|
continue;
|
|
21249
21280
|
}
|
|
21250
21281
|
if (r) {
|
|
21251
|
-
const [
|
|
21252
|
-
p.x >=
|
|
21282
|
+
const [h, g, f, b] = o;
|
|
21283
|
+
p.x >= h && p.x <= h + f && p.y >= g && p.y <= g + b || n(
|
|
21253
21284
|
"terminals",
|
|
21254
21285
|
`terminal '${p.id}' at (${p.x}, ${p.y}) is outside the viewBox — a pin floating off the symbol body leaves a visible gap at every connection`
|
|
21255
21286
|
);
|
|
21256
21287
|
}
|
|
21257
21288
|
}
|
|
21258
21289
|
if (i.length === 2) {
|
|
21259
|
-
const [p,
|
|
21260
|
-
Rn(p.x) !== null && Rn(
|
|
21290
|
+
const [p, h] = i;
|
|
21291
|
+
Rn(p.x) !== null && Rn(h.x) !== null && p.x !== h.x && p.y !== h.y && n(
|
|
21261
21292
|
"terminals",
|
|
21262
|
-
`the two terminals share neither an x (${p.x} vs ${
|
|
21293
|
+
`the two terminals share neither an x (${p.x} vs ${h.x}) nor a y (${p.y} vs ${h.y}). A series device whose pins are offset on both axes renders every wire into it with a right-angle jog, in every drawing, permanently — put both pins on the run axis.`
|
|
21263
21294
|
);
|
|
21264
21295
|
}
|
|
21265
21296
|
return t;
|
|
@@ -21348,16 +21379,16 @@ function _P() {
|
|
|
21348
21379
|
Q(() => {
|
|
21349
21380
|
const m = (p) => {
|
|
21350
21381
|
if (!(p.metaKey || p.ctrlKey)) return;
|
|
21351
|
-
const
|
|
21352
|
-
|
|
21382
|
+
const h = p.key.toLowerCase();
|
|
21383
|
+
h === "o" ? (p.preventDefault(), r()) : h === "s" && (p.preventDefault(), p.shiftKey ? a() : i());
|
|
21353
21384
|
};
|
|
21354
21385
|
return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
|
|
21355
21386
|
}, [r, i, a]), Q(() => {
|
|
21356
21387
|
if (!l) return;
|
|
21357
|
-
const m = (
|
|
21358
|
-
c.current && !c.current.contains(
|
|
21359
|
-
}, p = (
|
|
21360
|
-
|
|
21388
|
+
const m = (h) => {
|
|
21389
|
+
c.current && !c.current.contains(h.target) && s(!1);
|
|
21390
|
+
}, p = (h) => {
|
|
21391
|
+
h.key === "Escape" && s(!1);
|
|
21361
21392
|
};
|
|
21362
21393
|
return window.addEventListener("mousedown", m), window.addEventListener("keydown", p), () => {
|
|
21363
21394
|
window.removeEventListener("mousedown", m), window.removeEventListener("keydown", p);
|
|
@@ -21447,22 +21478,22 @@ function II() {
|
|
|
21447
21478
|
}
|
|
21448
21479
|
} };
|
|
21449
21480
|
}
|
|
21450
|
-
const
|
|
21481
|
+
const Fo = "WIRES", lt = "ELEMENTS", Wo = "LABELS", qe = "ANNOTATIONS", $a = 32, Aa = 64, PI = 8, zI = 1.25, MI = 6;
|
|
21451
21482
|
function DI(e, t = {}) {
|
|
21452
21483
|
var a, l;
|
|
21453
21484
|
const n = new UI(t.precision ?? 6);
|
|
21454
21485
|
n.header(t.title), n.tables([
|
|
21455
|
-
{ name:
|
|
21486
|
+
{ name: Fo, color: 7 },
|
|
21456
21487
|
{ name: lt, color: 7 },
|
|
21457
|
-
{ name:
|
|
21488
|
+
{ name: Wo, color: 8 },
|
|
21458
21489
|
{ name: qe, color: 3 }
|
|
21459
21490
|
]), n.beginEntities();
|
|
21460
21491
|
for (const s of e.wireRenders.values())
|
|
21461
|
-
s.path.length < 2 || (n.setColor(Jt(s.color)), n.polyline(
|
|
21492
|
+
s.path.length < 2 || (n.setColor(Jt(s.color)), n.polyline(Fo, s.path.map(ke), !1));
|
|
21462
21493
|
n.setColor(void 0);
|
|
21463
21494
|
for (const { bus: s, geometry: c } of e.buses.values()) {
|
|
21464
|
-
const { axis: d, at: m, span: p } = c,
|
|
21465
|
-
n.setColor(Jt(s.color)), n.polyline(
|
|
21495
|
+
const { axis: d, at: m, span: p } = c, h = p / 2, g = d === "x" ? [m[0] - h, m[1]] : [m[0], m[1] - h], f = d === "x" ? [m[0] + h, m[1]] : [m[0], m[1] + h];
|
|
21496
|
+
n.setColor(Jt(s.color)), n.polyline(Fo, [g, f].map(ke), !1);
|
|
21466
21497
|
}
|
|
21467
21498
|
n.setColor(void 0);
|
|
21468
21499
|
for (const s of e.elements.values()) {
|
|
@@ -21478,9 +21509,9 @@ function DI(e, t = {}) {
|
|
|
21478
21509
|
const d = mo(s, o);
|
|
21479
21510
|
if (d.length === 0) continue;
|
|
21480
21511
|
const m = s.libraryDef.label ?? po(s.libraryDef, r), {
|
|
21481
|
-
world: [p,
|
|
21512
|
+
world: [p, h],
|
|
21482
21513
|
textAnchor: g,
|
|
21483
|
-
dy:
|
|
21514
|
+
dy: f
|
|
21484
21515
|
} = ho(
|
|
21485
21516
|
m,
|
|
21486
21517
|
s.libraryDef,
|
|
@@ -21490,8 +21521,8 @@ function DI(e, t = {}) {
|
|
|
21490
21521
|
s.element.labelOffset
|
|
21491
21522
|
);
|
|
21492
21523
|
for (let b = 0; b < d.length; b++) {
|
|
21493
|
-
const [y, x] = ke([p,
|
|
21494
|
-
n.text(
|
|
21524
|
+
const [y, x] = ke([p, h + f + b * i]);
|
|
21525
|
+
n.text(Wo, [y, x], d[b], r, 0, !1, g);
|
|
21495
21526
|
}
|
|
21496
21527
|
}
|
|
21497
21528
|
for (const s of e.wireRenders.values()) {
|
|
@@ -21500,12 +21531,12 @@ function DI(e, t = {}) {
|
|
|
21500
21531
|
const d = fo(s.path, r);
|
|
21501
21532
|
if (!d) continue;
|
|
21502
21533
|
const m = ke(d.world);
|
|
21503
|
-
n.setColor(Jt(s.color)), n.text(
|
|
21534
|
+
n.setColor(Jt(s.color)), n.text(Wo, m, c, r, 0, !1, d.textAnchor);
|
|
21504
21535
|
}
|
|
21505
21536
|
n.setColor(void 0);
|
|
21506
21537
|
}
|
|
21507
21538
|
for (const s of t.annotations ?? [])
|
|
21508
|
-
switch (n.setColor(Jt(s.color)),
|
|
21539
|
+
switch (n.setColor(Jt(s.color)), et(s)) {
|
|
21509
21540
|
case "ellipse": {
|
|
21510
21541
|
const c = s;
|
|
21511
21542
|
if (n.polyline(
|
|
@@ -21522,14 +21553,14 @@ function DI(e, t = {}) {
|
|
|
21522
21553
|
break;
|
|
21523
21554
|
}
|
|
21524
21555
|
case "rect": {
|
|
21525
|
-
const c = s, [d, m] = c.at, [p,
|
|
21556
|
+
const c = s, [d, m] = c.at, [p, h] = c.size;
|
|
21526
21557
|
if (n.polyline(
|
|
21527
21558
|
qe,
|
|
21528
21559
|
[
|
|
21529
21560
|
[d, m],
|
|
21530
21561
|
[d + p, m],
|
|
21531
|
-
[d + p, m +
|
|
21532
|
-
[d, m +
|
|
21562
|
+
[d + p, m + h],
|
|
21563
|
+
[d, m + h]
|
|
21533
21564
|
].map(ke),
|
|
21534
21565
|
!0
|
|
21535
21566
|
), c.label) {
|
|
@@ -21545,19 +21576,19 @@ function DI(e, t = {}) {
|
|
|
21545
21576
|
const c = s, d = yn(c);
|
|
21546
21577
|
if (d.length < 2) break;
|
|
21547
21578
|
n.polyline(qe, d.map(ke), !1);
|
|
21548
|
-
for (const m of
|
|
21579
|
+
for (const m of _r(d, c.arrow))
|
|
21549
21580
|
n.polyline(qe, m.map(ke), !0);
|
|
21550
21581
|
break;
|
|
21551
21582
|
}
|
|
21552
21583
|
case "table": {
|
|
21553
|
-
const c = s, [d, m] = c.at, [p,
|
|
21584
|
+
const c = s, [d, m] = c.at, [p, h] = at(c), g = Ft(c), f = Wt(c), b = c.fontSize ?? Ue;
|
|
21554
21585
|
n.polyline(
|
|
21555
21586
|
qe,
|
|
21556
21587
|
[
|
|
21557
21588
|
[d, m],
|
|
21558
21589
|
[d + p, m],
|
|
21559
|
-
[d + p, m +
|
|
21560
|
-
[d, m +
|
|
21590
|
+
[d + p, m + h],
|
|
21591
|
+
[d, m + h]
|
|
21561
21592
|
].map(ke),
|
|
21562
21593
|
!0
|
|
21563
21594
|
);
|
|
@@ -21565,13 +21596,13 @@ function DI(e, t = {}) {
|
|
|
21565
21596
|
n.line(
|
|
21566
21597
|
qe,
|
|
21567
21598
|
ke([d + g[y], m]),
|
|
21568
|
-
ke([d + g[y], m +
|
|
21599
|
+
ke([d + g[y], m + h])
|
|
21569
21600
|
);
|
|
21570
21601
|
for (let y = 1; y < c.rowHeights.length; y++)
|
|
21571
21602
|
n.line(
|
|
21572
21603
|
qe,
|
|
21573
|
-
ke([d, m +
|
|
21574
|
-
ke([d + p, m +
|
|
21604
|
+
ke([d, m + f[y]]),
|
|
21605
|
+
ke([d + p, m + f[y]])
|
|
21575
21606
|
);
|
|
21576
21607
|
for (let y = 0; y < c.rowHeights.length; y++)
|
|
21577
21608
|
for (let x = 0; x < c.colWidths.length; x++) {
|
|
@@ -21579,7 +21610,7 @@ function DI(e, t = {}) {
|
|
|
21579
21610
|
if (C === "") continue;
|
|
21580
21611
|
const S = ke([
|
|
21581
21612
|
d + g[x] + cn,
|
|
21582
|
-
m +
|
|
21613
|
+
m + f[y] + c.rowHeights[y] / 2 + b * 0.35
|
|
21583
21614
|
]);
|
|
21584
21615
|
n.text(qe, S, C, b, 0, !1);
|
|
21585
21616
|
}
|
|
@@ -21591,11 +21622,11 @@ function DI(e, t = {}) {
|
|
|
21591
21622
|
const d = c.fontSize ?? PI, m = c.text.split(`
|
|
21592
21623
|
`);
|
|
21593
21624
|
for (let p = 0; p < m.length; p++) {
|
|
21594
|
-
const [
|
|
21625
|
+
const [h, g] = ke([
|
|
21595
21626
|
c.at[0],
|
|
21596
21627
|
c.at[1] + (p + 1) * d * zI
|
|
21597
21628
|
]);
|
|
21598
|
-
n.text(qe, [
|
|
21629
|
+
n.text(qe, [h, g], m[p], d, 0, !1);
|
|
21599
21630
|
}
|
|
21600
21631
|
break;
|
|
21601
21632
|
}
|
|
@@ -21707,25 +21738,25 @@ function GI(e, t, n) {
|
|
|
21707
21738
|
if (s.cmd === "M")
|
|
21708
21739
|
l(), i = [s.args[0], s.args[1]], a.push(i);
|
|
21709
21740
|
else if (s.cmd === "A" && i) {
|
|
21710
|
-
const [c, d, , m, p,
|
|
21741
|
+
const [c, d, , m, p, h, g] = s.args, f = KI(
|
|
21711
21742
|
i,
|
|
21712
|
-
[
|
|
21743
|
+
[h, g],
|
|
21713
21744
|
c,
|
|
21714
21745
|
d,
|
|
21715
21746
|
m !== 0,
|
|
21716
21747
|
p !== 0
|
|
21717
21748
|
);
|
|
21718
|
-
if (
|
|
21749
|
+
if (f)
|
|
21719
21750
|
for (let b = 1; b <= $a; b++) {
|
|
21720
|
-
const y =
|
|
21751
|
+
const y = f.theta1 + f.delta * b / $a;
|
|
21721
21752
|
a.push([
|
|
21722
|
-
|
|
21723
|
-
|
|
21753
|
+
f.cx + c * Math.cos(y),
|
|
21754
|
+
f.cy + d * Math.sin(y)
|
|
21724
21755
|
]);
|
|
21725
21756
|
}
|
|
21726
21757
|
else
|
|
21727
|
-
a.push([
|
|
21728
|
-
i = [
|
|
21758
|
+
a.push([h, g]);
|
|
21759
|
+
i = [h, g];
|
|
21729
21760
|
}
|
|
21730
21761
|
l();
|
|
21731
21762
|
}
|
|
@@ -21743,22 +21774,22 @@ function KI(e, t, n, o, r, i) {
|
|
|
21743
21774
|
const [a, l] = e, [s, c] = t;
|
|
21744
21775
|
if (a === s && l === c) return null;
|
|
21745
21776
|
const d = (a - s) / 2, m = (l - c) / 2;
|
|
21746
|
-
let p = Math.abs(n),
|
|
21747
|
-
const g = p * p,
|
|
21777
|
+
let p = Math.abs(n), h = Math.abs(o);
|
|
21778
|
+
const g = p * p, f = h * h, b = d * d / g + m * m / f;
|
|
21748
21779
|
if (b > 1) {
|
|
21749
21780
|
const V = Math.sqrt(b);
|
|
21750
|
-
p *= V,
|
|
21781
|
+
p *= V, h *= V;
|
|
21751
21782
|
}
|
|
21752
|
-
const y = r === i ? -1 : 1, x = p * p *
|
|
21783
|
+
const y = r === i ? -1 : 1, x = p * p * h * h - p * p * m * m - h * h * d * d, C = p * p * m * m + h * h * d * d, S = y * Math.sqrt(Math.max(0, x / C)), N = S * (p * m) / h, W = S * -(h * d) / p, oe = N + (a + s) / 2, ge = W + (l + c) / 2, A = (V, F, K, se) => {
|
|
21753
21784
|
const be = V * K + F * se, ce = Math.hypot(V, F) * Math.hypot(K, se);
|
|
21754
21785
|
let ye = Math.acos(Math.max(-1, Math.min(1, be / ce)));
|
|
21755
21786
|
return V * se - F * K < 0 && (ye = -ye), ye;
|
|
21756
|
-
}, L = A(1, 0, (d - N) / p, (m - W) /
|
|
21787
|
+
}, L = A(1, 0, (d - N) / p, (m - W) / h);
|
|
21757
21788
|
let H = A(
|
|
21758
21789
|
(d - N) / p,
|
|
21759
|
-
(m - W) /
|
|
21790
|
+
(m - W) / h,
|
|
21760
21791
|
(-d - N) / p,
|
|
21761
|
-
(-m - W) /
|
|
21792
|
+
(-m - W) / h
|
|
21762
21793
|
);
|
|
21763
21794
|
return !i && H > 0 ? H -= 2 * Math.PI : i && H < 0 && (H += 2 * Math.PI), { cx: oe, cy: ge, theta1: L, delta: H };
|
|
21764
21795
|
}
|
|
@@ -21898,7 +21929,7 @@ function Na(e) {
|
|
|
21898
21929
|
}
|
|
21899
21930
|
const YI = "http://www.w3.org/2000/svg", Hn = 24, ZI = 1.25;
|
|
21900
21931
|
function IS(e, t = {}) {
|
|
21901
|
-
var
|
|
21932
|
+
var h;
|
|
21902
21933
|
const n = rP(e, t), o = Math.floor(n.minX - Hn), r = Math.floor(n.minY - Hn), i = Math.ceil(n.maxX + Hn) - o, a = Math.ceil(n.maxY + Hn) - r, l = t.background ?? "#FFFFFF", s = [];
|
|
21903
21934
|
s.push('<?xml version="1.0" encoding="UTF-8"?>'), s.push(
|
|
21904
21935
|
`<svg xmlns="${YI}" viewBox="${o} ${r} ${i} ${a}" width="${i}" height="${a}">`
|
|
@@ -21907,27 +21938,27 @@ function IS(e, t = {}) {
|
|
|
21907
21938
|
), s.push(' <g fill="none" stroke="black" stroke-width="1">');
|
|
21908
21939
|
for (const g of e.wireRenders.values()) {
|
|
21909
21940
|
if (g.path.length < 2) continue;
|
|
21910
|
-
const
|
|
21911
|
-
s.push(` <polyline points="${
|
|
21941
|
+
const f = g.path.map(([y, x]) => `${y},${x}`).join(" "), b = g.color ? ` stroke="${Qe(g.color)}"` : "";
|
|
21942
|
+
s.push(` <polyline points="${f}"${b}/>`);
|
|
21912
21943
|
}
|
|
21913
21944
|
s.push(" </g>");
|
|
21914
|
-
for (const { bus: g, geometry:
|
|
21915
|
-
const { axis: b, at: y, span: x } =
|
|
21945
|
+
for (const { bus: g, geometry: f } of e.buses.values()) {
|
|
21946
|
+
const { axis: b, at: y, span: x } = f, C = x / 2, S = b === "x" ? y[0] - C : y[0], N = b === "x" ? y[1] : y[1] - C, W = b === "x" ? y[0] + C : y[0], oe = b === "x" ? y[1] : y[1] + C;
|
|
21916
21947
|
s.push(
|
|
21917
|
-
` <line id="${rt(g.id)}" x1="${S}" y1="${N}" x2="${W}" y2="${oe}" stroke="${
|
|
21948
|
+
` <line id="${rt(g.id)}" x1="${S}" y1="${N}" x2="${W}" y2="${oe}" stroke="${Qe(g.color)}" stroke-width="3" stroke-linecap="round" fill="none"/>`
|
|
21918
21949
|
);
|
|
21919
21950
|
}
|
|
21920
|
-
for (const { junction: g, world:
|
|
21951
|
+
for (const { junction: g, world: f, degree: b } of e.junctions.values())
|
|
21921
21952
|
b < 3 || s.push(
|
|
21922
|
-
` <circle id="${rt(g.id)}" cx="${
|
|
21953
|
+
` <circle id="${rt(g.id)}" cx="${f[0]}" cy="${f[1]}" r="3.5" fill="black"/>`
|
|
21923
21954
|
);
|
|
21924
21955
|
for (const g of e.elements.values()) {
|
|
21925
21956
|
if (!g.libraryDef) continue;
|
|
21926
|
-
const
|
|
21927
|
-
|
|
21928
|
-
` <g id="${rt(g.element.id)}" transform="${ft(
|
|
21957
|
+
const f = e.layout.get(g.element.id);
|
|
21958
|
+
f && (s.push(
|
|
21959
|
+
` <g id="${rt(g.element.id)}" transform="${ft(f)}">`
|
|
21929
21960
|
), s.push(
|
|
21930
|
-
` ${QI(X2(g.libraryDef.svg,
|
|
21961
|
+
` ${QI(X2(g.libraryDef.svg, f.scale), g.element.color)}`
|
|
21931
21962
|
), s.push(" </g>"));
|
|
21932
21963
|
}
|
|
21933
21964
|
const c = t.labelMode ?? "all", d = Rt(t.labelFontSize), m = bn(d);
|
|
@@ -21936,34 +21967,34 @@ function IS(e, t = {}) {
|
|
|
21936
21967
|
s.push(
|
|
21937
21968
|
` <g fill="black" font-family="ui-sans-serif, system-ui, sans-serif" font-size="${d}" paint-order="stroke" stroke="${g}" stroke-width="2" stroke-linejoin="round">`
|
|
21938
21969
|
);
|
|
21939
|
-
for (const
|
|
21940
|
-
const b = e.layout.get(
|
|
21941
|
-
if (!b || !
|
|
21942
|
-
const y = mo(
|
|
21970
|
+
for (const f of e.elements.values()) {
|
|
21971
|
+
const b = e.layout.get(f.element.id);
|
|
21972
|
+
if (!b || !f.libraryDef) continue;
|
|
21973
|
+
const y = mo(f, c);
|
|
21943
21974
|
if (y.length === 0) continue;
|
|
21944
|
-
const x =
|
|
21975
|
+
const x = f.libraryDef.label ?? po(f.libraryDef, d), {
|
|
21945
21976
|
world: [C, S],
|
|
21946
21977
|
textAnchor: N,
|
|
21947
21978
|
dy: W
|
|
21948
21979
|
} = ho(
|
|
21949
21980
|
x,
|
|
21950
|
-
|
|
21981
|
+
f.libraryDef,
|
|
21951
21982
|
b,
|
|
21952
21983
|
y.length,
|
|
21953
21984
|
d,
|
|
21954
|
-
|
|
21985
|
+
f.element.labelOffset
|
|
21955
21986
|
);
|
|
21956
21987
|
for (let oe = 0; oe < y.length; oe++)
|
|
21957
21988
|
s.push(
|
|
21958
21989
|
` <text x="${C}" y="${S + W + oe * m}" text-anchor="${N}">${rt(y[oe])}</text>`
|
|
21959
21990
|
);
|
|
21960
21991
|
}
|
|
21961
|
-
for (const
|
|
21962
|
-
const b = (
|
|
21992
|
+
for (const f of e.wireRenders.values()) {
|
|
21993
|
+
const b = (h = f.label) == null ? void 0 : h.trim();
|
|
21963
21994
|
if (!b) continue;
|
|
21964
|
-
const y = fo(
|
|
21995
|
+
const y = fo(f.path, d);
|
|
21965
21996
|
if (!y) continue;
|
|
21966
|
-
const x =
|
|
21997
|
+
const x = f.color ? ` fill="${Qe(f.color)}"` : "";
|
|
21967
21998
|
s.push(
|
|
21968
21999
|
` <text x="${y.world[0]}" y="${y.world[1]}" text-anchor="${y.textAnchor}"${x}>${rt(b)}</text>`
|
|
21969
22000
|
);
|
|
@@ -21972,9 +22003,9 @@ function IS(e, t = {}) {
|
|
|
21972
22003
|
}
|
|
21973
22004
|
const p = t.annotations ?? [];
|
|
21974
22005
|
if (p.length > 0) {
|
|
21975
|
-
const g = l === "transparent" ? "#FFFFFF" : l,
|
|
22006
|
+
const g = l === "transparent" ? "#FFFFFF" : l, f = l === "transparent" ? "none" : l, b = `font-family="ui-sans-serif, system-ui, sans-serif" paint-order="stroke" stroke="${g}" stroke-width="2" stroke-linejoin="round"`;
|
|
21976
22007
|
for (const y of p)
|
|
21977
|
-
switch (
|
|
22008
|
+
switch (et(y)) {
|
|
21978
22009
|
case "rect":
|
|
21979
22010
|
eP(s, y, b);
|
|
21980
22011
|
break;
|
|
@@ -21985,7 +22016,7 @@ function IS(e, t = {}) {
|
|
|
21985
22016
|
nP(s, y);
|
|
21986
22017
|
break;
|
|
21987
22018
|
case "table":
|
|
21988
|
-
oP(s, y,
|
|
22019
|
+
oP(s, y, f);
|
|
21989
22020
|
break;
|
|
21990
22021
|
default:
|
|
21991
22022
|
JI(s, y, b);
|
|
@@ -21997,7 +22028,7 @@ function IS(e, t = {}) {
|
|
|
21997
22028
|
}
|
|
21998
22029
|
function QI(e, t) {
|
|
21999
22030
|
if (!t || t === "default") return e;
|
|
22000
|
-
const n =
|
|
22031
|
+
const n = Qe(t);
|
|
22001
22032
|
return e.replace(
|
|
22002
22033
|
/(stroke|fill)="(black|#000|#000000)"/gi,
|
|
22003
22034
|
(o, r) => `${r}="${n}"`
|
|
@@ -22007,7 +22038,7 @@ function JI(e, t, n) {
|
|
|
22007
22038
|
if (!t.text) return;
|
|
22008
22039
|
const o = t.fontSize ?? Ue, r = t.text.split(`
|
|
22009
22040
|
`);
|
|
22010
|
-
e.push(` <g fill="${
|
|
22041
|
+
e.push(` <g fill="${Qe(t.color)}" ${n}>`);
|
|
22011
22042
|
for (let i = 0; i < r.length; i++) {
|
|
22012
22043
|
const a = t.at[1] + o * 0.85 + i * o * ZI;
|
|
22013
22044
|
e.push(
|
|
@@ -22017,7 +22048,7 @@ function JI(e, t, n) {
|
|
|
22017
22048
|
e.push(" </g>");
|
|
22018
22049
|
}
|
|
22019
22050
|
function eP(e, t, n) {
|
|
22020
|
-
const [o, r] = t.at, [i, a] = t.size, l =
|
|
22051
|
+
const [o, r] = t.at, [i, a] = t.size, l = Qe(t.color);
|
|
22021
22052
|
t.fill === "tint" && e.push(
|
|
22022
22053
|
` <rect x="${o}" y="${r}" width="${i}" height="${a}" fill="${l}" fill-opacity="${z2}"/>`
|
|
22023
22054
|
), e.push(
|
|
@@ -22025,7 +22056,7 @@ function eP(e, t, n) {
|
|
|
22025
22056
|
), PS(e, t, n);
|
|
22026
22057
|
}
|
|
22027
22058
|
function tP(e, t, n) {
|
|
22028
|
-
const { cx: o, cy: r, rx: i, ry: a } =
|
|
22059
|
+
const { cx: o, cy: r, rx: i, ry: a } = Cr(t), l = Qe(t.color);
|
|
22029
22060
|
t.fill === "tint" && e.push(
|
|
22030
22061
|
` <ellipse cx="${o}" cy="${r}" rx="${i}" ry="${a}" fill="${l}" fill-opacity="${z2}"/>`
|
|
22031
22062
|
), e.push(
|
|
@@ -22035,7 +22066,7 @@ function tP(e, t, n) {
|
|
|
22035
22066
|
function PS(e, t, n) {
|
|
22036
22067
|
if (!t.label) return;
|
|
22037
22068
|
const [o, r] = t.at;
|
|
22038
|
-
e.push(` <g fill="${
|
|
22069
|
+
e.push(` <g fill="${Qe(t.color)}" ${n}>`), e.push(
|
|
22039
22070
|
` <text x="${o + pt}" y="${r + pt + Ue * 0.85}" font-size="${Ue}">${rt(t.label)}</text>`
|
|
22040
22071
|
), e.push(" </g>");
|
|
22041
22072
|
}
|
|
@@ -22046,18 +22077,18 @@ function Er(e) {
|
|
|
22046
22077
|
function nP(e, t) {
|
|
22047
22078
|
const n = yn(t);
|
|
22048
22079
|
if (n.length < 2) return;
|
|
22049
|
-
const o =
|
|
22080
|
+
const o = Qe(t.color), r = n.map(([i, a]) => `${i},${a}`).join(" ");
|
|
22050
22081
|
e.push(
|
|
22051
22082
|
` <polyline points="${r}" fill="none" stroke="${o}" stroke-width="${Ht(t.strokeWidth)}"${Er(t.stroke)}/>`
|
|
22052
22083
|
);
|
|
22053
|
-
for (const i of
|
|
22084
|
+
for (const i of _r(n, t.arrow))
|
|
22054
22085
|
e.push(
|
|
22055
22086
|
` <polygon points="${i.map(([a, l]) => `${a},${l}`).join(" ")}" fill="${o}"/>`
|
|
22056
22087
|
);
|
|
22057
22088
|
}
|
|
22058
22089
|
function oP(e, t, n) {
|
|
22059
|
-
var
|
|
22060
|
-
const [o, r] = t.at, i =
|
|
22090
|
+
var h;
|
|
22091
|
+
const [o, r] = t.at, i = Qe(t.color), [a, l] = at(t), s = Ft(t), c = Wt(t), d = t.fontSize ?? Ue;
|
|
22061
22092
|
n !== "none" && e.push(
|
|
22062
22093
|
` <rect x="${o}" y="${r}" width="${a}" height="${l}" fill="${n}"/>`
|
|
22063
22094
|
);
|
|
@@ -22071,10 +22102,10 @@ function oP(e, t, n) {
|
|
|
22071
22102
|
);
|
|
22072
22103
|
const p = [];
|
|
22073
22104
|
for (let g = 0; g < t.rowHeights.length; g++)
|
|
22074
|
-
for (let
|
|
22075
|
-
const b = ((
|
|
22105
|
+
for (let f = 0; f < t.colWidths.length; f++) {
|
|
22106
|
+
const b = ((h = t.cells[g]) == null ? void 0 : h[f]) ?? "";
|
|
22076
22107
|
if (b === "") continue;
|
|
22077
|
-
const y = o + s[
|
|
22108
|
+
const y = o + s[f] + cn, x = r + c[g] + t.rowHeights[g] / 2 + d * 0.35;
|
|
22078
22109
|
p.push(
|
|
22079
22110
|
` <text x="${y}" y="${x}" font-size="${d}">${rt(b)}</text>`
|
|
22080
22111
|
);
|
|
@@ -22092,62 +22123,62 @@ function rP(e, t) {
|
|
|
22092
22123
|
for (const m of e.terminals.values()) a(m.world[0], m.world[1]);
|
|
22093
22124
|
for (const m of e.junctions.values()) a(m.world[0], m.world[1]);
|
|
22094
22125
|
for (const m of e.elements.values()) {
|
|
22095
|
-
const p = e.layout.get(m.element.id),
|
|
22096
|
-
if (!p || !
|
|
22097
|
-
const g = iP(
|
|
22126
|
+
const p = e.layout.get(m.element.id), h = m.libraryDef;
|
|
22127
|
+
if (!p || !h) continue;
|
|
22128
|
+
const g = iP(h.viewBox);
|
|
22098
22129
|
if (!g) {
|
|
22099
22130
|
a(p.at[0], p.at[1]);
|
|
22100
22131
|
continue;
|
|
22101
22132
|
}
|
|
22102
|
-
const
|
|
22133
|
+
const f = [
|
|
22103
22134
|
[g.x, g.y],
|
|
22104
22135
|
[g.x + g.w, g.y],
|
|
22105
22136
|
[g.x, g.y + g.h],
|
|
22106
22137
|
[g.x + g.w, g.y + g.h]
|
|
22107
22138
|
];
|
|
22108
|
-
for (const b of
|
|
22139
|
+
for (const b of f) {
|
|
22109
22140
|
const [y, x] = We(b, p);
|
|
22110
22141
|
a(y, x);
|
|
22111
22142
|
}
|
|
22112
22143
|
}
|
|
22113
22144
|
for (const { geometry: m } of e.buses.values()) {
|
|
22114
|
-
const { axis: p, at:
|
|
22115
|
-
p === "x" ? (a(
|
|
22145
|
+
const { axis: p, at: h, span: g } = m, f = g / 2;
|
|
22146
|
+
p === "x" ? (a(h[0] - f, h[1]), a(h[0] + f, h[1])) : (a(h[0], h[1] - f), a(h[0], h[1] + f));
|
|
22116
22147
|
}
|
|
22117
22148
|
for (const m of e.wireRenders.values())
|
|
22118
|
-
for (const [p,
|
|
22149
|
+
for (const [p, h] of m.path) a(p, h);
|
|
22119
22150
|
const l = t.labelMode ?? "all", s = Rt(t.labelFontSize), c = bn(s);
|
|
22120
22151
|
if (l !== "off") {
|
|
22121
22152
|
for (const m of e.elements.values()) {
|
|
22122
22153
|
const p = e.layout.get(m.element.id);
|
|
22123
22154
|
if (!p || !m.libraryDef) continue;
|
|
22124
|
-
const
|
|
22125
|
-
if (
|
|
22155
|
+
const h = mo(m, l);
|
|
22156
|
+
if (h.length === 0) continue;
|
|
22126
22157
|
const g = m.libraryDef.label ?? po(m.libraryDef, s), {
|
|
22127
|
-
world: [
|
|
22158
|
+
world: [f, b],
|
|
22128
22159
|
textAnchor: y,
|
|
22129
22160
|
dy: x
|
|
22130
22161
|
} = ho(
|
|
22131
22162
|
g,
|
|
22132
22163
|
m.libraryDef,
|
|
22133
22164
|
p,
|
|
22134
|
-
|
|
22165
|
+
h.length,
|
|
22135
22166
|
s,
|
|
22136
22167
|
m.element.labelOffset
|
|
22137
|
-
), C =
|
|
22168
|
+
), C = Qo(h, s), S = h.length * c, N = y === "middle" ? f - C / 2 : y === "end" ? f - C : f;
|
|
22138
22169
|
a(N, b + x - s), a(N + C, b + x + S);
|
|
22139
22170
|
}
|
|
22140
22171
|
for (const m of e.wireRenders.values()) {
|
|
22141
22172
|
const p = (d = m.label) == null ? void 0 : d.trim();
|
|
22142
22173
|
if (!p) continue;
|
|
22143
|
-
const
|
|
22144
|
-
if (!
|
|
22145
|
-
const [g,
|
|
22146
|
-
a(y,
|
|
22174
|
+
const h = fo(m.path, s);
|
|
22175
|
+
if (!h) continue;
|
|
22176
|
+
const [g, f] = h.world, b = Qo([p], s), y = h.textAnchor === "middle" ? g - b / 2 : g;
|
|
22177
|
+
a(y, f - s), a(y + b, f);
|
|
22147
22178
|
}
|
|
22148
22179
|
}
|
|
22149
22180
|
for (const m of t.annotations ?? []) {
|
|
22150
|
-
if (
|
|
22181
|
+
if (et(m) === "text" && !m.text)
|
|
22151
22182
|
continue;
|
|
22152
22183
|
const p = R2(m);
|
|
22153
22184
|
a(p.minX, p.minY), a(p.maxX, p.maxY);
|
|
@@ -22210,12 +22241,12 @@ function CP() {
|
|
|
22210
22241
|
};
|
|
22211
22242
|
}, [t]);
|
|
22212
22243
|
const r = (i) => () => {
|
|
22213
|
-
var m, p,
|
|
22244
|
+
var m, p, h, g, f;
|
|
22214
22245
|
n(!1);
|
|
22215
22246
|
const { internal: a, diagram: l, fileSession: s } = w.getState(), c = ((m = s == null ? void 0 : s.name) == null ? void 0 : m.replace(/\.json$/i, "")) ?? ((p = l.meta) == null ? void 0 : p.title) ?? "diagram", d = {
|
|
22216
|
-
title: (
|
|
22247
|
+
title: (h = l.meta) == null ? void 0 : h.title,
|
|
22217
22248
|
labelMode: (g = l.meta) == null ? void 0 : g.labelMode,
|
|
22218
|
-
labelFontSize: (
|
|
22249
|
+
labelFontSize: (f = l.meta) == null ? void 0 : f.labelFontSize,
|
|
22219
22250
|
annotations: l.annotations
|
|
22220
22251
|
};
|
|
22221
22252
|
i === "svg" ? aP(a, `${c}.svg`, d) : i === "png" ? sP(a, `${c}.png`, { ...d, scale: 2 }).catch((b) => {
|
|
@@ -22297,11 +22328,11 @@ export {
|
|
|
22297
22328
|
nN as CUSTOM_KIND_PREFIX,
|
|
22298
22329
|
CP as ExportMenu,
|
|
22299
22330
|
_P as FileMenu,
|
|
22300
|
-
|
|
22301
|
-
|
|
22331
|
+
Yo as LIBRARY,
|
|
22332
|
+
xr as NAMED_COLORS,
|
|
22302
22333
|
wP as OneLineEditor,
|
|
22303
22334
|
vP as OneLineViewer,
|
|
22304
|
-
|
|
22335
|
+
et as annotationKind,
|
|
22305
22336
|
cI as applyTheme,
|
|
22306
22337
|
fP as bindingsOf,
|
|
22307
22338
|
DI as buildExportDxf,
|
|
@@ -22314,13 +22345,13 @@ export {
|
|
|
22314
22345
|
aP as downloadSvg,
|
|
22315
22346
|
Jt as dxfColor,
|
|
22316
22347
|
iN as emptyInternalModel,
|
|
22317
|
-
|
|
22348
|
+
Qe as exportInk,
|
|
22318
22349
|
sS as fitToContent,
|
|
22319
22350
|
lS as fitToContentSoon,
|
|
22320
22351
|
yP as getInitialTheme,
|
|
22321
22352
|
hP as getLibraryEntry,
|
|
22322
22353
|
He as inkClass,
|
|
22323
|
-
|
|
22354
|
+
wr as isCustomKind,
|
|
22324
22355
|
pP as isTextAnnotation,
|
|
22325
22356
|
oN as mergeCustomKinds,
|
|
22326
22357
|
Nn as newAnnotationId,
|
|
@@ -22333,7 +22364,7 @@ export {
|
|
|
22333
22364
|
aN as resolvePlacement,
|
|
22334
22365
|
kP as sanitizeSymbolSvg,
|
|
22335
22366
|
gn as soleSelectedAnnotation,
|
|
22336
|
-
|
|
22367
|
+
Ho as toTagValue,
|
|
22337
22368
|
Fn as transformOrientation,
|
|
22338
22369
|
We as transformPoint,
|
|
22339
22370
|
gP as upsertBinding,
|