@edubeam/plot 0.0.0-stage → 0.1.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,2883 @@
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, mergeProps as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderList as h, resolveDynamicComponent as g, toDisplayString as _, toHandlers as v, toRaw as y, unref as b, useId as ee, watch as te, withCtx as ne } from "vue";
2
+ import { Beam2D as re, BeamConcentratedLoad as x, BeamElementTrapezoidalEdgeLoad as S, BeamElementUniformEdgeLoad as ie, BeamTemperatureLoad as C, DofID as w } from "@edubeam/fem";
3
+ // src/core/polynomial.ts
4
+ var T = (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
+ }, E = (e) => e.slice(1).map((e, t) => e * (t + 1)), D = (e) => e.x1 - e.x0, ae = (e, t) => D(e) > 0 ? (t - e.x0) / D(e) : 0, O = (e, t) => T(e.c, ae(e, t)), k = (e, t) => D(e) > 0 ? T(E(e.c), ae(e, t)) / D(e) : 0, A = (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
+ }, j = (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: A(a.map((e) => Array.from({ length: i }, (t, n) => e ** n)), a.map((r) => e(t + r * (n - t))))
33
+ };
34
+ }, M = (e) => {
35
+ let t = 0;
36
+ for (let n of e) for (let e of [
37
+ n.x0,
38
+ n.x1,
39
+ ...F(n)
40
+ ]) t = Math.max(t, Math.abs(O(n, e)));
41
+ return t;
42
+ }, N = (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
+ }), P = (e) => {
51
+ for (let t = e.c.length - 1; t >= 0; t--) if (e.c[t] !== 0) return t;
52
+ return null;
53
+ }, oe = (e) => e.every((e) => P(e) === null), F = (e) => {
54
+ let t = E(e.c);
55
+ if (t.every((e) => e === 0)) return [];
56
+ let n = [], r = 0, i = T(t, r);
57
+ for (let e = 1; e <= 64; e++) {
58
+ let a = e / 64, o = T(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 = T(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 * D(e));
71
+ }, I = (e, t, n = "right") => {
72
+ if (e.length === 0) return 0;
73
+ let r = se(e, t, n);
74
+ return O(r, Math.min(r.x1, Math.max(r.x0, t)));
75
+ }, L = (e, t, n = "right") => e.length === 0 ? 0 : k(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), R = (e, t = 4) => {
84
+ let n = (P(e) ?? 0) <= 3 ? 1 : t, r = [];
85
+ for (let t = 0; t < n; t++) {
86
+ let i = e.x0 + D(e) * t / n, a = e.x0 + D(e) * (t + 1) / n, o = (a - i) / 3, s = O(e, i), c = O(e, a);
87
+ r.push([
88
+ [i, s],
89
+ [i + o, s + o * k(e, i)],
90
+ [a - o, c - o * k(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
+ ...F(r).map((e) => [e, "right"])
111
+ ];
112
+ for (let [i, a] of e) {
113
+ let e = O(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
+ }, le = 3, ue = 5, de = 1e-9, fe = {
130
+ force: 1e-6,
131
+ moment: 1e-6,
132
+ displacement: 1e-12
133
+ }, pe = {
134
+ [w.Dx]: "dx",
135
+ [w.Dz]: "dz",
136
+ [w.Ry]: "ry"
137
+ }, B = (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(w.Dx),
143
+ dz: e.bcs.has(w.Dz),
144
+ ry: e.bcs.has(w.Ry)
145
+ },
146
+ angle: B(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[w.Dx] ?? 0, a = r.values[w.Dz] ?? 0, o = r.values[w.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 ie) {
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 S) 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 x) {
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 C) {
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[w.Dx],
231
+ dz: t[w.Dz],
232
+ ry: t[w.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 x)) 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) => j(e, r[i], n, t));
266
+ return {
267
+ N: a((n) => e.computeNormalForceAt(t, n), le),
268
+ V: a((n) => e.computeShearForceAt(t, n), le),
269
+ M: a((n) => e.computeBendingMomentAt(t, n), le),
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) => M(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: N(t.N, a("N")),
283
+ V: N(t.V, a("V")),
284
+ M: N(t.M, a("M")),
285
+ u: N(t.u, a("u")),
286
+ w: N(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 re), 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
+ }, V = {
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
+ }, H = (e, t, n = 0, r = 0) => ({
341
+ x: e,
342
+ z: t,
343
+ dx: n,
344
+ dy: r
345
+ }), U = (e, t, n) => ({
346
+ ...e,
347
+ dx: e.dx + t,
348
+ dy: e.dy + n
349
+ }), W = (e, t) => [e.tx + e.s * t.x + t.dx, e.ty + e.s * t.z + t.dy], G = (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 + G(t), 0) * t, Te = (e, t, n, r) => {
350
+ let i = we(e, t), a = n === "start" ? 0 : n === "end" ? -i : -i / 2, o = t, s = r === "top" ? 0 : r === "bottom" ? -o : -o / 2;
351
+ return {
352
+ x0: a,
353
+ x1: a + i,
354
+ y0: s,
355
+ y1: s + o
356
+ };
357
+ }, Ee = {
358
+ top: .78,
359
+ middle: .35,
360
+ bottom: -.22
361
+ }, De = () => ({
362
+ minX: Infinity,
363
+ maxX: -Infinity,
364
+ minY: Infinity,
365
+ maxY: -Infinity
366
+ }), Oe = (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
+ }, ke = (e, t, n) => {
369
+ let [r, i] = W(t, e.at), a = Te(e.text, e.size ?? n, e.align, e.baseline), o = De(), 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
+ ]) Oe(o, r + e * c - t * l, i + e * l + t * c);
376
+ return o;
377
+ }, Ae = (e, t, n) => {
378
+ let r = {
379
+ s: t,
380
+ tx: 0,
381
+ ty: 0
382
+ }, i = De(), a = (e, t = 0) => {
383
+ let [n, a] = W(r, e);
384
+ Oe(i, n - t, a - t), Oe(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 = ke(t, r, n);
393
+ Oe(i, e.minX, e.minY), Oe(i, e.maxX, e.maxY);
394
+ }
395
+ return i;
396
+ }, je = (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 = Ae(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 = Ae(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
+ }, K = (e) => {
415
+ let t = Math.round(e * 100) / 100;
416
+ return Object.is(t, -0) ? "0" : String(t);
417
+ }, Me = (e, t) => e.map((e) => {
418
+ switch (e.op) {
419
+ case "Z": return "Z";
420
+ case "M":
421
+ case "L": {
422
+ let [n, r] = W(t, e.p);
423
+ return `${e.op}${K(n)} ${K(r)}`;
424
+ }
425
+ case "A": {
426
+ let [n, r] = W(t, e.p);
427
+ return `A${K(e.r)} ${K(e.r)} 0 ${+!!e.large} ${+!!e.clockwise} ${K(n)} ${K(r)}`;
428
+ }
429
+ case "C": {
430
+ let [n, r] = W(t, e.c1), [i, a] = W(t, e.c2), [o, s] = W(t, e.p);
431
+ return `C${K(n)} ${K(r)} ${K(i)} ${K(a)} ${K(o)} ${K(s)}`;
432
+ }
433
+ }
434
+ }).join(""), Ne = (e, t, n) => e.minX < t.maxX + n && t.minX < e.maxX + n && e.minY < t.maxY + n && t.minY < e.maxY + n, Pe = (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
+ }, Fe = (e, t, n) => {
449
+ let r = [];
450
+ for (let n of e) {
451
+ if (n.kind !== "path" || !n.obstacle) continue;
452
+ let e = n.width / 2 + 1, i = null;
453
+ for (let a of n.segments) {
454
+ if (a.op === "Z") continue;
455
+ let n = W(t, a.p);
456
+ if (a.op === "A" && i) {
457
+ let [o, s] = W(t, a.center), c = Math.atan2(i[1] - s, i[0] - o), l = Math.atan2(n[1] - s, n[0] - o);
458
+ a.clockwise && l < c && (l += 2 * Math.PI), !a.clockwise && l > c && (l -= 2 * Math.PI);
459
+ let u = i;
460
+ for (let t = 1; t <= 12; t++) {
461
+ let n = c + (l - c) * t / 12, i = [o + a.r * Math.cos(n), s + a.r * Math.sin(n)];
462
+ r.push([
463
+ u,
464
+ i,
465
+ e
466
+ ]), u = i;
467
+ }
468
+ } else i && a.op !== "M" && r.push([
469
+ i,
470
+ n,
471
+ e
472
+ ]);
473
+ i = n;
474
+ }
475
+ }
476
+ let i = e.flatMap((e, t) => e.kind === "text" ? [{
477
+ item: e,
478
+ i: t
479
+ }] : []);
480
+ i.sort((e, t) => t.item.priority - e.item.priority || e.i - t.i);
481
+ let a = [], o = /* @__PURE__ */ new Map(), s = n.viewport, c = (e) => {
482
+ let i = ke(e, t, n.fontSize);
483
+ if (s && (i.minX < 0 || i.minY < 0 || i.maxX > s.width || i.maxY > s.height) || a.some((e) => Ne(e, i, 1))) return null;
484
+ let [o, c] = W(t, e.at), l = -(e.rotate ?? 0) * Math.PI / 180, u = Math.cos(l), d = Math.sin(l), f = ([e, t]) => [(e - o) * u - (t - c) * d, (e - o) * d + (t - c) * u], p = Te(e.text, e.size ?? n.fontSize, e.align, e.baseline);
485
+ return r.some(([e, t, n]) => Pe(f(e), f(t), {
486
+ minX: p.x0 - n + 1,
487
+ maxX: p.x1 + n - 1,
488
+ minY: p.y0 - n + 2,
489
+ maxY: p.y1 + n - 2
490
+ })) ? null : i;
491
+ };
492
+ for (let { item: e } of i) if (!n.exclude?.has(e)) for (let t of [e, ...(e.alternatives ?? []).map((t) => ({
493
+ ...e,
494
+ ...t
495
+ }))]) {
496
+ let n = c(t);
497
+ if (n) {
498
+ a.push(n), o.set(e, t);
499
+ break;
500
+ }
501
+ }
502
+ return o;
503
+ }, Ie = (e, t, n) => {
504
+ let r = Fe(e, t, n), i = [], a = [], o = [];
505
+ for (let s of e) if (s.kind === "path") i.push({
506
+ group: s.group,
507
+ d: Me(s.segments, t),
508
+ layer: s.layer,
509
+ tone: s.tone,
510
+ width: s.width,
511
+ fill: s.fill,
512
+ fillOpacity: s.fillOpacity,
513
+ opacity: s.opacity,
514
+ dash: s.dash,
515
+ cap: s.cap,
516
+ draw: s.draw
517
+ });
518
+ else if (s.kind === "circle") {
519
+ let [e, n] = W(t, s.at);
520
+ a.push({
521
+ group: s.group,
522
+ cx: e,
523
+ cy: n,
524
+ r: s.r,
525
+ layer: s.layer,
526
+ tone: s.tone,
527
+ width: s.width,
528
+ fill: s.fill
529
+ });
530
+ } else {
531
+ let e = r.get(s);
532
+ if (!e) continue;
533
+ let [i, a] = W(t, e.at), c = e.rotate ?? 0;
534
+ o.push({
535
+ group: s.group,
536
+ x: Math.round(i * 100) / 100,
537
+ y: Math.round((a + Ee[e.baseline] * (e.size ?? n.fontSize)) * 100) / 100,
538
+ text: e.text,
539
+ size: e.size,
540
+ tone: s.tone,
541
+ anchor: e.align,
542
+ transform: c === 0 ? void 0 : `rotate(${K(c)} ${K(i)} ${K(a)})`,
543
+ italic: s.italic,
544
+ weight: s.weight
545
+ });
546
+ }
547
+ return {
548
+ paths: i.sort((e, t) => e.layer - t.layer),
549
+ circles: a,
550
+ texts: o
551
+ };
552
+ }, q = (e) => new Map(e.nodes.map((e) => [e.id, e])), Le = (e, t, n = q(e)) => {
553
+ let r = n.get(t.start), i = n.get(t.end);
554
+ if (!r || !i) throw Error(`Member ${t.id} names a node that does not exist`);
555
+ let a = i.x - r.x, o = i.z - r.z, s = Math.hypot(a, o);
556
+ if (!(s > 0)) throw Error(`Member ${t.id} has zero length`);
557
+ let c = a / s, l = o / s;
558
+ return {
559
+ x: r.x,
560
+ z: r.z,
561
+ tx: c,
562
+ tz: l,
563
+ nx: -l,
564
+ nz: c,
565
+ length: s
566
+ };
567
+ }, Re = (e, t) => ({
568
+ x: e.x + e.tx * t,
569
+ z: e.z + e.tz * t
570
+ }), ze = (e) => e.dx && e.dz ? e.ry ? "fixed" : "pin" : e.dx || e.dz ? e.ry ? "slider" : "roller" : e.ry ? "rotation" : "none", Be = (e, t, n) => n.map((n) => ({
571
+ points: [[n, e], [n - t, e + t]],
572
+ weight: "thin"
573
+ })), Ve = (e, t) => ({
574
+ points: [
575
+ [0, 2],
576
+ [-t, e],
577
+ [t, e]
578
+ ],
579
+ closed: !0,
580
+ weight: "regular",
581
+ fill: "paper"
582
+ }), He = (e, t, n, r, i) => ({
583
+ points: [[e, t], [n, r]],
584
+ weight: i
585
+ }), Ue = [
586
+ -10,
587
+ -4,
588
+ 2,
589
+ 8,
590
+ 14
591
+ ], We = {
592
+ pin: [Ve(20, 11), He(-16, 20, 16, 20, "regular")],
593
+ roller: [Ve(19, 10), He(-14, 24, 14, 24, "regular")],
594
+ fixed: [He(-16, 0, 16, 0, "bold"), ...Be(0, 6, Ue)],
595
+ slider: [
596
+ He(-16, -6, 16, -6, "regular"),
597
+ He(-16, 6, 16, 6, "regular"),
598
+ ...Be(6, 6, Ue),
599
+ ...Ue.map((e) => He(e, -6, e - 6, -12, "thin"))
600
+ ],
601
+ rotation: [
602
+ [
603
+ [-14, 5],
604
+ [-5, 5],
605
+ [-5, 14]
606
+ ],
607
+ [
608
+ [5, 14],
609
+ [5, 5],
610
+ [14, 5]
611
+ ],
612
+ [
613
+ [14, -5],
614
+ [5, -5],
615
+ [5, -14]
616
+ ],
617
+ [
618
+ [-5, -14],
619
+ [-5, -5],
620
+ [-14, -5]
621
+ ]
622
+ ].map((e) => ({
623
+ points: e,
624
+ weight: "regular"
625
+ }))
626
+ }, Ge = (e) => e === "none" ? [] : We[e], Ke = (e, t) => {
627
+ let n = q(e), r = 0, i = 0, a = 0;
628
+ for (let o of e.members) {
629
+ if (o.start !== t.id && o.end !== t.id) continue;
630
+ let s = Le(e, o, n), c = o.start === t.id ? 1 : -1;
631
+ r += c * s.tx, i += c * s.tz, a++;
632
+ }
633
+ return {
634
+ x: r,
635
+ z: i,
636
+ count: a
637
+ };
638
+ }, qe = 180 / Math.PI, Je = (e) => {
639
+ let t = e / qe;
640
+ return {
641
+ x: -Math.sin(t),
642
+ z: Math.cos(t)
643
+ };
644
+ }, Ye = (e, t) => {
645
+ let n = Je(e), r = Math.hypot(t.x, t.z);
646
+ return r > 1e-9 && (n.x * t.x + n.z * t.z) / r > .7 ? e + 180 : e;
647
+ }, Xe = (e, t) => {
648
+ let n = ze(t.fixity), r = Ke(e, t), i = t.angle * qe, a = (() => {
649
+ switch (n) {
650
+ case "pin": return Ye(i, r);
651
+ case "roller": return Ye(t.fixity.dz ? i : i - 90, r);
652
+ case "fixed": {
653
+ let e = Math.hypot(r.x, r.z);
654
+ return e < 1e-9 ? i : Math.atan2(r.x / e, -r.z / e) * qe;
655
+ }
656
+ case "slider": return t.fixity.dz ? i : i + 90;
657
+ default: return 0;
658
+ }
659
+ })();
660
+ return {
661
+ node: t.id,
662
+ kind: n,
663
+ rotation: Ze(a)
664
+ };
665
+ }, Ze = (e) => {
666
+ let t = ((e + 180) % 360 + 360) % 360 - 180;
667
+ return t === -180 ? 180 : t;
668
+ }, Qe = (e, t, n, r) => {
669
+ let i = t / qe, a = Math.cos(i), o = Math.sin(i), s = 0;
670
+ for (let t of Ge(e)) for (let [e, i] of t.points) s = Math.max(s, (e * a - i * o) * n + (e * o + i * a) * r);
671
+ return s;
672
+ }, $e = {
673
+ force: {
674
+ symbol: "N",
675
+ scale: 1
676
+ },
677
+ moment: {
678
+ symbol: "N·m",
679
+ scale: 1
680
+ },
681
+ distributed: {
682
+ symbol: "N/m",
683
+ scale: 1
684
+ },
685
+ length: {
686
+ symbol: "m",
687
+ scale: 1
688
+ },
689
+ displacement: {
690
+ symbol: "m",
691
+ scale: 1
692
+ },
693
+ rotation: {
694
+ symbol: "rad",
695
+ scale: 1
696
+ },
697
+ temperature: {
698
+ symbol: "K",
699
+ scale: 1
700
+ }
701
+ }, et = {
702
+ force: {
703
+ symbol: "kN",
704
+ scale: .001
705
+ },
706
+ moment: {
707
+ symbol: "kNm",
708
+ scale: .001
709
+ },
710
+ distributed: {
711
+ symbol: "kN/m",
712
+ scale: .001
713
+ },
714
+ length: {
715
+ symbol: "m",
716
+ scale: 1
717
+ },
718
+ displacement: {
719
+ symbol: "mm",
720
+ scale: 1e3
721
+ },
722
+ rotation: {
723
+ symbol: "mrad",
724
+ scale: 1e3
725
+ },
726
+ temperature: {
727
+ symbol: "K",
728
+ scale: 1
729
+ }
730
+ }, tt = (e) => ({
731
+ ...et,
732
+ ...e
733
+ }), nt = new Intl.NumberFormat("en", { maximumFractionDigits: 1 }), J = (e, t = nt) => {
734
+ let n = t.formatToParts(e), r = n.filter((e) => e.type === "integer" || e.type === "fraction").map((e) => e.value).join(""), i = /^[0\D]*$/.test(r);
735
+ return n.filter((e) => !(i && e.type === "minusSign")).map((e) => e.type === "minusSign" ? "−" : e.value).join("");
736
+ }, Y = (e, t, n) => {
737
+ let r = J(e * t.scale, n);
738
+ return t.symbol ? `${r}\u202f${t.symbol}` : r;
739
+ }, rt = [
740
+ "N",
741
+ "V",
742
+ "M",
743
+ "w",
744
+ "dimensions",
745
+ "members",
746
+ "supports",
747
+ "loads",
748
+ "reactions",
749
+ "nodes",
750
+ "nodeLabels"
751
+ ], it = [
752
+ "N",
753
+ "V",
754
+ "M",
755
+ "w"
756
+ ], at = 7, ot = {
757
+ full: {
758
+ member: 3.5,
759
+ pointShaft: 3,
760
+ pointHead: 12,
761
+ pointHeadWidth: 14,
762
+ pointArrow: 52,
763
+ udlArrow: 32,
764
+ udlSpacing: 18,
765
+ reaction: 46,
766
+ reactionGap: 11,
767
+ arc: 15,
768
+ reactionArc: 20,
769
+ deformed: 2.25
770
+ },
771
+ compact: {
772
+ member: 2.75,
773
+ pointShaft: 2.25,
774
+ pointHead: 9,
775
+ pointHeadWidth: 10,
776
+ pointArrow: 34,
777
+ udlArrow: 22,
778
+ udlSpacing: 14,
779
+ reaction: 32,
780
+ reactionGap: 8,
781
+ arc: 11,
782
+ reactionArc: 15,
783
+ deformed: 1.75
784
+ }
785
+ }, st = {
786
+ N: "normal",
787
+ V: "shear",
788
+ M: "moment"
789
+ }, X = (e, t) => {
790
+ let n = Math.hypot(e, t);
791
+ return n > 0 ? {
792
+ x: e / n,
793
+ y: t / n
794
+ } : {
795
+ x: 0,
796
+ y: 0
797
+ };
798
+ }, Z = (e, t, n = 0, r = 0) => {
799
+ let i = Re(e, t);
800
+ return H(i.x, i.z, n, r);
801
+ }, ct = (e, t, n) => {
802
+ let r = U(e, t.x * n, t.y * n);
803
+ return Math.abs(t.x) > .85 ? {
804
+ at: r,
805
+ align: t.x > 0 ? "start" : "end",
806
+ baseline: "middle"
807
+ } : {
808
+ at: r,
809
+ align: Math.abs(t.x) < .25 ? "middle" : t.x > 0 ? "start" : "end",
810
+ baseline: t.y > 0 ? "top" : "bottom"
811
+ };
812
+ }, Q = (e, t, n, r, i, a, o) => ({
813
+ kind: "text",
814
+ group: e,
815
+ layer: V.label,
816
+ text: i,
817
+ tone: a,
818
+ priority: o,
819
+ ...ct(t, n, r)
820
+ }), lt = (e, t, n, r, i, a, o) => {
821
+ let s = X(r.x - n.x, r.y - n.y), c = o.headWidth / 2, l = {
822
+ x: r.x - s.x * o.head,
823
+ y: r.y - s.y * o.head
824
+ };
825
+ return [{
826
+ kind: "path",
827
+ group: e,
828
+ layer: a,
829
+ tone: i,
830
+ width: o.width,
831
+ dash: o.dash,
832
+ cap: "butt",
833
+ obstacle: o.obstacle,
834
+ segments: [{
835
+ op: "M",
836
+ p: U(t, n.x, n.y)
837
+ }, {
838
+ op: "L",
839
+ p: U(t, l.x + s.x, l.y + s.y)
840
+ }]
841
+ }, {
842
+ kind: "path",
843
+ group: e,
844
+ layer: a,
845
+ tone: i,
846
+ width: 0,
847
+ fill: "tone",
848
+ segments: [
849
+ {
850
+ op: "M",
851
+ p: U(t, r.x, r.y)
852
+ },
853
+ {
854
+ op: "L",
855
+ p: U(t, l.x - s.y * c, l.y + s.x * c)
856
+ },
857
+ {
858
+ op: "L",
859
+ p: U(t, l.x + s.y * c, l.y - s.x * c)
860
+ },
861
+ { op: "Z" }
862
+ ]
863
+ }];
864
+ }, ut = (e, t, n, r, i, a, o, s, c = 270) => {
865
+ 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) => ({
866
+ x: n * Math.cos(e),
867
+ y: n * Math.sin(e)
868
+ }), m = p(d), h = p(f), g = r ? {
869
+ x: Math.sin(f),
870
+ y: -Math.cos(f)
871
+ } : {
872
+ x: -Math.sin(f),
873
+ y: Math.cos(f)
874
+ }, _ = 3.5, v = {
875
+ x: h.x - g.x * 8 * .6,
876
+ y: h.y - g.y * 8 * .6
877
+ }, y = {
878
+ x: v.x + g.x * 8,
879
+ y: v.y + g.y * 8
880
+ };
881
+ return [{
882
+ kind: "path",
883
+ group: e,
884
+ layer: o,
885
+ tone: a,
886
+ width: 1.75,
887
+ dash: s,
888
+ cap: "butt",
889
+ obstacle: !0,
890
+ segments: [{
891
+ op: "M",
892
+ p: U(t, m.x, m.y)
893
+ }, {
894
+ op: "A",
895
+ r: n,
896
+ large: !0,
897
+ clockwise: !r,
898
+ center: t,
899
+ p: U(t, h.x, h.y)
900
+ }]
901
+ }, {
902
+ kind: "path",
903
+ group: e,
904
+ layer: o,
905
+ tone: a,
906
+ width: 0,
907
+ fill: "tone",
908
+ segments: [
909
+ {
910
+ op: "M",
911
+ p: U(t, y.x, y.y)
912
+ },
913
+ {
914
+ op: "L",
915
+ p: U(t, v.x - g.y * _, v.y + g.x * _)
916
+ },
917
+ {
918
+ op: "L",
919
+ p: U(t, v.x + g.y * _, v.y - g.x * _)
920
+ },
921
+ { op: "Z" }
922
+ ]
923
+ }];
924
+ }, dt = (e, t) => Array.from({ length: 8 }, (n, r) => {
925
+ let i = r * Math.PI / 4 - Math.PI / 4, a = {
926
+ x: Math.cos(i),
927
+ y: Math.sin(i)
928
+ };
929
+ return {
930
+ c: a,
931
+ 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)
932
+ };
933
+ }).sort((e, t) => t.score - e.score).map(({ c: e }) => e), ft = (e, t) => {
934
+ let n = t, r = -Infinity;
935
+ for (let i = 0; i < 8; i++) {
936
+ let a = i * Math.PI / 4 - Math.PI / 4, o = {
937
+ x: Math.cos(a),
938
+ y: Math.sin(a)
939
+ }, s = Math.min(2, ...e.map((e) => 1 - (o.x * e.x + o.y * e.y))) + .01 * (o.x * t.x + o.y * t.y);
940
+ s > r && (r = s, n = o);
941
+ }
942
+ return n;
943
+ }, pt = (e, t, n) => {
944
+ let r = Ke(e, t), i = Math.hypot(r.x, r.z);
945
+ return i > 1e-9 ? {
946
+ x: -r.x / i,
947
+ y: -r.z / i
948
+ } : n;
949
+ }, mt = (e, t) => {
950
+ let n = e.get(t);
951
+ if (!n) throw Error(`No frame for member ${t}`);
952
+ return n;
953
+ }, ht = (e, t, n) => e.members.map((e, r) => {
954
+ let i = mt(t, e.id);
955
+ return {
956
+ kind: "path",
957
+ group: "members",
958
+ layer: V.member,
959
+ tone: "ink",
960
+ width: n.member,
961
+ cap: "round",
962
+ obstacle: !0,
963
+ draw: r,
964
+ segments: [{
965
+ op: "M",
966
+ p: Z(i, 0)
967
+ }, {
968
+ op: "L",
969
+ p: Z(i, i.length)
970
+ }]
971
+ };
972
+ }), gt = (e, t, n) => {
973
+ let r = [], i = n.member + 1;
974
+ for (let n of e.nodes) {
975
+ let a = e.members.flatMap((e) => e.start === n.id ? [{
976
+ m: e,
977
+ end: 0
978
+ }] : e.end === n.id ? [{
979
+ m: e,
980
+ end: 1
981
+ }] : []), o = a.filter(({ m: e, end: t }) => e.hinges[t]);
982
+ if (o.length === 0) continue;
983
+ let s = (e) => ({
984
+ kind: "circle",
985
+ group: "members",
986
+ layer: V.hinge,
987
+ at: e,
988
+ r: i,
989
+ tone: "ink",
990
+ width: 1.75,
991
+ fill: "paper"
992
+ });
993
+ if (a.length - o.length <= 1) r.push(s(H(n.x, n.z)));
994
+ else for (let { m: e, end: n } of o) {
995
+ let a = mt(t, e.id), o = n === 0 ? 1 : -1, c = i * 2 + 1;
996
+ r.push(s(Z(a, n === 0 ? 0 : a.length, o * a.tx * c, o * a.tz * c)));
997
+ }
998
+ }
999
+ return r;
1000
+ }, _t = (e, t) => {
1001
+ let n = [];
1002
+ for (let r of e.nodes) {
1003
+ if (!t.has(r.id)) continue;
1004
+ let i = Xe(e, r), a = i.rotation * Math.PI / 180, o = Math.cos(a), s = Math.sin(a);
1005
+ for (let e of Ge(i.kind)) {
1006
+ let t = e.points.map(([e, t]) => H(r.x, r.z, e * o - t * s, e * s + t * o));
1007
+ n.push({
1008
+ kind: "path",
1009
+ group: "supports",
1010
+ layer: V.support,
1011
+ tone: "ink",
1012
+ width: e.weight === "bold" ? 2.25 : e.weight === "regular" ? 1.6 : 1,
1013
+ fill: e.fill,
1014
+ cap: "round",
1015
+ segments: [...t.map((e, t) => ({
1016
+ op: t === 0 ? "M" : "L",
1017
+ p: e
1018
+ })), ...e.closed ? [{ op: "Z" }] : []]
1019
+ });
1020
+ }
1021
+ }
1022
+ return n;
1023
+ }, vt = (e, t, n) => {
1024
+ let r = [];
1025
+ for (let i of e.nodes) if (t.has(i.id) && (n.has("nodes") && r.push({
1026
+ kind: "circle",
1027
+ group: "nodes",
1028
+ layer: V.hinge,
1029
+ at: H(i.x, i.z),
1030
+ r: 5,
1031
+ tone: "brand",
1032
+ width: 2,
1033
+ fill: "paper"
1034
+ }), n.has("nodeLabels"))) {
1035
+ let t = pt(e, i, {
1036
+ x: 0,
1037
+ y: -1
1038
+ }), [n, ...a] = dt([{
1039
+ x: -t.x,
1040
+ y: -t.y
1041
+ }, {
1042
+ x: 0,
1043
+ y: 1
1044
+ }], {
1045
+ x: -.7,
1046
+ y: -.7
1047
+ }).map((e) => ct(H(i.x, i.z), e, 9));
1048
+ r.push({
1049
+ kind: "text",
1050
+ group: "nodeLabels",
1051
+ layer: V.label,
1052
+ text: i.id,
1053
+ tone: "ink",
1054
+ priority: 9,
1055
+ weight: 600,
1056
+ ...n,
1057
+ alternatives: a.slice(0, 5)
1058
+ });
1059
+ }
1060
+ return r;
1061
+ }, yt = (e, t, n) => {
1062
+ let r = e.nodes.map((e) => e.x), i = e.nodes.map((e) => e.z), [a, o, s, c] = [
1063
+ Math.min(...r),
1064
+ Math.max(...r),
1065
+ Math.min(...i),
1066
+ Math.max(...i)
1067
+ ], l = [], u = (e, t) => ({
1068
+ kind: "path",
1069
+ group: "dimensions",
1070
+ layer: V.member,
1071
+ tone: "muted",
1072
+ width: 1,
1073
+ segments: [{
1074
+ op: "M",
1075
+ p: e
1076
+ }, {
1077
+ op: "L",
1078
+ p: t
1079
+ }]
1080
+ }), d = t.layers.has("reactions") ? 92 : 52, f = t.layers.has("reactions") ? 104 : 58;
1081
+ if (o - a > 1e-9) {
1082
+ l.push(u(H(a, c, 0, d), H(o, c, 0, d)));
1083
+ for (let e of [a, o]) l.push(u(H(e, c, 0, d - 8), H(e, c, 0, d + 8)));
1084
+ l.push({ ...Q("dimensions", H((a + o) / 2, c, 0, d), {
1085
+ x: 0,
1086
+ y: -1
1087
+ }, 5, n(o - a, t.units.length), "muted", 9) });
1088
+ }
1089
+ if (c - s > 1e-9) {
1090
+ l.push(u(H(o, s, f, 0), H(o, c, f, 0)));
1091
+ for (let e of [s, c]) l.push(u(H(o, e, f - 8, 0), H(o, e, f + 8, 0)));
1092
+ l.push(Q("dimensions", H(o, (s + c) / 2, f, 0), {
1093
+ x: 1,
1094
+ y: 0
1095
+ }, 8, n(c - s, t.units.length), "muted", 9));
1096
+ }
1097
+ return l;
1098
+ }, bt = (e, t, n, r) => r ? {
1099
+ x: t * e.tx + n * e.nx,
1100
+ y: t * e.tz + n * e.nz
1101
+ } : {
1102
+ x: t,
1103
+ y: n
1104
+ }, xt = 5, St = (e, t, n, r, i, a = !0) => {
1105
+ let o = bt(t, e.start.fx, e.start.fz, e.local), s = bt(t, e.end.fx, e.end.fz, e.local), c = Math.hypot(o.x, o.y), l = Math.hypot(s.x, s.y);
1106
+ if (c === 0 && l === 0) return [];
1107
+ 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 = [], _ = {
1108
+ width: 1.25,
1109
+ head: 6,
1110
+ headWidth: 6
1111
+ }, v = (e) => n.compact || !m ? i(Math.abs(e), n.units.distributed) : `q = ${i(Math.abs(e), n.units.distributed)}`;
1112
+ if (Math.abs(u.x * t.tz - u.y * t.tx) < .1) {
1113
+ let e = {
1114
+ x: -t.nx * 10,
1115
+ y: -t.nz * 10
1116
+ }, n = Math.max(1, Math.round(h / 30));
1117
+ for (let r = 0; r < n; r++) {
1118
+ let i = (r + .5) * t.length / n, a = d + (f - d) * i / t.length;
1119
+ if (Math.abs(a) < 1e-9 * p) continue;
1120
+ let o = Math.sign(a);
1121
+ g.push(...lt("loads", Z(t, i), {
1122
+ x: e.x - o * u.x * 8,
1123
+ y: e.y - o * u.y * 8
1124
+ }, {
1125
+ x: e.x + o * u.x * 8,
1126
+ y: e.y + o * u.y * 8
1127
+ }, "load", V.load, _));
1128
+ }
1129
+ return g.push(Q("loads", Z(t, t.length / 2, e.x, e.y), X(-t.nx, -t.nz), 8, v(p), "load", xt)), g;
1130
+ }
1131
+ let y = r.member / 2 + 2, b = (e) => r.udlArrow * e / p, ee = Math.max(2, Math.round(h / r.udlSpacing));
1132
+ for (let e = 0; e <= ee; e++) {
1133
+ let n = e * t.length / ee, r = b(d + (f - d) * e / ee);
1134
+ if (Math.abs(r) < y + 6) continue;
1135
+ let i = Math.sign(r);
1136
+ g.push(...lt("loads", Z(t, n), {
1137
+ x: -u.x * r,
1138
+ y: -u.y * r
1139
+ }, {
1140
+ x: -u.x * i * y,
1141
+ y: -u.y * i * y
1142
+ }, "load", V.load, _));
1143
+ }
1144
+ let te = (e, n) => Z(t, e, -u.x * b(n), -u.y * b(n));
1145
+ g.push({
1146
+ kind: "path",
1147
+ group: "loads",
1148
+ layer: V.load,
1149
+ tone: "load",
1150
+ width: 1.25,
1151
+ obstacle: !0,
1152
+ segments: [{
1153
+ op: "M",
1154
+ p: te(0, d)
1155
+ }, {
1156
+ op: "L",
1157
+ p: te(t.length, f)
1158
+ }]
1159
+ });
1160
+ let ne = X(-u.x, -u.y), re = t.tx >= 0 ? "start" : "end", x = t.tx >= 0 ? "end" : "start", S = m ? [[
1161
+ 0,
1162
+ d,
1163
+ re
1164
+ ]] : [[
1165
+ 0,
1166
+ d,
1167
+ re
1168
+ ], [
1169
+ t.length,
1170
+ f,
1171
+ x
1172
+ ]];
1173
+ for (let [e, t, n] of a ? S : []) {
1174
+ if (Math.abs(t) < 1e-9 * p) continue;
1175
+ let r = ct(te(e, t), Math.sign(t) >= 0 ? ne : {
1176
+ x: -ne.x,
1177
+ y: -ne.y
1178
+ }, 6);
1179
+ g.push({
1180
+ kind: "text",
1181
+ group: "loads",
1182
+ layer: V.label,
1183
+ text: v(t),
1184
+ tone: "load",
1185
+ priority: xt,
1186
+ ...r,
1187
+ align: r.baseline === "middle" ? r.align : n
1188
+ });
1189
+ }
1190
+ return g;
1191
+ }, Ct = (e, t, n, r, i) => {
1192
+ let a = X(t.x, t.y), o = {
1193
+ x: -a.x * i,
1194
+ y: -a.y * i
1195
+ }, s = {
1196
+ x: -a.x * (i + r.pointArrow),
1197
+ y: -a.y * (i + r.pointArrow)
1198
+ };
1199
+ return [...lt("loads", e, s, o, "load", V.load, {
1200
+ width: r.pointShaft,
1201
+ head: r.pointHead,
1202
+ headWidth: r.pointHeadWidth,
1203
+ obstacle: !0
1204
+ }), {
1205
+ ...Q("loads", U(e, s.x, s.y), {
1206
+ x: -a.x,
1207
+ y: -a.y
1208
+ }, 5, n, "load", xt),
1209
+ weight: 600
1210
+ }];
1211
+ }, wt = (e, t, n, r, i) => {
1212
+ let a = ft([n], {
1213
+ x: .7,
1214
+ y: -.7
1215
+ });
1216
+ return [...ut("loads", e, i.arc, t > 0, n, "load", V.load), Q("loads", U(e, a.x * i.arc, a.y * i.arc), a, 4, r, "load", xt)];
1217
+ }, Tt = (e, t, n, r) => {
1218
+ let i = [];
1219
+ if (e.uniform !== 0 && i.push(`ΔT = ${r(e.uniform, n.temperature)}`), e.gradient !== 0 && i.push(`ΔTb − ΔTt = ${r(e.gradient, n.temperature)}`), i.length === 0) return [];
1220
+ let a = Math.atan2(t.tz, t.tx) * 180 / Math.PI;
1221
+ a > 90 && (a -= 180), a <= -90 && (a += 180);
1222
+ let o = a * Math.PI / 180, s = {
1223
+ x: -Math.sin(o),
1224
+ y: Math.cos(o)
1225
+ }, c = [{
1226
+ kind: "text",
1227
+ group: "loads",
1228
+ layer: V.label,
1229
+ at: Z(t, t.length / 2, s.x * 9, s.y * 9),
1230
+ text: i.join(", "),
1231
+ tone: "load",
1232
+ align: "middle",
1233
+ baseline: "top",
1234
+ priority: xt,
1235
+ rotate: a
1236
+ }];
1237
+ if (e.gradient !== 0) {
1238
+ let n = -Math.sign(e.gradient) * 5;
1239
+ c.push({
1240
+ kind: "path",
1241
+ group: "loads",
1242
+ layer: V.load,
1243
+ tone: "load",
1244
+ width: 2,
1245
+ dash: "1 4",
1246
+ cap: "round",
1247
+ segments: [{
1248
+ op: "M",
1249
+ p: Z(t, 0, t.nx * -n, t.nz * -n)
1250
+ }, {
1251
+ op: "L",
1252
+ p: Z(t, t.length, t.nx * -n, t.nz * -n)
1253
+ }]
1254
+ });
1255
+ }
1256
+ return c;
1257
+ }, Et = (e, t, n, r, i, a) => {
1258
+ let o = [], s = H(t.x, t.z), c = Math.cos(t.angle), l = Math.sin(t.angle), u = e.dx ?? 0, d = e.dz ?? 0;
1259
+ if (u !== 0 || d !== 0) {
1260
+ let e = X(u * c - d * l, u * l + d * c), t = {
1261
+ x: -e.y,
1262
+ y: e.x
1263
+ }, i = t.x * n.x + t.y * n.y >= 0 ? 1 : -1, f = {
1264
+ x: t.x * i * 30,
1265
+ y: t.y * i * 30
1266
+ }, p = {
1267
+ x: f.x + e.x * 20,
1268
+ y: f.y + e.y * 20
1269
+ };
1270
+ o.push(...lt("loads", s, {
1271
+ x: f.x - e.x * 12,
1272
+ y: f.y - e.y * 12
1273
+ }, p, "load", V.load, {
1274
+ width: 1.5,
1275
+ head: 7,
1276
+ headWidth: 7,
1277
+ dash: "4 3"
1278
+ }), Q("loads", U(s, p.x, p.y), e, 4, a(Math.hypot(u, d), r.displacement), "load", xt));
1279
+ }
1280
+ if (e.ry) {
1281
+ let t = {
1282
+ x: -n.x,
1283
+ y: -n.y
1284
+ };
1285
+ o.push(...ut("loads", s, i.arc + 6, e.ry > 0, t, "load", V.load, "4 3"));
1286
+ let c = ft([t], {
1287
+ x: .7,
1288
+ y: -.7
1289
+ });
1290
+ o.push(Q("loads", U(s, c.x * (i.arc + 6), c.y * (i.arc + 6)), c, 4, a(Math.abs(e.ry), r.rotation), "load", xt));
1291
+ }
1292
+ return o;
1293
+ }, Dt = (e, t, n) => {
1294
+ let r = e.members.find((e) => e.id === n.member), i = t.get(n.member);
1295
+ if (!r || !i) return !1;
1296
+ let a = (e, t) => e.fx === t.fx && e.fz === t.fz;
1297
+ return e.loads.some((o) => {
1298
+ if (o === n || o.kind !== "distributed" || o.local !== n.local) return !1;
1299
+ let s = e.members.find((e) => e.id === o.member), c = t.get(o.member);
1300
+ 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);
1301
+ });
1302
+ }, Ot = (e, t, n, r, i) => {
1303
+ let a = q(e), o = [], { units: s } = n, c = r.member / 2 + 2;
1304
+ for (let l of e.loads) switch (l.kind) {
1305
+ case "nodalForce": {
1306
+ let e = a.get(l.node);
1307
+ if (e) {
1308
+ let t = i(Math.hypot(l.fx, l.fz), s.force);
1309
+ o.push(...Ct(H(e.x, e.z), {
1310
+ x: l.fx,
1311
+ y: l.fz
1312
+ }, t, r, c + 1));
1313
+ }
1314
+ break;
1315
+ }
1316
+ case "nodalMoment": {
1317
+ let t = a.get(l.node);
1318
+ if (t) {
1319
+ let n = pt(e, t, {
1320
+ x: 0,
1321
+ y: 1
1322
+ }), a = i(Math.abs(l.my), s.moment);
1323
+ o.push(...wt(H(t.x, t.z), l.my, {
1324
+ x: -n.x,
1325
+ y: -n.y
1326
+ }, a, r));
1327
+ }
1328
+ break;
1329
+ }
1330
+ case "distributed": {
1331
+ let a = t.get(l.member);
1332
+ a && o.push(...St(l, a, n, r, i, !Dt(e, t, l)));
1333
+ break;
1334
+ }
1335
+ case "pointForce": {
1336
+ let e = t.get(l.member);
1337
+ if (e) {
1338
+ let t = bt(e, l.fx, l.fz, l.local);
1339
+ o.push(...Ct(Z(e, l.at), t, i(Math.hypot(l.fx, l.fz), s.force), r, c));
1340
+ }
1341
+ break;
1342
+ }
1343
+ case "pointMoment": {
1344
+ let e = t.get(l.member);
1345
+ if (e) {
1346
+ let t = i(Math.abs(l.my), s.moment);
1347
+ o.push(...wt(Z(e, l.at), l.my, {
1348
+ x: e.nx,
1349
+ y: e.nz
1350
+ }, t, r));
1351
+ }
1352
+ break;
1353
+ }
1354
+ case "temperature": {
1355
+ let e = t.get(l.member);
1356
+ e && o.push(...Tt(l, e, s, i));
1357
+ break;
1358
+ }
1359
+ case "prescribed": {
1360
+ let t = a.get(l.node);
1361
+ t && o.push(...Et(l, t, pt(e, t, {
1362
+ x: 1,
1363
+ y: 0
1364
+ }), s, r, i));
1365
+ break;
1366
+ }
1367
+ }
1368
+ return o;
1369
+ }, kt = 5, At = (e, t, n, r, i) => {
1370
+ let a = [], o = q(e), s = /* @__PURE__ */ new Map();
1371
+ for (let e of t) e.value !== 0 && s.set(e.node, [...s.get(e.node) ?? [], e]);
1372
+ let c = {
1373
+ width: 1.75,
1374
+ head: 9,
1375
+ headWidth: 9,
1376
+ obstacle: !0
1377
+ };
1378
+ for (let [t, l] of s) {
1379
+ let s = o.get(t);
1380
+ if (!s) continue;
1381
+ let u = H(s.x, s.z), d = Xe(e, s), f = Je(d.rotation), p = {
1382
+ x: f.x,
1383
+ y: f.z
1384
+ }, m = {
1385
+ x: p.y,
1386
+ y: -p.x
1387
+ }, h = Ke(e, s), g = Math.hypot(h.x, h.z) > 1e-9 ? [X(h.x, h.z)] : [], _ = l.find((e) => e.dof === "ry"), v = r.reactionArc, y = Qe(d.kind, d.rotation, p.x, p.y), b = _ ? v + 8 : 0;
1388
+ for (let e of l) {
1389
+ if (e.dof === "ry") continue;
1390
+ let t = Math.cos(s.angle), o = Math.sin(s.angle), l = e.dof === "dx" ? {
1391
+ x: t,
1392
+ y: o
1393
+ } : {
1394
+ x: -o,
1395
+ y: t
1396
+ }, d = {
1397
+ x: l.x * e.value,
1398
+ y: l.y * e.value
1399
+ }, f = X(d.x, d.y), h = i(Math.abs(e.value), n.units.force);
1400
+ if (Math.abs(l.x * p.x + l.y * p.y) > .7) {
1401
+ let e = Math.max(y + r.reactionGap, b), t = e + r.reaction, n = {
1402
+ x: p.x * e,
1403
+ y: p.y * e
1404
+ }, i = {
1405
+ x: p.x * t,
1406
+ y: p.y * t
1407
+ }, o = f.x * p.x + f.y * p.y < 0;
1408
+ a.push(...lt("reactions", u, o ? i : n, o ? n : i, "reaction", V.reaction, c));
1409
+ let s = m.x >= 0 ? m : {
1410
+ x: -m.x,
1411
+ y: -m.y
1412
+ }, l = U(u, i.x - p.x * 6, i.y - p.y * 6);
1413
+ a.push({
1414
+ ...Q("reactions", l, s, 7, h, "reaction", kt),
1415
+ alternatives: [ct(l, {
1416
+ x: -s.x,
1417
+ y: -s.y
1418
+ }, 7)]
1419
+ }), g.push(p);
1420
+ } else {
1421
+ let e = Math.max(y + (n.compact ? 4 : 6), b), t = f.x * m.x + f.y * m.y > 0 ? -1 : 1, i = {
1422
+ x: p.x * e,
1423
+ y: p.y * e
1424
+ }, o = {
1425
+ x: i.x + m.x * t * (14 + r.reaction - 4),
1426
+ y: i.y + m.y * t * (14 + r.reaction - 4)
1427
+ }, s = {
1428
+ x: i.x + m.x * t * 14,
1429
+ y: i.y + m.y * t * 14
1430
+ };
1431
+ a.push(...lt("reactions", u, o, s, "reaction", V.reaction, c)), a.push(Q("reactions", U(u, o.x, o.y), X(o.x - s.x, o.y - s.y), 4, h, "reaction", kt)), g.push({
1432
+ x: m.x * t,
1433
+ y: m.y * t
1434
+ });
1435
+ }
1436
+ }
1437
+ if (_) {
1438
+ let e = g[0] ?? {
1439
+ x: 0,
1440
+ y: -1
1441
+ };
1442
+ a.push(...ut("reactions", u, v, _.value > 0, e, "reaction", V.reaction, void 0, 190));
1443
+ let t = ft(g, {
1444
+ x: .7,
1445
+ y: -.7
1446
+ });
1447
+ a.push(Q("reactions", U(u, t.x * v, t.y * v), t, 5, i(Math.abs(_.value), n.units.moment), "reaction", kt));
1448
+ }
1449
+ }
1450
+ return a;
1451
+ }, jt = (e, t) => e === "M" && t ? 1 : -1, Mt = (e, t, n, r) => R(t).map(([, t, i, a]) => ({
1452
+ op: "C",
1453
+ c1: Z(e, t[0], r.x * n * t[1], r.y * n * t[1]),
1454
+ c2: Z(e, i[0], r.x * n * i[1], r.y * n * i[1]),
1455
+ p: Z(e, a[0], r.x * n * a[1], r.y * n * a[1])
1456
+ })), Nt = (e, t, n, r, i, a, o, s) => {
1457
+ let c = [];
1458
+ n.forEach((e, n) => {
1459
+ let r = O(e, e.x0), o = Z(t, e.x0, a.x * i * r, a.y * i * r);
1460
+ n === 0 ? (c.push(s[0] ? {
1461
+ op: "M",
1462
+ p: Z(t, 0)
1463
+ } : {
1464
+ op: "M",
1465
+ p: o
1466
+ }), s[0] && c.push({
1467
+ op: "L",
1468
+ p: o
1469
+ })) : c.push({
1470
+ op: "L",
1471
+ p: o
1472
+ }), c.push(...Mt(t, e, i, a));
1473
+ }), s[1] && c.push({
1474
+ op: "L",
1475
+ p: Z(t, t.length)
1476
+ });
1477
+ let l = t.length * o, u = Math.floor(l / 7), d = (l - u * 7) / 2, f = [];
1478
+ for (let e = 0; e <= u; e++) {
1479
+ let r = (d + e * 7) / o, s = I(n, r);
1480
+ Math.abs(s * i) < 1.5 || f.push({
1481
+ op: "M",
1482
+ p: Z(t, r)
1483
+ }, {
1484
+ op: "L",
1485
+ p: Z(t, r, a.x * i * s, a.y * i * s)
1486
+ });
1487
+ }
1488
+ let p = [{
1489
+ kind: "path",
1490
+ group: e,
1491
+ layer: V.diagramLine,
1492
+ tone: r,
1493
+ width: 1.75,
1494
+ segments: c
1495
+ }];
1496
+ return f.length > 0 && p.push({
1497
+ kind: "path",
1498
+ group: e,
1499
+ layer: V.diagramHatch,
1500
+ tone: r,
1501
+ width: 1,
1502
+ opacity: .55,
1503
+ fitIgnore: !0,
1504
+ cap: "butt",
1505
+ segments: f
1506
+ }), p;
1507
+ }, Pt = (e, t, n, r = [
1508
+ 5,
1509
+ 11,
1510
+ 17
1511
+ ]) => r.flatMap((r) => {
1512
+ if (n === "horizontal") {
1513
+ let n = ct(e, t, r);
1514
+ return n.baseline === "middle" ? [
1515
+ n,
1516
+ {
1517
+ ...n,
1518
+ at: U(n.at, 0, 4),
1519
+ baseline: "top"
1520
+ },
1521
+ {
1522
+ ...n,
1523
+ at: U(n.at, 0, -4),
1524
+ baseline: "bottom"
1525
+ }
1526
+ ] : [
1527
+ n,
1528
+ {
1529
+ ...n,
1530
+ at: U(n.at, 4, 0),
1531
+ align: "start"
1532
+ },
1533
+ {
1534
+ ...n,
1535
+ at: U(n.at, -4, 0),
1536
+ align: "end"
1537
+ }
1538
+ ];
1539
+ }
1540
+ let i = Math.atan2(t.y, t.x) * 180 / Math.PI;
1541
+ Math.abs(Math.abs(i) - 90) < 1e-6 ? i = -90 : i > 90 ? i -= 180 : i <= -90 && (i += 180);
1542
+ let a = i * Math.PI / 180, o = Math.cos(a) * t.x + Math.sin(a) * t.y, s = {
1543
+ at: U(e, t.x * r, t.y * r),
1544
+ align: o < 0 ? "end" : "start",
1545
+ baseline: "middle",
1546
+ rotate: i
1547
+ }, c = {
1548
+ x: -Math.sin(a) * 4,
1549
+ y: Math.cos(a) * 4
1550
+ };
1551
+ return [
1552
+ s,
1553
+ {
1554
+ ...s,
1555
+ at: U(s.at, c.x, c.y),
1556
+ baseline: "top"
1557
+ },
1558
+ {
1559
+ ...s,
1560
+ at: U(s.at, -c.x, -c.y),
1561
+ baseline: "bottom"
1562
+ }
1563
+ ];
1564
+ }), Ft = (e, t, n, r, i, a, o) => {
1565
+ let s = r === "M" ? o.units.moment : o.units.force, c = st[r], l = o.resultLabelMode ?? "horizontal", u = Math.max(0, ...e.members.map((e) => M(n[e.id]?.[r] ?? [])));
1566
+ if (!(u > 0)) return [];
1567
+ let d = 1e-6 * u, f = (e, t) => Math.abs(e - t) <= 1e-4 * u, p = (e) => J(e * s.scale, o.numberFormat), m = (e) => 6 + Math.abs(e) / u, h = [], g = (e) => ({
1568
+ x: e.nx * a,
1569
+ y: e.nz * a
1570
+ }), _ = (e) => e.every((t) => (P(t) ?? 0) === 0 && f(O(t, t.x0), O(e[0], e[0].x0))), v = (e, t, n, i) => {
1571
+ let [a, ...o] = e;
1572
+ h.push({
1573
+ item: {
1574
+ kind: "text",
1575
+ group: r,
1576
+ layer: V.label,
1577
+ text: t,
1578
+ tone: c,
1579
+ priority: m(n),
1580
+ ...a,
1581
+ alternatives: o
1582
+ },
1583
+ members: i,
1584
+ magnitude: Math.abs(n)
1585
+ });
1586
+ };
1587
+ for (let a of e.nodes) {
1588
+ let o = e.members.flatMap((e) => {
1589
+ let o = n[e.id]?.[r], s = t.get(e.id);
1590
+ if (!o || o.length === 0 || !s || _(o)) return [];
1591
+ let c = e.start === a.id ? 0 : e.end === a.id ? 1 : -1;
1592
+ if (c === -1) return [];
1593
+ let l = c === 0 ? 0 : s.length, u = I(o, l, c === 0 ? "right" : "left");
1594
+ if (Math.abs(u) <= d) return [];
1595
+ let p = g(s), m = z(o);
1596
+ return [{
1597
+ m: e,
1598
+ f: s,
1599
+ v: u,
1600
+ extreme: !!m && (f(u, m.max.value) || f(u, m.min.value)),
1601
+ away: c === 0 ? {
1602
+ x: s.tx,
1603
+ y: s.tz
1604
+ } : {
1605
+ x: -s.tx,
1606
+ y: -s.tz
1607
+ },
1608
+ out: {
1609
+ x: p.x * Math.sign(u),
1610
+ y: p.y * Math.sign(u)
1611
+ },
1612
+ tip: Z(s, l, p.x * i * u, p.y * i * u)
1613
+ }];
1614
+ });
1615
+ if (o.length !== 0) {
1616
+ if (o.length >= 2 && o.every((e) => f(Math.abs(e.v), Math.abs(o[0].v)))) {
1617
+ 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) => Pt(e.tip, e.out, l)), r = t[0].v;
1618
+ v(n, p(r), r, o.map((e) => e.m.id));
1619
+ } else for (let e of o) !e.extreme && o.length < 2 || v(Pt(e.tip, e.out, l), p(e.v), e.v, [e.m.id]);
1620
+ }
1621
+ }
1622
+ for (let a of e.members) {
1623
+ let e = n[a.id]?.[r], o = t.get(a.id);
1624
+ if (!e || e.length === 0 || !o) continue;
1625
+ let s = g(o), c = (e, t) => Z(o, e, s.x * i * t, s.y * i * t), u = (e) => ({
1626
+ x: s.x * Math.sign(e),
1627
+ y: s.y * Math.sign(e)
1628
+ });
1629
+ if (_(e)) {
1630
+ let t = O(e[0], e[0].x0);
1631
+ Math.abs(t) > d && v(Pt(c(o.length / 2, t), u(t), l), p(t), t, [a.id]);
1632
+ } else {
1633
+ for (let t of ce(e)) {
1634
+ let n = I(e, t, "left"), r = I(e, t, "right");
1635
+ if (f(n, r)) Math.abs(n) > d && v(Pt(c(t, n), u(n), l), p(n), n, [a.id]);
1636
+ else for (let e of [n, r]) Math.abs(e) > d && v(Pt(c(t, e), u(e), l), p(e), e, [a.id]);
1637
+ }
1638
+ for (let t of e) for (let e of F(t)) {
1639
+ let n = O(t, e);
1640
+ Math.abs(n) > d && v(Pt(c(e, n), u(n), l), p(n), n, [a.id]);
1641
+ }
1642
+ }
1643
+ }
1644
+ return h;
1645
+ }, It = (e, t, n, r) => {
1646
+ let i = I(t, r === 0 ? 0 : e.length, r === 0 ? "right" : "left");
1647
+ return {
1648
+ x: e.nx * n * i,
1649
+ y: e.nz * n * i
1650
+ };
1651
+ }, Lt = (e, t, n, r, i, a, o) => {
1652
+ let s = o === 0 ? a.start : a.end, c = mt(t, a.id), l = It(c, n[a.id][r], i, o), u = Math.max(1e-30, ...e.members.map((e) => M(n[e.id]?.[r] ?? [])));
1653
+ return e.members.some((e) => {
1654
+ if (e.id === a.id || !n[e.id]) return !1;
1655
+ let o = e.start === s ? 0 : e.end === s ? 1 : -1;
1656
+ if (o === -1) return !1;
1657
+ let d = mt(t, e.id);
1658
+ if (Math.abs(c.tx * d.tx + c.tz * d.tz) < .999) return !1;
1659
+ let f = It(d, n[e.id][r], i, o);
1660
+ return Math.hypot(f.x - l.x, f.y - l.y) <= 1e-4 * u;
1661
+ });
1662
+ }, Rt = (e, t) => !e.loads.some((e) => "member" in e) && e.members.every((e) => (t[e.id]?.N ?? []).every((e) => (P(e) ?? 0) === 0)), zt = (e, t, n, r) => {
1663
+ let i = Math.max(0, ...e.members.map((e) => M(n[e.id]?.N ?? []))), a = r.units.force, o = (e) => J(e * a.scale, r.numberFormat), s = r.fontSize ?? 13, c = [.../* @__PURE__ */ new Set([
1664
+ s,
1665
+ Math.max(10, Math.min(s, 11)),
1666
+ Math.min(s, 10)
1667
+ ])], 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) => {
1668
+ let r = n[e.id]?.N, a = t.get(e.id);
1669
+ if (!r || r.length === 0 || !a) return [];
1670
+ let o = O(r[0], r[0].x0);
1671
+ return Math.abs(o) <= 1e-6 * i ? [] : [{
1672
+ m: e,
1673
+ f: a,
1674
+ v: o,
1675
+ mid: Re(a, a.length / 2)
1676
+ }];
1677
+ }), 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);
1678
+ return f.map(({ f: e, v: t }, n) => {
1679
+ let r = Math.atan2(e.tz, e.tx) * 180 / Math.PI;
1680
+ r > 90 && (r -= 180), r <= -90 && (r += 180);
1681
+ let a = r * Math.PI / 180, l = {
1682
+ x: Math.sin(a),
1683
+ y: -Math.cos(a)
1684
+ }, u = o(t), d = [.../* @__PURE__ */ new Set([u, o(t)])], m = [
1685
+ .5,
1686
+ .4,
1687
+ .6,
1688
+ .3,
1689
+ .7,
1690
+ .2,
1691
+ .8
1692
+ ], h = [];
1693
+ for (let t of d) for (let n of c) for (let r of [1, -1]) for (let i of m) h.push({
1694
+ at: Z(e, e.length * i, l.x * 3 * r, l.y * 3 * r),
1695
+ align: "middle",
1696
+ baseline: r > 0 ? "bottom" : "top",
1697
+ text: t,
1698
+ size: n === s ? void 0 : n
1699
+ });
1700
+ let [g, ..._] = h;
1701
+ return {
1702
+ kind: "text",
1703
+ group: "N",
1704
+ layer: V.label,
1705
+ tone: t > 0 ? "tension" : t < 0 ? "compression" : "normal",
1706
+ text: u,
1707
+ ...g,
1708
+ priority: (p(f[n], n) ? 5 : 7) + Math.abs(t) / i,
1709
+ rotate: r,
1710
+ alternatives: _
1711
+ };
1712
+ });
1713
+ }, Bt = (e, t) => {
1714
+ let n = /* @__PURE__ */ new Map();
1715
+ return [...e].sort((e, t) => t.magnitude - e.magnitude).filter((e) => {
1716
+ if (e.members.some((e) => (n.get(e) ?? 0) >= t)) return !1;
1717
+ for (let t of e.members) n.set(t, (n.get(t) ?? 0) + 1);
1718
+ return !0;
1719
+ });
1720
+ }, Vt = (e, t, n, r) => {
1721
+ let i = [], a = (t, r, i) => Z(e, t, n * (r * e.tx + i * e.nx), n * (r * e.tz + i * e.nz));
1722
+ return t.w.forEach((e, n) => {
1723
+ let r = t.u[n], o = Math.max(P(e) ?? 0, P(r) ?? 0), s = o <= 1 ? 1 : o <= 3 ? 2 : 6, c = (e.x1 - e.x0) / s;
1724
+ n === 0 && i.push({
1725
+ op: "M",
1726
+ p: a(e.x0, O(r, e.x0), O(e, e.x0))
1727
+ });
1728
+ for (let t = 0; t < s; t++) {
1729
+ let n = e.x0 + t * c, s = n + c, l = c / 3, [u, d, f, p] = [
1730
+ O(r, n),
1731
+ O(e, n),
1732
+ O(r, s),
1733
+ O(e, s)
1734
+ ];
1735
+ o <= 1 ? i.push({
1736
+ op: "L",
1737
+ p: a(s, f, p)
1738
+ }) : i.push({
1739
+ op: "C",
1740
+ c1: a(n + l, u + l * k(r, n), d + l * k(e, n)),
1741
+ c2: a(s - l, f - l * k(r, s), p - l * k(e, s)),
1742
+ p: a(s, f, p)
1743
+ });
1744
+ }
1745
+ }), {
1746
+ kind: "path",
1747
+ group: "w",
1748
+ layer: V.deformed,
1749
+ tone: "deformed",
1750
+ width: r,
1751
+ cap: "round",
1752
+ segments: i
1753
+ };
1754
+ }, Ht = (e, t, n) => {
1755
+ let r = null, i = 0;
1756
+ for (let a of e.members) {
1757
+ let e = n[a.id], o = t.get(a.id);
1758
+ if (e && o) for (let t of e.w) {
1759
+ let n = [
1760
+ t.x0,
1761
+ t.x1,
1762
+ ...F(t),
1763
+ ...Array.from({ length: 9 }, (e, n) => t.x0 + (n + 1) * (t.x1 - t.x0) / 10)
1764
+ ];
1765
+ for (let t of n) {
1766
+ let n = I(e.u, t), o = I(e.w, t);
1767
+ Math.hypot(n, o) > i && (i = Math.hypot(n, o), r = {
1768
+ member: a.id,
1769
+ x: t,
1770
+ u: n,
1771
+ w: o
1772
+ });
1773
+ }
1774
+ }
1775
+ }
1776
+ return r;
1777
+ }, Ut = (e, t) => {
1778
+ let n = Object.values(e.results?.members ?? {}), r = (e) => Math.max(0, ...n.map((t) => M(t[e]))), i = (e, n, r) => t.diagramScale?.[e] ?? (n > 0 ? r / n : 0);
1779
+ return {
1780
+ N: i("N", r("N"), t.diagramSize),
1781
+ V: i("V", r("V"), t.diagramSize),
1782
+ M: i("M", r("M"), t.diagramSize),
1783
+ w: i("w", Math.max(r("u"), r("w")), t.deformedSize)
1784
+ };
1785
+ }, Wt = (e) => {
1786
+ let t = q(e);
1787
+ return new Map(e.members.map((n) => [n.id, Le(e, n, t)]));
1788
+ }, Gt = (e) => {
1789
+ let t = e.results;
1790
+ if (!t) return null;
1791
+ let n = Object.values(t.members), r = (e) => Math.max(0, ...n.map((t) => M(t[e]))), [i, a, o] = [
1792
+ r("N"),
1793
+ r("V"),
1794
+ r("M")
1795
+ ];
1796
+ if (i === 0 && a === 0 && o === 0) return "w";
1797
+ if (e.members.length > 0 && e.members.every((e) => e.hinges[0] && e.hinges[1])) return "N";
1798
+ let s = Wt(e), c = [...s.values()].reduce((e, t) => e + t.length, 0) / Math.max(1, s.size);
1799
+ return !e.loads.some((e) => "member" in e) && o < .05 * i * c ? "N" : "M";
1800
+ }, Kt = (e, t) => {
1801
+ let n = Wt(e), r = new Set(e.members.flatMap((e) => [e.start, e.end])), i = (e, n) => Y(e, n, t.numberFormat), a = t.compact ? ot.compact : ot.full, { layers: o } = t, s = [], c = e.results;
1802
+ if (c) {
1803
+ let r = Ut(e, t);
1804
+ for (let i of [
1805
+ "N",
1806
+ "V",
1807
+ "M"
1808
+ ]) {
1809
+ if (!o.has(i) || !(r[i] > 0)) continue;
1810
+ if (i === "N" && Rt(e, c.members)) {
1811
+ s.push(...zt(e, n, c.members, t));
1812
+ continue;
1813
+ }
1814
+ let a = jt(i, t.momentOnTensionSide);
1815
+ for (let o of e.members) {
1816
+ let l = c.members[o.id], u = mt(n, o.id);
1817
+ if (l && l[i].some((e) => P(e) !== null)) {
1818
+ let d = {
1819
+ x: u.nx * a,
1820
+ y: u.nz * a
1821
+ }, f = [0, 1].map((t) => !Lt(e, n, c.members, i, a, o, t));
1822
+ s.push(...Nt(i, u, l[i], st[i], r[i], d, t.scale, f));
1823
+ }
1824
+ }
1825
+ let l = Ft(e, n, c.members, i, r[i], a, t);
1826
+ s.push(...(t.compact ? Bt(l, 2) : l).map((e) => e.item));
1827
+ }
1828
+ if (o.has("w") && r.w > 0) {
1829
+ for (let t of e.members) {
1830
+ let e = c.members[t.id];
1831
+ e && s.push(Vt(mt(n, t.id), e, r.w, a.deformed));
1832
+ }
1833
+ let i = Ht(e, n, c.members);
1834
+ if (i) {
1835
+ let e = mt(n, i.member), a = {
1836
+ x: i.u * e.tx + i.w * e.nx,
1837
+ y: i.u * e.tz + i.w * e.nz
1838
+ }, o = Z(e, i.x, r.w * a.x, r.w * a.y);
1839
+ s.push(Q("w", o, X(a.x, a.y), 5, J(Math.hypot(i.u, i.w) * t.units.displacement.scale, t.numberFormat), "deformed", 7));
1840
+ }
1841
+ }
1842
+ }
1843
+ return o.has("members") && s.push(...ht(e, n, a), ...gt(e, n, a)), o.has("supports") && s.push(..._t(e, r)), (o.has("nodes") || o.has("nodeLabels")) && s.push(...vt(e, r, o)), o.has("dimensions") && s.push(...yt(e, t, i)), o.has("loads") && s.push(...Ot(e, n, t, a, i)), o.has("reactions") && c && s.push(...At(e, c.reactions, t, a, i)), s;
1844
+ }, qt = (e, t, n = 0) => {
1845
+ let r = ce(e.V).find((e) => Math.abs(e - t) <= n) ?? t, i = (t) => ({
1846
+ left: I(e[t], r, "left"),
1847
+ right: I(e[t], r, "right")
1848
+ });
1849
+ return {
1850
+ x: r,
1851
+ values: {
1852
+ N: i("N"),
1853
+ V: i("V"),
1854
+ M: i("M"),
1855
+ w: i("w")
1856
+ }
1857
+ };
1858
+ }, Jt = (e, t, n, r, i) => {
1859
+ let a = e.results?.members;
1860
+ if (!a) return null;
1861
+ let o = q(e), s = null;
1862
+ for (let a of e.members) {
1863
+ let c = Le(e, a, o), [l, u] = W(t, H(c.x, c.z)), [d, f] = W(t, H(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);
1864
+ g <= i && (!s || g < s.d) && (s = {
1865
+ member: a.id,
1866
+ s: h,
1867
+ d: g,
1868
+ frame: c
1869
+ });
1870
+ }
1871
+ if (!s || !a[s.member]) return null;
1872
+ let c = 6 / t.s, l = s.frame, u = qt(a[s.member], s.s * l.length, c), [d, f] = W(t, H(l.x + l.tx * u.x, l.z + l.tz * u.x));
1873
+ return {
1874
+ member: s.member,
1875
+ x: u.x,
1876
+ px: d,
1877
+ py: f,
1878
+ values: u.values
1879
+ };
1880
+ }, Yt = {
1881
+ N: "N",
1882
+ V: "V",
1883
+ M: "M",
1884
+ w: "w"
1885
+ }, Xt = (e, t, n, r) => {
1886
+ let i = t === "M" ? n.moment : t === "w" ? n.displacement : n.force, { left: a, right: o } = e.values[t], s = J(a * i.scale, r) === J(o * i.scale, r) ? Y(o, i, r) : `${J(a * i.scale, r)} → ${Y(o, i, r)}`;
1887
+ return `${Yt[t]} = ${s}`;
1888
+ }, Zt = {
1889
+ ink: "var(--figure-ink, var(--ink, CanvasText))",
1890
+ paper: "var(--paper, Canvas)",
1891
+ muted: "var(--muted, GrayText)",
1892
+ brand: "var(--brand, #4f46e5)",
1893
+ normal: "var(--color-normal, #2222ff)",
1894
+ shear: "var(--color-shear, #00af00)",
1895
+ moment: "var(--color-moment, #ff2222)",
1896
+ deformed: "var(--figure-ink, var(--ink, CanvasText))",
1897
+ load: "var(--color-load, #ff8700)",
1898
+ reaction: "var(--color-reaction, #a020f0)",
1899
+ tension: "var(--color-tension, var(--color-moment, #ff2222))",
1900
+ compression: "var(--color-compression, var(--color-normal, #2222ff))"
1901
+ }, Qt = (e) => Object.fromEntries(Object.entries({
1902
+ ...Zt,
1903
+ ...e
1904
+ }).map(([e, t]) => [`--ebp-${e}`, t])), $t = ".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 .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}}", en = [
1905
+ "width",
1906
+ "height",
1907
+ "viewBox",
1908
+ "font-size",
1909
+ "aria-labelledby"
1910
+ ], tn = ["id"], nn = ["aria-hidden"], rn = [
1911
+ "d",
1912
+ "pathLength",
1913
+ "stroke",
1914
+ "stroke-width",
1915
+ "stroke-opacity",
1916
+ "stroke-dasharray",
1917
+ "stroke-linecap",
1918
+ "fill",
1919
+ "fill-opacity"
1920
+ ], an = [
1921
+ "cx",
1922
+ "cy",
1923
+ "r",
1924
+ "stroke",
1925
+ "stroke-width",
1926
+ "fill"
1927
+ ], on = ["aria-hidden"], sn = [
1928
+ "x",
1929
+ "y",
1930
+ "text-anchor",
1931
+ "transform",
1932
+ "fill",
1933
+ "font-weight",
1934
+ "font-size",
1935
+ "textContent"
1936
+ ], cn = {
1937
+ key: 0,
1938
+ class: "ebp-readout",
1939
+ "pointer-events": "none"
1940
+ }, ln = [
1941
+ "cx",
1942
+ "cy",
1943
+ "fill",
1944
+ "stroke"
1945
+ ], un = [
1946
+ "x",
1947
+ "y",
1948
+ "width",
1949
+ "height",
1950
+ "fill",
1951
+ "stroke"
1952
+ ], dn = [
1953
+ "x",
1954
+ "y",
1955
+ "fill",
1956
+ "textContent"
1957
+ ], fn = /* @__PURE__ */ s({
1958
+ __name: "StructurePlot",
1959
+ props: {
1960
+ solver: {},
1961
+ model: {},
1962
+ loadCase: { default: 0 },
1963
+ revision: { default: 0 },
1964
+ layers: {},
1965
+ reserve: {},
1966
+ compact: {
1967
+ type: Boolean,
1968
+ default: !1
1969
+ },
1970
+ units: {},
1971
+ numberFormat: {},
1972
+ colors: {},
1973
+ width: {},
1974
+ height: {},
1975
+ maxHeight: {},
1976
+ padding: { default: 6 },
1977
+ fontSize: {},
1978
+ diagramSize: {},
1979
+ deformedSize: {},
1980
+ diagramScale: {},
1981
+ momentOnTensionSide: {
1982
+ type: Boolean,
1983
+ default: !0
1984
+ },
1985
+ resultLabelMode: { default: "horizontal" },
1986
+ reserveLabelModes: {},
1987
+ animate: {
1988
+ type: Boolean,
1989
+ default: !0
1990
+ },
1991
+ hover: {
1992
+ type: Boolean,
1993
+ default: !1
1994
+ },
1995
+ title: {}
1996
+ },
1997
+ emits: ["readout"],
1998
+ setup(s, { emit: re }) {
1999
+ let x = s, S = re, ie = ee(), C = t(() => (x.revision, x.model ? x.model : x.solver ? Ce(y(x.solver), { loadCase: x.loadCase }) : {
2000
+ nodes: [],
2001
+ members: [],
2002
+ loads: []
2003
+ })), w = t(() => Gt(C.value)), T = t(() => {
2004
+ if (x.layers) return new Set(x.layers);
2005
+ let e = [
2006
+ "members",
2007
+ "supports",
2008
+ "loads",
2009
+ "reactions"
2010
+ ];
2011
+ return new Set(w.value ? [...e, w.value] : e);
2012
+ }), E = t(() => /* @__PURE__ */ new Set([...x.reserve ?? [], ...T.value])), D = m(null), ae = m(0), O;
2013
+ f(() => {
2014
+ D.value && typeof ResizeObserver < "u" && (O = new ResizeObserver(([e]) => {
2015
+ let t = Math.round(e.contentRect.width);
2016
+ t > 0 && (ae.value = t);
2017
+ }), O.observe(D.value));
2018
+ }), d(() => O?.disconnect());
2019
+ let k = t(() => ae.value || x.width || (x.compact ? 400 : 640)), A = t(() => x.fontSize ?? (x.compact ? 11.5 : 13)), j = t(() => ({
2020
+ layers: E.value,
2021
+ compact: x.compact,
2022
+ units: tt(x.units),
2023
+ numberFormat: x.numberFormat ?? nt,
2024
+ diagramSize: x.diagramSize ?? (x.compact ? 26 : 48),
2025
+ deformedSize: x.deformedSize ?? (x.compact ? 18 : 30),
2026
+ diagramScale: x.diagramScale,
2027
+ momentOnTensionSide: x.momentOnTensionSide,
2028
+ resultLabelMode: x.resultLabelMode,
2029
+ fontSize: A.value
2030
+ })), M = t(() => {
2031
+ let e = {
2032
+ width: k.value,
2033
+ height: x.height,
2034
+ maxHeight: x.maxHeight ?? (x.compact ? void 0 : Math.max(320, k.value * .75)),
2035
+ padding: x.padding,
2036
+ fontSize: A.value
2037
+ }, t = (e, t = x.resultLabelMode) => Kt(C.value, {
2038
+ ...j.value,
2039
+ resultLabelMode: t,
2040
+ scale: e
2041
+ }), n = (n) => {
2042
+ let r = t(1, n), i = Fe(r, je(r, e), { fontSize: A.value });
2043
+ return r.flatMap((e) => {
2044
+ if (e.kind !== "text") return [e];
2045
+ let t = i.get(e);
2046
+ return t ? [t] : [];
2047
+ });
2048
+ }, r = je([.../* @__PURE__ */ new Set([x.resultLabelMode, ...x.reserveLabelModes ?? []])].flatMap(n), e), i = t(r.s);
2049
+ return {
2050
+ fit: r,
2051
+ items: i,
2052
+ resolved: Ie(i, r, {
2053
+ fontSize: A.value,
2054
+ viewport: r
2055
+ })
2056
+ };
2057
+ }), N = t(() => rt.filter((e) => E.value.has(e)).map((e) => ({
2058
+ layer: e,
2059
+ on: T.value.has(e),
2060
+ paths: M.value.resolved.paths.filter((t) => t.group === e),
2061
+ circles: M.value.resolved.circles.filter((t) => t.group === e),
2062
+ texts: M.value.resolved.texts.filter((t) => t.group === e)
2063
+ }))), P = (e) => `var(--ebp-${e})`, oe = t(() => Qt(x.colors)), F = t(() => {
2064
+ if (x.title) return x.title;
2065
+ let e = {
2066
+ N: "normal force",
2067
+ V: "shear force",
2068
+ M: "bending moment",
2069
+ w: "deformed shape",
2070
+ reactions: "reactions",
2071
+ loads: "loads"
2072
+ }, t = [...T.value].flatMap((t) => e[t] ? [e[t]] : []);
2073
+ return t.length > 0 ? `Structure with its ${t.join(", ")}` : "Structure";
2074
+ }), I = m(null), L = m(null), se = (e) => {
2075
+ let t = L.value?.getBoundingClientRect();
2076
+ if (!t || t.width === 0) return;
2077
+ let n = (e.clientX - t.left) / t.width * M.value.fit.width, r = (e.clientY - t.top) / t.height * M.value.fit.height;
2078
+ I.value = Jt(C.value, M.value.fit, n, r, 18);
2079
+ }, ce = () => I.value = null;
2080
+ te(I, (e) => S("readout", e));
2081
+ let R = t(() => {
2082
+ let e = I.value;
2083
+ if (!e) return null;
2084
+ let t = j.value.units, n = [
2085
+ "N",
2086
+ "V",
2087
+ "M"
2088
+ ].filter((e) => T.value.has(e)).map((n) => ({
2089
+ tone: {
2090
+ N: "normal",
2091
+ V: "shear",
2092
+ M: "moment"
2093
+ }[n],
2094
+ text: Xt(e, n, t, j.value.numberFormat)
2095
+ }));
2096
+ if (T.value.has("w") && n.push({
2097
+ tone: "deformed",
2098
+ text: Xt(e, "w", t, j.value.numberFormat)
2099
+ }), n.length === 0) return null;
2100
+ let r = Math.max(...n.map((e) => we(e.text, A.value))) * 1.08 + 16, i = n.length * (A.value + 5) + 8;
2101
+ return {
2102
+ x: e.px + 14 + r < M.value.fit.width ? e.px + 14 : e.px - 14 - r,
2103
+ y: Math.min(Math.max(4, e.py - i - 10), M.value.fit.height - i - 4),
2104
+ w: r,
2105
+ h: i,
2106
+ lines: n
2107
+ };
2108
+ });
2109
+ return (t, d) => (p(), i("div", {
2110
+ ref_key: "root",
2111
+ ref: D,
2112
+ class: "ebp",
2113
+ style: u(oe.value)
2114
+ }, [(p(), i("svg", c({
2115
+ ref_key: "svg",
2116
+ ref: L,
2117
+ class: ["ebp-svg", {
2118
+ "ebp-animate": s.animate,
2119
+ "ebp-compact": s.compact
2120
+ }],
2121
+ width: M.value.fit.width,
2122
+ height: M.value.fit.height,
2123
+ viewBox: `0 0 ${M.value.fit.width} ${M.value.fit.height}`,
2124
+ "font-size": A.value,
2125
+ role: "img",
2126
+ "aria-labelledby": b(ie),
2127
+ style: s.hover ? { touchAction: "pan-y pinch-zoom" } : void 0
2128
+ }, v(s.hover ? {
2129
+ pointermove: se,
2130
+ pointerdown: se,
2131
+ pointerleave: ce
2132
+ } : {}, !0)), [
2133
+ a("title", { id: b(ie) }, _(F.value), 9, tn),
2134
+ (p(), n(g("style"), null, {
2135
+ default: ne(() => [o(_(b($t)), 1)]),
2136
+ _: 1
2137
+ })),
2138
+ (p(!0), i(e, null, h(N.value, (t) => (p(), i("g", {
2139
+ key: t.layer,
2140
+ class: l(["ebp-layer", [`ebp-layer-${t.layer}`, { "ebp-on": t.on }]]),
2141
+ "aria-hidden": t.on ? void 0 : "true"
2142
+ }, [(p(!0), i(e, null, h(t.paths, (e, t) => (p(), i("path", {
2143
+ key: t,
2144
+ d: e.d,
2145
+ class: l({ "ebp-draw": e.draw !== void 0 }),
2146
+ pathLength: e.draw === void 0 ? void 0 : 1,
2147
+ style: u(e.draw === void 0 ? void 0 : { transitionDelay: `${e.draw * 140}ms` }),
2148
+ stroke: e.width > 0 ? P(e.tone) : "none",
2149
+ "stroke-width": e.width > 0 ? e.width : void 0,
2150
+ "stroke-opacity": e.opacity,
2151
+ "stroke-dasharray": e.dash,
2152
+ "stroke-linecap": e.cap ?? "round",
2153
+ "stroke-linejoin": "round",
2154
+ fill: e.fill === "tone" ? P(e.tone) : e.fill === "paper" ? P("paper") : "none",
2155
+ "fill-opacity": e.fillOpacity
2156
+ }, null, 14, rn))), 128)), (p(!0), i(e, null, h(t.circles, (e, t) => (p(), i("circle", {
2157
+ key: `c${t}`,
2158
+ cx: e.cx,
2159
+ cy: e.cy,
2160
+ r: e.r,
2161
+ stroke: P(e.tone),
2162
+ "stroke-width": e.width,
2163
+ fill: e.fill === "paper" ? P("paper") : P(e.tone)
2164
+ }, null, 8, an))), 128))], 10, nn))), 128)),
2165
+ (p(!0), i(e, null, h(N.value, (t) => (p(), i("g", {
2166
+ key: `t-${t.layer}`,
2167
+ class: l(["ebp-layer ebp-labels", [`ebp-layer-${t.layer}`, { "ebp-on": t.on }]]),
2168
+ "aria-hidden": t.on ? void 0 : "true"
2169
+ }, [(p(!0), i(e, null, h(t.texts, (e, t) => (p(), i("text", {
2170
+ key: t,
2171
+ x: e.x,
2172
+ y: e.y,
2173
+ "text-anchor": e.anchor,
2174
+ transform: e.transform,
2175
+ fill: P(e.tone),
2176
+ "font-weight": e.weight,
2177
+ "font-size": e.size,
2178
+ textContent: _(e.text)
2179
+ }, null, 8, sn))), 128))], 10, on))), 128)),
2180
+ R.value && I.value ? (p(), i("g", cn, [
2181
+ a("circle", {
2182
+ cx: I.value.px,
2183
+ cy: I.value.py,
2184
+ r: "4",
2185
+ fill: P("ink"),
2186
+ stroke: P("paper"),
2187
+ "stroke-width": "1.5"
2188
+ }, null, 8, ln),
2189
+ a("rect", {
2190
+ x: R.value.x,
2191
+ y: R.value.y,
2192
+ width: R.value.w,
2193
+ height: R.value.h,
2194
+ rx: "5",
2195
+ fill: P("paper"),
2196
+ stroke: P("muted"),
2197
+ "stroke-opacity": "0.5"
2198
+ }, null, 8, un),
2199
+ (p(!0), i(e, null, h(R.value.lines, (e, t) => (p(), i("text", {
2200
+ key: t,
2201
+ x: R.value.x + 8,
2202
+ y: R.value.y + 4 + (t + 1) * (A.value + 5) - 4,
2203
+ fill: P(e.tone),
2204
+ "font-weight": "600",
2205
+ textContent: _(e.text)
2206
+ }, null, 8, dn))), 128))
2207
+ ])) : r("", !0)
2208
+ ], 16, en))], 4));
2209
+ }
2210
+ }), pn = (e, t) => {
2211
+ let n = q(e), r = t ? t.map((t) => e.members.find((e) => e.id === t)) : [...e.members];
2212
+ if (r.length === 0) throw Error("A diagram stack needs at least one member");
2213
+ let i = r.map((t) => {
2214
+ if (!t) throw Error("A diagram stack names a member that does not exist");
2215
+ let r = Le(e, t, n);
2216
+ 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`);
2217
+ return {
2218
+ m: t,
2219
+ f: r
2220
+ };
2221
+ });
2222
+ i.sort((e, t) => e.f.x - t.f.x);
2223
+ 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;
2224
+ for (let { m: e, f: t } of i) {
2225
+ 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`);
2226
+ c = t.x + t.length;
2227
+ }
2228
+ let l = /* @__PURE__ */ new Map();
2229
+ for (let { m: e, f: t } of i) l.set(e.start, t.x - a), l.set(e.end, t.x + t.length - a);
2230
+ return {
2231
+ members: i.map(({ m: e, f: t }) => ({
2232
+ id: e.id,
2233
+ offset: t.x - a,
2234
+ length: t.length
2235
+ })),
2236
+ x0: a,
2237
+ z: o,
2238
+ length: c - a,
2239
+ nodes: [...l].map(([e, t]) => ({
2240
+ id: e,
2241
+ at: t
2242
+ })).sort((e, t) => e.at - t.at)
2243
+ };
2244
+ }, mn = (e, t, n) => {
2245
+ let r = e.results?.members ?? {};
2246
+ return t.members.flatMap((e) => (r[e.id]?.[n] ?? []).map((t) => ({
2247
+ x0: t.x0 + e.offset,
2248
+ x1: t.x1 + e.offset,
2249
+ c: t.c
2250
+ })));
2251
+ }, hn = (e, t, n) => {
2252
+ 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);
2253
+ return {
2254
+ nodes: e.nodes.filter((e) => i.has(e.id)),
2255
+ members: e.members.filter((e) => r.has(e.id)),
2256
+ loads: e.loads.filter((e) => e !== n && a(e)),
2257
+ results: e.results && {
2258
+ members: e.results.members,
2259
+ reactions: e.results.reactions.filter((e) => i.has(e.node))
2260
+ }
2261
+ };
2262
+ }, gn = (e, t, n) => {
2263
+ let r = 1e-6 * Math.max(1, t.length);
2264
+ return e.loads.find((e) => {
2265
+ if (e.kind === "pointForce") {
2266
+ let i = t.members.find((t) => t.id === e.member);
2267
+ return !!i && Math.abs(i.offset + e.at - n) <= r;
2268
+ }
2269
+ if (e.kind === "nodalForce") {
2270
+ let i = t.nodes.find((t) => t.id === e.node);
2271
+ return !!i && Math.abs(i.at - n) <= r;
2272
+ }
2273
+ return !1;
2274
+ });
2275
+ }, $ = (e) => Math.round(e * 10) / 10, _n = (e, t, n, r) => {
2276
+ if (e.length === 0) return "";
2277
+ let i = [];
2278
+ return e.forEach((e, a) => {
2279
+ let o = `${$(t(e.x0))},${$(n(O(e, e.x0)))}`;
2280
+ a === 0 ? i.push(r ? `M${$(t(e.x0))},${$(n(0))}L${o}` : `M${o}`) : i.push(`L${o}`);
2281
+ for (let [, r, a, o] of R(e)) i.push(`C${$(t(r[0]))},${$(n(r[1]))} ${$(t(a[0]))},${$(n(a[1]))} ${$(t(o[0]))},${$(n(o[1]))}`);
2282
+ }), r && i.push(`L${$(t(e[e.length - 1].x1))},${$(n(0))}Z`), i.join("");
2283
+ }, vn = (e, t, n, r) => {
2284
+ if (e.length === 0) return "";
2285
+ 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 = [];
2286
+ for (let t = 0; t <= o; t++) {
2287
+ let a = s + t * r, o = I(e, e[0].x0 + (a - i) * c), u = n(0), d = n(o);
2288
+ Math.abs(d - u) >= 1.5 && l.push(`M${$(a)},${$(u)}V${$(d)}`);
2289
+ }
2290
+ return l.join("");
2291
+ }, yn = (e) => {
2292
+ let t = z(e);
2293
+ return t ? [Math.min(0, t.min.value), Math.max(0, t.max.value)] : [0, 0];
2294
+ }, bn = (e) => {
2295
+ let t = z(e);
2296
+ if (!t) return [];
2297
+ let n = M(e), r = [];
2298
+ return t.max.value > .02 * n && r.push({
2299
+ ...t.max,
2300
+ kind: "max"
2301
+ }), t.min.value < -.02 * n && r.push({
2302
+ ...t.min,
2303
+ kind: "min"
2304
+ }), r;
2305
+ }, xn = (e) => ce(e), Sn = [
2306
+ "width",
2307
+ "height",
2308
+ "viewBox",
2309
+ "font-size",
2310
+ "aria-labelledby"
2311
+ ], Cn = ["id"], wn = {
2312
+ class: "ebp-math",
2313
+ "font-size": "15"
2314
+ }, Tn = [
2315
+ "x",
2316
+ "y",
2317
+ "fill",
2318
+ "opacity"
2319
+ ], En = { class: "ebp-var" }, Dn = { key: 0 }, On = [
2320
+ "d",
2321
+ "stroke",
2322
+ "stroke-width",
2323
+ "stroke-opacity",
2324
+ "stroke-dasharray",
2325
+ "stroke-linecap",
2326
+ "fill"
2327
+ ], kn = [
2328
+ "cx",
2329
+ "cy",
2330
+ "r",
2331
+ "stroke",
2332
+ "stroke-width",
2333
+ "fill"
2334
+ ], An = [
2335
+ "x1",
2336
+ "x2",
2337
+ "y1",
2338
+ "y2",
2339
+ "stroke"
2340
+ ], jn = [
2341
+ "x1",
2342
+ "x2",
2343
+ "y1",
2344
+ "y2",
2345
+ "stroke",
2346
+ "stroke-dasharray"
2347
+ ], Mn = ["d", "stroke"], Nn = [
2348
+ "d",
2349
+ "stroke",
2350
+ "stroke-width"
2351
+ ], Pn = { key: 2 }, Fn = [
2352
+ "x",
2353
+ "y",
2354
+ "text-anchor",
2355
+ "transform",
2356
+ "fill",
2357
+ "font-weight",
2358
+ "textContent"
2359
+ ], In = [
2360
+ "x",
2361
+ "y",
2362
+ "fill",
2363
+ "textContent"
2364
+ ], Ln = [
2365
+ "aria-label",
2366
+ "aria-valuemax",
2367
+ "aria-valuenow",
2368
+ "aria-valuetext"
2369
+ ], Rn = ["x", "y"], zn = [
2370
+ "x1",
2371
+ "x2",
2372
+ "y1",
2373
+ "y2",
2374
+ "stroke"
2375
+ ], Bn = ["d", "fill"], Vn = [
2376
+ "cx",
2377
+ "cy",
2378
+ "fill"
2379
+ ], Hn = [
2380
+ "cx",
2381
+ "cy",
2382
+ "stroke"
2383
+ ], Un = [
2384
+ "x",
2385
+ "y",
2386
+ "text-anchor",
2387
+ "fill",
2388
+ "textContent"
2389
+ ], Wn = {
2390
+ key: 4,
2391
+ "pointer-events": "none",
2392
+ "font-weight": "600"
2393
+ }, Gn = [
2394
+ "x1",
2395
+ "x2",
2396
+ "y1",
2397
+ "y2",
2398
+ "stroke"
2399
+ ], Kn = [
2400
+ "x",
2401
+ "y",
2402
+ "fill"
2403
+ ], qn = [
2404
+ "cx",
2405
+ "cy",
2406
+ "fill",
2407
+ "stroke"
2408
+ ], Jn = [
2409
+ "x",
2410
+ "y",
2411
+ "width",
2412
+ "fill",
2413
+ "stroke"
2414
+ ], Yn = [
2415
+ "x",
2416
+ "y",
2417
+ "fill",
2418
+ "textContent"
2419
+ ], Xn = 20, Zn = 8, Qn = /* @__PURE__ */ s({
2420
+ __name: "DiagramStack",
2421
+ props: {
2422
+ solver: {},
2423
+ model: {},
2424
+ loadCase: { default: 0 },
2425
+ revision: { default: 0 },
2426
+ members: {},
2427
+ rows: { default: () => [
2428
+ "V",
2429
+ "M",
2430
+ "w"
2431
+ ] },
2432
+ loadRow: {
2433
+ type: Boolean,
2434
+ default: !0
2435
+ },
2436
+ ranges: {},
2437
+ rowHeights: {},
2438
+ maxHeight: {},
2439
+ units: {},
2440
+ numberFormat: {},
2441
+ colors: {},
2442
+ width: {},
2443
+ fontSize: {},
2444
+ hover: {
2445
+ type: Boolean,
2446
+ default: !0
2447
+ },
2448
+ loadAt: {},
2449
+ loadLabel: {},
2450
+ loadStep: { default: .05 },
2451
+ title: {}
2452
+ },
2453
+ emits: ["update:loadAt", "readout"],
2454
+ setup(s, { emit: re }) {
2455
+ let x = s, S = re, ie = ee(), C = t(() => (x.revision, x.model ? x.model : x.solver ? Ce(y(x.solver), { loadCase: x.loadCase }) : {
2456
+ nodes: [],
2457
+ members: [],
2458
+ loads: []
2459
+ })), w = t(() => pn(C.value, x.members)), T = t(() => tt(x.units)), E = t(() => x.numberFormat ?? nt), D = t(() => x.fontSize ?? 12.5), ae = m(null), O = m(0), k;
2460
+ f(() => {
2461
+ ae.value && typeof ResizeObserver < "u" && (k = new ResizeObserver(([e]) => {
2462
+ let t = Math.round(e.contentRect.width);
2463
+ t > 0 && (O.value = t);
2464
+ }), k.observe(ae.value));
2465
+ }), d(() => k?.disconnect());
2466
+ let A = t(() => Math.max(320, O.value || x.width || 720)), j = t(() => A.value < 560), M = t(() => j.value ? 52 : 60), N = t(() => A.value - M.value - Xn), P = (e) => M.value + e / w.value.length * N.value, oe = (e) => (e - M.value) / N.value * w.value.length, F = t(() => x.loadAt === void 0 ? void 0 : gn(C.value, w.value, x.loadAt)), L = t(() => {
2467
+ if (!x.loadRow) return null;
2468
+ let e = hn(C.value, w.value, F.value), t = /* @__PURE__ */ new Set([
2469
+ "members",
2470
+ "supports",
2471
+ "loads",
2472
+ "reactions"
2473
+ ]), n = N.value / w.value.length, r = Kt(e, {
2474
+ layers: t,
2475
+ compact: j.value,
2476
+ units: T.value,
2477
+ numberFormat: E.value,
2478
+ scale: n,
2479
+ diagramSize: 0,
2480
+ deformedSize: 0,
2481
+ momentOnTensionSide: !0
2482
+ }), i = Ae(r, n, D.value), a = 28 + Math.max(-(i.minY - n * w.value.z), F.value ? 92 : 0), o = {
2483
+ s: n,
2484
+ tx: M.value - n * w.value.x0,
2485
+ ty: a - n * w.value.z
2486
+ };
2487
+ return {
2488
+ beamY: a,
2489
+ bottom: a + (i.maxY - n * w.value.z) + 6,
2490
+ resolved: Ie(r, o, {
2491
+ fontSize: D.value,
2492
+ viewport: {
2493
+ width: A.value,
2494
+ height: 1e5
2495
+ }
2496
+ })
2497
+ };
2498
+ }), se = {
2499
+ N: "normal",
2500
+ V: "shear",
2501
+ M: "moment",
2502
+ w: "deformed"
2503
+ }, ce = {
2504
+ N: !0,
2505
+ V: !0,
2506
+ M: !1,
2507
+ w: !1
2508
+ }, R = (e) => e === "M" ? T.value.moment : e === "w" ? T.value.displacement : T.value.force, z = t(() => {
2509
+ let e = j.value ? {
2510
+ N: 88,
2511
+ V: 96,
2512
+ M: 104,
2513
+ w: 64
2514
+ } : {
2515
+ N: 100,
2516
+ V: 116,
2517
+ M: 128,
2518
+ w: 76
2519
+ }, t = j.value ? 22 : 26, n = L.value ? L.value.bottom + t : 30, r = x.rows.map((t) => x.rowHeights?.[t] ?? e[t]), i = r.reduce((e, t) => e + t, 0), a = x.maxHeight === void 0 ? Infinity : x.maxHeight - n - t * (x.rows.length - 1) - 14, o = Math.min(1, Math.max(.6, a / i)), s = n;
2520
+ return x.rows.map((e, n) => {
2521
+ let i = Math.round(r[n] * o), a = mn(C.value, w.value, e), [c, l] = x.ranges?.[e] ?? yn(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 = bn(a).map((t) => {
2522
+ let n = m(t.value), r = d ? t.value < 0 : t.value > 0, i = Y(t.value, R(e), E.value), a = we(i, D.value), o = Math.min(Math.max(P(t.x), M.value + a / 2), A.value - Xn - a / 2), s = n - 7, c = n + D.value + 3, l = n + D.value * .35;
2523
+ return {
2524
+ text: i,
2525
+ width: a,
2526
+ places: [
2527
+ {
2528
+ x: o,
2529
+ y: r ? c : s
2530
+ },
2531
+ {
2532
+ x: Math.min(o + a / 2 + 10, A.value - Xn - a / 2),
2533
+ y: l
2534
+ },
2535
+ {
2536
+ x: Math.max(o - a / 2 - 10, M.value + a / 2),
2537
+ y: l
2538
+ },
2539
+ {
2540
+ x: o,
2541
+ y: r ? s : c
2542
+ }
2543
+ ]
2544
+ };
2545
+ }), _ = {
2546
+ row: e,
2547
+ tone: h,
2548
+ top: s,
2549
+ height: i,
2550
+ axis: f,
2551
+ sy: m,
2552
+ pw: a,
2553
+ outline: _n(a, P, m, e !== "w"),
2554
+ ordinates: e === "w" ? "" : vn(a, P, m, 7),
2555
+ peaks: g
2556
+ };
2557
+ return s += i + t, _;
2558
+ });
2559
+ }), le = t(() => {
2560
+ let e = D.value, t = [];
2561
+ return z.value.map((n) => n.peaks.flatMap((r) => {
2562
+ for (let i of r.places) {
2563
+ let a = {
2564
+ x0: i.x - r.width / 2 - 2,
2565
+ x1: i.x + r.width / 2 + 2,
2566
+ y0: i.y - e,
2567
+ y1: i.y + 3
2568
+ };
2569
+ if (!t.some((e) => a.x0 < e.x1 && e.x0 < a.x1 && a.y0 < e.y1 && e.y0 < a.y1)) return t.push(a), [{
2570
+ ...i,
2571
+ text: r.text,
2572
+ tone: n.tone
2573
+ }];
2574
+ }
2575
+ return [];
2576
+ }));
2577
+ }), ue = t(() => {
2578
+ let e = z.value[z.value.length - 1], t = Math.max(0, ...(le.value[le.value.length - 1] ?? []).map((e) => e.y + 6));
2579
+ return Math.ceil(e ? Math.max(e.top + e.height + 14, t) : (L.value?.bottom ?? 0) + 8);
2580
+ }), de = {
2581
+ N: "N",
2582
+ V: "V",
2583
+ M: "M",
2584
+ w: "w"
2585
+ }, fe = m(null), pe = t(() => [...new Set(x.rows.flatMap((e) => xn(mn(C.value, w.value, e))))]), B = t(() => {
2586
+ let e = fe.value;
2587
+ if (e === null) return null;
2588
+ let t = pe.value.find((t) => Math.abs(P(t) - P(e)) < Zn) ?? e;
2589
+ return {
2590
+ x: t,
2591
+ values: Object.fromEntries(z.value.map((e) => [e.row, {
2592
+ left: I(e.pw, t, "left"),
2593
+ right: I(e.pw, t, "right")
2594
+ }]))
2595
+ };
2596
+ });
2597
+ te(B, (e) => S("readout", e));
2598
+ let me = t(() => {
2599
+ let e = B.value;
2600
+ if (!e) return [];
2601
+ let t = e.x < w.value.length * .7;
2602
+ return z.value.map((n) => {
2603
+ let r = e.values[n.row] ?? {
2604
+ left: 0,
2605
+ right: 0
2606
+ }, i = R(n.row), a = J(r.left * i.scale, E.value) === J(r.right * i.scale, E.value), o = a ? Y(r.right, i, E.value) : `${J(r.left * i.scale, E.value)} → ${Y(r.right, i, E.value)}`, s = a ? [n.sy(r.right)] : [n.sy(r.left), n.sy(r.right)], c = we(o, D.value) * 1.12 + 16, l = t ? P(e.x) + 8 : P(e.x) - 8 - c;
2607
+ return {
2608
+ key: n.row,
2609
+ tone: n.tone,
2610
+ ys: s,
2611
+ text: o,
2612
+ width: c,
2613
+ left: l,
2614
+ top: Math.min(...s) - 30
2615
+ };
2616
+ });
2617
+ }), he = m(null), ge = m(!1), _e = (e) => Math.min(w.value.length, Math.max(0, Math.round(e / x.loadStep) * x.loadStep)), ve = (e) => {
2618
+ let t = he.value?.getBoundingClientRect();
2619
+ return !t || !(t.width > 0) || !(t.height > 0) ? null : {
2620
+ x: oe((e.clientX - t.left) / t.width * A.value),
2621
+ y: (e.clientY - t.top) / t.height * ue.value
2622
+ };
2623
+ }, ye = (e) => {
2624
+ let t = ve(e);
2625
+ t && x.loadAt !== void 0 && L.value && (t.y > L.value.bottom + 6 || (ge.value = !0, e.currentTarget instanceof Element && e.currentTarget.setPointerCapture?.(e.pointerId), S("update:loadAt", _e(t.x))));
2626
+ }, be = (e) => {
2627
+ let t = ve(e);
2628
+ t && (ge.value ? S("update:loadAt", _e(t.x)) : x.hover && (fe.value = t.x >= 0 && t.x <= w.value.length ? t.x : null));
2629
+ }, xe = () => ge.value = !1, Se = () => fe.value = null, V = (e) => {
2630
+ if (x.loadAt === void 0) return;
2631
+ let t = x.loadStep, n = {
2632
+ ArrowLeft: -t,
2633
+ ArrowDown: -t,
2634
+ ArrowRight: t,
2635
+ ArrowUp: t,
2636
+ PageDown: -1,
2637
+ PageUp: 1
2638
+ }[e.key];
2639
+ if (n !== void 0) S("update:loadAt", _e(x.loadAt + n));
2640
+ else if (e.key === "Home") S("update:loadAt", 0);
2641
+ else if (e.key === "End") S("update:loadAt", w.value.length);
2642
+ else return;
2643
+ e.preventDefault();
2644
+ }, H = t(() => x.hover || x.loadAt !== void 0), U = t(() => H.value ? {
2645
+ pointerdown: ye,
2646
+ pointermove: be,
2647
+ pointerup: xe,
2648
+ pointercancel: xe,
2649
+ pointerleave: Se
2650
+ } : {}), W = t(() => {
2651
+ if (x.loadAt === void 0 || !L.value) return null;
2652
+ let e = F.value, t = e && (e.kind === "pointForce" || e.kind === "nodalForce") ? Math.hypot(e.fx, e.fz) : 0, n = P(x.loadAt), r = x.loadAt > w.value.length - w.value.length * .15;
2653
+ return {
2654
+ x: n,
2655
+ y: L.value.beamY,
2656
+ text: x.loadLabel ?? `P = ${Y(t, T.value.force, E.value)}`,
2657
+ nearEnd: r
2658
+ };
2659
+ }), G = (e) => `var(--ebp-${e})`, Te = t(() => Qt(x.colors)), Ee = t(() => x.title ?? `A beam with its loads${x.rows.length ? `, and its ${x.rows.map((e) => ({
2660
+ N: "normal force",
2661
+ V: "shear force",
2662
+ M: "bending moment",
2663
+ w: "deflection"
2664
+ })[e]).join(", ")} beneath` : ""}`), De = t(() => {
2665
+ let e = z.value[z.value.length - 1];
2666
+ return e ? e.top + e.height : ue.value;
2667
+ });
2668
+ return (t, d) => (p(), i("div", {
2669
+ ref_key: "root",
2670
+ ref: ae,
2671
+ class: "ebp ebp-stack",
2672
+ style: u(Te.value)
2673
+ }, [(p(), i("svg", c({
2674
+ ref_key: "svg",
2675
+ ref: he,
2676
+ class: "ebp-svg",
2677
+ width: A.value,
2678
+ height: ue.value,
2679
+ viewBox: `0 0 ${A.value} ${ue.value}`,
2680
+ "font-size": D.value,
2681
+ role: "group",
2682
+ "aria-labelledby": b(ie),
2683
+ style: H.value ? { touchAction: "pan-y pinch-zoom" } : void 0
2684
+ }, v(U.value, !0)), [
2685
+ a("title", { id: b(ie) }, _(Ee.value), 9, Cn),
2686
+ (p(), n(g("style"), null, {
2687
+ default: ne(() => [o(_(b($t)), 1)]),
2688
+ _: 1
2689
+ })),
2690
+ a("g", wn, [(p(!0), i(e, null, h(z.value, (e) => (p(), i("text", {
2691
+ key: e.row,
2692
+ x: M.value - 12,
2693
+ y: e.axis + 5,
2694
+ "text-anchor": "end",
2695
+ fill: G(e.tone),
2696
+ opacity: e.row === "w" ? .7 : void 0
2697
+ }, [
2698
+ a("tspan", En, _(de[e.row]), 1),
2699
+ d[0] ||= a("tspan", null, "(", -1),
2700
+ d[1] ||= a("tspan", { class: "ebp-var" }, "x", -1),
2701
+ d[2] ||= a("tspan", null, ")", -1)
2702
+ ], 8, Tn))), 128))]),
2703
+ L.value ? (p(), i("g", Dn, [(p(!0), i(e, null, h(L.value.resolved.paths, (e, t) => (p(), i("path", {
2704
+ key: t,
2705
+ d: e.d,
2706
+ stroke: e.width > 0 ? G(e.tone) : "none",
2707
+ "stroke-width": e.width > 0 ? e.width : void 0,
2708
+ "stroke-opacity": e.opacity,
2709
+ "stroke-dasharray": e.dash,
2710
+ "stroke-linecap": e.cap ?? "round",
2711
+ "stroke-linejoin": "round",
2712
+ fill: e.fill === "tone" ? G(e.tone) : e.fill === "paper" ? G("paper") : "none"
2713
+ }, null, 8, On))), 128)), (p(!0), i(e, null, h(L.value.resolved.circles, (e, t) => (p(), i("circle", {
2714
+ key: `c${t}`,
2715
+ cx: e.cx,
2716
+ cy: e.cy,
2717
+ r: e.r,
2718
+ stroke: G(e.tone),
2719
+ "stroke-width": e.width,
2720
+ fill: G("paper")
2721
+ }, null, 8, kn))), 128))])) : r("", !0),
2722
+ W.value && z.value.length ? (p(), i("line", {
2723
+ key: 1,
2724
+ x1: W.value.x,
2725
+ x2: W.value.x,
2726
+ y1: W.value.y,
2727
+ y2: De.value,
2728
+ stroke: G("brand"),
2729
+ "stroke-dasharray": "3 4",
2730
+ opacity: "0.45"
2731
+ }, null, 8, An)) : r("", !0),
2732
+ (p(!0), i(e, null, h(z.value, (e) => (p(), i("g", { key: e.row }, [
2733
+ a("line", {
2734
+ x1: P(0),
2735
+ x2: P(w.value.length),
2736
+ y1: e.axis,
2737
+ y2: e.axis,
2738
+ stroke: G("muted"),
2739
+ "stroke-opacity": "0.45",
2740
+ "stroke-dasharray": e.row === "w" ? "4 4" : void 0
2741
+ }, null, 8, jn),
2742
+ e.ordinates ? (p(), i("path", {
2743
+ key: 0,
2744
+ d: e.ordinates,
2745
+ stroke: G(e.tone),
2746
+ "stroke-width": "1",
2747
+ "stroke-opacity": "0.55"
2748
+ }, null, 8, Mn)) : r("", !0),
2749
+ a("path", {
2750
+ d: e.outline,
2751
+ fill: "none",
2752
+ stroke: G(e.tone),
2753
+ "stroke-width": e.row === "w" ? 2.25 : 1.75,
2754
+ "stroke-linejoin": "round",
2755
+ "stroke-linecap": "round"
2756
+ }, null, 8, Nn)
2757
+ ]))), 128)),
2758
+ L.value ? (p(), i("g", Pn, [(p(!0), i(e, null, h(L.value.resolved.texts, (e, t) => (p(), i("text", {
2759
+ key: t,
2760
+ x: e.x,
2761
+ y: e.y,
2762
+ "text-anchor": e.anchor,
2763
+ transform: e.transform,
2764
+ fill: G(e.tone),
2765
+ "font-weight": e.weight,
2766
+ textContent: _(e.text)
2767
+ }, null, 8, Fn))), 128))])) : r("", !0),
2768
+ (p(!0), i(e, null, h(le.value, (t, n) => (p(), i("g", { key: `l-${n}` }, [(p(!0), i(e, null, h(t, (e, t) => (p(), i("text", {
2769
+ key: t,
2770
+ x: e.x,
2771
+ y: e.y,
2772
+ "text-anchor": "middle",
2773
+ fill: G(e.tone),
2774
+ textContent: _(e.text)
2775
+ }, null, 8, In))), 128))]))), 128)),
2776
+ W.value ? (p(), i("g", {
2777
+ key: 3,
2778
+ class: l(["ebp-handle", { "ebp-dragging": ge.value }]),
2779
+ tabindex: "0",
2780
+ role: "slider",
2781
+ "aria-label": `Position of the load ${W.value.text}`,
2782
+ "aria-valuemin": 0,
2783
+ "aria-valuemax": w.value.length,
2784
+ "aria-valuenow": s.loadAt,
2785
+ "aria-valuetext": `${b(J)(s.loadAt ?? 0)} m from the start of the beam`,
2786
+ onKeydown: V
2787
+ }, [
2788
+ a("rect", {
2789
+ x: W.value.x - 22,
2790
+ y: W.value.y - 92,
2791
+ width: "44",
2792
+ height: "86",
2793
+ fill: "transparent"
2794
+ }, null, 8, Rn),
2795
+ a("line", {
2796
+ x1: W.value.x,
2797
+ x2: W.value.x,
2798
+ y1: W.value.y - 74,
2799
+ y2: W.value.y - 13,
2800
+ stroke: G("brand"),
2801
+ "stroke-width": "3"
2802
+ }, null, 8, zn),
2803
+ a("path", {
2804
+ d: `M${W.value.x - 7},${W.value.y - 14}L${W.value.x + 7},${W.value.y - 14}L${W.value.x},${W.value.y - 2}Z`,
2805
+ fill: G("brand")
2806
+ }, null, 8, Bn),
2807
+ a("circle", {
2808
+ class: "ebp-grip",
2809
+ cx: W.value.x,
2810
+ cy: W.value.y - 80,
2811
+ r: "9",
2812
+ fill: G("brand")
2813
+ }, null, 8, Vn),
2814
+ a("circle", {
2815
+ class: "ebp-focus-ring",
2816
+ cx: W.value.x,
2817
+ cy: W.value.y - 80,
2818
+ r: "16",
2819
+ fill: "none",
2820
+ stroke: G("ink"),
2821
+ "stroke-width": "2"
2822
+ }, null, 8, Hn),
2823
+ a("text", {
2824
+ x: W.value.x + (W.value.nearEnd ? -22 : 22),
2825
+ y: W.value.y - 76,
2826
+ "text-anchor": W.value.nearEnd ? "end" : "start",
2827
+ fill: G("brand"),
2828
+ "font-weight": "600",
2829
+ textContent: _(W.value.text)
2830
+ }, null, 8, Un)
2831
+ ], 42, Ln)) : r("", !0),
2832
+ B.value && !ge.value && z.value.length ? (p(), i("g", Wn, [
2833
+ a("line", {
2834
+ x1: P(B.value.x),
2835
+ x2: P(B.value.x),
2836
+ y1: z.value[0].top - 14,
2837
+ y2: De.value,
2838
+ stroke: G("ink"),
2839
+ "stroke-opacity": "0.3"
2840
+ }, null, 8, Gn),
2841
+ a("text", {
2842
+ x: P(B.value.x),
2843
+ y: z.value[0].top - 20,
2844
+ "text-anchor": "middle",
2845
+ fill: G("ink")
2846
+ }, [d[3] ||= a("tspan", { class: "ebp-math" }, [a("tspan", { class: "ebp-var" }, "x")], -1), o(" = " + _(b(Y)(B.value.x, T.value.length, E.value)), 1)], 8, Kn),
2847
+ (p(!0), i(e, null, h(me.value, (t) => (p(), i("g", { key: t.key }, [
2848
+ (p(!0), i(e, null, h(t.ys, (e, n) => (p(), i("circle", {
2849
+ key: n,
2850
+ cx: P(B.value.x),
2851
+ cy: e,
2852
+ r: "4",
2853
+ fill: G(t.tone),
2854
+ stroke: G("paper"),
2855
+ "stroke-width": "1.5"
2856
+ }, null, 8, qn))), 128)),
2857
+ a("rect", {
2858
+ x: t.left,
2859
+ y: t.top,
2860
+ width: t.width,
2861
+ height: "21",
2862
+ rx: "5",
2863
+ fill: G("paper"),
2864
+ stroke: G(t.tone),
2865
+ "stroke-opacity": "0.5"
2866
+ }, null, 8, Jn),
2867
+ a("text", {
2868
+ x: t.left + 7,
2869
+ y: t.top + 15,
2870
+ fill: G(t.tone),
2871
+ class: "ebp-pill",
2872
+ textContent: _(t.text)
2873
+ }, null, 8, Yn)
2874
+ ]))), 128))
2875
+ ])) : r("", !0)
2876
+ ], 16, Sn))], 4));
2877
+ }
2878
+ }), $n = { install(e) {
2879
+ e.component("StructurePlot", fn), e.component("DiagramStack", Qn);
2880
+ } };
2881
+ export { Zt as DEFAULT_COLORS, nt as DEFAULT_NUMBER_FORMAT, Qn as DiagramStack, $n as EduBeamPlot, at as HATCH_SPACING_PX, et as KN_UNITS, $t as PLOT_CSS, rt as PLOT_LAYERS, it as RESULT_LAYERS, $e as SI_UNITS, fn as StructurePlot, pn as beamLine, Kt as buildStructureScene, N as cleanPiecewise, Gt as defaultResultLayer, Ut as diagramScales, jt as diagramSide, O as evalPiece, k as evalPieceSlope, z as extremes, j as fitPiece, je as fitScene, J as formatNumber, Y as formatQuantity, Xt as formatReadout, Qe as glyphReach, ce as innerBreaks, oe as isZero, mn as lineDiagram, hn as lineModel, M as maxAbs, Le as memberFrame, Wt as memberFrames, Ce as modelFromSolver, q as nodeMap, P as pieceDegree, F as pieceExtrema, R as pieceToBeziers, Fe as placeLabels, Re as pointAlong, gn as pointLoadAt, W as project, qt as readMember, Jt as readoutAt, Ie as resolveScene, tt as resolveUnits, xn as rowBreaks, vn as rowOrdinates, _n as rowOutline, bn as rowPeaks, yn as rowRange, Ae as sceneBounds, L as slopeAt, Ge as supportGlyph, ze as supportKind, Xe as supportPlacement, Pt as tipPlacements, Qt as toneVars, I as valueAt };
2882
+
2883
+ //# sourceMappingURL=index.js.map