@edubeam/plot 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,3257 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, inject as c, mergeProps as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderList as g, resolveDynamicComponent as _, toDisplayString as v, toHandlers as y, toRaw as b, unref as x, useId as ee, watch as te, withCtx as ne } from "vue";
2
+ import { Beam2D as S, BeamConcentratedLoad as C, BeamElementTrapezoidalEdgeLoad as w, BeamElementUniformEdgeLoad as T, BeamTemperatureLoad as re, DofID as E } from "@edubeam/fem";
3
+ // src/core/polynomial.ts
4
+ var D = (e, t) => {
5
+ let n = 0;
6
+ for (let r = e.length - 1; r >= 0; r--) n = n * t + e[r];
7
+ return n;
8
+ }, O = (e) => e.slice(1).map((e, t) => e * (t + 1)), k = (e) => e.x1 - e.x0, ie = (e, t) => k(e) > 0 ? (t - e.x0) / k(e) : 0, A = (e, t) => D(e.c, ie(e, t)), j = (e, t) => k(e) > 0 ? D(O(e.c), ie(e, t)) / k(e) : 0, M = (e, t) => {
9
+ let n = t.length;
10
+ for (let r = 0; r < n; r++) {
11
+ let i = r;
12
+ for (let t = r + 1; t < n; t++) Math.abs(e[t][r]) > Math.abs(e[i][r]) && (i = t);
13
+ [e[r], e[i]] = [e[i], e[r]], [t[r], t[i]] = [t[i], t[r]];
14
+ for (let i = r + 1; i < n; i++) {
15
+ let a = e[i][r] / e[r][r];
16
+ for (let t = r; t < n; t++) e[i][t] -= a * e[r][t];
17
+ t[i] -= a * t[r];
18
+ }
19
+ }
20
+ let r = Array.from({ length: n }, () => 0);
21
+ for (let i = n - 1; i >= 0; i--) {
22
+ let a = t[i];
23
+ for (let t = i + 1; t < n; t++) a -= e[i][t] * r[t];
24
+ r[i] = a / e[i][i];
25
+ }
26
+ return r;
27
+ }, N = (e, t, n, r) => {
28
+ let i = r + 1, a = Array.from({ length: i }, (e, t) => (1 - Math.cos((2 * t + 1) * Math.PI / (2 * i))) / 2);
29
+ return {
30
+ x0: t,
31
+ x1: n,
32
+ c: M(a.map((e) => Array.from({ length: i }, (t, n) => e ** n)), a.map((r) => e(t + r * (n - t))))
33
+ };
34
+ }, P = (e) => {
35
+ let t = 0;
36
+ for (let n of e) for (let e of [
37
+ n.x0,
38
+ n.x1,
39
+ ...oe(n)
40
+ ]) t = Math.max(t, Math.abs(A(n, e)));
41
+ return t;
42
+ }, F = (e, t) => e.map((e) => {
43
+ let n = e.c.map((e) => Math.abs(e) <= t ? 0 : e);
44
+ for (; n.length > 1 && n[n.length - 1] === 0;) n.pop();
45
+ return {
46
+ x0: e.x0,
47
+ x1: e.x1,
48
+ c: n
49
+ };
50
+ }), I = (e) => {
51
+ for (let t = e.c.length - 1; t >= 0; t--) if (e.c[t] !== 0) return t;
52
+ return null;
53
+ }, ae = (e) => e.every((e) => I(e) === null), oe = (e) => {
54
+ let t = O(e.c);
55
+ if (t.every((e) => e === 0)) return [];
56
+ let n = [], r = 0, i = D(t, r);
57
+ for (let e = 1; e <= 64; e++) {
58
+ let a = e / 64, o = D(t, a);
59
+ if (i === 0 && r > 0) n.push(r);
60
+ else if (i * o < 0) {
61
+ let e = r, o = a, s = i;
62
+ for (let n = 0; n < 80 && o - e > 1e-15; n++) {
63
+ let n = (e + o) / 2, r = D(t, n);
64
+ s * r <= 0 ? o = n : (e = n, s = r);
65
+ }
66
+ n.push((e + o) / 2);
67
+ }
68
+ r = a, i = o;
69
+ }
70
+ return n.filter((e) => e > 1e-9 && e < 1 - 1e-9).map((t) => e.x0 + t * k(e));
71
+ }, L = (e, t, n = "right") => {
72
+ if (e.length === 0) return 0;
73
+ let r = se(e, t, n);
74
+ return A(r, Math.min(r.x1, Math.max(r.x0, t)));
75
+ }, R = (e, t, n = "right") => e.length === 0 ? 0 : j(se(e, t, n), t), se = (e, t, n) => {
76
+ let r = 1e-12 * Math.max(1, Math.abs(e[e.length - 1].x1));
77
+ if (n === "left") {
78
+ for (let n of e) if (t <= n.x1 + r) return n;
79
+ return e[e.length - 1];
80
+ }
81
+ for (let n = e.length - 1; n >= 0; n--) if (t >= e[n].x0 - r) return e[n];
82
+ return e[0];
83
+ }, ce = (e) => e.slice(1).map((e) => e.x0), le = (e, t = 4) => {
84
+ let n = (I(e) ?? 0) <= 3 ? 1 : t, r = [];
85
+ for (let t = 0; t < n; t++) {
86
+ let i = e.x0 + k(e) * t / n, a = e.x0 + k(e) * (t + 1) / n, o = (a - i) / 3, s = A(e, i), c = A(e, a);
87
+ r.push([
88
+ [i, s],
89
+ [i + o, s + o * j(e, i)],
90
+ [a - o, c - o * j(e, a)],
91
+ [a, c]
92
+ ]);
93
+ }
94
+ return r;
95
+ }, z = (e) => {
96
+ if (e.length === 0) return null;
97
+ let t = {
98
+ x: e[0].x0,
99
+ value: -Infinity,
100
+ side: "right"
101
+ }, n = {
102
+ x: e[0].x0,
103
+ value: Infinity,
104
+ side: "right"
105
+ };
106
+ for (let r of e) {
107
+ let e = [
108
+ [r.x0, "right"],
109
+ [r.x1, "left"],
110
+ ...oe(r).map((e) => [e, "right"])
111
+ ];
112
+ for (let [i, a] of e) {
113
+ let e = A(r, i);
114
+ e > t.value && (t = {
115
+ x: i,
116
+ value: e,
117
+ side: a
118
+ }), e < n.value && (n = {
119
+ x: i,
120
+ value: e,
121
+ side: a
122
+ });
123
+ }
124
+ }
125
+ return {
126
+ max: t,
127
+ min: n
128
+ };
129
+ }, B = 3, ue = 5, de = 1e-9, fe = {
130
+ force: 1e-6,
131
+ moment: 1e-6,
132
+ displacement: 1e-12
133
+ }, pe = {
134
+ [E.Dx]: "dx",
135
+ [E.Dz]: "dz",
136
+ [E.Ry]: "ry"
137
+ }, V = (e) => e.hasLcs() ? Math.atan2(e.lcs[0][2], e.lcs[0][0]) : 0, me = (e) => ({
138
+ id: e.label,
139
+ x: e.coords[0],
140
+ z: e.coords[2],
141
+ fixity: {
142
+ dx: e.bcs.has(E.Dx),
143
+ dz: e.bcs.has(E.Dz),
144
+ ry: e.bcs.has(E.Ry)
145
+ },
146
+ angle: V(e)
147
+ }), he = (e) => {
148
+ if (typeof e == "number") return [e];
149
+ if (Array.isArray(e)) return e.flatMap((e) => he(e));
150
+ if (typeof e == "object" && e && "toArray" in e && typeof e.toArray == "function") return he(e.toArray.call(e));
151
+ throw Error("Unexpected reaction value from the solver");
152
+ }, ge = (e, t, n, r) => {
153
+ if (!r || !e.hasLcs()) return {
154
+ fx: t,
155
+ fz: n
156
+ };
157
+ let [i, , a] = e.lcs;
158
+ return {
159
+ fx: t * i[0] + n * a[0],
160
+ fz: t * i[2] + n * a[2]
161
+ };
162
+ }, _e = (e, t) => {
163
+ let n = [];
164
+ for (let r of t.nodalLoadList) {
165
+ let t = e.domain.getNode(r.target), i = r.values[E.Dx] ?? 0, a = r.values[E.Dz] ?? 0, o = r.values[E.Ry] ?? 0;
166
+ (i !== 0 || a !== 0) && n.push({
167
+ kind: "nodalForce",
168
+ node: r.target,
169
+ ...ge(t, i, a, r.lcs)
170
+ }), o !== 0 && n.push({
171
+ kind: "nodalMoment",
172
+ node: r.target,
173
+ my: o
174
+ });
175
+ }
176
+ for (let e of t.elementLoadList) if (e instanceof T) {
177
+ let t = {
178
+ fx: e.values[0] ?? 0,
179
+ fz: e.values[1] ?? 0
180
+ };
181
+ n.push({
182
+ kind: "distributed",
183
+ member: e.target,
184
+ start: t,
185
+ end: t,
186
+ local: e.lcs
187
+ });
188
+ } else if (e instanceof w) n.push({
189
+ kind: "distributed",
190
+ member: e.target,
191
+ start: {
192
+ fx: e.startValues[0],
193
+ fz: e.startValues[1]
194
+ },
195
+ end: {
196
+ fx: e.endValues[0],
197
+ fz: e.endValues[1]
198
+ },
199
+ local: e.lcs
200
+ });
201
+ else if (e instanceof C) {
202
+ let [t = 0, r = 0, i = 0, a = 0] = e.values;
203
+ (t !== 0 || r !== 0) && n.push({
204
+ kind: "pointForce",
205
+ member: e.target,
206
+ at: a,
207
+ fx: t,
208
+ fz: r,
209
+ local: e.lcs
210
+ }), i !== 0 && n.push({
211
+ kind: "pointMoment",
212
+ member: e.target,
213
+ at: a,
214
+ my: i
215
+ });
216
+ } else if (e instanceof re) {
217
+ let [t = 0, r = 0, i = 0] = e.values;
218
+ n.push({
219
+ kind: "temperature",
220
+ member: e.target,
221
+ uniform: t,
222
+ gradient: r - i
223
+ });
224
+ }
225
+ for (let e of t.prescribedBC) {
226
+ let t = e.prescribedValues;
227
+ n.push({
228
+ kind: "prescribed",
229
+ node: e.target,
230
+ dx: t[E.Dx],
231
+ dz: t[E.Dz],
232
+ ry: t[E.Ry]
233
+ });
234
+ }
235
+ return n;
236
+ }, ve = (e, t, n) => {
237
+ let r = 1e-9 * n, i = [0, n];
238
+ for (let a of t.getElementLoadsOnElement(e.label)) {
239
+ if (!(a instanceof C)) continue;
240
+ let e = a.values[3] ?? 0;
241
+ e > r && e < n - r && i.every((t) => Math.abs(t - e) > r) && i.push(e);
242
+ }
243
+ return i.sort((e, t) => e - t);
244
+ }, ye = (e, t) => {
245
+ let n = e.computeEndDisplacement(t), r = [
246
+ 0,
247
+ 1,
248
+ 2,
249
+ 3,
250
+ 4,
251
+ 5
252
+ ].map((e) => n.get([e])), i = t.getElementLoadsOnElement(e.label);
253
+ return (t) => {
254
+ let n = e.computeEndShapes(t), a = n[0] * r[1] + n[1] * r[2] + n[2] * r[4] + n[3] * r[5], o = (1 - t) * r[0] + t * r[3];
255
+ for (let e of i) {
256
+ let n = e.computeBeamDeflectionContrib(t);
257
+ o += n.u, a += n.w;
258
+ }
259
+ return {
260
+ u: o,
261
+ w: a
262
+ };
263
+ };
264
+ }, be = (e, t) => {
265
+ let { l: n } = e.computeGeo(), r = ve(e, t, n), i = ye(e, t), a = (e, t) => r.slice(1).map((n, i) => N(e, r[i], n, t));
266
+ return {
267
+ N: a((n) => e.computeNormalForceAt(t, n), B),
268
+ V: a((n) => e.computeShearForceAt(t, n), B),
269
+ M: a((n) => e.computeBendingMomentAt(t, n), B),
270
+ u: a((e) => i(e / n).u, ue),
271
+ w: a((e) => i(e / n).w, ue)
272
+ };
273
+ }, xe = (e) => {
274
+ let t = [
275
+ "N",
276
+ "V",
277
+ "M",
278
+ "u",
279
+ "w"
280
+ ], n = Object.values(e), r = Object.fromEntries(t.map((e) => [e, Math.max(0, ...n.map((t) => P(t[e])))])), i = Math.max(r.u, r.w), a = (e) => e === "u" || e === "w" ? Math.max(de * i, fe.displacement) : Math.max(de * r[e], e === "M" ? fe.moment : fe.force);
281
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, {
282
+ N: F(t.N, a("N")),
283
+ V: F(t.V, a("V")),
284
+ M: F(t.M, a("M")),
285
+ u: F(t.u, a("u")),
286
+ w: F(t.w, a("w"))
287
+ }]));
288
+ }, Se = (e, t, n) => {
289
+ let r = [], i = [];
290
+ for (let a of e.domain.nodes.values()) {
291
+ if (a.bcs.size === 0 || !n.has(a.label)) continue;
292
+ let e = a.getReactions(t, !1), o = he(e.values);
293
+ e.dofs.forEach((e, t) => {
294
+ let n = pe[e];
295
+ n && (r.push({
296
+ node: a.label,
297
+ dof: n,
298
+ value: o[t]
299
+ }), i.push(Math.abs(o[t])));
300
+ });
301
+ }
302
+ let a = Math.max(de * Math.max(0, ...i), fe.force);
303
+ return r.map((e) => Math.abs(e.value) <= a ? {
304
+ ...e,
305
+ value: 0
306
+ } : e);
307
+ }, Ce = (e, t = {}) => {
308
+ let n = e.loadCases[t.loadCase ?? 0];
309
+ if (!n) throw Error(`The solver has no load case ${t.loadCase ?? 0}`);
310
+ let r = [...e.domain.elements.values()].filter((e) => e instanceof S), i = new Set(r.flatMap((e) => e.nodes)), a = {
311
+ nodes: [...e.domain.nodes.values()].map(me),
312
+ members: r.map((e) => ({
313
+ id: e.label,
314
+ start: e.nodes[0],
315
+ end: e.nodes[1],
316
+ hinges: [e.hinges[0], e.hinges[1]]
317
+ })),
318
+ loads: _e(e, n)
319
+ };
320
+ if (!n.solved) return a;
321
+ let o = xe(Object.fromEntries(r.map((e) => [e.label, be(e, n)])));
322
+ return {
323
+ ...a,
324
+ results: {
325
+ members: o,
326
+ reactions: Se(e, n, i)
327
+ }
328
+ };
329
+ }, H = {
330
+ diagramFill: 0,
331
+ diagramHatch: 1,
332
+ diagramLine: 2,
333
+ deformed: 3,
334
+ member: 4,
335
+ hinge: 5,
336
+ support: 6,
337
+ load: 7,
338
+ reaction: 8,
339
+ label: 9
340
+ }, U = (e, t, n = 0, r = 0) => ({
341
+ x: e,
342
+ z: t,
343
+ dx: n,
344
+ dy: r
345
+ }), W = (e, t, n) => ({
346
+ ...e,
347
+ dx: e.dx + t,
348
+ dy: e.dy + n
349
+ }), G = (e, t) => [e.tx + e.s * t.x + t.dx, e.ty + e.s * t.z + t.dy], K = (e) => /[0-9]/.test(e) ? .56 : /[.,:;·'|!il]/.test(e) ? .28 : e === " " || e === " " ? .25 : /[mwMWΔ]/.test(e) ? .84 : /[A-Z]/.test(e) ? .66 : .56, we = (e, t) => [...e].reduce((e, t) => e + K(t), 0) * t, Te = .75, Ee = .28, De = (e, t, n, r, i) => {
350
+ let a = we(e, t) + (i ? we(i, t * Te) : 0), o = n === "start" ? 0 : n === "end" ? -a : -a / 2, s = t, c = r === "top" ? 0 : r === "bottom" ? -s : -s / 2;
351
+ return {
352
+ x0: o,
353
+ x1: o + a,
354
+ y0: c,
355
+ y1: c + s
356
+ };
357
+ }, Oe = {
358
+ top: .78,
359
+ middle: .35,
360
+ bottom: -.22
361
+ }, ke = () => ({
362
+ minX: Infinity,
363
+ maxX: -Infinity,
364
+ minY: Infinity,
365
+ maxY: -Infinity
366
+ }), Ae = (e, t, n) => {
367
+ t < e.minX && (e.minX = t), t > e.maxX && (e.maxX = t), n < e.minY && (e.minY = n), n > e.maxY && (e.maxY = n);
368
+ }, je = (e, t, n) => {
369
+ let [r, i] = G(t, e.at), a = De(e.text, e.size ?? n, e.align, e.baseline, e.sub), o = ke(), s = (e.rotate ?? 0) * Math.PI / 180, c = Math.cos(s), l = Math.sin(s);
370
+ for (let [e, t] of [
371
+ [a.x0, a.y0],
372
+ [a.x1, a.y0],
373
+ [a.x0, a.y1],
374
+ [a.x1, a.y1]
375
+ ]) Ae(o, r + e * c - t * l, i + e * l + t * c);
376
+ return o;
377
+ }, Me = (e, t, n) => {
378
+ let r = {
379
+ s: t,
380
+ tx: 0,
381
+ ty: 0
382
+ }, i = ke(), a = (e, t = 0) => {
383
+ let [n, a] = G(r, e);
384
+ Ae(i, n - t, a - t), Ae(i, n + t, a + t);
385
+ };
386
+ for (let t of e) if (t.kind === "path") {
387
+ if (t.fitIgnore) continue;
388
+ let e = t.width / 2;
389
+ for (let n of t.segments) n.op !== "Z" && (n.op === "C" && (a(n.c1, e), a(n.c2, e)), n.op === "A" && a(n.center, n.r + e), a(n.p, e));
390
+ } else if (t.kind === "circle") a(t.at, t.r + t.width / 2);
391
+ else {
392
+ let e = je(t, r, n);
393
+ Ae(i, e.minX, e.minY), Ae(i, e.maxX, e.maxY);
394
+ }
395
+ return i;
396
+ }, Ne = (e, t) => {
397
+ let n = Math.max(1, t.width - 2 * t.padding), r = t.height === void 0 ? void 0 : Math.max(1, t.height - 2 * t.padding), i = t.maxHeight === void 0 ? Infinity : Math.max(1, t.maxHeight - 2 * t.padding), a = r ?? i, o = (r) => {
398
+ let i = Me(e, r, t.fontSize);
399
+ return i.maxX - i.minX <= n && i.maxY - i.minY <= a;
400
+ }, s = 0, c = 1;
401
+ for (; o(c) && c < 1e9;) s = c, c *= 2;
402
+ for (let e = 0; e < 60; e++) {
403
+ let e = (s + c) / 2;
404
+ o(e) ? s = e : c = e;
405
+ }
406
+ let l = s > 0 ? s : c * .001, u = Me(e, l, t.fontSize), d = u.maxX - u.minX, f = u.maxY - u.minY, p = t.height ?? Math.min(f, i) + 2 * t.padding;
407
+ return {
408
+ s: l,
409
+ tx: t.padding + (n - d) / 2 - u.minX,
410
+ ty: (p - f) / 2 - u.minY,
411
+ width: t.width,
412
+ height: Math.ceil(p)
413
+ };
414
+ }, q = (e) => {
415
+ let t = Math.round(e * 100) / 100;
416
+ return Object.is(t, -0) ? "0" : String(t);
417
+ }, Pe = (e, t) => e.map((e) => {
418
+ switch (e.op) {
419
+ case "Z": return "Z";
420
+ case "M":
421
+ case "L": {
422
+ let [n, r] = G(t, e.p);
423
+ return `${e.op}${q(n)} ${q(r)}`;
424
+ }
425
+ case "A": {
426
+ let [n, r] = G(t, e.p);
427
+ return `A${q(e.r)} ${q(e.r)} 0 ${+!!e.large} ${+!!e.clockwise} ${q(n)} ${q(r)}`;
428
+ }
429
+ case "C": {
430
+ let [n, r] = G(t, e.c1), [i, a] = G(t, e.c2), [o, s] = G(t, e.p);
431
+ return `C${q(n)} ${q(r)} ${q(i)} ${q(a)} ${q(o)} ${q(s)}`;
432
+ }
433
+ }
434
+ }).join(""), Fe = (e, t, n) => e.minX < t.maxX + n && t.minX < e.maxX + n && e.minY < t.maxY + n && t.minY < e.maxY + n, Ie = (e, t, n) => {
435
+ let r = t[0] - e[0], i = t[1] - e[1], a = 0, o = 1, s = [
436
+ [-r, e[0] - n.minX],
437
+ [r, n.maxX - e[0]],
438
+ [-i, e[1] - n.minY],
439
+ [i, n.maxY - e[1]]
440
+ ];
441
+ for (let [e, t] of s) if (e === 0) {
442
+ if (t < 0) return !1;
443
+ } else {
444
+ let n = t / e;
445
+ if (e < 0 ? a = Math.max(a, n) : o = Math.min(o, n), a > o) return !1;
446
+ }
447
+ return !0;
448
+ }, Le = (e, t, n) => {
449
+ let r = [];
450
+ for (let i of e) {
451
+ if (i.kind !== "path" || !(i.obstacle || i.shield && (n.shields?.has(i.group) ?? !0))) continue;
452
+ let e = i.obstacle ? null : i.group, a = i.width / 2 + 1, o = null;
453
+ for (let n of i.segments) {
454
+ if (n.op === "Z") continue;
455
+ let i = G(t, n.p);
456
+ if (n.op === "A" && o) {
457
+ let [s, c] = G(t, n.center), l = Math.atan2(o[1] - c, o[0] - s), u = Math.atan2(i[1] - c, i[0] - s);
458
+ n.clockwise && u < l && (u += 2 * Math.PI), !n.clockwise && u > l && (u -= 2 * Math.PI);
459
+ let d = o;
460
+ for (let t = 1; t <= 12; t++) {
461
+ let i = l + (u - l) * t / 12, o = [s + n.r * Math.cos(i), c + n.r * Math.sin(i)];
462
+ r.push([
463
+ d,
464
+ o,
465
+ a,
466
+ e
467
+ ]), d = o;
468
+ }
469
+ } else if (n.op === "C" && o) {
470
+ let [s, c] = [G(t, n.c1), G(t, n.c2)], l = o;
471
+ for (let t = 1; t <= 12; t++) {
472
+ let n = t / 12, u = 1 - n, d = [u * u * u * o[0] + 3 * u * u * n * s[0] + 3 * u * n * n * c[0] + n * n * n * i[0], u * u * u * o[1] + 3 * u * u * n * s[1] + 3 * u * n * n * c[1] + n * n * n * i[1]];
473
+ r.push([
474
+ l,
475
+ d,
476
+ a,
477
+ e
478
+ ]), l = d;
479
+ }
480
+ } else o && n.op !== "M" && r.push([
481
+ o,
482
+ i,
483
+ a,
484
+ e
485
+ ]);
486
+ o = i;
487
+ }
488
+ }
489
+ let i = n.alternativeGroups ?? /* @__PURE__ */ new Set(), a = e.flatMap((e, t) => e.kind === "text" ? [{
490
+ item: e,
491
+ i: t
492
+ }] : []), o = (e) => +!!i.has(e.group);
493
+ a.sort((e, t) => o(e.item) - o(t.item) || t.item.priority - e.item.priority || e.i - t.i);
494
+ let s = [], c = /* @__PURE__ */ new Map(), l = n.viewport, u = (e, t) => e === t || !i.has(e) || !i.has(t), d = (e) => {
495
+ let a = je(e, t, n.fontSize);
496
+ if (l && (a.minX < 0 || a.minY < 0 || a.maxX > l.width || a.maxY > l.height) || s.some((t) => u(t.group, e.group) && Fe(t.box, a, 1))) return null;
497
+ let [o, c] = G(t, e.at), d = -(e.rotate ?? 0) * Math.PI / 180, f = Math.cos(d), p = Math.sin(d), m = ([e, t]) => [(e - o) * f - (t - c) * p, (e - o) * p + (t - c) * f], h = De(e.text, e.size ?? n.fontSize, e.align, e.baseline, e.sub), g = (t) => t === null || t !== e.group && !i.has(e.group);
498
+ return r.some(([e, t, n, r]) => g(r) && Ie(m(e), m(t), {
499
+ minX: h.x0 - n + 1,
500
+ maxX: h.x1 + n - 1,
501
+ minY: h.y0 - n + 2,
502
+ maxY: h.y1 + n - 2
503
+ })) ? null : a;
504
+ };
505
+ for (let { item: e } of a) if (!n.exclude?.has(e)) for (let t of [e, ...(e.alternatives ?? []).map((t) => ({
506
+ ...e,
507
+ ...t
508
+ }))]) {
509
+ let n = d(t);
510
+ if (n) {
511
+ s.push({
512
+ box: n,
513
+ group: e.group
514
+ }), c.set(e, t);
515
+ break;
516
+ }
517
+ }
518
+ return c;
519
+ }, Re = (e, t, n) => {
520
+ let r = Le(e, t, n), i = [], a = [], o = [];
521
+ for (let s of e) if (s.kind === "path") i.push({
522
+ group: s.group,
523
+ d: Pe(s.segments, t),
524
+ layer: s.layer,
525
+ tone: s.tone,
526
+ width: s.width,
527
+ fill: s.fill,
528
+ fillOpacity: s.fillOpacity,
529
+ opacity: s.opacity,
530
+ dash: s.dash,
531
+ cap: s.cap,
532
+ draw: s.draw
533
+ });
534
+ else if (s.kind === "circle") {
535
+ let [e, n] = G(t, s.at);
536
+ a.push({
537
+ group: s.group,
538
+ cx: e,
539
+ cy: n,
540
+ r: s.r,
541
+ layer: s.layer,
542
+ tone: s.tone,
543
+ width: s.width,
544
+ fill: s.fill
545
+ });
546
+ } else {
547
+ let e = r.get(s);
548
+ if (!e) continue;
549
+ let [i, a] = G(t, e.at), c = e.rotate ?? 0;
550
+ o.push({
551
+ group: s.group,
552
+ x: Math.round(i * 100) / 100,
553
+ y: Math.round((a + Oe[e.baseline] * (e.size ?? n.fontSize)) * 100) / 100,
554
+ text: e.text,
555
+ sub: s.sub,
556
+ size: e.size,
557
+ tone: s.tone,
558
+ anchor: e.align,
559
+ transform: c === 0 ? void 0 : `rotate(${q(c)} ${q(i)} ${q(a)})`,
560
+ italic: s.italic,
561
+ weight: s.weight
562
+ });
563
+ }
564
+ return {
565
+ paths: i.sort((e, t) => e.layer - t.layer),
566
+ circles: a,
567
+ texts: o
568
+ };
569
+ }, ze = (e) => new Map(e.nodes.map((e) => [e.id, e])), Be = (e, t, n = ze(e)) => {
570
+ let r = n.get(t.start), i = n.get(t.end);
571
+ if (!r || !i) throw Error(`Member ${t.id} names a node that does not exist`);
572
+ let a = i.x - r.x, o = i.z - r.z, s = Math.hypot(a, o);
573
+ if (!(s > 0)) throw Error(`Member ${t.id} has zero length`);
574
+ let c = a / s, l = o / s;
575
+ return {
576
+ x: r.x,
577
+ z: r.z,
578
+ tx: c,
579
+ tz: l,
580
+ nx: -l,
581
+ nz: c,
582
+ length: s
583
+ };
584
+ }, Ve = (e, t) => ({
585
+ x: e.x + e.tx * t,
586
+ z: e.z + e.tz * t
587
+ }), He = (e) => e.dx && e.dz ? e.ry ? "fixed" : "pin" : e.dx || e.dz ? e.ry ? "slider" : "roller" : e.ry ? "rotation" : "none", J = (e, t, n, r, i) => ({
588
+ points: [[e, t], [n, r]],
589
+ weight: i
590
+ }), Ue = {
591
+ points: [
592
+ [0, 0],
593
+ [-15, 20],
594
+ [15, 20]
595
+ ],
596
+ closed: !0,
597
+ weight: "regular",
598
+ fill: "paper"
599
+ }, We = (e, t, n) => [J(-18.5, e, 15.5, e, n), ...Array.from({ length: 7 }, (n, r) => {
600
+ let i = (r + 1) * 40 / 7 - 24.5;
601
+ return J(i, e, i + 10, e + t * 10, "thin");
602
+ })], Ge = (e, t) => [
603
+ 0,
604
+ 1,
605
+ 2
606
+ ].map((n) => J(e * (8 + 4 * n), t * 7, e * 7, t * (8 + 4 * n), "thin")), Ke = {
607
+ pin: [Ue],
608
+ roller: [Ue, J(-15, 25, 15, 25, "regular")],
609
+ fixed: We(0, 1, "bold"),
610
+ slider: [...We(5, 1, "regular"), ...We(-5, -1, "regular")],
611
+ rotation: [
612
+ J(-20, 5, -5, 5, "regular"),
613
+ J(-20, -5, -5, -5, "regular"),
614
+ J(5, -5, 20, -5, "regular"),
615
+ J(5, 5, 20, 5, "regular"),
616
+ J(-5, -20, -5, -5, "regular"),
617
+ J(5, -20, 5, -5, "regular"),
618
+ J(5, 5, 5, 20, "regular"),
619
+ J(-5, 5, -5, 20, "regular"),
620
+ ...Ge(1, 1),
621
+ ...Ge(-1, -1),
622
+ ...Ge(-1, 1),
623
+ ...Ge(1, -1)
624
+ ]
625
+ }, qe = .8, Je = (e) => e.map((e) => ({
626
+ ...e,
627
+ points: e.points.map(([e, t]) => [e * qe, t * qe])
628
+ })), Ye = {
629
+ pin: Je(Ke.pin),
630
+ roller: Je(Ke.roller),
631
+ fixed: Je(Ke.fixed),
632
+ slider: Je(Ke.slider),
633
+ rotation: Je(Ke.rotation)
634
+ }, Xe = (e) => e === "none" ? [] : Ye[e], Ze = (e, t) => {
635
+ let n = ze(e), r = 0, i = 0, a = 0;
636
+ for (let o of e.members) {
637
+ if (o.start !== t.id && o.end !== t.id) continue;
638
+ let s = Be(e, o, n), c = o.start === t.id ? 1 : -1;
639
+ r += c * s.tx, i += c * s.tz, a++;
640
+ }
641
+ return {
642
+ x: r,
643
+ z: i,
644
+ count: a
645
+ };
646
+ }, Qe = 180 / Math.PI, $e = (e) => {
647
+ let t = e / Qe;
648
+ return {
649
+ x: -Math.sin(t),
650
+ z: Math.cos(t)
651
+ };
652
+ }, et = (e, t) => {
653
+ let n = $e(e), r = Math.hypot(t.x, t.z);
654
+ return r > 1e-9 && (n.x * t.x + n.z * t.z) / r > .7 ? e + 180 : e;
655
+ }, tt = (e, t) => {
656
+ let n = He(t.fixity), r = Ze(e, t), i = t.angle * Qe, a = (() => {
657
+ switch (n) {
658
+ case "pin": return et(i, r);
659
+ case "roller": return et(t.fixity.dz ? i : i - 90, r);
660
+ case "fixed": {
661
+ let e = Math.hypot(r.x, r.z);
662
+ return e < 1e-9 ? i : Math.atan2(r.x / e, -r.z / e) * Qe;
663
+ }
664
+ case "slider": return t.fixity.dz ? i : i + 90;
665
+ default: return 0;
666
+ }
667
+ })();
668
+ return {
669
+ node: t.id,
670
+ kind: n,
671
+ rotation: nt(a)
672
+ };
673
+ }, nt = (e) => {
674
+ let t = ((e + 180) % 360 + 360) % 360 - 180;
675
+ return t === -180 ? 180 : t;
676
+ }, rt = (e, t, n, r) => {
677
+ let i = t / Qe, a = Math.cos(i), o = Math.sin(i), s = 0;
678
+ for (let t of Xe(e)) for (let [e, i] of t.points) s = Math.max(s, (e * a - i * o) * n + (e * o + i * a) * r);
679
+ return s;
680
+ }, it = {
681
+ force: {
682
+ symbol: "N",
683
+ scale: 1
684
+ },
685
+ moment: {
686
+ symbol: "N·m",
687
+ scale: 1
688
+ },
689
+ distributed: {
690
+ symbol: "N/m",
691
+ scale: 1
692
+ },
693
+ length: {
694
+ symbol: "m",
695
+ scale: 1
696
+ },
697
+ displacement: {
698
+ symbol: "m",
699
+ scale: 1
700
+ },
701
+ rotation: {
702
+ symbol: "rad",
703
+ scale: 1
704
+ },
705
+ temperature: {
706
+ symbol: "K",
707
+ scale: 1
708
+ }
709
+ }, at = {
710
+ force: {
711
+ symbol: "kN",
712
+ scale: .001
713
+ },
714
+ moment: {
715
+ symbol: "kNm",
716
+ scale: .001
717
+ },
718
+ distributed: {
719
+ symbol: "kN/m",
720
+ scale: .001
721
+ },
722
+ length: {
723
+ symbol: "m",
724
+ scale: 1
725
+ },
726
+ displacement: {
727
+ symbol: "mm",
728
+ scale: 1e3
729
+ },
730
+ rotation: {
731
+ symbol: "mrad",
732
+ scale: 1e3
733
+ },
734
+ temperature: {
735
+ symbol: "K",
736
+ scale: 1
737
+ }
738
+ }, ot = (e) => ({
739
+ ...at,
740
+ ...e
741
+ }), st = new Intl.NumberFormat("en", { maximumFractionDigits: 1 }), Y = (e, t = st) => {
742
+ let n = t.formatToParts(Number(e.toPrecision(12))), r = n.filter((e) => e.type === "integer" || e.type === "fraction").map((e) => e.value).join(""), i = /^[0\D]*$/.test(r);
743
+ return n.filter((e) => !(i && e.type === "minusSign")).map((e) => e.type === "minusSign" ? "−" : e.value).join("");
744
+ }, ct = (e, t, n) => {
745
+ let r = Y(e * t.scale, n);
746
+ return t.symbol ? `${r}\u202f${t.symbol}` : r;
747
+ }, lt = [
748
+ "N",
749
+ "V",
750
+ "M",
751
+ "w",
752
+ "dimensions",
753
+ "members",
754
+ "supports",
755
+ "loads",
756
+ "reactions",
757
+ "nodes",
758
+ "nodeLabels"
759
+ ], ut = {
760
+ uniform: "ΔT",
761
+ gradient: "ΔTb − ΔTt"
762
+ }, dt = [
763
+ "N",
764
+ "V",
765
+ "M",
766
+ "w"
767
+ ], ft = 7, pt = {
768
+ full: {
769
+ member: 3.5,
770
+ pointShaft: 3,
771
+ pointHead: 12,
772
+ pointHeadWidth: 14,
773
+ pointArrow: 52,
774
+ udlArrow: 32,
775
+ udlSpacing: 18,
776
+ reaction: 46,
777
+ reactionGap: 11,
778
+ arc: 15,
779
+ reactionArc: 20,
780
+ deformed: 2.25
781
+ },
782
+ compact: {
783
+ member: 2.75,
784
+ pointShaft: 2.25,
785
+ pointHead: 9,
786
+ pointHeadWidth: 10,
787
+ pointArrow: 34,
788
+ udlArrow: 22,
789
+ udlSpacing: 14,
790
+ reaction: 32,
791
+ reactionGap: 8,
792
+ arc: 11,
793
+ reactionArc: 15,
794
+ deformed: 1.75
795
+ }
796
+ }, mt = {
797
+ N: "normal",
798
+ V: "shear",
799
+ M: "moment"
800
+ }, X = (e, t) => {
801
+ let n = Math.hypot(e, t);
802
+ return n > 0 ? {
803
+ x: e / n,
804
+ y: t / n
805
+ } : {
806
+ x: 0,
807
+ y: 0
808
+ };
809
+ }, Z = (e, t, n = 0, r = 0) => {
810
+ let i = Ve(e, t);
811
+ return U(i.x, i.z, n, r);
812
+ }, Q = (e, t, n) => {
813
+ let r = W(e, t.x * n, t.y * n);
814
+ return Math.abs(t.x) > .85 ? {
815
+ at: r,
816
+ align: t.x > 0 ? "start" : "end",
817
+ baseline: "middle"
818
+ } : {
819
+ at: r,
820
+ align: Math.abs(t.x) < .25 ? "middle" : t.x > 0 ? "start" : "end",
821
+ baseline: t.y > 0 ? "top" : "bottom"
822
+ };
823
+ }, ht = (e, t, n, r, i, a, o) => ({
824
+ kind: "text",
825
+ group: e,
826
+ layer: H.label,
827
+ text: i,
828
+ tone: a,
829
+ priority: o,
830
+ ...Q(t, n, r)
831
+ }), gt = (e, t, n, r, i, a, o) => {
832
+ let s = X(r.x - n.x, r.y - n.y), c = o.headWidth / 2, l = {
833
+ x: r.x - s.x * o.head,
834
+ y: r.y - s.y * o.head
835
+ };
836
+ return [{
837
+ kind: "path",
838
+ group: e,
839
+ layer: a,
840
+ tone: i,
841
+ width: o.width,
842
+ dash: o.dash,
843
+ cap: "butt",
844
+ obstacle: o.obstacle,
845
+ segments: [{
846
+ op: "M",
847
+ p: W(t, n.x, n.y)
848
+ }, {
849
+ op: "L",
850
+ p: W(t, l.x + s.x, l.y + s.y)
851
+ }]
852
+ }, {
853
+ kind: "path",
854
+ group: e,
855
+ layer: a,
856
+ tone: i,
857
+ width: 0,
858
+ fill: "tone",
859
+ obstacle: o.obstacle,
860
+ segments: [
861
+ {
862
+ op: "M",
863
+ p: W(t, r.x, r.y)
864
+ },
865
+ {
866
+ op: "L",
867
+ p: W(t, l.x - s.y * c, l.y + s.x * c)
868
+ },
869
+ {
870
+ op: "L",
871
+ p: W(t, l.x + s.y * c, l.y - s.x * c)
872
+ },
873
+ { op: "Z" }
874
+ ]
875
+ }];
876
+ }, _t = (e, t, n, r, i, a, o, s, c = 270) => {
877
+ let l = Math.atan2(i.y, i.x) + Math.PI, u = c / 2 * Math.PI / 180, d = r ? l + u : l - u, f = r ? l - u : l + u, p = (e) => ({
878
+ x: n * Math.cos(e),
879
+ y: n * Math.sin(e)
880
+ }), m = p(d), h = p(f), g = r ? {
881
+ x: Math.sin(f),
882
+ y: -Math.cos(f)
883
+ } : {
884
+ x: -Math.sin(f),
885
+ y: Math.cos(f)
886
+ }, _ = 3.5, v = {
887
+ x: h.x - g.x * 8 * .6,
888
+ y: h.y - g.y * 8 * .6
889
+ }, y = {
890
+ x: v.x + g.x * 8,
891
+ y: v.y + g.y * 8
892
+ };
893
+ return [{
894
+ kind: "path",
895
+ group: e,
896
+ layer: o,
897
+ tone: a,
898
+ width: 1.75,
899
+ dash: s,
900
+ cap: "butt",
901
+ obstacle: !0,
902
+ segments: [{
903
+ op: "M",
904
+ p: W(t, m.x, m.y)
905
+ }, {
906
+ op: "A",
907
+ r: n,
908
+ large: !0,
909
+ clockwise: !r,
910
+ center: t,
911
+ p: W(t, h.x, h.y)
912
+ }]
913
+ }, {
914
+ kind: "path",
915
+ group: e,
916
+ layer: o,
917
+ tone: a,
918
+ width: 0,
919
+ fill: "tone",
920
+ segments: [
921
+ {
922
+ op: "M",
923
+ p: W(t, y.x, y.y)
924
+ },
925
+ {
926
+ op: "L",
927
+ p: W(t, v.x - g.y * _, v.y + g.x * _)
928
+ },
929
+ {
930
+ op: "L",
931
+ p: W(t, v.x + g.y * _, v.y - g.x * _)
932
+ },
933
+ { op: "Z" }
934
+ ]
935
+ }];
936
+ }, vt = (e, t) => Array.from({ length: 8 }, (n, r) => {
937
+ let i = r * Math.PI / 4 - Math.PI / 4, a = {
938
+ x: Math.cos(i),
939
+ y: Math.sin(i)
940
+ };
941
+ return {
942
+ c: a,
943
+ score: Math.min(2, ...e.map((e) => 1 - (a.x * e.x + a.y * e.y))) + .01 * (a.x * t.x + a.y * t.y)
944
+ };
945
+ }).sort((e, t) => t.score - e.score).map(({ c: e }) => e), yt = (e, t, n) => {
946
+ let r = Ze(e, t), i = Math.hypot(r.x, r.z);
947
+ return i > 1e-9 ? {
948
+ x: -r.x / i,
949
+ y: -r.z / i
950
+ } : n;
951
+ }, bt = (e, t) => {
952
+ let n = e.get(t);
953
+ if (!n) throw Error(`No frame for member ${t}`);
954
+ return n;
955
+ }, xt = 1, St = "5 4", Ct = 2.5, wt = (e, t, n) => e.members.flatMap((e, r) => {
956
+ let i = bt(t, e.id), a = n.member / 2 + Ct;
957
+ return [{
958
+ kind: "path",
959
+ group: "members",
960
+ layer: H.member,
961
+ tone: "ink",
962
+ width: n.member,
963
+ cap: "round",
964
+ obstacle: !0,
965
+ draw: r,
966
+ segments: [{
967
+ op: "M",
968
+ p: Z(i, 0)
969
+ }, {
970
+ op: "L",
971
+ p: Z(i, i.length)
972
+ }]
973
+ }, {
974
+ kind: "path",
975
+ group: "members",
976
+ layer: H.member,
977
+ tone: "muted",
978
+ width: xt,
979
+ dash: St,
980
+ cap: "butt",
981
+ fitIgnore: !0,
982
+ segments: [{
983
+ op: "M",
984
+ p: Z(i, 0, i.nx * a, i.nz * a)
985
+ }, {
986
+ op: "L",
987
+ p: Z(i, i.length, i.nx * a, i.nz * a)
988
+ }]
989
+ }];
990
+ }), Tt = (e, t, n) => {
991
+ let r = [], i = n.member + 1;
992
+ for (let n of e.nodes) {
993
+ let a = e.members.flatMap((e) => e.start === n.id ? [{
994
+ m: e,
995
+ end: 0
996
+ }] : e.end === n.id ? [{
997
+ m: e,
998
+ end: 1
999
+ }] : []), o = a.filter(({ m: e, end: t }) => e.hinges[t]);
1000
+ if (o.length === 0) continue;
1001
+ let s = (e) => ({
1002
+ kind: "circle",
1003
+ group: "members",
1004
+ layer: H.hinge,
1005
+ at: e,
1006
+ r: i,
1007
+ tone: "ink",
1008
+ width: 1.75,
1009
+ fill: "paper"
1010
+ });
1011
+ if (a.length - o.length <= 1) r.push(s(U(n.x, n.z)));
1012
+ else for (let { m: e, end: n } of o) {
1013
+ let a = bt(t, e.id), o = n === 0 ? 1 : -1, c = i * 2 + 1;
1014
+ r.push(s(Z(a, n === 0 ? 0 : a.length, o * a.tx * c, o * a.tz * c)));
1015
+ }
1016
+ }
1017
+ return r;
1018
+ }, Et = {
1019
+ regular: 1.8,
1020
+ bold: 2.4,
1021
+ thin: 1.2
1022
+ }, Dt = (e, t) => {
1023
+ let n = [];
1024
+ for (let r of e.nodes) {
1025
+ if (!t.has(r.id)) continue;
1026
+ let i = tt(e, r), a = i.rotation * Math.PI / 180, o = Math.cos(a), s = Math.sin(a);
1027
+ for (let e of Xe(i.kind)) {
1028
+ let t = e.points.map(([e, t]) => U(r.x, r.z, e * o - t * s, e * s + t * o));
1029
+ n.push({
1030
+ kind: "path",
1031
+ group: "supports",
1032
+ layer: H.support,
1033
+ tone: "ink",
1034
+ width: Et[e.weight],
1035
+ fill: e.fill,
1036
+ cap: "round",
1037
+ segments: [...t.map((e, t) => ({
1038
+ op: t === 0 ? "M" : "L",
1039
+ p: e
1040
+ })), ...e.closed ? [{ op: "Z" }] : []]
1041
+ });
1042
+ }
1043
+ }
1044
+ return n;
1045
+ }, Ot = (e, t, n) => {
1046
+ let r = [];
1047
+ for (let i of e.nodes) if (t.has(i.id) && (n.has("nodes") && r.push({
1048
+ kind: "circle",
1049
+ group: "nodes",
1050
+ layer: H.hinge,
1051
+ at: U(i.x, i.z),
1052
+ r: 5,
1053
+ tone: "brand",
1054
+ width: 2,
1055
+ fill: "paper"
1056
+ }), n.has("nodeLabels"))) {
1057
+ let t = yt(e, i, {
1058
+ x: 0,
1059
+ y: -1
1060
+ }), n = vt([{
1061
+ x: -t.x,
1062
+ y: -t.y
1063
+ }, {
1064
+ x: 0,
1065
+ y: 1
1066
+ }], {
1067
+ x: -.7,
1068
+ y: -.7
1069
+ }), [a, ...o] = (i.fixity.ry || e.loads.some((e) => e.kind === "nodalMoment" && e.node === i.id) ? [24, 32] : [9, 22]).flatMap((e) => n.map((t) => Q(U(i.x, i.z), t, e)));
1070
+ r.push({
1071
+ kind: "text",
1072
+ group: "nodeLabels",
1073
+ layer: H.label,
1074
+ text: i.id,
1075
+ tone: "ink",
1076
+ priority: 9,
1077
+ weight: 600,
1078
+ ...a,
1079
+ alternatives: o
1080
+ });
1081
+ }
1082
+ return r;
1083
+ }, kt = (e) => [...e].sort((e, t) => e - t).filter((e, t, n) => t === 0 || e - n[t - 1] > 1e-6), At = 11, jt = (e, t, n, r) => {
1084
+ let i = e.loads.flatMap((e) => {
1085
+ if (e.kind !== "pointForce" && e.kind !== "pointMoment") return [];
1086
+ let n = t.get(e.member);
1087
+ return n ? [Ve(n, e.at).x] : [];
1088
+ }), a = kt([...e.nodes.map((e) => e.x), ...i]), o = kt(e.nodes.map((e) => e.z)), [s, c, l, u] = [
1089
+ a[0],
1090
+ a[a.length - 1],
1091
+ o[0],
1092
+ o[o.length - 1]
1093
+ ], d = [], f = (e, t) => ({
1094
+ kind: "path",
1095
+ group: "dimensions",
1096
+ layer: H.member,
1097
+ tone: "muted",
1098
+ width: 1,
1099
+ segments: [{
1100
+ op: "M",
1101
+ p: e
1102
+ }, {
1103
+ op: "L",
1104
+ p: t
1105
+ }]
1106
+ }), p = (e) => r(e, n.units.length), m = n.layers.has("reactions") ? 92 : 52, h = n.layers.has("reactions") ? 104 : 58, g = (e) => ({
1107
+ ...f(W(e, -4, 4), W(e, 4, -4)),
1108
+ width: 1.5
1109
+ }), _ = (e, t) => {
1110
+ d.push(f(U(e[0], u, 0, t), U(e[e.length - 1], u, 0, t)));
1111
+ for (let n of e) d.push(f(U(n, u, 0, t - 6), U(n, u, 0, t + 6)), g(U(n, u, 0, t)));
1112
+ e.slice(1).forEach((n, r) => {
1113
+ let i = e[r];
1114
+ d.push(ht("dimensions", U((i + n) / 2, u, 0, t), {
1115
+ x: 0,
1116
+ y: -1
1117
+ }, 4, p(n - i), "muted", At));
1118
+ });
1119
+ }, v = (e, t) => {
1120
+ d.push(f(U(c, e[0], t, 0), U(c, e[e.length - 1], t, 0)));
1121
+ for (let n of e) d.push(f(U(c, n, t - 6, 0), U(c, n, t + 6, 0)), g(U(c, n, t, 0)));
1122
+ e.slice(1).forEach((n, r) => {
1123
+ let i = e[r];
1124
+ d.push(ht("dimensions", U(c, (i + n) / 2, t, 0), {
1125
+ x: 1,
1126
+ y: 0
1127
+ }, 6, p(n - i), "muted", At));
1128
+ });
1129
+ };
1130
+ return c - s > 1e-9 && (_(a, m), a.length > 2 && _([s, c], m + 28)), u - l > 1e-9 && (v(o, h), o.length > 2 && v([l, u], h + 56)), d;
1131
+ }, Mt = (e, t, n, r) => r ? {
1132
+ x: t * e.tx + n * e.nx,
1133
+ y: t * e.tz + n * e.nz
1134
+ } : {
1135
+ x: t,
1136
+ y: n
1137
+ }, Nt = 5, Pt = (e, t, n, r, i, a = !0) => {
1138
+ let o = Mt(t, e.start.fx, e.start.fz, e.local), s = Mt(t, e.end.fx, e.end.fz, e.local), c = Math.hypot(o.x, o.y), l = Math.hypot(s.x, s.y);
1139
+ if (c === 0 && l === 0) return [];
1140
+ let u = l > c ? X(s.x, s.y) : X(o.x, o.y), d = o.x * u.x + o.y * u.y, f = s.x * u.x + s.y * u.y, p = Math.max(Math.abs(d), Math.abs(f)), m = Math.abs(d - f) <= 1e-9 * p, h = t.length * n.scale, g = [], _ = {
1141
+ width: 1.25,
1142
+ head: 6,
1143
+ headWidth: 6
1144
+ }, v = (e) => n.compact || !m ? i(Math.abs(e), n.units.distributed) : `q = ${i(Math.abs(e), n.units.distributed)}`;
1145
+ if (Math.abs(u.x * t.tz - u.y * t.tx) < .1) {
1146
+ let e = {
1147
+ x: -t.nx * 10,
1148
+ y: -t.nz * 10
1149
+ }, n = Math.max(1, Math.round(h / 30));
1150
+ for (let r = 0; r < n; r++) {
1151
+ let i = (r + .5) * t.length / n, a = d + (f - d) * i / t.length;
1152
+ if (Math.abs(a) < 1e-9 * p) continue;
1153
+ let o = Math.sign(a);
1154
+ g.push(...gt("loads", Z(t, i), {
1155
+ x: e.x - o * u.x * 8,
1156
+ y: e.y - o * u.y * 8
1157
+ }, {
1158
+ x: e.x + o * u.x * 8,
1159
+ y: e.y + o * u.y * 8
1160
+ }, "load", H.load, _));
1161
+ }
1162
+ return g.push(ht("loads", Z(t, t.length / 2, e.x, e.y), X(-t.nx, -t.nz), 8, v(p), "load", Nt)), g;
1163
+ }
1164
+ let y = r.member / 2 + 2, b = (e) => r.udlArrow * e / p, x = Math.max(2, Math.round(h / r.udlSpacing));
1165
+ for (let e = 0; e <= x; e++) {
1166
+ let n = e * t.length / x, r = b(d + (f - d) * e / x);
1167
+ if (Math.abs(r) < y + 6) continue;
1168
+ let i = Math.sign(r);
1169
+ g.push(...gt("loads", Z(t, n), {
1170
+ x: -u.x * r,
1171
+ y: -u.y * r
1172
+ }, {
1173
+ x: -u.x * i * y,
1174
+ y: -u.y * i * y
1175
+ }, "load", H.load, _));
1176
+ }
1177
+ let ee = (e, n) => Z(t, e, -u.x * b(n), -u.y * b(n));
1178
+ g.push({
1179
+ kind: "path",
1180
+ group: "loads",
1181
+ layer: H.load,
1182
+ tone: "load",
1183
+ width: 1.25,
1184
+ obstacle: !0,
1185
+ segments: [{
1186
+ op: "M",
1187
+ p: ee(0, d)
1188
+ }, {
1189
+ op: "L",
1190
+ p: ee(t.length, f)
1191
+ }]
1192
+ });
1193
+ let te = X(-u.x, -u.y), ne = t.tx >= 0 ? "start" : "end", S = t.tx >= 0 ? "end" : "start", C = m ? [[
1194
+ 0,
1195
+ d,
1196
+ ne
1197
+ ]] : [[
1198
+ 0,
1199
+ d,
1200
+ ne
1201
+ ], [
1202
+ t.length,
1203
+ f,
1204
+ S
1205
+ ]], w = (e, t, n) => {
1206
+ let r = Q(ee(e, t), Math.sign(t) >= 0 ? te : {
1207
+ x: -te.x,
1208
+ y: -te.y
1209
+ }, 6);
1210
+ return {
1211
+ ...r,
1212
+ align: r.baseline === "middle" ? r.align : n
1213
+ };
1214
+ };
1215
+ for (let [e, n, r] of a ? C : []) Math.abs(n) < 1e-9 * p || g.push({
1216
+ kind: "text",
1217
+ group: "loads",
1218
+ layer: H.label,
1219
+ text: v(n),
1220
+ tone: "load",
1221
+ priority: Nt,
1222
+ ...w(e, n, r),
1223
+ alternatives: m ? [
1224
+ w(t.length / 2, n, "middle"),
1225
+ w(t.length, n, S),
1226
+ w(0, n, S),
1227
+ w(t.length, n, ne)
1228
+ ] : []
1229
+ });
1230
+ return g;
1231
+ }, Ft = (e, t, n, r, i, a = !1) => {
1232
+ let o = X(t.x, t.y), s = a ? i : -i, c = a ? i + r.pointArrow : -(i + r.pointArrow), [l, u] = a ? [{
1233
+ x: o.x * c,
1234
+ y: o.y * c
1235
+ }, {
1236
+ x: o.x * s,
1237
+ y: o.y * s
1238
+ }] : [{
1239
+ x: o.x * s,
1240
+ y: o.y * s
1241
+ }, {
1242
+ x: o.x * c,
1243
+ y: o.y * c
1244
+ }], d = a ? l : u;
1245
+ return [...gt("loads", e, u, l, "load", H.load, {
1246
+ width: r.pointShaft,
1247
+ head: r.pointHead,
1248
+ headWidth: r.pointHeadWidth,
1249
+ obstacle: !0
1250
+ }), {
1251
+ ...ht("loads", W(e, d.x, d.y), a ? o : {
1252
+ x: -o.x,
1253
+ y: -o.y
1254
+ }, 5, n, "load", Nt),
1255
+ weight: 600
1256
+ }];
1257
+ }, It = (e, t, n, r) => e.members.some((e) => {
1258
+ if (e.start !== n.id && e.end !== n.id) return !1;
1259
+ let i = t.get(e.id);
1260
+ return i ? (e.start === n.id ? 1 : -1) * (i.tx * r.x + i.tz * r.y) > .97 : !1;
1261
+ }), Lt = (e, t, n, r, i, a = []) => {
1262
+ let [o, ...s] = vt([n, ...a], {
1263
+ x: .7,
1264
+ y: -.7
1265
+ }).map((t) => Q(W(e, t.x * i.arc, t.y * i.arc), t, 4));
1266
+ return [..._t("loads", e, i.arc, t > 0, n, "load", H.load), {
1267
+ kind: "text",
1268
+ group: "loads",
1269
+ layer: H.label,
1270
+ text: r,
1271
+ tone: "load",
1272
+ priority: Nt,
1273
+ ...o,
1274
+ alternatives: s
1275
+ }];
1276
+ }, Rt = (e, t, n, r, i) => {
1277
+ let a = [];
1278
+ if (e.uniform !== 0 && a.push(`${i.uniform} = ${r(e.uniform, n.temperature)}`), e.gradient !== 0 && a.push(`${i.gradient} = ${r(e.gradient, n.temperature)}`), a.length === 0) return [];
1279
+ let o = Math.atan2(t.tz, t.tx) * 180 / Math.PI;
1280
+ o > 90 && (o -= 180), o <= -90 && (o += 180);
1281
+ let s = o * Math.PI / 180, c = {
1282
+ x: -Math.sin(s),
1283
+ y: Math.cos(s)
1284
+ }, l = [{
1285
+ kind: "text",
1286
+ group: "loads",
1287
+ layer: H.label,
1288
+ at: Z(t, t.length / 2, c.x * 9, c.y * 9),
1289
+ text: a.join(", "),
1290
+ tone: "load",
1291
+ align: "middle",
1292
+ baseline: "top",
1293
+ priority: Nt,
1294
+ rotate: o
1295
+ }];
1296
+ if (e.gradient !== 0) {
1297
+ let n = -Math.sign(e.gradient) * 5;
1298
+ l.push({
1299
+ kind: "path",
1300
+ group: "loads",
1301
+ layer: H.load,
1302
+ tone: "load",
1303
+ width: 2,
1304
+ dash: "1 4",
1305
+ cap: "round",
1306
+ segments: [{
1307
+ op: "M",
1308
+ p: Z(t, 0, t.nx * -n, t.nz * -n)
1309
+ }, {
1310
+ op: "L",
1311
+ p: Z(t, t.length, t.nx * -n, t.nz * -n)
1312
+ }]
1313
+ });
1314
+ }
1315
+ return l;
1316
+ }, zt = (e, t, n, r, i, a) => {
1317
+ let o = [], s = U(t.x, t.z), c = Math.cos(t.angle), l = Math.sin(t.angle), u = e.dx ?? 0, d = e.dz ?? 0;
1318
+ if (u !== 0 || d !== 0) {
1319
+ let e = X(u * c - d * l, u * l + d * c), t = {
1320
+ x: -e.y,
1321
+ y: e.x
1322
+ }, i = t.x * n.x + t.y * n.y >= 0 ? 1 : -1, f = {
1323
+ x: t.x * i * 30,
1324
+ y: t.y * i * 30
1325
+ }, p = {
1326
+ x: f.x + e.x * 20,
1327
+ y: f.y + e.y * 20
1328
+ };
1329
+ o.push(...gt("loads", s, {
1330
+ x: f.x - e.x * 12,
1331
+ y: f.y - e.y * 12
1332
+ }, p, "load", H.load, {
1333
+ width: 1.5,
1334
+ head: 7,
1335
+ headWidth: 7,
1336
+ dash: "4 3"
1337
+ }), {
1338
+ ...ht("loads", W(s, p.x, p.y), e, 4, a(Math.hypot(u, d), r.displacement), "load", Nt),
1339
+ alternatives: [Q(W(s, f.x + e.x * 4, f.y + e.y * 4), {
1340
+ x: t.x * i,
1341
+ y: t.y * i
1342
+ }, 6), Q(W(s, f.x - e.x * 12, f.y - e.y * 12), {
1343
+ x: -e.x,
1344
+ y: -e.y
1345
+ }, 4)]
1346
+ });
1347
+ }
1348
+ if (e.ry) {
1349
+ let t = {
1350
+ x: -n.x,
1351
+ y: -n.y
1352
+ };
1353
+ o.push(..._t("loads", s, i.arc + 6, e.ry > 0, t, "load", H.load, "4 3"));
1354
+ let c = i.arc + 6, [l, ...u] = vt([t], {
1355
+ x: .7,
1356
+ y: -.7
1357
+ }).map((e) => Q(W(s, e.x * c, e.y * c), e, 4));
1358
+ o.push({
1359
+ kind: "text",
1360
+ group: "loads",
1361
+ layer: H.label,
1362
+ text: a(Math.abs(e.ry), r.rotation),
1363
+ tone: "load",
1364
+ priority: Nt,
1365
+ ...l,
1366
+ alternatives: u
1367
+ });
1368
+ }
1369
+ return o;
1370
+ }, Bt = (e, t, n) => {
1371
+ let r = e.members.find((e) => e.id === n.member), i = t.get(n.member);
1372
+ if (!r || !i) return !1;
1373
+ let a = (e, t) => e.fx === t.fx && e.fz === t.fz;
1374
+ return e.loads.some((o) => {
1375
+ if (o === n || o.kind !== "distributed" || o.local !== n.local) return !1;
1376
+ let s = e.members.find((e) => e.id === o.member), c = t.get(o.member);
1377
+ return !!s && !!c && s.end === r.start && Math.abs(i.tx * c.tx + i.tz * c.tz - 1) < 1e-9 && a(o.end, n.start) && a(o.start, o.end) && a(n.start, n.end);
1378
+ });
1379
+ }, Vt = (e, t, n, r, i) => {
1380
+ let a = ze(e), o = [], { units: s } = n, c = r.member / 2 + 2;
1381
+ for (let l of e.loads) switch (l.kind) {
1382
+ case "nodalForce": {
1383
+ let n = a.get(l.node);
1384
+ if (n) {
1385
+ let a = i(Math.hypot(l.fx, l.fz), s.force), u = X(l.fx, l.fz), d = It(e, t, n, {
1386
+ x: -u.x,
1387
+ y: -u.y
1388
+ }) && !It(e, t, n, u);
1389
+ o.push(...Ft(U(n.x, n.z), {
1390
+ x: l.fx,
1391
+ y: l.fz
1392
+ }, a, r, c + 1, d));
1393
+ }
1394
+ break;
1395
+ }
1396
+ case "nodalMoment": {
1397
+ let t = a.get(l.node);
1398
+ if (t) {
1399
+ let n = yt(e, t, {
1400
+ x: 0,
1401
+ y: 1
1402
+ }), a = i(Math.abs(l.my), s.moment);
1403
+ o.push(...Lt(U(t.x, t.z), l.my, {
1404
+ x: -n.x,
1405
+ y: -n.y
1406
+ }, a, r, [{
1407
+ x: -.7,
1408
+ y: -.7
1409
+ }]));
1410
+ }
1411
+ break;
1412
+ }
1413
+ case "distributed": {
1414
+ let a = t.get(l.member);
1415
+ a && o.push(...Pt(l, a, n, r, i, !Bt(e, t, l)));
1416
+ break;
1417
+ }
1418
+ case "pointForce": {
1419
+ let e = t.get(l.member);
1420
+ if (e) {
1421
+ let t = Mt(e, l.fx, l.fz, l.local);
1422
+ o.push(...Ft(Z(e, l.at), t, i(Math.hypot(l.fx, l.fz), s.force), r, c));
1423
+ }
1424
+ break;
1425
+ }
1426
+ case "pointMoment": {
1427
+ let e = t.get(l.member);
1428
+ if (e) {
1429
+ let t = i(Math.abs(l.my), s.moment);
1430
+ o.push(...Lt(Z(e, l.at), l.my, {
1431
+ x: e.nx,
1432
+ y: e.nz
1433
+ }, t, r));
1434
+ }
1435
+ break;
1436
+ }
1437
+ case "temperature": {
1438
+ let e = t.get(l.member);
1439
+ e && o.push(...Rt(l, e, s, i, n.temperatureSymbols ?? ut));
1440
+ break;
1441
+ }
1442
+ case "prescribed": {
1443
+ let t = a.get(l.node);
1444
+ t && o.push(...zt(l, t, yt(e, t, {
1445
+ x: 1,
1446
+ y: 0
1447
+ }), s, r, i));
1448
+ break;
1449
+ }
1450
+ }
1451
+ return o;
1452
+ }, Ht = 5, Ut = 10, Wt = (e) => e.nodes.flatMap((e) => [
1453
+ ...e.fixity.dx ? [{
1454
+ node: e.id,
1455
+ dof: "dx",
1456
+ value: 1
1457
+ }] : [],
1458
+ ...e.fixity.dz ? [{
1459
+ node: e.id,
1460
+ dof: "dz",
1461
+ value: -1
1462
+ }] : [],
1463
+ ...e.fixity.ry ? [{
1464
+ node: e.id,
1465
+ dof: "ry",
1466
+ value: 1
1467
+ }] : []
1468
+ ]), Gt = (e, t, n, r) => {
1469
+ let i = [], a = ze(e), o = /* @__PURE__ */ new Map();
1470
+ for (let e of t) e.value !== 0 && o.set(e.node, [...o.get(e.node) ?? [], e]);
1471
+ let s = {
1472
+ width: 1.75,
1473
+ head: 9,
1474
+ headWidth: 9,
1475
+ obstacle: !0
1476
+ }, c = n.reactionLabels === "names", l = c ? Ut : Ht, u = {
1477
+ italic: !0,
1478
+ weight: 600,
1479
+ size: Math.round((n.fontSize ?? 13) * 1.15)
1480
+ }, d = (e) => c ? e.dof === "ry" ? {
1481
+ text: "M",
1482
+ sub: e.node,
1483
+ ...u
1484
+ } : {
1485
+ text: e.node,
1486
+ sub: e.dof === "dx" ? "x" : "z",
1487
+ ...u
1488
+ } : { text: Y(Math.abs(e.value) * (e.dof === "ry" ? n.units.moment : n.units.force).scale, n.numberFormat) };
1489
+ for (let [t, u] of o) {
1490
+ let o = a.get(t);
1491
+ if (!o) continue;
1492
+ let f = U(o.x, o.z), p = tt(e, o), m = $e(p.rotation), h = {
1493
+ x: m.x,
1494
+ y: m.z
1495
+ }, g = {
1496
+ x: h.y,
1497
+ y: -h.x
1498
+ }, _ = Ze(e, o), v = Math.hypot(_.x, _.z) > 1e-9 ? [X(_.x, _.z)] : [], y = u.find((e) => e.dof === "ry"), b = r.reactionArc, x = rt(p.kind, p.rotation, h.x, h.y), ee = y ? b + 8 : 0;
1499
+ for (let e of u) {
1500
+ if (e.dof === "ry") continue;
1501
+ let t = Math.cos(o.angle), a = Math.sin(o.angle), c = e.dof === "dx" ? {
1502
+ x: t,
1503
+ y: a
1504
+ } : {
1505
+ x: -a,
1506
+ y: t
1507
+ }, u = {
1508
+ x: c.x * e.value,
1509
+ y: c.y * e.value
1510
+ }, p = X(u.x, u.y), m = d(e);
1511
+ if (Math.abs(c.x * h.x + c.y * h.y) > .7) {
1512
+ let e = Math.max(x + r.reactionGap, ee), t = e + r.reaction, n = {
1513
+ x: h.x * e,
1514
+ y: h.y * e
1515
+ }, a = {
1516
+ x: h.x * t,
1517
+ y: h.y * t
1518
+ }, o = p.x * h.x + p.y * h.y < 0;
1519
+ i.push(...gt("reactions", f, o ? a : n, o ? n : a, "reaction", H.reaction, s));
1520
+ let c = g.x >= 0 ? g : {
1521
+ x: -g.x,
1522
+ y: -g.y
1523
+ }, u = W(f, a.x - h.x * 6, a.y - h.y * 6);
1524
+ i.push({
1525
+ ...ht("reactions", u, c, 7, m.text, "reaction", l),
1526
+ ...m,
1527
+ alternatives: [Q(u, {
1528
+ x: -c.x,
1529
+ y: -c.y
1530
+ }, 7)]
1531
+ }), v.push(h);
1532
+ } else {
1533
+ let e = Math.max(x + (n.compact ? 4 : 6), ee), t = p.x * g.x + p.y * g.y > 0 ? -1 : 1, a = {
1534
+ x: h.x * e,
1535
+ y: h.y * e
1536
+ }, o = {
1537
+ x: a.x + g.x * t * (14 + r.reaction - 4),
1538
+ y: a.y + g.y * t * (14 + r.reaction - 4)
1539
+ }, c = {
1540
+ x: a.x + g.x * t * 14,
1541
+ y: a.y + g.y * t * 14
1542
+ };
1543
+ i.push(...gt("reactions", f, o, c, "reaction", H.reaction, s));
1544
+ let u = X(o.x - c.x, o.y - c.y), d = {
1545
+ x: (o.x + c.x) / 2,
1546
+ y: (o.y + c.y) / 2
1547
+ };
1548
+ i.push({
1549
+ ...ht("reactions", W(f, o.x, o.y), u, 4, m.text, "reaction", l),
1550
+ ...m,
1551
+ alternatives: [Q(W(f, d.x, d.y), h, 5), Q(W(f, d.x, d.y), {
1552
+ x: -h.x,
1553
+ y: -h.y
1554
+ }, 5)]
1555
+ }), v.push({
1556
+ x: g.x * t,
1557
+ y: g.y * t
1558
+ });
1559
+ }
1560
+ }
1561
+ if (y) {
1562
+ let t = v[0] ?? {
1563
+ x: 0,
1564
+ y: -1
1565
+ };
1566
+ i.push(..._t("reactions", f, b, y.value > 0, t, "reaction", H.reaction, void 0, 190));
1567
+ let n = Ze(e, o), r = n.count > 0 && Math.abs(n.x) > Math.abs(n.z), a = r ? c ? X(-n.x, -1) : X(-n.x, -.2) : {
1568
+ x: .7,
1569
+ y: -.7
1570
+ }, s = vt(n.count > 0 ? [...v, X(n.x, n.z)] : v, a), [u, ...p] = (r ? [a, ...s] : s).map((e) => Q(W(f, e.x * b, e.y * b), e, 5));
1571
+ i.push({
1572
+ kind: "text",
1573
+ group: "reactions",
1574
+ layer: H.label,
1575
+ ...d(y),
1576
+ tone: "reaction",
1577
+ priority: l,
1578
+ ...u,
1579
+ alternatives: p
1580
+ });
1581
+ }
1582
+ }
1583
+ return i;
1584
+ }, Kt = (e, t) => e === "M" && t ? 1 : -1, qt = (e, t, n, r) => le(t).map(([, t, i, a]) => ({
1585
+ op: "C",
1586
+ c1: Z(e, t[0], r.x * n * t[1], r.y * n * t[1]),
1587
+ c2: Z(e, i[0], r.x * n * i[1], r.y * n * i[1]),
1588
+ p: Z(e, a[0], r.x * n * a[1], r.y * n * a[1])
1589
+ })), Jt = (e, t, n, r, i, a, o, s) => {
1590
+ let c = [];
1591
+ n.forEach((e, n) => {
1592
+ let r = A(e, e.x0), o = Z(t, e.x0, a.x * i * r, a.y * i * r);
1593
+ n === 0 ? (c.push(s[0] ? {
1594
+ op: "M",
1595
+ p: Z(t, 0)
1596
+ } : {
1597
+ op: "M",
1598
+ p: o
1599
+ }), s[0] && c.push({
1600
+ op: "L",
1601
+ p: o
1602
+ })) : c.push({
1603
+ op: "L",
1604
+ p: o
1605
+ }), c.push(...qt(t, e, i, a));
1606
+ }), s[1] && c.push({
1607
+ op: "L",
1608
+ p: Z(t, t.length)
1609
+ });
1610
+ let l = t.length * o, u = Math.floor(l / 7), d = (l - u * 7) / 2, f = [];
1611
+ for (let e = 0; e <= u; e++) {
1612
+ let r = (d + e * 7) / o, s = L(n, r);
1613
+ Math.abs(s * i) < 1.5 || f.push({
1614
+ op: "M",
1615
+ p: Z(t, r)
1616
+ }, {
1617
+ op: "L",
1618
+ p: Z(t, r, a.x * i * s, a.y * i * s)
1619
+ });
1620
+ }
1621
+ let p = [{
1622
+ kind: "path",
1623
+ group: e,
1624
+ layer: H.diagramLine,
1625
+ tone: r,
1626
+ width: 1.75,
1627
+ segments: c,
1628
+ shield: !0
1629
+ }];
1630
+ return f.length > 0 && p.push({
1631
+ kind: "path",
1632
+ group: e,
1633
+ layer: H.diagramHatch,
1634
+ tone: r,
1635
+ width: 1,
1636
+ opacity: .55,
1637
+ fitIgnore: !0,
1638
+ cap: "butt",
1639
+ segments: f
1640
+ }), p;
1641
+ }, Yt = (e, t, n, r = [
1642
+ 5,
1643
+ 11,
1644
+ 17
1645
+ ]) => r.flatMap((r) => {
1646
+ if (n === "horizontal") {
1647
+ let n = Q(e, t, r);
1648
+ return n.baseline === "middle" ? [
1649
+ n,
1650
+ {
1651
+ ...n,
1652
+ at: W(n.at, 0, 4),
1653
+ baseline: "top"
1654
+ },
1655
+ {
1656
+ ...n,
1657
+ at: W(n.at, 0, -4),
1658
+ baseline: "bottom"
1659
+ }
1660
+ ] : [
1661
+ n,
1662
+ {
1663
+ ...n,
1664
+ at: W(n.at, 4, 0),
1665
+ align: "start"
1666
+ },
1667
+ {
1668
+ ...n,
1669
+ at: W(n.at, -4, 0),
1670
+ align: "end"
1671
+ }
1672
+ ];
1673
+ }
1674
+ let i = Math.atan2(t.y, t.x) * 180 / Math.PI;
1675
+ Math.abs(Math.abs(i) - 90) < 1e-6 ? i = -90 : i > 90 ? i -= 180 : i <= -90 && (i += 180);
1676
+ let a = i * Math.PI / 180, o = Math.cos(a) * t.x + Math.sin(a) * t.y, s = {
1677
+ at: W(e, t.x * r, t.y * r),
1678
+ align: o < 0 ? "end" : "start",
1679
+ baseline: "middle",
1680
+ rotate: i
1681
+ }, c = {
1682
+ x: -Math.sin(a) * 4,
1683
+ y: Math.cos(a) * 4
1684
+ };
1685
+ return [
1686
+ s,
1687
+ {
1688
+ ...s,
1689
+ at: W(s.at, c.x, c.y),
1690
+ baseline: "top"
1691
+ },
1692
+ {
1693
+ ...s,
1694
+ at: W(s.at, -c.x, -c.y),
1695
+ baseline: "bottom"
1696
+ }
1697
+ ];
1698
+ }), Xt = (e, t, n, r, i, a, o) => {
1699
+ let s = r === "M" ? o.units.moment : o.units.force, c = mt[r], l = o.resultLabelMode ?? "horizontal", u = Math.max(0, ...e.members.map((e) => P(n[e.id]?.[r] ?? [])));
1700
+ if (!(u > 0)) return [];
1701
+ let d = 1e-6 * u, f = (e, t) => Math.abs(e - t) <= 1e-4 * u, p = (e) => Y(e * s.scale, o.numberFormat), m = (e) => 6 + Math.abs(e) / u, h = [], g = (e) => ({
1702
+ x: e.nx * a,
1703
+ y: e.nz * a
1704
+ }), _ = (e) => e.every((t) => (I(t) ?? 0) === 0 && f(A(t, t.x0), A(e[0], e[0].x0))), v = (e, t, n, i) => {
1705
+ if (!/[1-9]/.test(t)) return;
1706
+ let [a, ...o] = e;
1707
+ h.push({
1708
+ item: {
1709
+ kind: "text",
1710
+ group: r,
1711
+ layer: H.label,
1712
+ text: t,
1713
+ tone: c,
1714
+ priority: m(n),
1715
+ ...a,
1716
+ alternatives: o
1717
+ },
1718
+ members: i,
1719
+ magnitude: Math.abs(n)
1720
+ });
1721
+ };
1722
+ for (let a of e.nodes) {
1723
+ let o = e.members.flatMap((e) => {
1724
+ let o = n[e.id]?.[r], s = t.get(e.id);
1725
+ if (!o || o.length === 0 || !s || _(o)) return [];
1726
+ let c = e.start === a.id ? 0 : e.end === a.id ? 1 : -1;
1727
+ if (c === -1) return [];
1728
+ let l = c === 0 ? 0 : s.length, u = L(o, l, c === 0 ? "right" : "left");
1729
+ if (Math.abs(u) <= d) return [];
1730
+ let f = g(s);
1731
+ return [{
1732
+ m: e,
1733
+ f: s,
1734
+ v: u,
1735
+ away: c === 0 ? {
1736
+ x: s.tx,
1737
+ y: s.tz
1738
+ } : {
1739
+ x: -s.tx,
1740
+ y: -s.tz
1741
+ },
1742
+ out: {
1743
+ x: f.x * Math.sign(u),
1744
+ y: f.y * Math.sign(u)
1745
+ },
1746
+ tip: Z(s, l, f.x * i * u, f.y * i * u)
1747
+ }];
1748
+ });
1749
+ if (o.length !== 0) {
1750
+ if (r === "M" && o.length >= 2 && o.every((e) => f(Math.abs(e.v), Math.abs(o[0].v)))) {
1751
+ let e = (e) => Math.max(-1, ...o.filter((t) => t !== e).map((t) => e.out.x * t.away.x + e.out.y * t.away.y)), t = [...o].sort((t, n) => e(t) - e(n) || Math.abs(n.f.tx) - Math.abs(t.f.tx)), n = t.flatMap((e) => Yt(e.tip, e.out, l)), r = t[0].v;
1752
+ v(n, p(r), r, o.map((e) => e.m.id));
1753
+ } else for (let e of o) v(Yt(e.tip, e.out, l), p(e.v), e.v, [e.m.id]);
1754
+ }
1755
+ }
1756
+ for (let a of e.members) {
1757
+ let e = n[a.id]?.[r], o = t.get(a.id);
1758
+ if (!e || e.length === 0 || !o) continue;
1759
+ let s = g(o), c = (e, t) => Z(o, e, s.x * i * t, s.y * i * t), u = (e) => ({
1760
+ x: s.x * Math.sign(e),
1761
+ y: s.y * Math.sign(e)
1762
+ });
1763
+ if (_(e)) {
1764
+ let t = A(e[0], e[0].x0), n = [
1765
+ .5,
1766
+ .25,
1767
+ .75
1768
+ ].flatMap((e) => Yt(c(o.length * e, t), u(t), l));
1769
+ Math.abs(t) > d && v(n, p(t), t, [a.id]);
1770
+ } else {
1771
+ for (let t of ce(e)) {
1772
+ let n = L(e, t, "left"), r = L(e, t, "right");
1773
+ if (f(n, r)) Math.abs(n) > d && v(Yt(c(t, n), u(n), l), p(n), n, [a.id]);
1774
+ else for (let e of [n, r]) Math.abs(e) > d && v(Yt(c(t, e), u(e), l), p(e), e, [a.id]);
1775
+ }
1776
+ for (let t of e) for (let e of oe(t)) {
1777
+ let n = A(t, e);
1778
+ Math.abs(n) > d && v(Yt(c(e, n), u(n), l), p(n), n, [a.id]);
1779
+ }
1780
+ }
1781
+ }
1782
+ return h;
1783
+ }, Zt = (e, t, n, r) => {
1784
+ let i = L(t, r === 0 ? 0 : e.length, r === 0 ? "right" : "left");
1785
+ return {
1786
+ x: e.nx * n * i,
1787
+ y: e.nz * n * i
1788
+ };
1789
+ }, Qt = (e, t, n, r, i, a, o) => {
1790
+ let s = o === 0 ? a.start : a.end, c = bt(t, a.id), l = Zt(c, n[a.id][r], i, o), u = Math.max(1e-30, ...e.members.map((e) => P(n[e.id]?.[r] ?? [])));
1791
+ return e.members.some((e) => {
1792
+ if (e.id === a.id || !n[e.id]) return !1;
1793
+ let o = e.start === s ? 0 : e.end === s ? 1 : -1;
1794
+ if (o === -1) return !1;
1795
+ let d = bt(t, e.id);
1796
+ if (Math.abs(c.tx * d.tx + c.tz * d.tz) < .999) return !1;
1797
+ let f = Zt(d, n[e.id][r], i, o);
1798
+ return Math.hypot(f.x - l.x, f.y - l.y) <= 1e-4 * u;
1799
+ });
1800
+ }, $t = (e, t) => !e.loads.some((e) => "member" in e) && e.members.every((e) => (t[e.id]?.N ?? []).every((e) => (I(e) ?? 0) === 0)), en = (e, t, n, r) => {
1801
+ let i = Math.max(0, ...e.members.map((e) => P(n[e.id]?.N ?? []))), a = r.units.force, o = (e) => Y(e * a.scale, r.numberFormat), s = r.fontSize ?? 13, c = [.../* @__PURE__ */ new Set([
1802
+ s,
1803
+ Math.max(10, Math.min(s, 11)),
1804
+ Math.min(s, 10)
1805
+ ])], l = e.nodes.map((e) => e.x), u = (Math.min(...l) + Math.max(...l)) / 2, d = Math.max(...l) - Math.min(...l) || 1, f = e.members.flatMap((e) => {
1806
+ let r = n[e.id]?.N, a = t.get(e.id);
1807
+ if (!r || r.length === 0 || !a) return [];
1808
+ let o = A(r[0], r[0].x0);
1809
+ return Math.abs(o) <= 1e-6 * i ? [] : [{
1810
+ m: e,
1811
+ f: a,
1812
+ v: o,
1813
+ mid: Ve(a, a.length / 2)
1814
+ }];
1815
+ }), p = (e, t) => f.slice(0, t).some((t) => o(t.v) === o(e.v) && Math.abs(t.mid.x + e.mid.x - 2 * u) < 1e-6 * d && Math.abs(t.mid.z - e.mid.z) < 1e-6 * d);
1816
+ return f.map(({ f: e, v: t }, n) => {
1817
+ let r = Math.atan2(e.tz, e.tx) * 180 / Math.PI;
1818
+ r > 90 && (r -= 180), r <= -90 && (r += 180);
1819
+ let a = r * Math.PI / 180, l = {
1820
+ x: Math.sin(a),
1821
+ y: -Math.cos(a)
1822
+ }, u = o(t), d = [.../* @__PURE__ */ new Set([u, o(t)])], m = [
1823
+ .5,
1824
+ .4,
1825
+ .6,
1826
+ .3,
1827
+ .7,
1828
+ .2,
1829
+ .8
1830
+ ], h = [];
1831
+ for (let t of d) for (let n of c) for (let r of [1, -1]) for (let i of m) h.push({
1832
+ at: Z(e, e.length * i, l.x * 3 * r, l.y * 3 * r),
1833
+ align: "middle",
1834
+ baseline: r > 0 ? "bottom" : "top",
1835
+ text: t,
1836
+ size: n === s ? void 0 : n
1837
+ });
1838
+ let [g, ..._] = h;
1839
+ return {
1840
+ kind: "text",
1841
+ group: "N",
1842
+ layer: H.label,
1843
+ tone: t > 0 ? "tension" : t < 0 ? "compression" : "normal",
1844
+ text: u,
1845
+ ...g,
1846
+ priority: (p(f[n], n) ? 5 : 7) + Math.abs(t) / i,
1847
+ rotate: r,
1848
+ alternatives: _
1849
+ };
1850
+ });
1851
+ }, tn = (e, t) => {
1852
+ let n = /* @__PURE__ */ new Map();
1853
+ return [...e].sort((e, t) => t.magnitude - e.magnitude).filter((e) => {
1854
+ if (e.members.some((e) => (n.get(e) ?? 0) >= t)) return !1;
1855
+ for (let t of e.members) n.set(t, (n.get(t) ?? 0) + 1);
1856
+ return !0;
1857
+ });
1858
+ }, nn = (e, t, n, r) => {
1859
+ let i = [], a = (t, r, i) => Z(e, t, n * (r * e.tx + i * e.nx), n * (r * e.tz + i * e.nz));
1860
+ return t.w.forEach((e, n) => {
1861
+ let r = t.u[n], o = Math.max(I(e) ?? 0, I(r) ?? 0), s = o <= 1 ? 1 : o <= 3 ? 2 : 6, c = (e.x1 - e.x0) / s;
1862
+ n === 0 && i.push({
1863
+ op: "M",
1864
+ p: a(e.x0, A(r, e.x0), A(e, e.x0))
1865
+ });
1866
+ for (let t = 0; t < s; t++) {
1867
+ let n = e.x0 + t * c, s = n + c, l = c / 3, [u, d, f, p] = [
1868
+ A(r, n),
1869
+ A(e, n),
1870
+ A(r, s),
1871
+ A(e, s)
1872
+ ];
1873
+ o <= 1 ? i.push({
1874
+ op: "L",
1875
+ p: a(s, f, p)
1876
+ }) : i.push({
1877
+ op: "C",
1878
+ c1: a(n + l, u + l * j(r, n), d + l * j(e, n)),
1879
+ c2: a(s - l, f - l * j(r, s), p - l * j(e, s)),
1880
+ p: a(s, f, p)
1881
+ });
1882
+ }
1883
+ }), {
1884
+ kind: "path",
1885
+ group: "w",
1886
+ layer: H.deformed,
1887
+ tone: "deformed",
1888
+ width: r,
1889
+ cap: "round",
1890
+ segments: i
1891
+ };
1892
+ }, rn = (e, t, n) => {
1893
+ let r = [];
1894
+ for (let i of e.members) {
1895
+ let e = n[i.id], a = t.get(i.id);
1896
+ if (!e || !a) continue;
1897
+ let o = null;
1898
+ for (let t of e.w) {
1899
+ let n = [
1900
+ t.x0,
1901
+ t.x1,
1902
+ ...oe(t),
1903
+ ...Array.from({ length: 9 }, (e, n) => t.x0 + (n + 1) * (t.x1 - t.x0) / 10)
1904
+ ];
1905
+ for (let t of n) {
1906
+ let n = L(e.u, t), r = L(e.w, t), a = Math.hypot(n, r);
1907
+ (!o || a > o.size) && (o = {
1908
+ member: i.id,
1909
+ x: t,
1910
+ u: n,
1911
+ w: r,
1912
+ size: a
1913
+ });
1914
+ }
1915
+ }
1916
+ o && r.push(o);
1917
+ }
1918
+ let i = Math.max(0, ...r.map((e) => e.size));
1919
+ if (!(i > 0)) return [];
1920
+ let a = [];
1921
+ return r.filter((e) => {
1922
+ if (e.size < i * .999) return !1;
1923
+ let n = Ve(bt(t, e.member), e.x);
1924
+ return !a.some((e) => Math.hypot(e.x - n.x, e.z - n.z) < 1e-6) && (a.push(n), !0);
1925
+ });
1926
+ }, an = (e, t) => {
1927
+ let n = Object.values(e.results?.members ?? {}), r = (e) => Math.max(0, ...n.map((t) => P(t[e]))), i = (e, n, r) => t.diagramScale?.[e] ?? (n > 0 ? r / n : 0);
1928
+ return {
1929
+ N: i("N", r("N"), t.diagramSize),
1930
+ V: i("V", r("V"), t.diagramSize),
1931
+ M: i("M", r("M"), t.diagramSize),
1932
+ w: i("w", Math.max(r("u"), r("w")), t.deformedSize)
1933
+ };
1934
+ }, on = (e) => {
1935
+ let t = ze(e);
1936
+ return new Map(e.members.map((n) => [n.id, Be(e, n, t)]));
1937
+ }, sn = (e) => {
1938
+ let t = e.results;
1939
+ if (!t) return null;
1940
+ let n = Object.values(t.members), r = (e) => Math.max(0, ...n.map((t) => P(t[e]))), [i, a, o] = [
1941
+ r("N"),
1942
+ r("V"),
1943
+ r("M")
1944
+ ];
1945
+ if (i === 0 && a === 0 && o === 0) return "w";
1946
+ if (e.members.length > 0 && e.members.every((e) => e.hinges[0] && e.hinges[1])) return "N";
1947
+ let s = on(e), c = [...s.values()].reduce((e, t) => e + t.length, 0) / Math.max(1, s.size);
1948
+ return !e.loads.some((e) => "member" in e) && o < .05 * i * c ? "N" : "M";
1949
+ }, cn = (e, t) => {
1950
+ let n = on(e), r = new Set(e.members.flatMap((e) => [e.start, e.end])), i = (e, n) => ct(e, n, t.numberFormat), a = t.compact ? pt.compact : pt.full, { layers: o } = t, s = [], c = e.results;
1951
+ if (c) {
1952
+ let r = an(e, t);
1953
+ for (let i of [
1954
+ "N",
1955
+ "V",
1956
+ "M"
1957
+ ]) {
1958
+ if (!o.has(i) || !(r[i] > 0)) continue;
1959
+ if (i === "N" && $t(e, c.members)) {
1960
+ s.push(...en(e, n, c.members, t));
1961
+ continue;
1962
+ }
1963
+ let a = Kt(i, t.momentOnTensionSide);
1964
+ for (let o of e.members) {
1965
+ let l = c.members[o.id], u = bt(n, o.id);
1966
+ if (l && l[i].some((e) => I(e) !== null)) {
1967
+ let d = {
1968
+ x: u.nx * a,
1969
+ y: u.nz * a
1970
+ }, f = [0, 1].map((t) => !Qt(e, n, c.members, i, a, o, t));
1971
+ s.push(...Jt(i, u, l[i], mt[i], r[i], d, t.scale, f));
1972
+ }
1973
+ }
1974
+ let l = Xt(e, n, c.members, i, r[i], a, t);
1975
+ s.push(...(t.compact ? tn(l, 2) : l).map((e) => e.item));
1976
+ }
1977
+ if (o.has("w") && r.w > 0) {
1978
+ for (let t of e.members) {
1979
+ let e = c.members[t.id];
1980
+ e && s.push(nn(bt(n, t.id), e, r.w, a.deformed));
1981
+ }
1982
+ for (let i of rn(e, n, c.members)) {
1983
+ let e = bt(n, i.member), a = {
1984
+ x: i.u * e.tx + i.w * e.nx,
1985
+ y: i.u * e.tz + i.w * e.nz
1986
+ }, o = Z(e, i.x, r.w * a.x, r.w * a.y);
1987
+ s.push(ht("w", o, X(a.x, a.y), 5, Y(i.size * t.units.displacement.scale, t.numberFormat), "deformed", 7));
1988
+ }
1989
+ }
1990
+ }
1991
+ if (o.has("members") && s.push(...wt(e, n, a), ...Tt(e, n, a)), o.has("supports") && s.push(...Dt(e, r)), (o.has("nodes") || o.has("nodeLabels")) && s.push(...Ot(e, r, o)), o.has("dimensions") && s.push(...jt(e, n, t, i)), o.has("loads") && s.push(...Vt(e, n, t, a, i)), o.has("reactions")) {
1992
+ let n = t.reactionLabels === "names" ? Wt(e) : c?.reactions;
1993
+ n && s.push(...Gt(e, n, t, a));
1994
+ }
1995
+ return s;
1996
+ }, ln = (e) => dt.filter((t) => e.has(t)).length > 1 ? /* @__PURE__ */ new Set() : new Set(dt), un = (e, t, n, r = t.layers, i = [t.resultLabelMode ?? "horizontal"], a = []) => {
1997
+ let o = n.fontSize, s = ln(r), c = (n, r = t.resultLabelMode, i = t.reactionLabels) => cn(e, {
1998
+ ...t,
1999
+ resultLabelMode: r,
2000
+ reactionLabels: i,
2001
+ scale: n
2002
+ }), l = (e, t) => {
2003
+ let r = c(1, e, t), i = Le(r, Ne(r, n), {
2004
+ fontSize: o,
2005
+ alternativeGroups: s,
2006
+ shields: /* @__PURE__ */ new Set()
2007
+ });
2008
+ return r.flatMap((e) => {
2009
+ if (e.kind !== "text") return [e];
2010
+ let t = i.get(e);
2011
+ return t ? [t] : [];
2012
+ });
2013
+ }, u = [.../* @__PURE__ */ new Set([t.resultLabelMode ?? "horizontal", ...i])], d = [.../* @__PURE__ */ new Set([t.reactionLabels ?? "values", ...a])], f = Ne(u.flatMap((e) => d.flatMap((t) => l(e, t))), n), p = c(f.s);
2014
+ return {
2015
+ fit: f,
2016
+ items: p,
2017
+ resolved: Re(p, f, {
2018
+ fontSize: o,
2019
+ viewport: f,
2020
+ alternativeGroups: s,
2021
+ shields: new Set(dt.filter((e) => r.has(e)))
2022
+ })
2023
+ };
2024
+ }, dn = (e, t, n = 0) => {
2025
+ let r = ce(e.V).find((e) => Math.abs(e - t) <= n) ?? t, i = (t) => ({
2026
+ left: L(e[t], r, "left"),
2027
+ right: L(e[t], r, "right")
2028
+ });
2029
+ return {
2030
+ x: r,
2031
+ u: i("u").right,
2032
+ values: {
2033
+ N: i("N"),
2034
+ V: i("V"),
2035
+ M: i("M"),
2036
+ w: i("w")
2037
+ }
2038
+ };
2039
+ }, fn = (e, t, n, r, i) => {
2040
+ let a = e.results?.members;
2041
+ if (!a) return null;
2042
+ let o = ze(e), s = null;
2043
+ for (let a of e.members) {
2044
+ let c = Be(e, a, o), [l, u] = G(t, U(c.x, c.z)), [d, f] = G(t, U(c.x + c.tx * c.length, c.z + c.tz * c.length)), p = d - l, m = f - u, h = Math.min(1, Math.max(0, ((n - l) * p + (r - u) * m) / (p * p + m * m || 1))), g = Math.hypot(l + h * p - n, u + h * m - r);
2045
+ g <= i && (!s || g < s.d) && (s = {
2046
+ member: a.id,
2047
+ s: h,
2048
+ d: g,
2049
+ frame: c
2050
+ });
2051
+ }
2052
+ if (!s || !a[s.member]) return null;
2053
+ let c = 6 / t.s, l = s.frame, u = dn(a[s.member], s.s * l.length, c), [d, f] = G(t, U(l.x + l.tx * u.x, l.z + l.tz * u.x));
2054
+ return {
2055
+ member: s.member,
2056
+ x: u.x,
2057
+ px: d,
2058
+ py: f,
2059
+ values: u.values,
2060
+ u: u.u
2061
+ };
2062
+ }, pn = {
2063
+ N: "normal",
2064
+ V: "shear",
2065
+ M: "moment",
2066
+ w: "deformed"
2067
+ }, mn = (e, t, n, r, i, a) => {
2068
+ let o = e.members.find((e) => e.id === n.member);
2069
+ if (!o) return [];
2070
+ let s = Be(e, o, ze(e)), c = s.x + s.tx * n.x, l = s.z + s.tz * n.x, u = G(t, U(c, l));
2071
+ return r.flatMap((e) => {
2072
+ if (!(i[e] > 0)) return [];
2073
+ if (e === "w") {
2074
+ let e = n.values.w.right, r = i.w * (n.u * s.tx + e * s.nx), a = i.w * (n.u * s.tz + e * s.nz);
2075
+ return [{
2076
+ tone: pn.w,
2077
+ from: u,
2078
+ to: G(t, U(c, l, r, a))
2079
+ }];
2080
+ }
2081
+ let { left: r, right: o } = n.values[e];
2082
+ return (Math.abs(r - o) > 1e-9 * Math.max(1, Math.abs(r), Math.abs(o)) ? [r, o] : [o]).map((n) => ({
2083
+ tone: pn[e],
2084
+ from: u,
2085
+ to: G(t, U(c, l, s.nx * a[e] * i[e] * n, s.nz * a[e] * i[e] * n))
2086
+ }));
2087
+ });
2088
+ }, hn = {
2089
+ N: "N",
2090
+ V: "V",
2091
+ M: "M",
2092
+ w: "w"
2093
+ }, gn = (e, t, n, r) => {
2094
+ let i = t === "M" ? n.moment : t === "w" ? n.displacement : n.force, { left: a, right: o } = e.values[t], s = Y(a * i.scale, r) === Y(o * i.scale, r) ? ct(o, i, r) : `${Y(a * i.scale, r)} → ${ct(o, i, r)}`;
2095
+ return `${hn[t]} = ${s}`;
2096
+ }, _n = {
2097
+ ink: "var(--figure-ink, var(--ink, CanvasText))",
2098
+ paper: "var(--paper, Canvas)",
2099
+ muted: "var(--muted, GrayText)",
2100
+ brand: "var(--brand, #4f46e5)",
2101
+ normal: "var(--color-normal, #2222ff)",
2102
+ shear: "var(--color-shear, #00af00)",
2103
+ moment: "var(--color-moment, #ff2222)",
2104
+ deformed: "var(--figure-ink, var(--ink, CanvasText))",
2105
+ load: "var(--color-load, #ff8700)",
2106
+ reaction: "var(--color-reaction, #a020f0)",
2107
+ tension: "var(--color-tension, var(--color-moment, #ff2222))",
2108
+ compression: "var(--color-compression, var(--color-normal, #2222ff))"
2109
+ }, vn = (e) => Object.fromEntries(Object.entries({
2110
+ ..._n,
2111
+ ...e
2112
+ }).map(([e, t]) => [`--ebp-${e}`, t])), yn = ".ebp-svg{display:block;max-width:100%;height:auto;overflow:visible;font-family:var(--ebp-font,var(--font-sans,inherit));font-variant-numeric:tabular-nums;-webkit-user-select:none;user-select:none}\n.ebp-svg text{paint-order:stroke;stroke:var(--ebp-paper);stroke-width:4px;stroke-linejoin:round}\n.ebp-svg text.ebp-nohalo{stroke:none}\n.ebp-svg .ebp-math{font-family:KaTeX_Main,'Latin Modern Roman',Georgia,serif}\n.ebp-svg .ebp-math tspan.ebp-var{font-family:KaTeX_Math,'Latin Modern Math',Georgia,serif;font-style:italic}\n.ebp-layer{opacity:0}\n.ebp-layer.ebp-on{opacity:1}\n.ebp-draw{stroke-dasharray:1;stroke-dashoffset:1}\n.ebp-on .ebp-draw{stroke-dashoffset:0}\n.ebp-animate .ebp-layer{transition:opacity .45s ease}\n.ebp-animate .ebp-draw{transition:stroke-dashoffset .6s cubic-bezier(.22,1,.36,1)}\n.ebp-handle{cursor:grab;outline:none}\n.ebp-handle.ebp-dragging{cursor:grabbing}\n.ebp-animate .ebp-grip,.ebp-stack .ebp-grip{transition:r .15s}\n.ebp-handle:hover .ebp-grip,.ebp-handle:focus-visible .ebp-grip,.ebp-handle.ebp-dragging .ebp-grip{r:11px}\n.ebp-handle:focus-visible .ebp-grip{stroke:var(--ebp-paper);stroke-width:3}\n.ebp-focus-ring{opacity:0}\n.ebp-handle:focus-visible .ebp-focus-ring{opacity:1}\n@media (prefers-reduced-motion:reduce){.ebp-stack .ebp-grip{transition:none}}\n@media (prefers-reduced-motion:reduce){.ebp-animate .ebp-layer,.ebp-animate .ebp-draw{transition:none}}", bn = {
2113
+ N: "normal force",
2114
+ V: "shear force",
2115
+ M: "bending moment",
2116
+ w: "deformed shape",
2117
+ reactions: "reactions",
2118
+ loads: "loads"
2119
+ }, xn = {
2120
+ structure: (e) => {
2121
+ let t = e.flatMap((e) => bn[e] ?? []);
2122
+ return t.length > 0 ? `Structure with its ${t.join(", ")}` : "Structure";
2123
+ },
2124
+ stack: (e) => {
2125
+ let t = {
2126
+ N: "normal force",
2127
+ V: "shear force",
2128
+ M: "bending moment",
2129
+ w: "deflection"
2130
+ };
2131
+ return `A beam with its loads${e.length ? `, and its ${e.map((e) => t[e]).join(", ")} beneath` : ""}`;
2132
+ },
2133
+ temperature: ut,
2134
+ loadHandle: (e) => `Position of the load ${e}`,
2135
+ loadPosition: (e) => `${e} m from the start of the beam`
2136
+ }, Sn = Symbol("edubeam-plot-texts"), Cn = () => {
2137
+ let e = c(Sn, null);
2138
+ return t(() => ({
2139
+ ...xn,
2140
+ ...x(e)
2141
+ }));
2142
+ }, wn = [
2143
+ "width",
2144
+ "height",
2145
+ "viewBox",
2146
+ "font-size",
2147
+ "aria-labelledby"
2148
+ ], Tn = ["id"], En = ["aria-hidden"], Dn = [
2149
+ "d",
2150
+ "pathLength",
2151
+ "stroke",
2152
+ "stroke-width",
2153
+ "stroke-opacity",
2154
+ "stroke-dasharray",
2155
+ "stroke-linecap",
2156
+ "fill",
2157
+ "fill-opacity"
2158
+ ], On = [
2159
+ "cx",
2160
+ "cy",
2161
+ "r",
2162
+ "stroke",
2163
+ "stroke-width",
2164
+ "fill"
2165
+ ], kn = ["aria-hidden"], An = [
2166
+ "x",
2167
+ "y",
2168
+ "text-anchor",
2169
+ "transform",
2170
+ "fill",
2171
+ "font-weight",
2172
+ "font-size",
2173
+ "font-style"
2174
+ ], jn = ["font-size", "dy"], Mn = [
2175
+ "x",
2176
+ "y",
2177
+ "text-anchor",
2178
+ "transform",
2179
+ "fill",
2180
+ "font-weight",
2181
+ "font-size",
2182
+ "font-style"
2183
+ ], Nn = ["font-size", "dy"], Pn = {
2184
+ key: 0,
2185
+ class: "ebp-readout",
2186
+ "pointer-events": "none"
2187
+ }, Fn = [
2188
+ "cx",
2189
+ "cy",
2190
+ "fill"
2191
+ ], In = [
2192
+ "x1",
2193
+ "y1",
2194
+ "x2",
2195
+ "y2",
2196
+ "stroke"
2197
+ ], Ln = [
2198
+ "cx",
2199
+ "cy",
2200
+ "fill",
2201
+ "stroke"
2202
+ ], Rn = [
2203
+ "x",
2204
+ "y",
2205
+ "width",
2206
+ "height",
2207
+ "fill",
2208
+ "stroke"
2209
+ ], zn = [
2210
+ "x",
2211
+ "y",
2212
+ "fill",
2213
+ "textContent"
2214
+ ], Bn = /* @__PURE__ */ s({
2215
+ __name: "StructurePlot",
2216
+ props: {
2217
+ solver: {},
2218
+ model: {},
2219
+ loadCase: { default: 0 },
2220
+ revision: { default: 0 },
2221
+ layers: {},
2222
+ reserve: {},
2223
+ compact: {
2224
+ type: Boolean,
2225
+ default: !1
2226
+ },
2227
+ units: {},
2228
+ numberFormat: {},
2229
+ colors: {},
2230
+ width: {},
2231
+ height: {},
2232
+ maxHeight: {},
2233
+ padding: { default: 6 },
2234
+ fontSize: {},
2235
+ diagramSize: {},
2236
+ deformedSize: {},
2237
+ diagramScale: {},
2238
+ momentOnTensionSide: {
2239
+ type: Boolean,
2240
+ default: !0
2241
+ },
2242
+ resultLabelMode: { default: "horizontal" },
2243
+ reactionLabels: {},
2244
+ reserveLabelModes: {},
2245
+ reserveReactionLabels: {},
2246
+ animate: {
2247
+ type: Boolean,
2248
+ default: !0
2249
+ },
2250
+ hover: {
2251
+ type: Boolean,
2252
+ default: !1
2253
+ },
2254
+ title: {}
2255
+ },
2256
+ emits: ["readout"],
2257
+ setup(s, { emit: c }) {
2258
+ let S = s, C = c, w = ee(), T = t(() => (S.revision, S.model ? S.model : S.solver ? Ce(b(S.solver), { loadCase: S.loadCase }) : {
2259
+ nodes: [],
2260
+ members: [],
2261
+ loads: []
2262
+ })), re = t(() => sn(T.value)), E = t(() => {
2263
+ if (S.layers) return new Set(S.layers);
2264
+ let e = [
2265
+ "members",
2266
+ "supports",
2267
+ "loads",
2268
+ "reactions"
2269
+ ];
2270
+ return new Set(re.value ? [...e, re.value] : e);
2271
+ }), D = t(() => /* @__PURE__ */ new Set([...S.reserve ?? [], ...E.value])), O = h(null), k = h(0), ie;
2272
+ p(() => {
2273
+ O.value && typeof ResizeObserver < "u" && (ie = new ResizeObserver(([e]) => {
2274
+ let t = Math.round(e.contentRect.width);
2275
+ t > 0 && (k.value = t);
2276
+ }), ie.observe(O.value));
2277
+ }), f(() => ie?.disconnect());
2278
+ let A = t(() => k.value || S.width || (S.compact ? 400 : 640)), j = t(() => S.fontSize ?? (S.compact ? 11.5 : 13)), M = t(() => ({
2279
+ layers: D.value,
2280
+ compact: S.compact,
2281
+ units: ot(S.units),
2282
+ numberFormat: S.numberFormat ?? st,
2283
+ diagramSize: S.diagramSize ?? (S.compact ? 26 : 48),
2284
+ deformedSize: S.deformedSize ?? (S.compact ? 18 : 30),
2285
+ diagramScale: S.diagramScale,
2286
+ momentOnTensionSide: S.momentOnTensionSide,
2287
+ resultLabelMode: S.resultLabelMode,
2288
+ reactionLabels: S.reactionLabels,
2289
+ temperatureSymbols: ae.value.temperature,
2290
+ fontSize: j.value
2291
+ })), N = t(() => un(T.value, {
2292
+ ...M.value,
2293
+ resultLabelMode: S.resultLabelMode
2294
+ }, {
2295
+ width: A.value,
2296
+ height: S.height,
2297
+ maxHeight: S.maxHeight ?? (S.compact ? void 0 : Math.max(320, A.value * .75)),
2298
+ padding: S.padding,
2299
+ fontSize: j.value
2300
+ }, E.value, S.reserveLabelModes ?? [], S.reserveReactionLabels ?? [])), P = t(() => lt.filter((e) => D.value.has(e)).map((e) => ({
2301
+ layer: e,
2302
+ on: E.value.has(e),
2303
+ paths: N.value.resolved.paths.filter((t) => t.group === e),
2304
+ circles: N.value.resolved.circles.filter((t) => t.group === e),
2305
+ texts: N.value.resolved.texts.filter((t) => t.group === e)
2306
+ }))), F = (e) => `var(--ebp-${e})`, I = t(() => vn(S.colors)), ae = Cn(), oe = t(() => S.title || ae.value.structure([...E.value])), L = h(null), R = h(null), se = (e) => {
2307
+ let t = R.value?.getBoundingClientRect();
2308
+ if (!t || t.width === 0) return;
2309
+ let n = (e.clientX - t.left) / t.width * N.value.fit.width, r = (e.clientY - t.top) / t.height * N.value.fit.height, i = 18 + (le.value.length > 0 ? M.value.diagramSize : 0);
2310
+ L.value = fn(T.value, N.value.fit, n, r, i);
2311
+ }, ce = () => L.value = null, le = t(() => [
2312
+ "N",
2313
+ "V",
2314
+ "M",
2315
+ "w"
2316
+ ].filter((e) => E.value.has(e) && !(e === "N" && T.value.results && $t(T.value, T.value.results.members)))), z = t(() => {
2317
+ let e = L.value;
2318
+ if (!e) return [];
2319
+ let t = an(T.value, M.value), n = S.momentOnTensionSide, r = {
2320
+ N: Kt("N", n),
2321
+ V: Kt("V", n),
2322
+ M: Kt("M", n)
2323
+ };
2324
+ return mn(T.value, N.value.fit, e, le.value, t, r);
2325
+ });
2326
+ te(L, (e) => C("readout", e));
2327
+ let B = t(() => {
2328
+ let e = L.value;
2329
+ if (!e) return null;
2330
+ let t = M.value.units, n = [
2331
+ "N",
2332
+ "V",
2333
+ "M"
2334
+ ].filter((e) => E.value.has(e)).map((n) => ({
2335
+ tone: {
2336
+ N: "normal",
2337
+ V: "shear",
2338
+ M: "moment"
2339
+ }[n],
2340
+ text: gn(e, n, t, M.value.numberFormat)
2341
+ }));
2342
+ if (E.value.has("w") && n.push({
2343
+ tone: "deformed",
2344
+ text: gn(e, "w", t, M.value.numberFormat)
2345
+ }), n.length === 0) return null;
2346
+ let r = Math.max(...n.map((e) => we(e.text, j.value))) * 1.08 + 16, i = n.length * (j.value + 5) + 8, [a, o] = z.value[0]?.to ?? [e.px, e.py];
2347
+ return {
2348
+ x: a + 14 + r < N.value.fit.width ? a + 14 : a - 14 - r,
2349
+ y: Math.min(Math.max(4, o - i - 10), N.value.fit.height - i - 4),
2350
+ w: r,
2351
+ h: i,
2352
+ lines: n
2353
+ };
2354
+ });
2355
+ return (t, c) => (m(), i("div", {
2356
+ ref_key: "root",
2357
+ ref: O,
2358
+ class: "ebp",
2359
+ style: d(I.value)
2360
+ }, [(m(), i("svg", l({
2361
+ ref_key: "svg",
2362
+ ref: R,
2363
+ class: ["ebp-svg", {
2364
+ "ebp-animate": s.animate,
2365
+ "ebp-compact": s.compact
2366
+ }],
2367
+ width: N.value.fit.width,
2368
+ height: N.value.fit.height,
2369
+ viewBox: `0 0 ${N.value.fit.width} ${N.value.fit.height}`,
2370
+ "font-size": j.value,
2371
+ role: "img",
2372
+ "aria-labelledby": x(w),
2373
+ style: s.hover ? { touchAction: "pan-y pinch-zoom" } : void 0
2374
+ }, y(s.hover ? {
2375
+ pointermove: se,
2376
+ pointerdown: se,
2377
+ pointerleave: ce
2378
+ } : {}, !0)), [
2379
+ a("title", { id: x(w) }, v(oe.value), 9, Tn),
2380
+ (m(), n(_("style"), null, {
2381
+ default: ne(() => [o(v(x(yn)), 1)]),
2382
+ _: 1
2383
+ })),
2384
+ (m(!0), i(e, null, g(P.value, (t) => (m(), i("g", {
2385
+ key: t.layer,
2386
+ class: u(["ebp-layer", [`ebp-layer-${t.layer}`, { "ebp-on": t.on }]]),
2387
+ "aria-hidden": t.on ? void 0 : "true"
2388
+ }, [(m(!0), i(e, null, g(t.paths, (e, t) => (m(), i("path", {
2389
+ key: t,
2390
+ d: e.d,
2391
+ class: u({ "ebp-draw": s.animate && e.draw !== void 0 }),
2392
+ pathLength: s.animate && e.draw !== void 0 ? 1 : void 0,
2393
+ style: d(s.animate && e.draw !== void 0 ? { transitionDelay: `${e.draw * 140}ms` } : void 0),
2394
+ stroke: e.width > 0 ? F(e.tone) : "none",
2395
+ "stroke-width": e.width > 0 ? e.width : void 0,
2396
+ "stroke-opacity": e.opacity,
2397
+ "stroke-dasharray": e.dash,
2398
+ "stroke-linecap": e.cap ?? "round",
2399
+ "stroke-linejoin": "round",
2400
+ fill: e.fill === "tone" ? F(e.tone) : e.fill === "paper" ? F("paper") : "none",
2401
+ "fill-opacity": e.fillOpacity
2402
+ }, null, 14, Dn))), 128)), (m(!0), i(e, null, g(t.circles, (e, t) => (m(), i("circle", {
2403
+ key: `c${t}`,
2404
+ cx: e.cx,
2405
+ cy: e.cy,
2406
+ r: e.r,
2407
+ stroke: F(e.tone),
2408
+ "stroke-width": e.width,
2409
+ fill: e.fill === "paper" ? F("paper") : F(e.tone)
2410
+ }, null, 8, On))), 128))], 10, En))), 128)),
2411
+ (m(!0), i(e, null, g(P.value, (t) => (m(), i("g", {
2412
+ key: `t-${t.layer}`,
2413
+ class: u(["ebp-layer ebp-labels", [`ebp-layer-${t.layer}`, { "ebp-on": t.on }]]),
2414
+ "aria-hidden": t.on ? void 0 : "true"
2415
+ }, [(m(!0), i(e, null, g(t.texts, (t, n) => (m(), i(e, { key: n }, [t.sub ? (m(), i("text", {
2416
+ key: 0,
2417
+ class: "ebp-halo",
2418
+ "aria-hidden": "true",
2419
+ x: t.x,
2420
+ y: t.y,
2421
+ "text-anchor": t.anchor,
2422
+ transform: t.transform,
2423
+ fill: F("paper"),
2424
+ "font-weight": t.weight,
2425
+ "font-size": t.size,
2426
+ "font-style": t.italic ? "italic" : void 0
2427
+ }, [o(v(t.text), 1), a("tspan", {
2428
+ "font-size": (t.size ?? j.value) * x(Te),
2429
+ dy: (t.size ?? j.value) * x(Ee)
2430
+ }, v(t.sub), 9, jn)], 8, An)) : r("", !0), a("text", {
2431
+ class: u({ "ebp-nohalo": t.sub }),
2432
+ x: t.x,
2433
+ y: t.y,
2434
+ "text-anchor": t.anchor,
2435
+ transform: t.transform,
2436
+ fill: F(t.tone),
2437
+ "font-weight": t.weight,
2438
+ "font-size": t.size,
2439
+ "font-style": t.italic ? "italic" : void 0
2440
+ }, [o(v(t.text), 1), t.sub ? (m(), i("tspan", {
2441
+ key: 0,
2442
+ "font-size": (t.size ?? j.value) * x(Te),
2443
+ dy: (t.size ?? j.value) * x(Ee)
2444
+ }, v(t.sub), 9, Nn)) : r("", !0)], 10, Mn)], 64))), 128))], 10, kn))), 128)),
2445
+ B.value && L.value ? (m(), i("g", Pn, [
2446
+ a("circle", {
2447
+ cx: L.value.px,
2448
+ cy: L.value.py,
2449
+ r: "2.5",
2450
+ fill: F("ink")
2451
+ }, null, 8, Fn),
2452
+ (m(!0), i(e, null, g(z.value, (t, n) => (m(), i(e, { key: n }, [a("line", {
2453
+ x1: t.from[0],
2454
+ y1: t.from[1],
2455
+ x2: t.to[0],
2456
+ y2: t.to[1],
2457
+ stroke: F(t.tone),
2458
+ "stroke-width": "2"
2459
+ }, null, 8, In), a("circle", {
2460
+ cx: t.to[0],
2461
+ cy: t.to[1],
2462
+ r: "4",
2463
+ fill: F(t.tone),
2464
+ stroke: F("paper"),
2465
+ "stroke-width": "1.5"
2466
+ }, null, 8, Ln)], 64))), 128)),
2467
+ a("rect", {
2468
+ x: B.value.x,
2469
+ y: B.value.y,
2470
+ width: B.value.w,
2471
+ height: B.value.h,
2472
+ rx: "5",
2473
+ fill: F("paper"),
2474
+ stroke: F("muted"),
2475
+ "stroke-opacity": "0.5"
2476
+ }, null, 8, Rn),
2477
+ (m(!0), i(e, null, g(B.value.lines, (e, t) => (m(), i("text", {
2478
+ key: t,
2479
+ x: B.value.x + 8,
2480
+ y: B.value.y + 4 + (t + 1) * (j.value + 5) - 4,
2481
+ fill: F(e.tone),
2482
+ "font-weight": "600",
2483
+ textContent: v(e.text)
2484
+ }, null, 8, zn))), 128))
2485
+ ])) : r("", !0)
2486
+ ], 16, wn))], 4));
2487
+ }
2488
+ }), Vn = (e, t) => {
2489
+ let n = ze(e), r = t ? t.map((t) => e.members.find((e) => e.id === t)) : [...e.members];
2490
+ if (r.length === 0) throw Error("A diagram stack needs at least one member");
2491
+ let i = r.map((t) => {
2492
+ if (!t) throw Error("A diagram stack names a member that does not exist");
2493
+ let r = Be(e, t, n);
2494
+ if (Math.abs(r.tz) > 1e-9 || r.tx < 0) throw Error(`Member ${t.id} is not horizontal and drawn left to right, as a diagram stack needs`);
2495
+ return {
2496
+ m: t,
2497
+ f: r
2498
+ };
2499
+ });
2500
+ i.sort((e, t) => e.f.x - t.f.x);
2501
+ let a = i[0].f.x, o = i[0].f.z, s = 1e-9 * Math.max(1, ...i.map(({ f: e }) => e.length)), c = a;
2502
+ for (let { m: e, f: t } of i) {
2503
+ if (Math.abs(t.z - o) > s || Math.abs(t.x - c) > s) throw Error(`Member ${e.id} does not continue the line of the diagram stack`);
2504
+ c = t.x + t.length;
2505
+ }
2506
+ let l = /* @__PURE__ */ new Map();
2507
+ for (let { m: e, f: t } of i) l.set(e.start, t.x - a), l.set(e.end, t.x + t.length - a);
2508
+ return {
2509
+ members: i.map(({ m: e, f: t }) => ({
2510
+ id: e.id,
2511
+ offset: t.x - a,
2512
+ length: t.length
2513
+ })),
2514
+ x0: a,
2515
+ z: o,
2516
+ length: c - a,
2517
+ nodes: [...l].map(([e, t]) => ({
2518
+ id: e,
2519
+ at: t
2520
+ })).sort((e, t) => e.at - t.at)
2521
+ };
2522
+ }, Hn = (e, t, n) => {
2523
+ let r = e.results?.members ?? {};
2524
+ return t.members.flatMap((e) => (r[e.id]?.[n] ?? []).map((t) => ({
2525
+ x0: t.x0 + e.offset,
2526
+ x1: t.x1 + e.offset,
2527
+ c: t.c
2528
+ })));
2529
+ }, Un = (e, t, n) => {
2530
+ let r = new Set(t.members.map((e) => e.id)), i = new Set(t.nodes.map((e) => e.id)), a = (e) => "member" in e ? r.has(e.member) : i.has(e.node);
2531
+ return {
2532
+ nodes: e.nodes.filter((e) => i.has(e.id)),
2533
+ members: e.members.filter((e) => r.has(e.id)),
2534
+ loads: e.loads.filter((e) => e !== n && a(e)),
2535
+ results: e.results && {
2536
+ members: e.results.members,
2537
+ reactions: e.results.reactions.filter((e) => i.has(e.node))
2538
+ }
2539
+ };
2540
+ }, Wn = (e, t, n) => {
2541
+ let r = 1e-6 * Math.max(1, t.length);
2542
+ return e.loads.find((e) => {
2543
+ if (e.kind === "pointForce") {
2544
+ let i = t.members.find((t) => t.id === e.member);
2545
+ return !!i && Math.abs(i.offset + e.at - n) <= r;
2546
+ }
2547
+ if (e.kind === "nodalForce") {
2548
+ let i = t.nodes.find((t) => t.id === e.node);
2549
+ return !!i && Math.abs(i.at - n) <= r;
2550
+ }
2551
+ return !1;
2552
+ });
2553
+ }, $ = (e) => Math.round(e * 10) / 10, Gn = (e, t, n, r) => {
2554
+ if (e.length === 0) return "";
2555
+ let i = [];
2556
+ return e.forEach((e, a) => {
2557
+ let o = `${$(t(e.x0))},${$(n(A(e, e.x0)))}`;
2558
+ a === 0 ? i.push(r ? `M${$(t(e.x0))},${$(n(0))}L${o}` : `M${o}`) : i.push(`L${o}`);
2559
+ for (let [, r, a, o] of le(e)) i.push(`C${$(t(r[0]))},${$(n(r[1]))} ${$(t(a[0]))},${$(n(a[1]))} ${$(t(o[0]))},${$(n(o[1]))}`);
2560
+ }), r && i.push(`L${$(t(e[e.length - 1].x1))},${$(n(0))}Z`), i.join("");
2561
+ }, Kn = (e, t, n, r) => {
2562
+ if (e.length === 0) return "";
2563
+ let i = t(e[0].x0), a = t(e[e.length - 1].x1), o = Math.floor((a - i) / r), s = i + (a - i - o * r) / 2, c = (e[e.length - 1].x1 - e[0].x0) / (a - i), l = [];
2564
+ for (let t = 0; t <= o; t++) {
2565
+ let a = s + t * r, o = L(e, e[0].x0 + (a - i) * c), u = n(0), d = n(o);
2566
+ Math.abs(d - u) >= 1.5 && l.push(`M${$(a)},${$(u)}V${$(d)}`);
2567
+ }
2568
+ return l.join("");
2569
+ }, qn = (e) => {
2570
+ let t = z(e);
2571
+ return t ? [Math.min(0, t.min.value), Math.max(0, t.max.value)] : [0, 0];
2572
+ }, Jn = (e) => {
2573
+ let t = z(e);
2574
+ if (!t) return [];
2575
+ let n = P(e), r = [];
2576
+ return t.max.value > .02 * n && r.push({
2577
+ ...t.max,
2578
+ kind: "max"
2579
+ }), t.min.value < -.02 * n && r.push({
2580
+ ...t.min,
2581
+ kind: "min"
2582
+ }), r;
2583
+ }, Yn = (e) => ce(e), Xn = [
2584
+ "width",
2585
+ "height",
2586
+ "viewBox",
2587
+ "font-size",
2588
+ "aria-labelledby"
2589
+ ], Zn = ["id"], Qn = {
2590
+ class: "ebp-math",
2591
+ "font-size": "15"
2592
+ }, $n = [
2593
+ "x",
2594
+ "y",
2595
+ "fill",
2596
+ "opacity"
2597
+ ], er = { class: "ebp-var" }, tr = { key: 0 }, nr = [
2598
+ "d",
2599
+ "stroke",
2600
+ "stroke-width",
2601
+ "stroke-opacity",
2602
+ "stroke-dasharray",
2603
+ "stroke-linecap",
2604
+ "fill"
2605
+ ], rr = [
2606
+ "cx",
2607
+ "cy",
2608
+ "r",
2609
+ "stroke",
2610
+ "stroke-width",
2611
+ "fill"
2612
+ ], ir = [
2613
+ "x1",
2614
+ "x2",
2615
+ "y1",
2616
+ "y2",
2617
+ "stroke"
2618
+ ], ar = [
2619
+ "x1",
2620
+ "x2",
2621
+ "y1",
2622
+ "y2",
2623
+ "stroke",
2624
+ "stroke-dasharray"
2625
+ ], or = ["d", "stroke"], sr = [
2626
+ "d",
2627
+ "stroke",
2628
+ "stroke-width"
2629
+ ], cr = { key: 2 }, lr = [
2630
+ "x",
2631
+ "y",
2632
+ "text-anchor",
2633
+ "transform",
2634
+ "fill",
2635
+ "font-weight",
2636
+ "textContent"
2637
+ ], ur = [
2638
+ "x",
2639
+ "y",
2640
+ "fill",
2641
+ "textContent"
2642
+ ], dr = [
2643
+ "aria-label",
2644
+ "aria-valuemax",
2645
+ "aria-valuenow",
2646
+ "aria-valuetext"
2647
+ ], fr = ["x", "y"], pr = [
2648
+ "x1",
2649
+ "x2",
2650
+ "y1",
2651
+ "y2",
2652
+ "stroke"
2653
+ ], mr = ["d", "fill"], hr = [
2654
+ "cx",
2655
+ "cy",
2656
+ "fill"
2657
+ ], gr = [
2658
+ "cx",
2659
+ "cy",
2660
+ "stroke"
2661
+ ], _r = [
2662
+ "x",
2663
+ "y",
2664
+ "text-anchor",
2665
+ "fill",
2666
+ "textContent"
2667
+ ], vr = {
2668
+ key: 4,
2669
+ "pointer-events": "none",
2670
+ "font-weight": "600"
2671
+ }, yr = [
2672
+ "x1",
2673
+ "x2",
2674
+ "y1",
2675
+ "y2",
2676
+ "stroke"
2677
+ ], br = [
2678
+ "x",
2679
+ "y",
2680
+ "fill"
2681
+ ], xr = [
2682
+ "cx",
2683
+ "cy",
2684
+ "fill",
2685
+ "stroke"
2686
+ ], Sr = [
2687
+ "x",
2688
+ "y",
2689
+ "width",
2690
+ "fill",
2691
+ "stroke"
2692
+ ], Cr = [
2693
+ "x",
2694
+ "y",
2695
+ "fill",
2696
+ "textContent"
2697
+ ], wr = 20, Tr = 8, Er = /* @__PURE__ */ s({
2698
+ __name: "DiagramStack",
2699
+ props: {
2700
+ solver: {},
2701
+ model: {},
2702
+ loadCase: { default: 0 },
2703
+ revision: { default: 0 },
2704
+ members: {},
2705
+ rows: { default: () => [
2706
+ "V",
2707
+ "M",
2708
+ "w"
2709
+ ] },
2710
+ loadRow: {
2711
+ type: Boolean,
2712
+ default: !0
2713
+ },
2714
+ ranges: {},
2715
+ rowHeights: {},
2716
+ maxHeight: {},
2717
+ units: {},
2718
+ numberFormat: {},
2719
+ colors: {},
2720
+ width: {},
2721
+ fontSize: {},
2722
+ hover: {
2723
+ type: Boolean,
2724
+ default: !0
2725
+ },
2726
+ loadAt: {},
2727
+ loadLabel: {},
2728
+ loadStep: { default: .05 },
2729
+ title: {}
2730
+ },
2731
+ emits: ["update:loadAt", "readout"],
2732
+ setup(s, { emit: c }) {
2733
+ let S = s, C = c, w = Cn(), T = ee(), re = t(() => (S.revision, S.model ? S.model : S.solver ? Ce(b(S.solver), { loadCase: S.loadCase }) : {
2734
+ nodes: [],
2735
+ members: [],
2736
+ loads: []
2737
+ })), E = t(() => Vn(re.value, S.members)), D = t(() => ot(S.units)), O = t(() => S.numberFormat ?? st), k = t(() => S.fontSize ?? 12.5), ie = h(null), A = h(0), j;
2738
+ p(() => {
2739
+ ie.value && typeof ResizeObserver < "u" && (j = new ResizeObserver(([e]) => {
2740
+ let t = Math.round(e.contentRect.width);
2741
+ t > 0 && (A.value = t);
2742
+ }), j.observe(ie.value));
2743
+ }), f(() => j?.disconnect());
2744
+ let M = t(() => Math.max(320, A.value || S.width || 720)), N = t(() => M.value < 560), P = t(() => N.value ? 52 : 60), F = t(() => M.value - P.value - wr), I = (e) => P.value + e / E.value.length * F.value, ae = (e) => (e - P.value) / F.value * E.value.length, oe = t(() => S.loadAt === void 0 ? void 0 : Wn(re.value, E.value, S.loadAt)), R = t(() => {
2745
+ if (!S.loadRow) return null;
2746
+ let e = Un(re.value, E.value, oe.value), t = /* @__PURE__ */ new Set([
2747
+ "members",
2748
+ "supports",
2749
+ "loads",
2750
+ "reactions"
2751
+ ]), n = F.value / E.value.length, r = cn(e, {
2752
+ layers: t,
2753
+ compact: N.value,
2754
+ units: D.value,
2755
+ numberFormat: O.value,
2756
+ scale: n,
2757
+ diagramSize: 0,
2758
+ deformedSize: 0,
2759
+ momentOnTensionSide: !0
2760
+ }), i = Me(r, n, k.value), a = 28 + Math.max(-(i.minY - n * E.value.z), oe.value ? 92 : 0), o = {
2761
+ s: n,
2762
+ tx: P.value - n * E.value.x0,
2763
+ ty: a - n * E.value.z
2764
+ };
2765
+ return {
2766
+ beamY: a,
2767
+ bottom: a + (i.maxY - n * E.value.z) + 6,
2768
+ resolved: Re(r, o, {
2769
+ fontSize: k.value,
2770
+ viewport: {
2771
+ width: M.value,
2772
+ height: 1e5
2773
+ }
2774
+ })
2775
+ };
2776
+ }), se = {
2777
+ N: "normal",
2778
+ V: "shear",
2779
+ M: "moment",
2780
+ w: "deformed"
2781
+ }, ce = {
2782
+ N: !0,
2783
+ V: !0,
2784
+ M: !1,
2785
+ w: !1
2786
+ }, le = (e) => e === "M" ? D.value.moment : e === "w" ? D.value.displacement : D.value.force, z = t(() => {
2787
+ let e = N.value ? {
2788
+ N: 88,
2789
+ V: 96,
2790
+ M: 104,
2791
+ w: 64
2792
+ } : {
2793
+ N: 100,
2794
+ V: 116,
2795
+ M: 128,
2796
+ w: 76
2797
+ }, t = N.value ? 22 : 26, n = R.value ? R.value.bottom + t : 30, r = S.rows.map((t) => S.rowHeights?.[t] ?? e[t]), i = r.reduce((e, t) => e + t, 0), a = S.maxHeight === void 0 ? Infinity : S.maxHeight - n - t * (S.rows.length - 1) - 14, o = Math.min(1, Math.max(.6, a / i)), s = n;
2798
+ return S.rows.map((e, n) => {
2799
+ let i = Math.round(r[n] * o), a = Hn(re.value, E.value, e), [c, l] = S.ranges?.[e] ?? qn(a), u = l - c || 1, d = ce[e], f = d ? s + l / u * i : s + -c / u * i, p = i / u, m = (e) => d ? f - e * p : f + e * p, h = se[e], g = Jn(a).map((t) => {
2800
+ let n = m(t.value), r = d ? t.value < 0 : t.value > 0, i = ct(t.value, le(e), O.value), a = we(i, k.value), o = Math.min(Math.max(I(t.x), P.value + a / 2), M.value - wr - a / 2), s = n - 7, c = n + k.value + 3, l = n + k.value * .35;
2801
+ return {
2802
+ text: i,
2803
+ width: a,
2804
+ places: [
2805
+ {
2806
+ x: o,
2807
+ y: r ? c : s
2808
+ },
2809
+ {
2810
+ x: Math.min(o + a / 2 + 10, M.value - wr - a / 2),
2811
+ y: l
2812
+ },
2813
+ {
2814
+ x: Math.max(o - a / 2 - 10, P.value + a / 2),
2815
+ y: l
2816
+ },
2817
+ {
2818
+ x: o,
2819
+ y: r ? s : c
2820
+ }
2821
+ ]
2822
+ };
2823
+ }), _ = {
2824
+ row: e,
2825
+ tone: h,
2826
+ top: s,
2827
+ height: i,
2828
+ axis: f,
2829
+ sy: m,
2830
+ pw: a,
2831
+ outline: Gn(a, I, m, e !== "w"),
2832
+ ordinates: e === "w" ? "" : Kn(a, I, m, 7),
2833
+ peaks: g
2834
+ };
2835
+ return s += i + t, _;
2836
+ });
2837
+ }), B = t(() => {
2838
+ let e = k.value, t = [];
2839
+ return z.value.map((n) => n.peaks.flatMap((r) => {
2840
+ for (let i of r.places) {
2841
+ let a = {
2842
+ x0: i.x - r.width / 2 - 2,
2843
+ x1: i.x + r.width / 2 + 2,
2844
+ y0: i.y - e,
2845
+ y1: i.y + 3
2846
+ };
2847
+ if (!t.some((e) => a.x0 < e.x1 && e.x0 < a.x1 && a.y0 < e.y1 && e.y0 < a.y1)) return t.push(a), [{
2848
+ ...i,
2849
+ text: r.text,
2850
+ tone: n.tone
2851
+ }];
2852
+ }
2853
+ return [];
2854
+ }));
2855
+ }), ue = t(() => {
2856
+ let e = z.value[z.value.length - 1], t = Math.max(0, ...(B.value[B.value.length - 1] ?? []).map((e) => e.y + 6));
2857
+ return Math.ceil(e ? Math.max(e.top + e.height + 14, t) : (R.value?.bottom ?? 0) + 8);
2858
+ }), de = {
2859
+ N: "N",
2860
+ V: "V",
2861
+ M: "M",
2862
+ w: "w"
2863
+ }, fe = h(null), pe = t(() => [...new Set(S.rows.flatMap((e) => Yn(Hn(re.value, E.value, e))))]), V = t(() => {
2864
+ let e = fe.value;
2865
+ if (e === null) return null;
2866
+ let t = pe.value.find((t) => Math.abs(I(t) - I(e)) < Tr) ?? e;
2867
+ return {
2868
+ x: t,
2869
+ values: Object.fromEntries(z.value.map((e) => [e.row, {
2870
+ left: L(e.pw, t, "left"),
2871
+ right: L(e.pw, t, "right")
2872
+ }]))
2873
+ };
2874
+ });
2875
+ te(V, (e) => C("readout", e));
2876
+ let me = t(() => {
2877
+ let e = V.value;
2878
+ if (!e) return [];
2879
+ let t = e.x < E.value.length * .7;
2880
+ return z.value.map((n) => {
2881
+ let r = e.values[n.row] ?? {
2882
+ left: 0,
2883
+ right: 0
2884
+ }, i = le(n.row), a = Y(r.left * i.scale, O.value) === Y(r.right * i.scale, O.value), o = a ? ct(r.right, i, O.value) : `${Y(r.left * i.scale, O.value)} → ${ct(r.right, i, O.value)}`, s = a ? [n.sy(r.right)] : [n.sy(r.left), n.sy(r.right)], c = we(o, k.value) * 1.12 + 16, l = t ? I(e.x) + 8 : I(e.x) - 8 - c;
2885
+ return {
2886
+ key: n.row,
2887
+ tone: n.tone,
2888
+ ys: s,
2889
+ text: o,
2890
+ width: c,
2891
+ left: l,
2892
+ top: Math.min(...s) - 30
2893
+ };
2894
+ });
2895
+ }), he = h(null), ge = h(!1), _e = (e) => Math.min(E.value.length, Math.max(0, Math.round(e / S.loadStep) * S.loadStep)), ve = (e) => {
2896
+ let t = he.value?.getBoundingClientRect();
2897
+ return !t || !(t.width > 0) || !(t.height > 0) ? null : {
2898
+ x: ae((e.clientX - t.left) / t.width * M.value),
2899
+ y: (e.clientY - t.top) / t.height * ue.value
2900
+ };
2901
+ }, ye = (e) => {
2902
+ let t = ve(e);
2903
+ t && S.loadAt !== void 0 && R.value && (t.y > R.value.bottom + 6 || (ge.value = !0, e.currentTarget instanceof Element && e.currentTarget.setPointerCapture?.(e.pointerId), C("update:loadAt", _e(t.x))));
2904
+ }, be = (e) => {
2905
+ let t = ve(e);
2906
+ t && (ge.value ? C("update:loadAt", _e(t.x)) : S.hover && (fe.value = t.x >= 0 && t.x <= E.value.length ? t.x : null));
2907
+ }, xe = () => ge.value = !1, Se = () => fe.value = null, H = (e) => {
2908
+ if (S.loadAt === void 0) return;
2909
+ let t = S.loadStep, n = {
2910
+ ArrowLeft: -t,
2911
+ ArrowDown: -t,
2912
+ ArrowRight: t,
2913
+ ArrowUp: t,
2914
+ PageDown: -1,
2915
+ PageUp: 1
2916
+ }[e.key];
2917
+ if (n !== void 0) C("update:loadAt", _e(S.loadAt + n));
2918
+ else if (e.key === "Home") C("update:loadAt", 0);
2919
+ else if (e.key === "End") C("update:loadAt", E.value.length);
2920
+ else return;
2921
+ e.preventDefault();
2922
+ }, U = t(() => S.hover || S.loadAt !== void 0), W = t(() => U.value ? {
2923
+ pointerdown: ye,
2924
+ pointermove: be,
2925
+ pointerup: xe,
2926
+ pointercancel: xe,
2927
+ pointerleave: Se
2928
+ } : {}), G = t(() => {
2929
+ if (S.loadAt === void 0 || !R.value) return null;
2930
+ let e = oe.value, t = e && (e.kind === "pointForce" || e.kind === "nodalForce") ? Math.hypot(e.fx, e.fz) : 0, n = I(S.loadAt), r = S.loadAt > E.value.length - E.value.length * .15;
2931
+ return {
2932
+ x: n,
2933
+ y: R.value.beamY,
2934
+ text: S.loadLabel ?? `P = ${ct(t, D.value.force, O.value)}`,
2935
+ nearEnd: r
2936
+ };
2937
+ }), K = (e) => `var(--ebp-${e})`, Te = t(() => vn(S.colors)), Ee = t(() => S.title ?? w.value.stack(S.rows)), De = t(() => {
2938
+ let e = z.value[z.value.length - 1];
2939
+ return e ? e.top + e.height : ue.value;
2940
+ });
2941
+ return (t, c) => (m(), i("div", {
2942
+ ref_key: "root",
2943
+ ref: ie,
2944
+ class: "ebp ebp-stack",
2945
+ style: d(Te.value)
2946
+ }, [(m(), i("svg", l({
2947
+ ref_key: "svg",
2948
+ ref: he,
2949
+ class: "ebp-svg",
2950
+ width: M.value,
2951
+ height: ue.value,
2952
+ viewBox: `0 0 ${M.value} ${ue.value}`,
2953
+ "font-size": k.value,
2954
+ role: "group",
2955
+ "aria-labelledby": x(T),
2956
+ style: U.value ? { touchAction: "pan-y pinch-zoom" } : void 0
2957
+ }, y(W.value, !0)), [
2958
+ a("title", { id: x(T) }, v(Ee.value), 9, Zn),
2959
+ (m(), n(_("style"), null, {
2960
+ default: ne(() => [o(v(x(yn)), 1)]),
2961
+ _: 1
2962
+ })),
2963
+ a("g", Qn, [(m(!0), i(e, null, g(z.value, (e) => (m(), i("text", {
2964
+ key: e.row,
2965
+ x: P.value - 12,
2966
+ y: e.axis + 5,
2967
+ "text-anchor": "end",
2968
+ fill: K(e.tone),
2969
+ opacity: e.row === "w" ? .7 : void 0
2970
+ }, [
2971
+ a("tspan", er, v(de[e.row]), 1),
2972
+ c[0] ||= a("tspan", null, "(", -1),
2973
+ c[1] ||= a("tspan", { class: "ebp-var" }, "x", -1),
2974
+ c[2] ||= a("tspan", null, ")", -1)
2975
+ ], 8, $n))), 128))]),
2976
+ R.value ? (m(), i("g", tr, [(m(!0), i(e, null, g(R.value.resolved.paths, (e, t) => (m(), i("path", {
2977
+ key: t,
2978
+ d: e.d,
2979
+ stroke: e.width > 0 ? K(e.tone) : "none",
2980
+ "stroke-width": e.width > 0 ? e.width : void 0,
2981
+ "stroke-opacity": e.opacity,
2982
+ "stroke-dasharray": e.dash,
2983
+ "stroke-linecap": e.cap ?? "round",
2984
+ "stroke-linejoin": "round",
2985
+ fill: e.fill === "tone" ? K(e.tone) : e.fill === "paper" ? K("paper") : "none"
2986
+ }, null, 8, nr))), 128)), (m(!0), i(e, null, g(R.value.resolved.circles, (e, t) => (m(), i("circle", {
2987
+ key: `c${t}`,
2988
+ cx: e.cx,
2989
+ cy: e.cy,
2990
+ r: e.r,
2991
+ stroke: K(e.tone),
2992
+ "stroke-width": e.width,
2993
+ fill: K("paper")
2994
+ }, null, 8, rr))), 128))])) : r("", !0),
2995
+ G.value && z.value.length ? (m(), i("line", {
2996
+ key: 1,
2997
+ x1: G.value.x,
2998
+ x2: G.value.x,
2999
+ y1: G.value.y,
3000
+ y2: De.value,
3001
+ stroke: K("brand"),
3002
+ "stroke-dasharray": "3 4",
3003
+ opacity: "0.45"
3004
+ }, null, 8, ir)) : r("", !0),
3005
+ (m(!0), i(e, null, g(z.value, (e) => (m(), i("g", { key: e.row }, [
3006
+ a("line", {
3007
+ x1: I(0),
3008
+ x2: I(E.value.length),
3009
+ y1: e.axis,
3010
+ y2: e.axis,
3011
+ stroke: K("muted"),
3012
+ "stroke-opacity": "0.45",
3013
+ "stroke-dasharray": e.row === "w" ? "4 4" : void 0
3014
+ }, null, 8, ar),
3015
+ e.ordinates ? (m(), i("path", {
3016
+ key: 0,
3017
+ d: e.ordinates,
3018
+ stroke: K(e.tone),
3019
+ "stroke-width": "1",
3020
+ "stroke-opacity": "0.55"
3021
+ }, null, 8, or)) : r("", !0),
3022
+ a("path", {
3023
+ d: e.outline,
3024
+ fill: "none",
3025
+ stroke: K(e.tone),
3026
+ "stroke-width": e.row === "w" ? 2.25 : 1.75,
3027
+ "stroke-linejoin": "round",
3028
+ "stroke-linecap": "round"
3029
+ }, null, 8, sr)
3030
+ ]))), 128)),
3031
+ R.value ? (m(), i("g", cr, [(m(!0), i(e, null, g(R.value.resolved.texts, (e, t) => (m(), i("text", {
3032
+ key: t,
3033
+ x: e.x,
3034
+ y: e.y,
3035
+ "text-anchor": e.anchor,
3036
+ transform: e.transform,
3037
+ fill: K(e.tone),
3038
+ "font-weight": e.weight,
3039
+ textContent: v(e.text)
3040
+ }, null, 8, lr))), 128))])) : r("", !0),
3041
+ (m(!0), i(e, null, g(B.value, (t, n) => (m(), i("g", { key: `l-${n}` }, [(m(!0), i(e, null, g(t, (e, t) => (m(), i("text", {
3042
+ key: t,
3043
+ x: e.x,
3044
+ y: e.y,
3045
+ "text-anchor": "middle",
3046
+ fill: K(e.tone),
3047
+ textContent: v(e.text)
3048
+ }, null, 8, ur))), 128))]))), 128)),
3049
+ G.value ? (m(), i("g", {
3050
+ key: 3,
3051
+ class: u(["ebp-handle", { "ebp-dragging": ge.value }]),
3052
+ tabindex: "0",
3053
+ role: "slider",
3054
+ "aria-label": x(w).loadHandle(G.value.text),
3055
+ "aria-valuemin": 0,
3056
+ "aria-valuemax": E.value.length,
3057
+ "aria-valuenow": s.loadAt,
3058
+ "aria-valuetext": x(w).loadPosition(x(Y)(s.loadAt ?? 0)),
3059
+ onKeydown: H
3060
+ }, [
3061
+ a("rect", {
3062
+ x: G.value.x - 22,
3063
+ y: G.value.y - 92,
3064
+ width: "44",
3065
+ height: "86",
3066
+ fill: "transparent"
3067
+ }, null, 8, fr),
3068
+ a("line", {
3069
+ x1: G.value.x,
3070
+ x2: G.value.x,
3071
+ y1: G.value.y - 74,
3072
+ y2: G.value.y - 13,
3073
+ stroke: K("brand"),
3074
+ "stroke-width": "3"
3075
+ }, null, 8, pr),
3076
+ a("path", {
3077
+ d: `M${G.value.x - 7},${G.value.y - 14}L${G.value.x + 7},${G.value.y - 14}L${G.value.x},${G.value.y - 2}Z`,
3078
+ fill: K("brand")
3079
+ }, null, 8, mr),
3080
+ a("circle", {
3081
+ class: "ebp-grip",
3082
+ cx: G.value.x,
3083
+ cy: G.value.y - 80,
3084
+ r: "9",
3085
+ fill: K("brand")
3086
+ }, null, 8, hr),
3087
+ a("circle", {
3088
+ class: "ebp-focus-ring",
3089
+ cx: G.value.x,
3090
+ cy: G.value.y - 80,
3091
+ r: "16",
3092
+ fill: "none",
3093
+ stroke: K("ink"),
3094
+ "stroke-width": "2"
3095
+ }, null, 8, gr),
3096
+ a("text", {
3097
+ x: G.value.x + (G.value.nearEnd ? -22 : 22),
3098
+ y: G.value.y - 76,
3099
+ "text-anchor": G.value.nearEnd ? "end" : "start",
3100
+ fill: K("brand"),
3101
+ "font-weight": "600",
3102
+ textContent: v(G.value.text)
3103
+ }, null, 8, _r)
3104
+ ], 42, dr)) : r("", !0),
3105
+ V.value && !ge.value && z.value.length ? (m(), i("g", vr, [
3106
+ a("line", {
3107
+ x1: I(V.value.x),
3108
+ x2: I(V.value.x),
3109
+ y1: z.value[0].top - 14,
3110
+ y2: De.value,
3111
+ stroke: K("ink"),
3112
+ "stroke-opacity": "0.3"
3113
+ }, null, 8, yr),
3114
+ a("text", {
3115
+ x: I(V.value.x),
3116
+ y: z.value[0].top - 20,
3117
+ "text-anchor": "middle",
3118
+ fill: K("ink")
3119
+ }, [c[3] ||= a("tspan", { class: "ebp-math" }, [a("tspan", { class: "ebp-var" }, "x")], -1), o(" = " + v(x(ct)(V.value.x, D.value.length, O.value)), 1)], 8, br),
3120
+ (m(!0), i(e, null, g(me.value, (t) => (m(), i("g", { key: t.key }, [
3121
+ (m(!0), i(e, null, g(t.ys, (e, n) => (m(), i("circle", {
3122
+ key: n,
3123
+ cx: I(V.value.x),
3124
+ cy: e,
3125
+ r: "4",
3126
+ fill: K(t.tone),
3127
+ stroke: K("paper"),
3128
+ "stroke-width": "1.5"
3129
+ }, null, 8, xr))), 128)),
3130
+ a("rect", {
3131
+ x: t.left,
3132
+ y: t.top,
3133
+ width: t.width,
3134
+ height: "21",
3135
+ rx: "5",
3136
+ fill: K("paper"),
3137
+ stroke: K(t.tone),
3138
+ "stroke-opacity": "0.5"
3139
+ }, null, 8, Sr),
3140
+ a("text", {
3141
+ x: t.left + 7,
3142
+ y: t.top + 15,
3143
+ fill: K(t.tone),
3144
+ class: "ebp-pill",
3145
+ textContent: v(t.text)
3146
+ }, null, 8, Cr)
3147
+ ]))), 128))
3148
+ ])) : r("", !0)
3149
+ ], 16, Xn))], 4));
3150
+ }
3151
+ }), Dr = { install(e) {
3152
+ e.component("StructurePlot", Bn), e.component("DiagramStack", Er);
3153
+ } }, Or = {
3154
+ ink: "#16182b",
3155
+ paper: "#ffffff",
3156
+ muted: "#6b7085",
3157
+ brand: "#4f46e5",
3158
+ normal: "#2222ff",
3159
+ shear: "#00af00",
3160
+ moment: "#ff2222",
3161
+ deformed: "#16182b",
3162
+ load: "#ff8700",
3163
+ reaction: "#a020f0",
3164
+ tension: "#ff2222",
3165
+ compression: "#2222ff"
3166
+ }, kr = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), Ar = (e) => Math.round(e * 100) / 100, jr = (e) => Object.entries(e).filter(([, e]) => e !== void 0 && e !== "").map(([e, t]) => `${e}="${kr(String(t))}"`).join(" "), Mr = (e, t = {}) => {
3167
+ let n = t.fontSize ?? (t.compact ? 11.5 : 13), r = t.width ?? 640, i = sn(e), a = new Set(t.layers ?? [
3168
+ "members",
3169
+ "supports",
3170
+ "loads",
3171
+ "reactions",
3172
+ ...i ? [i] : []
3173
+ ]), { fit: o, resolved: s } = un(e, {
3174
+ layers: /* @__PURE__ */ new Set([...a, ...t.reserve ?? []]),
3175
+ compact: t.compact ?? !1,
3176
+ units: ot(t.units),
3177
+ numberFormat: t.numberFormat ?? st,
3178
+ diagramSize: t.diagramSize ?? (t.compact ? 26 : 48),
3179
+ deformedSize: t.deformedSize ?? (t.compact ? 18 : 30),
3180
+ momentOnTensionSide: t.momentOnTensionSide ?? !0,
3181
+ resultLabelMode: t.resultLabelMode ?? "horizontal",
3182
+ reactionLabels: t.reactionLabels,
3183
+ temperatureSymbols: t.temperatureSymbols,
3184
+ fontSize: n
3185
+ }, {
3186
+ width: r,
3187
+ height: t.height,
3188
+ maxHeight: t.maxHeight ?? Math.max(320, r * .75),
3189
+ padding: t.padding ?? 6,
3190
+ fontSize: n
3191
+ }, a, t.reserveLabelModes, t.reserveReactionLabels), c = a, l = {
3192
+ paths: s.paths.filter((e) => c.has(e.group)),
3193
+ circles: s.circles.filter((e) => c.has(e.group)),
3194
+ texts: s.texts.filter((e) => c.has(e.group))
3195
+ }, u = {
3196
+ ...Or,
3197
+ ...t.colors
3198
+ }, d = (e) => u[e], f = (e) => `<path ${jr({
3199
+ d: e.d,
3200
+ fill: e.fill === "tone" ? d(e.tone) : e.fill === "paper" ? d("paper") : "none",
3201
+ "fill-opacity": e.fillOpacity,
3202
+ stroke: e.width > 0 ? d(e.tone) : "none",
3203
+ "stroke-width": e.width > 0 ? e.width : void 0,
3204
+ "stroke-opacity": e.opacity,
3205
+ "stroke-dasharray": e.dash,
3206
+ "stroke-linecap": e.cap ?? "round",
3207
+ "stroke-linejoin": "round"
3208
+ })}/>`, p = (e) => `<circle ${jr({
3209
+ cx: e.cx,
3210
+ cy: e.cy,
3211
+ r: e.r,
3212
+ stroke: d(e.tone),
3213
+ "stroke-width": e.width,
3214
+ fill: e.fill === "paper" ? d("paper") : d(e.tone)
3215
+ })}/>`, m = (e) => {
3216
+ let t = {
3217
+ x: e.x,
3218
+ y: e.y,
3219
+ "text-anchor": e.anchor,
3220
+ "font-size": e.size ?? n,
3221
+ "font-weight": e.weight,
3222
+ "font-style": e.italic ? "italic" : void 0,
3223
+ transform: e.transform
3224
+ }, r = e.size ?? n, i = kr(e.text) + (e.sub ? `<tspan ${jr({
3225
+ "font-size": Ar(r * Te),
3226
+ dy: Ar(r * Ee)
3227
+ })}>${kr(e.sub)}</tspan>` : "");
3228
+ return [`<text ${jr({
3229
+ ...t,
3230
+ fill: d("paper"),
3231
+ stroke: d("paper"),
3232
+ "stroke-width": 4,
3233
+ "stroke-linejoin": "round"
3234
+ })}>${i}</text>`, `<text ${jr({
3235
+ ...t,
3236
+ fill: d(e.tone)
3237
+ })}>${i}</text>`];
3238
+ }, h = lt.flatMap((e) => [...l.paths.filter((t) => t.group === e).map(f), ...l.circles.filter((t) => t.group === e).map(p)]), g = lt.flatMap((e) => l.texts.filter((t) => t.group === e).flatMap(m));
3239
+ return [
3240
+ `<svg ${jr({
3241
+ xmlns: "http://www.w3.org/2000/svg",
3242
+ width: o.width,
3243
+ height: o.height,
3244
+ viewBox: `0 0 ${o.width} ${o.height}`,
3245
+ "font-family": t.fontFamily ?? "Helvetica, Arial, sans-serif"
3246
+ })}>`,
3247
+ ...t.title ? [`<title>${kr(t.title)}</title>`] : [],
3248
+ ...t.background === !1 ? [] : [`<rect width="100%" height="100%" fill="${d("paper")}"/>`],
3249
+ ...h,
3250
+ ...g,
3251
+ "</svg>",
3252
+ ""
3253
+ ].join("\n");
3254
+ };
3255
+ export { _n as DEFAULT_COLORS, st as DEFAULT_NUMBER_FORMAT, xn as DEFAULT_PLOT_TEXTS, ut as DEFAULT_TEMPERATURE_SYMBOLS, Er as DiagramStack, Dr as EduBeamPlot, ft as HATCH_SPACING_PX, at as KN_UNITS, yn as PLOT_CSS, lt as PLOT_LAYERS, Sn as PLOT_TEXTS, Or as PRINT_COLORS, dt as RESULT_LAYERS, it as SI_UNITS, Bn as StructurePlot, ln as alternativeResultGroups, Vn as beamLine, cn as buildStructureScene, F as cleanPiecewise, sn as defaultResultLayer, an as diagramScales, Kt as diagramSide, A as evalPiece, j as evalPieceSlope, z as extremes, N as fitPiece, Ne as fitScene, Y as formatNumber, ct as formatQuantity, gn as formatReadout, rt as glyphReach, ce as innerBreaks, $t as isBarStructure, ae as isZero, un as layoutStructure, Hn as lineDiagram, Un as lineModel, P as maxAbs, Be as memberFrame, on as memberFrames, Ce as modelFromSolver, ze as nodeMap, I as pieceDegree, oe as pieceExtrema, le as pieceToBeziers, Le as placeLabels, Ve as pointAlong, Wn as pointLoadAt, G as project, dn as readMember, fn as readoutAt, mn as readoutMarks, Re as resolveScene, ot as resolveUnits, Yn as rowBreaks, Kn as rowOrdinates, Gn as rowOutline, Jn as rowPeaks, qn as rowRange, Me as sceneBounds, R as slopeAt, Mr as structureSvg, Xe as supportGlyph, He as supportKind, tt as supportPlacement, Yt as tipPlacements, vn as toneVars, Cn as usePlotTexts, L as valueAt };
3256
+
3257
+ //# sourceMappingURL=index.js.map