flight-indicators 1.2.2 → 1.2.4

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.cjs CHANGED
@@ -16,38 +16,63 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
20
20
 
21
21
  // src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
+ AMMETER_SCALE: () => AMMETER_SCALE,
24
25
  AdfIndicator: () => AdfIndicator,
25
26
  Airspeed: () => Airspeed,
26
27
  Altimeter: () => Altimeter,
28
+ AnnunciatorPanel: () => AnnunciatorPanel,
27
29
  AoaIndicator: () => AoaIndicator,
28
30
  AttitudeIndicator: () => AttitudeIndicator,
31
+ DEFAULT_ANNUNCIATORS: () => DEFAULT_ANNUNCIATORS,
29
32
  DEFAULT_BAR_GAUGES: () => DEFAULT_BAR_GAUGES,
30
33
  DEFAULT_MANIFOLD: () => DEFAULT_MANIFOLD,
31
34
  DEFAULT_RPM: () => DEFAULT_RPM,
32
35
  DataPanel: () => DataPanel,
36
+ DigitalClock: () => DigitalClock,
37
+ DualGauge: () => DualGauge,
38
+ EGT_SCALE: () => EGT_SCALE,
39
+ EgtFuelFlowGauge: () => EgtFuelFlowGauge,
33
40
  EngineIndicator: () => EngineIndicator,
41
+ FUEL_FLOW_SCALE: () => FUEL_FLOW_SCALE,
42
+ FUEL_QUANTITY_SCALE: () => FUEL_QUANTITY_SCALE,
34
43
  FlapIndicator: () => FlapIndicator,
35
44
  FuelIndicator: () => FuelIndicator,
45
+ FuelQuantityGauge: () => FuelQuantityGauge,
46
+ HOLD_TIME: () => HOLD_TIME,
36
47
  HeadingIndicator: () => HeadingIndicator,
48
+ HobbsMeter: () => HobbsMeter,
49
+ HsiIndicator: () => HsiIndicator,
37
50
  IlsIndicator: () => IlsIndicator,
51
+ MANIFOLD_SCALE: () => MANIFOLD_SCALE,
38
52
  MAX_BAR_GAUGES: () => MAX_BAR_GAUGES,
39
53
  MAX_CYLINDERS: () => MAX_CYLINDERS,
40
54
  MAX_FIELDS: () => MAX_FIELDS,
41
55
  MAX_TANKS: () => MAX_TANKS,
56
+ MagneticCompass: () => MagneticCompass,
57
+ ManifoldFuelFlowGauge: () => ManifoldFuelFlowGauge,
58
+ OIL_PRESSURE_SCALE: () => OIL_PRESSURE_SCALE,
59
+ OIL_TEMPERATURE_SCALE: () => OIL_TEMPERATURE_SCALE,
60
+ OilGauge: () => OilGauge,
42
61
  RadioPanel: () => RadioPanel,
43
62
  RadioStack: () => RadioStack,
63
+ Tachometer: () => Tachometer,
64
+ TrimIndicator: () => TrimIndicator,
44
65
  TurnCoordinator: () => TurnCoordinator,
66
+ VACUUM_SCALE: () => VACUUM_SCALE,
67
+ VacuumAmmeterGauge: () => VacuumAmmeterGauge,
45
68
  VerticalSpeed: () => VerticalSpeed,
46
69
  VorIndicator: () => VorIndicator,
47
70
  WindIndicator: () => WindIndicator,
71
+ drumPositions: () => drumPositions,
48
72
  formatAdf: () => formatAdf,
49
73
  formatDme: () => formatDme,
50
74
  formatNav: () => formatNav,
75
+ formatTimer: () => formatTimer,
51
76
  formatValue: () => formatValue,
52
77
  parseAdf: () => parseAdf,
53
78
  parseNav: () => parseNav,
@@ -67,16 +92,16 @@ function polar(r, deg2, cx = CENTER, cy = CENTER) {
67
92
  const a = deg2 * Math.PI / 180;
68
93
  return [round(cx + r * Math.sin(a)), round(cy - r * Math.cos(a))];
69
94
  }
70
- function arcPath(r, startDeg, endDeg) {
71
- const [x1, y1] = polar(r, startDeg);
72
- const [x2, y2] = polar(r, endDeg);
95
+ function arcPath(r, startDeg, endDeg, cx = CENTER, cy = CENTER) {
96
+ const [x1, y1] = polar(r, startDeg, cx, cy);
97
+ const [x2, y2] = polar(r, endDeg, cx, cy);
73
98
  const largeArc = Math.abs(endDeg - startDeg) > 180 ? 1 : 0;
74
99
  const sweep = endDeg >= startDeg ? 1 : 0;
75
100
  return `M ${x1} ${y1} A ${r} ${r} 0 ${largeArc} ${sweep} ${x2} ${y2}`;
76
101
  }
77
- function tickPath(r1, r2, deg2) {
78
- const [x1, y1] = polar(r1, deg2);
79
- const [x2, y2] = polar(r2, deg2);
102
+ function tickPath(r1, r2, deg2, cx = CENTER, cy = CENTER) {
103
+ const [x1, y1] = polar(r1, deg2, cx, cy);
104
+ const [x2, y2] = polar(r2, deg2, cx, cy);
80
105
  return `M ${x1} ${y1} L ${x2} ${y2}`;
81
106
  }
82
107
  function range(start, end, step) {
@@ -110,6 +135,47 @@ function useSvgId(prefix) {
110
135
 
111
136
  // src/components/Instrument.tsx
112
137
  var import_jsx_runtime = require("react/jsx-runtime");
138
+ var KNOB_PLACES = {
139
+ "bottom-left": [46, 354, 30],
140
+ "bottom-right": [354, 354, 30],
141
+ bottom: [CENTER, 376, 17]
142
+ };
143
+ function Knob({ id, label: label2, position, angle = 0, animationDuration = DEFAULT_ANIMATION_MS }) {
144
+ const [cx, cy, r] = KNOB_PLACES[position];
145
+ const display2 = useContinuousAngle(angle);
146
+ const step = 360 / 28;
147
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { "data-testid": `knob-${id}`, children: [
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx, cy: cy + 2, r: r + 2, fill: "#000", opacity: "0.55" }),
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { "data-testid": `knob-${id}-rim`, style: motionStyle(`rotate(${display2}deg)`, animationDuration, cx, cy), children: [
150
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx, cy, r, fill: "#2e2e2e", stroke: "#000", strokeWidth: "2" }),
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { stroke: "#111", strokeWidth: r > 20 ? 3 : 2, children: range(0, 360 - step, step).map((a) => {
152
+ const rad = a * Math.PI / 180;
153
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
154
+ "path",
155
+ {
156
+ d: `M ${cx + (r - 5) * Math.sin(rad)} ${cy - (r - 5) * Math.cos(rad)} L ${cx + r * Math.sin(rad)} ${cy - r * Math.cos(rad)}`
157
+ },
158
+ a
159
+ );
160
+ }) }),
161
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: `M ${cx} ${cy - r + 1} v ${r * 0.22}`, stroke: "#ddd", strokeWidth: "2", strokeLinecap: "round" })
162
+ ] }),
163
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx, cy, r: r * 0.72, fill: "#1f1f1f", stroke: "#cfcfcf", strokeWidth: r > 20 ? 2 : 1.5 }),
164
+ label2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
165
+ "text",
166
+ {
167
+ x: cx,
168
+ y: cy,
169
+ fill: "#eee",
170
+ fontSize: Math.min(13, r * 1.15 / Math.max(1, label2.length * 0.6)),
171
+ fontWeight: "bold",
172
+ textAnchor: "middle",
173
+ dominantBaseline: "central",
174
+ children: label2
175
+ }
176
+ )
177
+ ] });
178
+ }
113
179
  var SCREWS = [
114
180
  [32, 32],
115
181
  [368, 32],
@@ -119,10 +185,14 @@ var SCREWS = [
119
185
  function InstrumentFrame({
120
186
  size = 200,
121
187
  showBox = true,
188
+ showKnobs = true,
189
+ knobs,
190
+ animationDuration,
122
191
  className,
123
192
  style,
124
193
  title,
125
194
  label: label2,
195
+ role = "img",
126
196
  children
127
197
  }) {
128
198
  const titleId = useSvgId("fi-title");
@@ -134,7 +204,7 @@ function InstrumentFrame({
134
204
  viewBox: "0 0 400 400",
135
205
  width: size,
136
206
  height: size,
137
- role: "img",
207
+ role,
138
208
  "aria-labelledby": titleId,
139
209
  className,
140
210
  style: { display: "inline-block", userSelect: "none", ...style },
@@ -154,7 +224,8 @@ function InstrumentFrame({
154
224
  ] }),
155
225
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: CENTER, cy: CENTER, r: "196", fill: `url(#${bezelId})` }),
156
226
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: CENTER, cy: CENTER, r: "182", fill: "#111", stroke: "#000", strokeWidth: "4" }),
157
- children
227
+ children,
228
+ showKnobs && knobs?.map((k) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Knob, { ...k, animationDuration }, k.id))
158
229
  ]
159
230
  }
160
231
  );
@@ -162,6 +233,34 @@ function InstrumentFrame({
162
233
  function Hub({ r = 14 }) {
163
234
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: CENTER, cy: CENTER, r, fill: "#2a2a2a", stroke: "#555", strokeWidth: "2" });
164
235
  }
236
+ function PanelFrame({ size = 200, showBox = true, className, style, title, label: label2, width, height, children }) {
237
+ const titleId = useSvgId("fi-title");
238
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
239
+ "svg",
240
+ {
241
+ xmlns: "http://www.w3.org/2000/svg",
242
+ viewBox: `0 0 ${width} ${height}`,
243
+ width: size,
244
+ height: typeof size === "number" ? Math.round(size * height / width * 100) / 100 : void 0,
245
+ role: "img",
246
+ "aria-labelledby": titleId,
247
+ className,
248
+ style: { display: "inline-block", userSelect: "none", aspectRatio: `${width} / ${height}`, ...style },
249
+ fontFamily: "'Helvetica Neue', Arial, sans-serif",
250
+ children: [
251
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { id: titleId, children: title ?? label2 }),
252
+ showBox && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { children: [
253
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2", width: width - 4, height: height - 4, rx: "14", fill: "#232323", stroke: "#0d0d0d", strokeWidth: "4" }),
254
+ [22, width - 22].map((x) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { children: [
255
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: x, cy: height / 2, r: "9", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
256
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: `M ${x - 6} ${height / 2 + 2} L ${x + 6} ${height / 2 - 2}`, stroke: "#111", strokeWidth: "2.5" })
257
+ ] }, x))
258
+ ] }),
259
+ children
260
+ ]
261
+ }
262
+ );
263
+ }
165
264
 
166
265
  // src/components/AttitudeIndicator.tsx
167
266
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -187,6 +286,7 @@ function AttitudeIndicator({ roll = 0, pitch = 0, pitchLimit = 40, ...props }) {
187
286
  {
188
287
  ...props,
189
288
  label: `Attitude indicator: pitch ${Math.round(safePitch)}\xB0, roll ${Math.round(safeRoll)}\xB0`,
289
+ knobs: [{ id: "adjust", position: "bottom" }],
190
290
  children: [
191
291
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: CENTER, cy: CENTER, r: FACE_R }) }) }),
192
292
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { clipPath: `url(#${clipId})`, children: [
@@ -239,41 +339,49 @@ function HeadingIndicator({ heading = 0, ...props }) {
239
339
  const safeHeading = finite(heading);
240
340
  const normalised = (Math.round(safeHeading) % 360 + 360) % 360;
241
341
  const displayHeading = useContinuousAngle(safeHeading);
242
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(InstrumentFrame, { ...props, label: `Heading indicator: ${String(normalised).padStart(3, "0")}\xB0`, children: [
243
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { "data-testid": "heading-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
244
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
245
- range(0, 330, 30).map((a) => {
246
- const [x, y] = polar(132, a);
247
- const label2 = CARDINALS[a] ?? String(a / 10);
248
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
249
- "text",
342
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
343
+ InstrumentFrame,
344
+ {
345
+ ...props,
346
+ label: `Heading indicator: ${String(normalised).padStart(3, "0")}\xB0`,
347
+ knobs: [{ id: "set", label: "PUSH", position: "bottom-left", angle: safeHeading }],
348
+ children: [
349
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { "data-testid": "heading-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
350
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
351
+ range(0, 330, 30).map((a) => {
352
+ const [x, y] = polar(132, a);
353
+ const label2 = CARDINALS[a] ?? String(a / 10);
354
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
355
+ "text",
356
+ {
357
+ x,
358
+ y,
359
+ transform: `rotate(${a} ${x} ${y})`,
360
+ fill: a % 90 === 0 ? "#ffb000" : "#fff",
361
+ fontSize: a % 90 === 0 ? 30 : 26,
362
+ fontWeight: "bold",
363
+ textAnchor: "middle",
364
+ dominantBaseline: "central",
365
+ children: label2
366
+ },
367
+ a
368
+ );
369
+ })
370
+ ] }),
371
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#ffb000", strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
372
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -9 -26 h 18 z`, fill: "#ffb000" }),
373
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
374
+ "path",
250
375
  {
251
- x,
252
- y,
253
- transform: `rotate(${a} ${x} ${y})`,
254
- fill: a % 90 === 0 ? "#ffb000" : "#fff",
255
- fontSize: a % 90 === 0 ? 30 : 26,
256
- fontWeight: "bold",
257
- textAnchor: "middle",
258
- dominantBaseline: "central",
259
- children: label2
260
- },
261
- a
262
- );
263
- })
264
- ] }),
265
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#ffb000", strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
266
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -9 -26 h 18 z`, fill: "#ffb000" }),
267
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
268
- "path",
269
- {
270
- d: "M200 135 c6 0 8 8 8 16 v30 l52 18 v12 l-52 -8 v34 l18 12 v10 l-26 -6 l-26 6 v-10 l18 -12 v-34 l-52 8 v-12 l52 -18 v-30 c0 -8 2 -16 8 -16 z",
271
- fill: "#ffb000",
272
- stroke: "#000",
273
- strokeWidth: "2"
274
- }
275
- )
276
- ] });
376
+ d: "M200 135 c6 0 8 8 8 16 v30 l52 18 v12 l-52 -8 v34 l18 12 v10 l-26 -6 l-26 6 v-10 l18 -12 v-34 l-52 8 v-12 l52 -18 v-30 c0 -8 2 -16 8 -16 z",
377
+ fill: "#ffb000",
378
+ stroke: "#000",
379
+ strokeWidth: "2"
380
+ }
381
+ )
382
+ ]
383
+ }
384
+ );
277
385
  }
278
386
 
279
387
  // src/components/Airspeed.tsx
@@ -322,25 +430,33 @@ function Altimeter({ altitude = 0, pressure, pressureUnit = "hPa", ...props }) {
322
430
  const alt = finite(altitude);
323
431
  const qnh = finite(pressure, STANDARD[pressureUnit]);
324
432
  const qnhText = pressureUnit === "inHg" ? qnh.toFixed(2) : Math.round(qnh).toString();
325
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(InstrumentFrame, { ...props, label: `Altimeter: ${Math.round(alt)} feet, ${qnhText} ${pressureUnit}`, children: [
326
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 49, 1).map((i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: tickPath(178, i % 5 === 0 ? 150 : 164, i * 7.2), strokeWidth: i % 5 === 0 ? 4 : 2 }, i)) }),
327
- range(0, 9, 1).map((n) => {
328
- const [x, y] = polar(126, n * 36);
329
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x, y, fill: "#fff", fontSize: "32", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: n }, n);
330
- }),
331
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER, y: CENTER - 58, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: "ALT" }),
332
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER, y: CENTER - 40, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: "100 FEET" }),
333
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: CENTER + 30, y: CENTER - 16, width: "74", height: "32", rx: "4", fill: "#000", stroke: "#666", strokeWidth: "2" }),
334
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { "data-testid": "altimeter-pressure", x: CENTER + 67, y: CENTER + 1, fill: "#fff", fontSize: "20", fontFamily: "monospace", textAnchor: "middle", dominantBaseline: "central", children: qnhText }),
335
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER + 67, y: CENTER + 30, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: pressureUnit }),
336
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { "data-testid": "altimeter-10000", style: motionStyle(`rotate(${alt / 1e5 * 360}deg)`, duration), children: [
337
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER} ${CENTER} L ${CENTER} ${CENTER - 150}`, stroke: "#fff", strokeWidth: "3" }),
338
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER} ${CENTER - 178} l -10 22 h 20 z`, fill: "#fff" })
339
- ] }),
340
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { "data-testid": "altimeter-1000", style: motionStyle(`rotate(${alt / 1e4 * 360}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER - 9} ${CENTER + 14} L ${CENTER - 12} ${CENTER - 70} L ${CENTER} ${CENTER - 100} L ${CENTER + 12} ${CENTER - 70} L ${CENTER + 9} ${CENTER + 14} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
341
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { "data-testid": "altimeter-100", style: motionStyle(`rotate(${alt / 1e3 * 360}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER - 5} ${CENTER + 30} L ${CENTER - 4} ${CENTER - 140} L ${CENTER} ${CENTER - 168} L ${CENTER + 4} ${CENTER - 140} L ${CENTER + 5} ${CENTER + 30} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
342
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hub, {})
343
- ] });
433
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
434
+ InstrumentFrame,
435
+ {
436
+ ...props,
437
+ label: `Altimeter: ${Math.round(alt)} feet, ${qnhText} ${pressureUnit}`,
438
+ knobs: [{ id: "baro", label: "BARO", position: "bottom-left", angle: Math.round((qnh - STANDARD[pressureUnit]) * (pressureUnit === "inHg" ? 3e4 : 1e3)) / 100 }],
439
+ children: [
440
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 49, 1).map((i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: tickPath(178, i % 5 === 0 ? 150 : 164, i * 7.2), strokeWidth: i % 5 === 0 ? 4 : 2 }, i)) }),
441
+ range(0, 9, 1).map((n) => {
442
+ const [x, y] = polar(126, n * 36);
443
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x, y, fill: "#fff", fontSize: "32", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: n }, n);
444
+ }),
445
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER, y: CENTER - 58, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: "ALT" }),
446
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER, y: CENTER - 40, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: "100 FEET" }),
447
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: CENTER + 30, y: CENTER - 16, width: "74", height: "32", rx: "4", fill: "#000", stroke: "#666", strokeWidth: "2" }),
448
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { "data-testid": "altimeter-pressure", x: CENTER + 67, y: CENTER + 1, fill: "#fff", fontSize: "20", fontFamily: "monospace", textAnchor: "middle", dominantBaseline: "central", children: qnhText }),
449
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: CENTER + 67, y: CENTER + 30, fill: "#ccc", fontSize: "12", textAnchor: "middle", children: pressureUnit }),
450
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { "data-testid": "altimeter-10000", style: motionStyle(`rotate(${alt / 1e5 * 360}deg)`, duration), children: [
451
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER} ${CENTER} L ${CENTER} ${CENTER - 150}`, stroke: "#fff", strokeWidth: "3" }),
452
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER} ${CENTER - 178} l -10 22 h 20 z`, fill: "#fff" })
453
+ ] }),
454
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { "data-testid": "altimeter-1000", style: motionStyle(`rotate(${alt / 1e4 * 360}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER - 9} ${CENTER + 14} L ${CENTER - 12} ${CENTER - 70} L ${CENTER} ${CENTER - 100} L ${CENTER + 12} ${CENTER - 70} L ${CENTER + 9} ${CENTER + 14} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
455
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { "data-testid": "altimeter-100", style: motionStyle(`rotate(${alt / 1e3 * 360}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: `M ${CENTER - 5} ${CENTER + 30} L ${CENTER - 4} ${CENTER - 140} L ${CENTER} ${CENTER - 168} L ${CENTER + 4} ${CENTER - 140} L ${CENTER + 5} ${CENTER + 30} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) }),
456
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Hub, {})
457
+ ]
458
+ }
459
+ );
344
460
  }
345
461
 
346
462
  // src/components/VerticalSpeed.tsx
@@ -668,7 +784,7 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ne
668
784
  const needleAngle = -(dev / FULL_SCALE_DEG) * SWING_FULL_SCALE_DEG;
669
785
  const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
670
786
  const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
671
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
787
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "obs", label: "OBS", position: "bottom-left", angle: crs }], children: [
672
788
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { "data-testid": "vor-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
673
789
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
674
790
  range(0, 330, 30).map((a) => {
@@ -868,7 +984,7 @@ function IlsIndicator({
868
984
  const label2 = signal ? `ILS indicator: course ${courseText}\xB0, course needle ${devText}, ${gsText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `ILS indicator: course ${courseText}\xB0, no NAV signal, ${gsText}`;
869
985
  const clipId = useSvgId("fi-ils-clip");
870
986
  const dots = range(1, 5, 1).flatMap((i) => [-i, i]);
871
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
987
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "obs", label: "OBS", position: "bottom-left", angle: crs }], children: [
872
988
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "ils-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
873
989
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { stroke: "#eee", strokeLinecap: "butt", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: tickPath(170, a % 10 === 0 ? 154 : 162, a), strokeWidth: a % 10 === 0 ? 4 : 2.5 }, a)) }),
874
990
  range(0, 330, 30).map((a) => {
@@ -931,25 +1047,195 @@ function IlsIndicator({
931
1047
  ] }),
932
1048
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FlagWindow, { x: CENTER, y: CENTER + FLAG_OFFSET, axis: "h", visible: !signal, testId: "ils-nav-flag" }),
933
1049
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FlagWindow, { x: CENTER + FLAG_OFFSET, y: CENTER, axis: "v", visible: !hasGs, testId: "ils-gs-flag" }),
934
- swing && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: GS_PIVOT_X, cy: CENTER, r: "7", fill: "#1a1a1a", stroke: "#555", strokeWidth: "2" }),
935
- props.showBox !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "ils-obs", children: [
936
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: 44, cy: 356, r: "30", fill: "#1a1a1a", stroke: "#000", strokeWidth: "2" }),
937
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: 44, cy: 356, r: "24", fill: "#2a2a2a", stroke: "#ddd", strokeWidth: "2" }),
938
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("text", { x: 44, y: 356, fill: "#eee", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "OBS" })
939
- ] })
1050
+ swing && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: GS_PIVOT_X, cy: CENTER, r: "7", fill: "#1a1a1a", stroke: "#555", strokeWidth: "2" })
940
1051
  ] });
941
1052
  }
942
1053
 
943
- // src/components/AdfIndicator.tsx
1054
+ // src/components/HsiIndicator.tsx
944
1055
  var import_jsx_runtime11 = require("react/jsx-runtime");
945
1056
  var CARDINALS5 = { 0: "N", 90: "E", 180: "S", 270: "W" };
946
1057
  var AMBER3 = "#ffb000";
1058
+ var COURSE = "#e6d930";
1059
+ var BUG = "#ff7a1a";
1060
+ var FLAG2 = "#e0342a";
1061
+ var DOT_SPACING3 = 36;
1062
+ var FULL_SCALE_PX3 = DOT_SPACING3 * 2;
1063
+ var BAR_HALF = 58;
1064
+ var GS_X = 108;
1065
+ var GS_DOT_SPACING = 24;
1066
+ var GS_FULL_SCALE_PX = GS_DOT_SPACING * 2;
1067
+ var norm4 = (deg2) => (deg2 % 360 + 360) % 360;
1068
+ var round22 = (n) => Math.round(n * 100) / 100 + 0;
1069
+ var pad3 = (deg2) => String(Math.round(norm4(deg2)) % 360 || 360).padStart(3, "0");
1070
+ function WarningFlag({ x, y, text, visible, testId, vertical }) {
1071
+ const [w, h] = vertical ? [20, 46] : [44, 20];
1072
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": testId, opacity: visible ? 1 : 0, style: { transition: "opacity 200ms ease-out" }, children: [
1073
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: x - w / 2, y: y - h / 2, width: w, height: h, rx: "2", fill: FLAG2, stroke: "#000", strokeWidth: "1.5" }),
1074
+ vertical ? text.split("").map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x, y: y + (i - (text.length - 1) / 2) * 15, fill: "#111", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: c }, i)) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x, y, fill: "#111", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: text })
1075
+ ] });
1076
+ }
1077
+ function GlideslopeScale({ side, y, visible, duration }) {
1078
+ const x = CENTER + side * GS_X;
1079
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { children: [
1080
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { fill: "none", stroke: "#eee", strokeWidth: "2", children: [-2, -1, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: x, cy: CENTER + i * GS_DOT_SPACING, r: "4.5" }, i)) }),
1081
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${x - 7} ${CENTER} h 14`, stroke: "#eee", strokeWidth: "3", strokeLinecap: "round" }),
1082
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1083
+ "g",
1084
+ {
1085
+ "data-testid": side > 0 ? "hsi-gs-pointer" : "hsi-gs-pointer-left",
1086
+ opacity: visible ? 1 : 0,
1087
+ style: { ...motionStyle(`translate(0px, ${y}px)`, duration), transition: duration > 0 ? `transform ${duration}ms ease-out, opacity 200ms ease-out` : "opacity 200ms ease-out" },
1088
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${x - side * 7} ${CENTER} l ${side * 15} -9 v 18 z`, fill: "#3ddc84", stroke: "#000", strokeWidth: "1.5", strokeLinejoin: "round" })
1089
+ }
1090
+ )
1091
+ ] });
1092
+ }
1093
+ function HsiIndicator({
1094
+ heading = 0,
1095
+ headingBug,
1096
+ course = 0,
1097
+ radial,
1098
+ deviation,
1099
+ fullScale = 10,
1100
+ toFrom,
1101
+ signal = true,
1102
+ glideslope,
1103
+ glideslopeFullScale = 0.7,
1104
+ glideslopeSignal,
1105
+ ...props
1106
+ }) {
1107
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
1108
+ const hdg = finite(heading);
1109
+ const crs = finite(course);
1110
+ const hasBug = typeof headingBug === "number" && Number.isFinite(headingBug);
1111
+ const bug = hasBug ? headingBug : 0;
1112
+ const computed = typeof radial === "number" && Number.isFinite(radial) ? vorDeviation(crs, radial) : void 0;
1113
+ const locScale = finite(fullScale, 10) > 0 ? finite(fullScale, 10) : 10;
1114
+ const gsScale = finite(glideslopeFullScale, 0.7) > 0 ? finite(glideslopeFullScale, 0.7) : 0.7;
1115
+ const dev = signal ? clamp(finite(deviation, computed?.deviation ?? 0), -locScale, locScale) : 0;
1116
+ const flag = !signal ? "OFF" : toFrom ?? computed?.toFrom ?? "OFF";
1117
+ const hasGs = glideslopeSignal ?? (typeof glideslope === "number" && Number.isFinite(glideslope));
1118
+ const gs = hasGs ? clamp(finite(glideslope), -gsScale, gsScale) : 0;
1119
+ const barX = round22(dev / locScale * FULL_SCALE_PX3);
1120
+ const gsY = round22(-(gs / gsScale) * GS_FULL_SCALE_PX);
1121
+ const displayHeading = useContinuousAngle(hdg);
1122
+ const displayCourse = useContinuousAngle(crs);
1123
+ const displayBug = useContinuousAngle(bug);
1124
+ const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
1125
+ const gsText = !hasGs ? "glideslope off" : Math.abs(gs) < 5e-3 ? "glideslope centred" : `glideslope ${Math.abs(gs).toFixed(2)}\xB0 ${gs > 0 ? "up" : "down"}`;
1126
+ const navText = signal ? `course bar ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : "no NAV signal";
1127
+ const label2 = `HSI: heading ${pad3(hdg)}\xB0, course ${pad3(crs)}\xB0, ${navText}, ${gsText}${hasBug ? `, heading bug ${pad3(bug)}\xB0` : ""}`;
1128
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1129
+ InstrumentFrame,
1130
+ {
1131
+ ...props,
1132
+ label: label2,
1133
+ knobs: [
1134
+ { id: "crs", label: "CRS", position: "bottom-left", angle: crs },
1135
+ { id: "hdg", label: "HDG", position: "bottom-right", angle: bug }
1136
+ ],
1137
+ children: [
1138
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "hsi-card", style: motionStyle(`rotate(${-displayHeading}deg)`, duration), children: [
1139
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: "#eee", strokeLinecap: "butt", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(172, a % 10 === 0 ? 154 : 163, a), strokeWidth: a % 10 === 0 ? 3.5 : 2 }, a)) }),
1140
+ range(0, 330, 30).map((a) => {
1141
+ const [x, y] = polar(138, a);
1142
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1143
+ "text",
1144
+ {
1145
+ x,
1146
+ y,
1147
+ transform: `rotate(${a} ${x} ${y})`,
1148
+ fill: "#eee",
1149
+ fontSize: a % 90 === 0 ? 24 : 21,
1150
+ fontWeight: "bold",
1151
+ textAnchor: "middle",
1152
+ dominantBaseline: "central",
1153
+ children: CARDINALS5[a] ?? String(a / 10)
1154
+ },
1155
+ a
1156
+ );
1157
+ }),
1158
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { "data-testid": "hsi-heading-bug", opacity: hasBug ? 1 : 0, style: motionStyle(`rotate(${displayBug}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1159
+ "path",
1160
+ {
1161
+ d: `M ${CENTER - 13} ${CENTER - 182} h 26 v 20 h -7 l -6 -8 l -6 8 h -7 z`,
1162
+ fill: BUG,
1163
+ stroke: "#000",
1164
+ strokeWidth: "1.5",
1165
+ strokeLinejoin: "round"
1166
+ }
1167
+ ) }),
1168
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "hsi-course", style: motionStyle(`rotate(${displayCourse}deg)`, duration), children: [
1169
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { fill: "none", stroke: "#eee", strokeWidth: "2.5", children: [-2, -1, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: CENTER + i * DOT_SPACING3, cy: CENTER, r: "6" }, i)) }),
1170
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1171
+ "path",
1172
+ {
1173
+ d: `M ${CENTER} ${CENTER - 126} l 13 24 h -8 v 40 h -10 v -40 h -8 z`,
1174
+ fill: COURSE,
1175
+ stroke: "#000",
1176
+ strokeWidth: "1.5",
1177
+ strokeLinejoin: "round"
1178
+ }
1179
+ ),
1180
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: CENTER - 5, y: CENTER + 62, width: "10", height: "58", fill: COURSE, stroke: "#000", strokeWidth: "1.5" }),
1181
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { "data-testid": "hsi-cdi", style: motionStyle(`translate(${barX}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: CENTER - 5, y: CENTER - BAR_HALF, width: "10", height: BAR_HALF * 2, fill: COURSE, stroke: "#000", strokeWidth: "1.5" }) }),
1182
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1183
+ "path",
1184
+ {
1185
+ "data-testid": "hsi-to",
1186
+ d: `M ${CENTER + 26} ${CENTER - 58} l 11 18 h -22 z`,
1187
+ fill: "#eee",
1188
+ stroke: "#000",
1189
+ strokeWidth: "1.5",
1190
+ opacity: flag === "TO" ? 1 : 0,
1191
+ style: { transition: "opacity 200ms ease-out" }
1192
+ }
1193
+ ),
1194
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1195
+ "path",
1196
+ {
1197
+ "data-testid": "hsi-from",
1198
+ d: `M ${CENTER + 26} ${CENTER + 58} l 11 -18 h -22 z`,
1199
+ fill: "#eee",
1200
+ stroke: "#000",
1201
+ strokeWidth: "1.5",
1202
+ opacity: flag === "FROM" ? 1 : 0,
1203
+ style: { transition: "opacity 200ms ease-out" }
1204
+ }
1205
+ )
1206
+ ] })
1207
+ ] }),
1208
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 135, 225, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(192, 180, a) }, a)) }),
1209
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER} ${CENTER - 156} l -9 -24 h 18 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1" }),
1210
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1211
+ "path",
1212
+ {
1213
+ d: `M ${CENTER} ${CENTER - 30} c 4 0 5 5 5 10 v 14 l 25 9 v 7 l -25 -3 v 16 l 10 6 v 6 l -15 -3 l -15 3 v -6 l 10 -6 v -16 l -25 3 v -7 l 25 -9 v -14 c 0 -5 1 -10 5 -10 z`,
1214
+ fill: AMBER3,
1215
+ stroke: "#000",
1216
+ strokeWidth: "1.5",
1217
+ strokeLinejoin: "round"
1218
+ }
1219
+ ),
1220
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GlideslopeScale, { side: -1, y: gsY, visible: hasGs, duration }),
1221
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GlideslopeScale, { side: 1, y: gsY, visible: hasGs, duration }),
1222
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WarningFlag, { x: CENTER + GS_X, y: CENTER, text: "GS", visible: !hasGs, testId: "hsi-gs-flag", vertical: true }),
1223
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WarningFlag, { x: CENTER - 62, y: CENTER - 84, text: "NAV", visible: !signal, testId: "hsi-nav-flag" })
1224
+ ]
1225
+ }
1226
+ );
1227
+ }
1228
+
1229
+ // src/components/AdfIndicator.tsx
1230
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1231
+ var CARDINALS6 = { 0: "N", 90: "E", 180: "S", 270: "W" };
1232
+ var AMBER4 = "#ffb000";
947
1233
  var NEEDLE = "#ffe14d";
948
1234
  var PARKED_DEG = 90;
949
- var norm4 = (deg2) => (deg2 % 360 + 360) % 360;
950
- var pad3 = (deg2) => String(Math.round(norm4(deg2)) % 360).padStart(3, "0");
1235
+ var norm5 = (deg2) => (deg2 % 360 + 360) % 360;
1236
+ var pad32 = (deg2) => String(Math.round(norm5(deg2)) % 360).padStart(3, "0");
951
1237
  function relativeBearing(heading, bearingToStation) {
952
- return norm4(finite(bearingToStation) - finite(heading));
1238
+ return norm5(finite(bearingToStation) - finite(heading));
953
1239
  }
954
1240
  function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
955
1241
  const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
@@ -957,41 +1243,41 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
957
1243
  const hdg = finite(heading);
958
1244
  const displayCard = useContinuousAngle(hdg);
959
1245
  const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
960
- const label2 = signal ? `ADF indicator: station ${pad3(rel)}\xB0 relative, bearing ${pad3(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
961
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
962
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
963
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
1246
+ const label2 = signal ? `ADF indicator: station ${pad32(rel)}\xB0 relative, bearing ${pad32(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
1247
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(InstrumentFrame, { ...props, label: label2, knobs: [{ id: "hdg", label: "HDG", position: "bottom-left", angle: hdg }], children: [
1248
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
1249
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
964
1250
  range(0, 330, 30).map((a) => {
965
1251
  const [x, y] = polar(132, a);
966
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1252
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
967
1253
  "text",
968
1254
  {
969
1255
  x,
970
1256
  y,
971
1257
  transform: `rotate(${a} ${x} ${y})`,
972
- fill: a % 90 === 0 ? AMBER3 : "#fff",
1258
+ fill: a % 90 === 0 ? AMBER4 : "#fff",
973
1259
  fontSize: a % 90 === 0 ? 28 : 24,
974
1260
  fontWeight: "bold",
975
1261
  textAnchor: "middle",
976
1262
  dominantBaseline: "central",
977
- children: CARDINALS5[a] ?? String(a / 10)
1263
+ children: CARDINALS6[a] ?? String(a / 10)
978
1264
  },
979
1265
  a
980
1266
  );
981
1267
  })
982
1268
  ] }),
983
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1.5" }),
984
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
985
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { stroke: AMBER3, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
986
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
987
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
1269
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER4, stroke: "#000", strokeWidth: "1.5" }),
1270
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { stroke: AMBER4, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
1271
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { stroke: AMBER4, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
1272
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
1273
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
988
1274
  ] }),
989
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
990
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
991
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
992
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
1275
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
1276
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
1277
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
1278
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
993
1279
  ] }),
994
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1280
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
995
1281
  "path",
996
1282
  {
997
1283
  d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
@@ -1001,12 +1287,12 @@ function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
1001
1287
  strokeLinejoin: "round"
1002
1288
  }
1003
1289
  ) }),
1004
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Hub, { r: 10 })
1290
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Hub, { r: 10 })
1005
1291
  ] });
1006
1292
  }
1007
1293
 
1008
1294
  // src/components/RadioPanel.tsx
1009
- var import_jsx_runtime12 = require("react/jsx-runtime");
1295
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1010
1296
  var SIDE = 252;
1011
1297
  var ORIGIN = CENTER - SIDE / 2;
1012
1298
  var ROW_H = 60;
@@ -1023,9 +1309,9 @@ var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz
1023
1309
  var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
1024
1310
  function Display({ x, y, width, value, color, testId, unit }) {
1025
1311
  const h = ROW_H - 16;
1026
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { children: [
1027
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
1028
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1312
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
1313
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
1314
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1029
1315
  "text",
1030
1316
  {
1031
1317
  "data-testid": testId,
@@ -1040,18 +1326,18 @@ function Display({ x, y, width, value, color, testId, unit }) {
1040
1326
  children: value
1041
1327
  }
1042
1328
  ),
1043
- unit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
1329
+ unit && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
1044
1330
  ] });
1045
1331
  }
1046
1332
  function Swap({ y }) {
1047
1333
  const cy = y + ROW_H / 2;
1048
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
1049
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
1050
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
1334
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
1335
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
1336
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
1051
1337
  ] });
1052
1338
  }
1053
1339
  function RowLabel({ y, children }) {
1054
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
1340
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
1055
1341
  }
1056
1342
  function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
1057
1343
  const rows = [
@@ -1061,29 +1347,29 @@ function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
1061
1347
  const dmeText = formatDme(dme);
1062
1348
  const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
1063
1349
  const label2 = "Radio panel: " + rows.map((r) => `${r.name} ${r.tuned ? `${r.active} ${r.unit}` : "not tuned"}`).join(", ") + `, DME ${usable(dme) ? `${dmeText} NM` : "no distance"}`;
1064
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
1065
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1066
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
1067
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
1068
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
1350
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
1351
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1352
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
1353
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
1354
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
1069
1355
  ] }),
1070
1356
  rows.map((r, i) => {
1071
1357
  const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
1072
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("g", { children: [
1073
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RowLabel, { y, children: r.name }),
1074
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
1075
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Swap, { y }),
1076
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
1358
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
1359
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RowLabel, { y, children: r.name }),
1360
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
1361
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Swap, { y }),
1362
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
1077
1363
  ] }, r.key);
1078
1364
  }),
1079
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RowLabel, { y: dmeY, children: "DME" }),
1080
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
1365
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RowLabel, { y: dmeY, children: "DME" }),
1366
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
1081
1367
  ] });
1082
1368
  }
1083
1369
 
1084
1370
  // src/components/RadioStack.tsx
1085
1371
  var import_react2 = require("react");
1086
- var import_jsx_runtime13 = require("react/jsx-runtime");
1372
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1087
1373
  var parseNav = (text) => {
1088
1374
  const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
1089
1375
  return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
@@ -1116,9 +1402,9 @@ var display = {
1116
1402
  var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
1117
1403
  var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
1118
1404
  function SwapIcon() {
1119
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
1120
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
1121
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
1405
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
1406
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
1407
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
1122
1408
  ] });
1123
1409
  }
1124
1410
  function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
@@ -1152,13 +1438,13 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
1152
1438
  if (text && standby === void 0 || standby === value.standby) return;
1153
1439
  onChange({ active: value.active, standby });
1154
1440
  };
1155
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1156
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: label, children: [
1157
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: name }),
1158
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
1441
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1442
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: label, children: [
1443
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: name }),
1444
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
1159
1445
  ] }),
1160
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
1161
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1446
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
1447
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1162
1448
  "button",
1163
1449
  {
1164
1450
  type: "button",
@@ -1166,10 +1452,10 @@ function Receiver({ name, unit, value, ident: station, color, format, parse, onC
1166
1452
  "aria-label": `Swap ${name} active and standby`,
1167
1453
  title: "Swap active and standby",
1168
1454
  style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "2em", padding: 0, margin: 0, border: "0.08em solid #555", borderRadius: "0.3em", background: "#3a3a3a", color: "#ddd", font: "inherit", fontSize: "1.2em", cursor: "pointer" },
1169
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SwapIcon, {})
1455
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SwapIcon, {})
1170
1456
  }
1171
1457
  ),
1172
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1458
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1173
1459
  "input",
1174
1460
  {
1175
1461
  type: "text",
@@ -1231,7 +1517,7 @@ function RadioStack({
1231
1517
  const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
1232
1518
  return (
1233
1519
  // The outer box is a size container so every inner measurement can follow the width.
1234
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1520
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1235
1521
  "div",
1236
1522
  {
1237
1523
  role: "group",
@@ -1254,20 +1540,20 @@ function RadioStack({
1254
1540
  userSelect: "none"
1255
1541
  },
1256
1542
  children: [
1257
- SCREWS2.map((position, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
1258
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
1259
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
1543
+ SCREWS2.map((position, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
1544
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
1545
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
1260
1546
  ] }, i)),
1261
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {}),
1262
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: heading, children: "ACTIVE" }),
1263
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {}),
1264
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: heading, children: "STBY" }),
1265
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
1266
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
1267
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: label, children: "DME" }),
1268
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { "aria-label": "DME distance", style: { ...display, gridColumn: "span 3", display: "flex", alignItems: "baseline", justifyContent: "flex-end", gap: "0.4em", padding: "0 0.5em", color }, children: [
1269
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
1270
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
1547
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {}),
1548
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: heading, children: "ACTIVE" }),
1549
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {}),
1550
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: heading, children: "STBY" }),
1551
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
1552
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
1553
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: label, children: "DME" }),
1554
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { "aria-label": "DME distance", style: { ...display, gridColumn: "span 3", display: "flex", alignItems: "baseline", justifyContent: "flex-end", gap: "0.4em", padding: "0 0.5em", color }, children: [
1555
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
1556
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
1271
1557
  ] })
1272
1558
  ]
1273
1559
  }
@@ -1276,7 +1562,7 @@ function RadioStack({
1276
1562
  }
1277
1563
 
1278
1564
  // src/components/DataPanel.tsx
1279
- var import_jsx_runtime14 = require("react/jsx-runtime");
1565
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1280
1566
  var MAX_FIELDS = 6;
1281
1567
  var SIDE2 = 252;
1282
1568
  var PAD = 8;
@@ -1296,9 +1582,9 @@ function DataPanel({ fields = [], heading, ...props }) {
1296
1582
  const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
1297
1583
  const valueSize = VALUE_SIZE[rows] ?? 27;
1298
1584
  const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
1299
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
1300
- heading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
1301
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1585
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
1586
+ heading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
1587
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
1302
1588
  shown.map((f, i) => {
1303
1589
  const col = i % cols;
1304
1590
  const row = Math.floor(i / cols);
@@ -1306,10 +1592,10 @@ function DataPanel({ fields = [], heading, ...props }) {
1306
1592
  const y = ORIGIN2 + PAD + row * (cellH + GAP);
1307
1593
  const value = formatValue(f);
1308
1594
  const fit = Math.min(valueSize, (cellW - 16) / (0.62 * Math.max(1, value.length)));
1309
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("g", { "data-testid": `data-field-${i}`, children: [
1310
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
1311
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
1312
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1595
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { "data-testid": `data-field-${i}`, children: [
1596
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
1597
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
1598
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1313
1599
  "text",
1314
1600
  {
1315
1601
  "data-testid": `data-value-${i}`,
@@ -1324,14 +1610,14 @@ function DataPanel({ fields = [], heading, ...props }) {
1324
1610
  children: value
1325
1611
  }
1326
1612
  ),
1327
- f.unit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
1613
+ f.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
1328
1614
  ] }, i);
1329
1615
  })
1330
1616
  ] });
1331
1617
  }
1332
1618
 
1333
1619
  // src/components/FuelIndicator.tsx
1334
- var import_jsx_runtime15 = require("react/jsx-runtime");
1620
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1335
1621
  var MAX_TANKS = 4;
1336
1622
  var GREEN2 = "#2ee05a";
1337
1623
  var RED = "#ff3b3b";
@@ -1374,16 +1660,16 @@ function FuelIndicator({
1374
1660
  return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
1375
1661
  });
1376
1662
  const title = `${label2}: ` + (readings.length ? readings.map((r) => `${r.name} ${r.full ? "full" : `${r.text} of ${r.cap.toFixed(places)} ${unit}`}${r.isLow ? " (low)" : ""}`).join(", ") : "no tanks");
1377
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(InstrumentFrame, { ...props, label: title, children: [
1378
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
1663
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(InstrumentFrame, { ...props, label: title, children: [
1664
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
1379
1665
  readings.map((r, i) => {
1380
1666
  const cx = INNER_LEFT + colW * (i + 0.5);
1381
1667
  const color = r.isLow ? RED : GREEN2;
1382
1668
  const tickX = cx - barW / 2 - 14;
1383
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { "data-testid": `fuel-tank-${i}`, children: [
1384
- i > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
1385
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
1386
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1669
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { "data-testid": `fuel-tank-${i}`, children: [
1670
+ i > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
1671
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
1672
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1387
1673
  "path",
1388
1674
  {
1389
1675
  d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
@@ -1391,9 +1677,9 @@ function FuelIndicator({
1391
1677
  },
1392
1678
  f
1393
1679
  )) }),
1394
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
1395
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
1396
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1680
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
1681
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
1682
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1397
1683
  "text",
1398
1684
  {
1399
1685
  "data-testid": `fuel-value-${i}`,
@@ -1408,16 +1694,16 @@ function FuelIndicator({
1408
1694
  children: r.text
1409
1695
  }
1410
1696
  ),
1411
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
1697
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
1412
1698
  ] }, i);
1413
1699
  }),
1414
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
1415
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
1700
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
1701
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
1416
1702
  ] });
1417
1703
  }
1418
1704
 
1419
1705
  // src/components/EngineIndicator.tsx
1420
- var import_jsx_runtime16 = require("react/jsx-runtime");
1706
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1421
1707
  var MAX_CYLINDERS = 6;
1422
1708
  var MAX_BAR_GAUGES = 4;
1423
1709
  var GREEN3 = "#5fe04a";
@@ -1426,11 +1712,11 @@ var RED2 = "#ff3030";
1426
1712
  var BLUE = "#4fb7e8";
1427
1713
  var LABEL2 = "#b9c8e6";
1428
1714
  var LINE = "#8a8f99";
1429
- var round22 = (n) => Math.round(n * 100) / 100;
1715
+ var round23 = (n) => Math.round(n * 100) / 100;
1430
1716
  var DIAL_R = 182;
1431
1717
  function chord(y, inset = 8) {
1432
1718
  const half = Math.sqrt(Math.max(0, DIAL_R * DIAL_R - (y - CENTER) ** 2)) - inset;
1433
- return `M ${round22(CENTER - half)} ${y} H ${round22(CENTER + half)}`;
1719
+ return `M ${round23(CENTER - half)} ${y} H ${round23(CENTER + half)}`;
1434
1720
  }
1435
1721
  var DEFAULT_MANIFOLD = { min: 10, max: 35, green: [15, 29], yellow: [29, 31], high: 31, unit: "IN", decimals: 1 };
1436
1722
  var DEFAULT_RPM = { min: 0, max: 3e3, green: [800, 2500], yellow: [2500, 2700], high: 2700, decimals: 0 };
@@ -1475,22 +1761,22 @@ function arcAt(cx, cy, r, a0, a1) {
1475
1761
  }
1476
1762
  function ArcGauge({ cx, label: label2, g, duration, testId }) {
1477
1763
  const span = g.max - g.min;
1478
- const angle = (v) => round22(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
1479
- const band = (from, to, color) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
1764
+ const angle = (v) => round23(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
1765
+ const band = (from, to, color) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
1480
1766
  const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
1481
1767
  const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
1482
1768
  const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
1483
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1484
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
1769
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1770
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
1485
1771
  g.green && band(g.green[0], g.green[1], GREEN3),
1486
1772
  g.yellow && band(g.yellow[0], g.yellow[1], YELLOW2),
1487
1773
  g.low !== void 0 && band(g.min, g.low, RED2),
1488
1774
  g.high !== void 0 && band(g.high, g.max, RED2),
1489
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1490
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
1491
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1775
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1776
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
1777
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1492
1778
  g.text,
1493
- g.unit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", dx: "2", children: g.unit })
1779
+ g.unit && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", dx: "2", children: g.unit })
1494
1780
  ] })
1495
1781
  ] });
1496
1782
  }
@@ -1500,28 +1786,28 @@ var BAR_ROW_H = 39;
1500
1786
  var BAR_TOP2 = 137;
1501
1787
  function BarGauge({ top, g, label: label2, duration, testId }) {
1502
1788
  const y = top + 14;
1503
- const at = (v) => round22(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
1504
- const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
1505
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1506
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
1507
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
1789
+ const at = (v) => round23(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
1790
+ const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
1791
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1792
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
1793
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
1508
1794
  g.green && seg(g.green[0], g.green[1], GREEN3),
1509
1795
  g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW2),
1510
1796
  g.low !== void 0 && seg(g.min, g.low, RED2),
1511
1797
  g.high !== void 0 && seg(g.high, g.max, RED2),
1512
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": testId, style: motionStyle(`translate(${round22(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1513
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
1514
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
1515
- g.unit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
1798
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": testId, style: motionStyle(`translate(${round23(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1799
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
1800
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
1801
+ g.unit && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
1516
1802
  ] });
1517
1803
  }
1518
1804
  function Tank({ x, fraction, duration, testId }) {
1519
1805
  const top = 304;
1520
1806
  const h = 40;
1521
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1522
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
1523
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
1524
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
1807
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1808
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
1809
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
1810
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
1525
1811
  ] });
1526
1812
  }
1527
1813
  var hottest = (values) => {
@@ -1589,79 +1875,79 @@ function EngineIndicator({
1589
1875
  fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
1590
1876
  volts !== void 0 ? `${fmt(volts, 1)} V` : null
1591
1877
  ].filter(Boolean).join(", ");
1592
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
1593
- power !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1594
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tspan", { fill: LABEL2, fontSize: "11", children: [
1878
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
1879
+ power !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1880
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tspan", { fill: LABEL2, fontSize: "11", children: [
1595
1881
  "POWER",
1596
1882
  " "
1597
1883
  ] }),
1598
1884
  fmt(power),
1599
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", children: "%" })
1885
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", children: "%" })
1600
1886
  ] }),
1601
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
1602
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
1603
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { stroke: LINE, strokeWidth: "1.5", children: [
1604
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: chord(133) }),
1605
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M 200 133 V 298" }),
1606
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: chord(298) }),
1607
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M 136 298 V 348 M 264 298 V 348" })
1887
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
1888
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
1889
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { stroke: LINE, strokeWidth: "1.5", children: [
1890
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: chord(133) }),
1891
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M 200 133 V 298" }),
1892
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: chord(298) }),
1893
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M 136 298 V 348 M 264 298 V 348" })
1608
1894
  ] }),
1609
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1610
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
1895
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1896
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
1611
1897
  r.name,
1612
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "9", children: temperatureUnit })
1898
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "9", children: temperatureUnit })
1613
1899
  ] }),
1614
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
1900
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
1615
1901
  ] }, r.name)) }),
1616
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
1617
- columns > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1618
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
1619
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
1902
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
1903
+ columns > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1904
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
1905
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
1620
1906
  Array.from({ length: cylinders }, (_, i) => {
1621
1907
  const x0 = chartX0 + colW * i;
1622
1908
  const mid = x0 + colW / 2;
1623
1909
  const c = chtValues[i];
1624
1910
  const e = egtValues[i];
1625
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1626
- c !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
1627
- e !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
1628
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
1911
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1912
+ c !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
1913
+ e !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
1914
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
1629
1915
  ] }, i);
1630
1916
  }),
1631
- hasTit && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1632
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
1633
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
1917
+ hasTit && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1918
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
1919
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
1634
1920
  ] })
1635
1921
  ] }),
1636
- bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
1637
- i > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
1638
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
1922
+ bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1923
+ i > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
1924
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
1639
1925
  ] }, b.label)),
1640
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1641
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
1926
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
1927
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
1642
1928
  fmt(amps),
1643
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", dx: "2", children: "A" })
1929
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", dx: "2", children: "A" })
1644
1930
  ] }),
1645
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
1646
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
1647
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
1648
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
1931
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
1932
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
1933
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
1934
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
1649
1935
  fmt(left),
1650
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { dx: "14", children: fmt(right) })
1936
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { dx: "14", children: fmt(right) })
1651
1937
  ] }),
1652
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
1653
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
1654
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
1938
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
1939
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
1940
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
1655
1941
  fmt(volts, 1),
1656
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "11", dx: "2", children: "V" })
1942
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "11", dx: "2", children: "V" })
1657
1943
  ] }),
1658
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
1944
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
1659
1945
  ] })
1660
1946
  ] });
1661
1947
  }
1662
1948
 
1663
1949
  // src/components/FlapIndicator.tsx
1664
- var import_jsx_runtime17 = require("react/jsx-runtime");
1950
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1665
1951
  var GREEN4 = "#3ddc3d";
1666
1952
  var YELLOW3 = "#ffd400";
1667
1953
  var ORANGE = "#ff8a00";
@@ -1700,12 +1986,12 @@ function FlapIndicator({
1700
1986
  const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
1701
1987
  const segH = BAR_H2 / count;
1702
1988
  const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
1703
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(InstrumentFrame, { ...props, label: title, children: [
1704
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: BAR_X - BAR_W / 2 - 4, y: BAR_TOP3 - 4, width: BAR_W + 8, height: BAR_H2 + 8, rx: "4", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
1989
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(InstrumentFrame, { ...props, label: title, children: [
1990
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: BAR_X - BAR_W / 2 - 4, y: BAR_TOP3 - 4, width: BAR_W + 8, height: BAR_H2 + 8, rx: "4", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
1705
1991
  Array.from({ length: count }, (_, i) => {
1706
1992
  const y = BAR_TOP3 + i * segH;
1707
1993
  const on = i < lit;
1708
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1994
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1709
1995
  "rect",
1710
1996
  {
1711
1997
  "data-testid": `flap-segment-${i}`,
@@ -1722,26 +2008,26 @@ function FlapIndicator({
1722
2008
  i
1723
2009
  );
1724
2010
  }),
1725
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { children: [
1726
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
1727
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
2011
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { children: [
2012
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
2013
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
1728
2014
  ] }, d)) }),
1729
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
1730
- limit && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
1731
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
2015
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
2016
+ limit && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
2017
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
1732
2018
  Math.round(limit.speed),
1733
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tspan", { fontSize: "13", dx: "3", children: "KTS" })
2019
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tspan", { fontSize: "13", dx: "3", children: "KTS" })
1734
2020
  ] }),
1735
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
2021
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
1736
2022
  ] }),
1737
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
2023
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
1738
2024
  ] });
1739
2025
  }
1740
2026
 
1741
2027
  // src/components/AoaIndicator.tsx
1742
- var import_jsx_runtime18 = require("react/jsx-runtime");
2028
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1743
2029
  var GREEN5 = "#3ddc3d";
1744
- var AMBER4 = "#ffb000";
2030
+ var AMBER5 = "#ffb000";
1745
2031
  var RED4 = "#ff2a2a";
1746
2032
  var UNLIT_OPACITY = 0.15;
1747
2033
  var ROWS = [
@@ -1750,10 +2036,10 @@ var ROWS = [
1750
2036
  { shape: "bar", color: GREEN5, y: 256 },
1751
2037
  { shape: "bar", color: GREEN5, y: 234 },
1752
2038
  { shape: "donut", color: GREEN5, y: 208 },
1753
- { shape: "bar", color: AMBER4, y: 182 },
1754
- { shape: "split", color: AMBER4, y: 160 },
1755
- { shape: "chevron", color: AMBER4, y: 125 },
1756
- { shape: "chevron", color: AMBER4, y: 103 },
2039
+ { shape: "bar", color: AMBER5, y: 182 },
2040
+ { shape: "split", color: AMBER5, y: 160 },
2041
+ { shape: "chevron", color: AMBER5, y: 125 },
2042
+ { shape: "chevron", color: AMBER5, y: 103 },
1757
2043
  { shape: "chevron", color: RED4, y: 74 },
1758
2044
  { shape: "chevron", color: RED4, y: 52 }
1759
2045
  ];
@@ -1767,20 +2053,20 @@ function RowShape({ shape, y }) {
1767
2053
  const r = CENTER + HALF;
1768
2054
  switch (shape) {
1769
2055
  case "bar":
1770
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
2056
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
1771
2057
  case "split":
1772
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1773
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
2058
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2059
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
2060
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
1775
2061
  ] });
1776
2062
  case "donut":
1777
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1778
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
1779
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
1780
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
2063
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2064
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
2065
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
2066
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
1781
2067
  ] });
1782
2068
  case "chevron":
1783
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
2069
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
1784
2070
  }
1785
2071
  }
1786
2072
  function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
@@ -1794,11 +2080,11 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
1794
2080
  const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
1795
2081
  const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
1796
2082
  const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
1797
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(InstrumentFrame, { ...props, label: title, children: [
1798
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
2083
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(InstrumentFrame, { ...props, label: title, children: [
2084
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
1799
2085
  ROWS.map((row, i) => {
1800
2086
  const on = i < lit;
1801
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2087
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1802
2088
  "g",
1803
2089
  {
1804
2090
  "data-testid": `aoa-row-${i}`,
@@ -1809,46 +2095,920 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
1809
2095
  opacity: on ? 1 : UNLIT_OPACITY,
1810
2096
  style: { transition: "opacity 150ms ease-out" },
1811
2097
  children: [
1812
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RowShape, { shape: row.shape, y: row.y }),
1813
- on && stall && row.shape === "chevron" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
2098
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RowShape, { shape: row.shape, y: row.y }),
2099
+ on && stall && row.shape === "chevron" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
1814
2100
  ]
1815
2101
  },
1816
2102
  i
1817
2103
  );
1818
2104
  }),
1819
- showValue && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
1820
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
2105
+ showValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
2106
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
2107
+ ] });
2108
+ }
2109
+
2110
+ // src/components/DigitalClock.tsx
2111
+ var import_react3 = require("react");
2112
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2113
+ var MIN = 6e4;
2114
+ var HOUR = 60 * MIN;
2115
+ var DAY = 24 * HOUR;
2116
+ var HOLD_TIME = 2e3;
2117
+ var MODES = ["UT", "LT", "FT", "ET"];
2118
+ var UPPER = ["volts", "F", "C"];
2119
+ var pad2 = (n) => String(n).padStart(2, "0");
2120
+ var mod = (n, m) => (n % m + m) % m;
2121
+ var readWatch = (w, t) => w.acc + (w.since === null ? 0 : Math.max(0, t - w.since));
2122
+ var startWatch = (w, t) => w.since === null ? { acc: w.acc, since: t } : w;
2123
+ var stopWatch = (w, t) => w.since === null ? w : { acc: readWatch(w, t), since: null };
2124
+ function timerDigits(ms) {
2125
+ const s = Math.max(0, Math.floor(ms / 1e3));
2126
+ if (s < 3600) return pad2(Math.floor(s / 60)) + pad2(s % 60);
2127
+ return pad2(Math.floor(s / 3600) % 100) + pad2(Math.floor(s / 60) % 60);
2128
+ }
2129
+ function formatTimer(seconds) {
2130
+ const d = timerDigits(finite(seconds) * 1e3);
2131
+ return `${d.slice(0, 2)}:${d.slice(2)}`;
2132
+ }
2133
+ function upperText(display2, oat, volts) {
2134
+ if (display2 === "volts") {
2135
+ if (Number.isNaN(volts)) return ["---", "V"];
2136
+ const v = clamp(volts, 0, 99.9);
2137
+ return [v.toFixed(1).padStart(4, " "), "V"];
2138
+ }
2139
+ if (Number.isNaN(oat)) return ["---", `\xB0${display2}`];
2140
+ const t = display2 === "F" ? oat * 9 / 5 + 32 : oat;
2141
+ return [String(Math.round(clamp(t, -99, 999))).padStart(3, " "), `\xB0${display2}`];
2142
+ }
2143
+ var GLYPHS = {
2144
+ "0": "abcdef",
2145
+ "1": "bc",
2146
+ "2": "abdeg",
2147
+ "3": "abcdg",
2148
+ "4": "bcfg",
2149
+ "5": "acdfg",
2150
+ "6": "acdefg",
2151
+ "7": "abc",
2152
+ "8": "abcdefg",
2153
+ "9": "abcdfg",
2154
+ "-": "g",
2155
+ " ": ""
2156
+ };
2157
+ function segmentPaths(w, h) {
2158
+ const t = w * 0.2;
2159
+ const half = t / 2;
2160
+ const gap = t * 0.2;
2161
+ const pts = (p) => p.map(([x, y]) => `${Math.round(x * 10) / 10},${Math.round(y * 10) / 10}`).join(" ");
2162
+ const hs = (y) => {
2163
+ const x1 = half + gap;
2164
+ const x2 = w - half - gap;
2165
+ return pts([[x1, y], [x1 + half, y - half], [x2 - half, y - half], [x2, y], [x2 - half, y + half], [x1 + half, y + half]]);
2166
+ };
2167
+ const vs = (x, y1, y2) => pts([[x, y1], [x + half, y1 + half], [x + half, y2 - half], [x, y2], [x - half, y2 - half], [x - half, y1 + half]]);
2168
+ return {
2169
+ a: hs(half),
2170
+ g: hs(h / 2),
2171
+ d: hs(h - half),
2172
+ f: vs(half, half + gap, h / 2 - gap),
2173
+ b: vs(w - half, half + gap, h / 2 - gap),
2174
+ e: vs(half, h / 2 + gap, h - half - gap),
2175
+ c: vs(w - half, h / 2 + gap, h - half - gap)
2176
+ };
2177
+ }
2178
+ function Cell({ x, y, w, h, char, dot, on, off, testId }) {
2179
+ const paths = segmentPaths(w, h);
2180
+ const lit = GLYPHS[char] ?? "";
2181
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("g", { transform: `translate(${x + h * 0.05} ${y}) skewX(-5)`, "data-testid": testId, "data-char": char, children: [
2182
+ Object.keys(paths).map((s) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("polygon", { points: paths[s], fill: lit.includes(s) ? on : off }, s)),
2183
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx: w + w * 0.2, cy: h - w * 0.1, r: w * 0.1, fill: dot ? on : off })
2184
+ ] });
2185
+ }
2186
+ function digitMax(target, digits, i) {
2187
+ if (target === "ET") return [5, 9, 5, 9][i] ?? 9;
2188
+ if (target === "FT") return [9, 9, 5, 9][i] ?? 9;
2189
+ if (i === 0) return 2;
2190
+ if (i === 1) return digits[0] === 2 ? 3 : 9;
2191
+ return [5, 9][i - 2] ?? 9;
2192
+ }
2193
+ var lastDigit = (target) => target === "LT" ? 1 : 3;
2194
+ var twoDigits = (d, i) => (d[i] ?? 0) * 10 + (d[i + 1] ?? 0);
2195
+ var LCD = "#9da793";
2196
+ var INK = "#1f241d";
2197
+ var GHOST = "rgba(31,36,29,0.07)";
2198
+ var FACE_TEXT = "#e6e6e6";
2199
+ var BUTTONS = {
2200
+ oatVolts: { cx: CENTER, cy: 56, name: "O.A.T / VOLTS" },
2201
+ select: { cx: 140, cy: 330, name: "SELECT" },
2202
+ control: { cx: 260, cy: 330, name: "CONTROL" }
2203
+ };
2204
+ function DigitalClock({
2205
+ oat,
2206
+ volts,
2207
+ upperDisplay,
2208
+ defaultUpperDisplay = "volts",
2209
+ onUpperDisplayChange,
2210
+ mode,
2211
+ defaultMode = "UT",
2212
+ onModeChange,
2213
+ now,
2214
+ localOffset,
2215
+ defaultLocalOffset,
2216
+ onLocalOffsetChange,
2217
+ onTimeSet,
2218
+ flightTimeRunning = true,
2219
+ defaultFlightTime = 0,
2220
+ defaultFlightTimeAlarm = 0,
2221
+ defaultCountdown = 0,
2222
+ lowVoltage,
2223
+ highVoltage,
2224
+ onAlarm,
2225
+ ...props
2226
+ }) {
2227
+ const lcdId = useSvgId("fi-lcd");
2228
+ const clockNow = now === void 0 ? Date.now() : finite(now instanceof Date ? now.getTime() : now, Date.now());
2229
+ const clockRef = (0, import_react3.useRef)(clockNow);
2230
+ clockRef.current = clockNow;
2231
+ const readClock = () => now === void 0 ? Date.now() : clockRef.current;
2232
+ const [, setTick] = (0, import_react3.useState)(0);
2233
+ (0, import_react3.useEffect)(() => {
2234
+ const id = setInterval(() => setTick((n) => n + 1), 250);
2235
+ return () => clearInterval(id);
2236
+ }, []);
2237
+ const blinkOn = Math.floor(Date.now() / 400) % 2 === 0;
2238
+ const [innerUpper, setInnerUpper] = (0, import_react3.useState)(defaultUpperDisplay);
2239
+ const upper = upperDisplay ?? innerUpper;
2240
+ const changeUpper = (next) => {
2241
+ if (upperDisplay === void 0) setInnerUpper(next);
2242
+ onUpperDisplayChange?.(next);
2243
+ };
2244
+ const [innerMode, setInnerMode] = (0, import_react3.useState)(defaultMode);
2245
+ const current = mode ?? innerMode;
2246
+ const changeMode = (next) => {
2247
+ if (mode === void 0) setInnerMode(next);
2248
+ onModeChange?.(next);
2249
+ };
2250
+ const [correction, setCorrection] = (0, import_react3.useState)(0);
2251
+ const [innerOffset, setInnerOffset] = (0, import_react3.useState)(() => finite(defaultLocalOffset, -(/* @__PURE__ */ new Date()).getTimezoneOffset()));
2252
+ const offset = finite(localOffset, innerOffset);
2253
+ const ut = clockNow + correction;
2254
+ const utDate = new Date(ut);
2255
+ const ltDate = new Date(ut + offset * MIN);
2256
+ const [ft, setFt] = (0, import_react3.useState)(() => ({
2257
+ acc: Math.max(0, finite(defaultFlightTime)) * 1e3,
2258
+ since: flightTimeRunning ? clockNow : null
2259
+ }));
2260
+ (0, import_react3.useEffect)(() => {
2261
+ setFt((w) => flightTimeRunning ? startWatch(w, clockRef.current) : stopWatch(w, clockRef.current));
2262
+ }, [flightTimeRunning]);
2263
+ const [ftAlarm, setFtAlarm] = (0, import_react3.useState)(() => Math.max(0, finite(defaultFlightTimeAlarm)) * 1e3);
2264
+ const ftMs = readWatch(ft, clockNow);
2265
+ const [et, setEt] = (0, import_react3.useState)({ acc: 0, since: null });
2266
+ const [countdown, setCountdown] = (0, import_react3.useState)(() => Math.max(0, finite(defaultCountdown)) * 1e3);
2267
+ const etMs = readWatch(et, clockNow);
2268
+ const countingDown = countdown > 0 && etMs < countdown;
2269
+ const etRunning = et.since !== null;
2270
+ const v = finite(volts, NaN);
2271
+ const system28 = Number.isNaN(v) || v > 18;
2272
+ const low = finite(lowVoltage, system28 ? 24.5 : 12.4);
2273
+ const high = finite(highVoltage, system28 ? 32 : 16);
2274
+ const voltsBad = !Number.isNaN(v) && (v < low || v > high);
2275
+ const [voltsAck, setVoltsAck] = (0, import_react3.useState)(false);
2276
+ const [lowerAlarm, setLowerAlarm] = (0, import_react3.useState)(null);
2277
+ const fired = (0, import_react3.useRef)({ voltage: false, flightTime: false, countdown: false });
2278
+ (0, import_react3.useEffect)(() => {
2279
+ const f = fired.current;
2280
+ if (voltsBad && !f.voltage) {
2281
+ f.voltage = true;
2282
+ onAlarm?.("voltage");
2283
+ } else if (!voltsBad && f.voltage) {
2284
+ f.voltage = false;
2285
+ setVoltsAck(false);
2286
+ }
2287
+ if (countdown > 0 && etMs >= countdown && !f.countdown) {
2288
+ f.countdown = true;
2289
+ setLowerAlarm("countdown");
2290
+ changeMode("ET");
2291
+ onAlarm?.("countdown");
2292
+ }
2293
+ if (ftAlarm > 0 && ftMs >= ftAlarm && !f.flightTime) {
2294
+ f.flightTime = true;
2295
+ setLowerAlarm("flightTime");
2296
+ changeMode("FT");
2297
+ onAlarm?.("flightTime");
2298
+ }
2299
+ });
2300
+ const voltsFlashing = voltsBad && !voltsAck;
2301
+ const alarmActive = voltsFlashing || lowerAlarm !== null;
2302
+ const [editing, setEditing] = (0, import_react3.useState)(null);
2303
+ const [lampTest, setLampTest] = (0, import_react3.useState)(false);
2304
+ const startEditing = () => {
2305
+ const d = (a, b) => [Math.floor(a / 10), a % 10, Math.floor(b / 10), b % 10];
2306
+ let digits;
2307
+ if (current === "UT") digits = d(utDate.getUTCHours(), utDate.getUTCMinutes());
2308
+ else if (current === "LT") digits = d(ltDate.getUTCHours(), ltDate.getUTCMinutes());
2309
+ else if (current === "ET") digits = d(Math.floor(countdown / MIN) % 60, Math.floor(countdown / 1e3) % 60);
2310
+ else digits = d(Math.min(99, Math.floor(ftAlarm / HOUR)), Math.floor(ftAlarm / MIN) % 60);
2311
+ setEditing({ target: current, digits, index: 0 });
2312
+ };
2313
+ const commit = (e) => {
2314
+ const { target, digits } = e;
2315
+ setEditing(null);
2316
+ if (target === "UT") {
2317
+ const wanted = twoDigits(digits, 0) * HOUR + twoDigits(digits, 2) * MIN;
2318
+ const delta = mod(wanted - mod(ut, DAY) + DAY / 2, DAY) - DAY / 2;
2319
+ setCorrection(correction + delta);
2320
+ onTimeSet?.(new Date(ut + delta));
2321
+ } else if (target === "LT") {
2322
+ let next = offset + (twoDigits(digits, 0) - ltDate.getUTCHours()) * 60;
2323
+ while (next > 14 * 60) next -= 24 * 60;
2324
+ while (next < -12 * 60) next += 24 * 60;
2325
+ if (localOffset === void 0) setInnerOffset(next);
2326
+ onLocalOffsetChange?.(next);
2327
+ } else if (target === "ET") {
2328
+ setCountdown((twoDigits(digits, 0) * 60 + twoDigits(digits, 2)) * 1e3);
2329
+ setEt({ acc: 0, since: null });
2330
+ fired.current.countdown = false;
2331
+ } else {
2332
+ setFtAlarm(twoDigits(digits, 0) * HOUR + twoDigits(digits, 2) * MIN);
2333
+ fired.current.flightTime = false;
2334
+ }
2335
+ };
2336
+ const resetEt = () => {
2337
+ setEt({ acc: 0, since: null });
2338
+ fired.current.countdown = false;
2339
+ };
2340
+ const resetFt = () => {
2341
+ setFt({ acc: 0, since: flightTimeRunning ? readClock() : null });
2342
+ fired.current.flightTime = false;
2343
+ };
2344
+ const click = (b) => {
2345
+ if (b === "oatVolts") return changeUpper(UPPER[(UPPER.indexOf(upper) + 1) % UPPER.length]);
2346
+ if (editing) {
2347
+ if (b === "control") {
2348
+ const digits = [...editing.digits];
2349
+ const i = editing.index;
2350
+ const d = digits[i] ?? 0;
2351
+ digits[i] = d >= digitMax(editing.target, digits, i) ? 0 : d + 1;
2352
+ if (i === 0 && editing.target !== "ET" && editing.target !== "FT") digits[1] = Math.min(digits[1] ?? 0, digitMax(editing.target, digits, 1));
2353
+ return setEditing({ ...editing, digits });
2354
+ }
2355
+ if (editing.index >= lastDigit(editing.target)) return commit(editing);
2356
+ return setEditing({ ...editing, index: editing.index + 1 });
2357
+ }
2358
+ if (b === "select") return changeMode(MODES[(MODES.indexOf(current) + 1) % MODES.length]);
2359
+ if (current === "ET") {
2360
+ if (etRunning) setEt(stopWatch(et, readClock()));
2361
+ else if (et.acc > 0) resetEt();
2362
+ else setEt(startWatch(et, readClock()));
2363
+ }
2364
+ };
2365
+ const hold = (b) => {
2366
+ if (b === "oatVolts") {
2367
+ setLampTest(true);
2368
+ return true;
2369
+ }
2370
+ if (b === "select") {
2371
+ if (editing) commit(editing);
2372
+ else startEditing();
2373
+ return true;
2374
+ }
2375
+ if (editing) return false;
2376
+ if (current === "FT") resetFt();
2377
+ else if (current === "ET") resetEt();
2378
+ else return false;
2379
+ return true;
2380
+ };
2381
+ const both = () => editing ? commit(editing) : startEditing();
2382
+ const acknowledge = () => {
2383
+ if (voltsBad) setVoltsAck(true);
2384
+ setLowerAlarm(null);
2385
+ };
2386
+ const actions = (0, import_react3.useRef)({ click, hold, both, acknowledge, alarmActive });
2387
+ actions.current = { click, hold, both, acknowledge, alarmActive };
2388
+ const presses = (0, import_react3.useRef)({
2389
+ oatVolts: { down: false, used: false },
2390
+ select: { down: false, used: false },
2391
+ control: { down: false, used: false }
2392
+ });
2393
+ const [pressed, setPressed] = (0, import_react3.useState)(null);
2394
+ (0, import_react3.useEffect)(() => () => Object.values(presses.current).forEach((p) => clearTimeout(p.timer)), []);
2395
+ const press = (b) => {
2396
+ const p = presses.current[b];
2397
+ if (p.down) return;
2398
+ p.down = true;
2399
+ p.used = false;
2400
+ setPressed(b);
2401
+ const a = actions.current;
2402
+ if (a.alarmActive) {
2403
+ a.acknowledge();
2404
+ p.used = true;
2405
+ return;
2406
+ }
2407
+ const other = b === "select" ? presses.current.control : b === "control" ? presses.current.select : null;
2408
+ if (other?.down) {
2409
+ clearTimeout(other.timer);
2410
+ other.used = true;
2411
+ p.used = true;
2412
+ a.both();
2413
+ return;
2414
+ }
2415
+ p.timer = setTimeout(() => {
2416
+ if (p.down && !p.used) p.used = actions.current.hold(b);
2417
+ }, HOLD_TIME);
2418
+ };
2419
+ const release = (b, cancel = false) => {
2420
+ const p = presses.current[b];
2421
+ if (!p.down) return;
2422
+ p.down = false;
2423
+ clearTimeout(p.timer);
2424
+ setPressed((x) => x === b ? null : x);
2425
+ if (b === "oatVolts") setLampTest(false);
2426
+ if (!p.used && !cancel) actions.current.click(b);
2427
+ };
2428
+ const oatC = finite(oat, NaN);
2429
+ const shownUpper = voltsFlashing ? "volts" : upper;
2430
+ const [upperDigits, unit] = lampTest ? ["88.8", "V"] : upperText(shownUpper, oatC, v);
2431
+ const upperCells = [];
2432
+ for (const ch of upperDigits) {
2433
+ const prev = upperCells[upperCells.length - 1];
2434
+ if (ch === "." && prev) prev.dot = true;
2435
+ else upperCells.push({ char: ch, dot: false });
2436
+ }
2437
+ while (upperCells.length < 3) upperCells.unshift({ char: " ", dot: false });
2438
+ const upperVisible = !voltsFlashing || blinkOn;
2439
+ let lowerDigits;
2440
+ if (lampTest) lowerDigits = "8888";
2441
+ else if (editing) {
2442
+ const d = editing.digits.join("");
2443
+ lowerDigits = editing.target === "LT" ? d.slice(0, 2) + pad2(ltDate.getUTCMinutes()) : d;
2444
+ } else if (current === "UT") lowerDigits = pad2(utDate.getUTCHours()) + pad2(utDate.getUTCMinutes());
2445
+ else if (current === "LT") lowerDigits = pad2(ltDate.getUTCHours()) + pad2(ltDate.getUTCMinutes());
2446
+ else if (current === "FT") lowerDigits = timerDigits(ftMs);
2447
+ else lowerDigits = timerDigits(countingDown ? Math.ceil((countdown - etMs) / 1e3) * 1e3 : countdown > 0 ? etMs - countdown : etMs);
2448
+ const lowerVisible = lowerAlarm === null || blinkOn;
2449
+ const shownMode = editing ? editing.target : current;
2450
+ const upperLabel = upperText(shownUpper, oatC, v);
2451
+ const lowerLabel = `${lowerDigits.slice(0, 2)}:${lowerDigits.slice(2)}`;
2452
+ const state = shownMode === "ET" ? etRunning ? countingDown ? " counting down" : " running" : et.acc > 0 ? " stopped" : "" : shownMode === "FT" && !flightTimeRunning ? " stopped" : "";
2453
+ const label2 = `Clock: ${shownUpper === "volts" ? `${upperLabel[0].trim()} volts` : `OAT ${upperLabel[0].trim()} ${upperLabel[1]}`}${voltsBad ? v < low ? " LOW" : " HIGH" : ""}, ${shownMode} ${lowerLabel}${state}${editing ? " (setting)" : ""}`;
2454
+ const labelPos = { UT: [86, 202], LT: [128, 202], FT: [86, 246], ET: [128, 246] };
2455
+ const DW = 32;
2456
+ const DH = 58;
2457
+ const lowerX = [166, 206, 262, 302];
2458
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(InstrumentFrame, { ...props, role: "group", label: label2, children: [
2459
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("linearGradient", { id: lcdId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
2460
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("stop", { offset: "0", stopColor: "#7f8977" }),
2461
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("stop", { offset: "0.18", stopColor: LCD }),
2462
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("stop", { offset: "1", stopColor: "#a9b29f" })
2463
+ ] }) }),
2464
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("g", { fill: FACE_TEXT, fontSize: "16", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
2465
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("text", { x: "148", y: "80", children: "O.A.T" }),
2466
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("text", { x: "256", y: "80", children: "VOLTS" }),
2467
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("text", { x: "140", y: "294", children: "SELECT" }),
2468
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("text", { x: "260", y: "294", children: "CONTROL" })
2469
+ ] }),
2470
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "104", y: "94", width: "192", height: "66", rx: "4", fill: "#0b0b0b" }),
2471
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "108", y: "98", width: "184", height: "58", rx: "2", fill: `url(#${lcdId})` }),
2472
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("g", { "data-testid": "clock-upper", "data-unit": unit, opacity: upperVisible ? 1 : 0, children: [
2473
+ upperCells.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Cell, { x: 132 + i * 36, y: 104, w: 26, h: 46, char: c.char, dot: c.dot, on: INK, off: GHOST, testId: `clock-upper-${i}` }, i)),
2474
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("text", { x: "244", y: "129", fill: INK, fontSize: "34", fontWeight: "bold", dominantBaseline: "central", children: unit })
2475
+ ] }),
2476
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "56", y: "170", width: "288", height: "104", rx: "4", fill: "#0b0b0b" }),
2477
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "60", y: "174", width: "280", height: "96", rx: "2", fill: `url(#${lcdId})` }),
2478
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("g", { fill: INK, fontSize: "17", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("text", { x: labelPos[m][0], y: labelPos[m][1], children: m }, m)) }),
2479
+ MODES.map((m) => {
2480
+ const [x, y] = labelPos[m];
2481
+ const top = y < 224;
2482
+ const points = top ? `${x - 8},224 ${x + 8},224 ${x},215` : `${x - 8},220 ${x + 8},220 ${x},229`;
2483
+ const active = lampTest || m === shownMode;
2484
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("polygon", { "data-testid": `clock-mode-${m}`, "data-active": active, points, fill: active ? INK : GHOST }, m);
2485
+ }),
2486
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("g", { "data-testid": "clock-lower", opacity: lowerVisible ? 1 : 0, children: [
2487
+ lowerX.map((x, i) => {
2488
+ const blank = editing !== null && i === editing.index && !blinkOn;
2489
+ const ch = blank ? " " : lowerDigits[i] ?? " ";
2490
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Cell, { x, y: 193, w: DW, h: DH, char: ch, on: INK, off: GHOST, testId: `clock-lower-${i}` }, i);
2491
+ }),
2492
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx: "253", cy: "210", r: "4", fill: INK }),
2493
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx: "249", cy: "236", r: "4", fill: INK })
2494
+ ] }),
2495
+ Object.keys(BUTTONS).map((b) => {
2496
+ const { cx, cy, name } = BUTTONS[b];
2497
+ const down = pressed === b;
2498
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2499
+ "g",
2500
+ {
2501
+ role: "button",
2502
+ tabIndex: 0,
2503
+ "aria-label": name,
2504
+ "data-testid": `clock-button-${b}`,
2505
+ style: { cursor: "pointer", outline: "none", touchAction: "none" },
2506
+ onPointerDown: (e) => {
2507
+ e.preventDefault();
2508
+ press(b);
2509
+ },
2510
+ onPointerUp: () => release(b),
2511
+ onPointerLeave: () => release(b, true),
2512
+ onPointerCancel: () => release(b, true),
2513
+ onKeyDown: (e) => {
2514
+ if (e.key !== "Enter" && e.key !== " ") return;
2515
+ e.preventDefault();
2516
+ if (!e.repeat) press(b);
2517
+ },
2518
+ onKeyUp: (e) => {
2519
+ if (e.key === "Enter" || e.key === " ") release(b);
2520
+ },
2521
+ onBlur: () => release(b, true),
2522
+ children: [
2523
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx, cy, r: "24", fill: "transparent" }),
2524
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx, cy: cy + 2, r: "17", fill: "#000", opacity: "0.6" }),
2525
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx, cy: cy + (down ? 1.5 : 0), r: "15", fill: down ? "#bdbdbd" : "#ececec", stroke: "#8a8a8a", strokeWidth: "1.5" })
2526
+ ]
2527
+ },
2528
+ b
2529
+ );
2530
+ })
2531
+ ] });
2532
+ }
2533
+
2534
+ // src/components/DualGauge.tsx
2535
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2536
+ var GREEN6 = "#2fb54a";
2537
+ var YELLOW4 = "#f2c200";
2538
+ var RED5 = "#e02020";
2539
+ var SWEEP2 = 56;
2540
+ var PIVOT_OFFSET = 130;
2541
+ var R = 118;
2542
+ var pivotX = (side) => CENTER + side * PIVOT_OFFSET;
2543
+ var angleAt = (side, fraction) => side < 0 ? 90 + SWEEP2 - fraction * 2 * SWEEP2 : 270 - SWEEP2 + fraction * 2 * SWEEP2;
2544
+ var round24 = (n) => Math.round(n * 100) / 100;
2545
+ function resolve2(scale) {
2546
+ const min = finite(scale?.min, 0);
2547
+ const rawMax = finite(scale?.max, 100);
2548
+ const max = rawMax > min ? rawMax : min + 1;
2549
+ const value = clamp(finite(scale?.value, min), min, max);
2550
+ return { ...scale, min, max, value };
2551
+ }
2552
+ function Half({ side, scale, duration }) {
2553
+ const px = pivotX(side);
2554
+ const frac = (v) => (clamp(v, scale.min, scale.max) - scale.min) / (scale.max - scale.min);
2555
+ const deg2 = (v) => angleAt(side, frac(v));
2556
+ const band = (b, color, key) => {
2557
+ if (!b) return null;
2558
+ const a = Math.min(deg2(b[0]), deg2(b[1]));
2559
+ const c = Math.max(deg2(b[0]), deg2(b[1]));
2560
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: arcPath(R - 5, a, c, px, CENTER), stroke: color, strokeWidth: "10", fill: "none" }, key);
2561
+ };
2562
+ const ticks = Math.max(1, Math.round(finite(scale.ticks, 10)));
2563
+ const marks = (scale.marks ?? [scale.min, scale.max]).map((m) => typeof m === "number" ? { value: m, text: String(m) } : m);
2564
+ const labelX = CENTER + side * 76;
2565
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("g", { "data-testid": `dual-${side < 0 ? "left" : "right"}`, children: [
2566
+ band(scale.green, GREEN6, "green"),
2567
+ band(scale.yellow, YELLOW4, "yellow"),
2568
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("g", { stroke: "#fff", strokeLinecap: "round", children: [
2569
+ Array.from({ length: ticks + 1 }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: tickPath(R, R - 10, angleAt(side, i / ticks), px, CENTER), strokeWidth: "2" }, i)),
2570
+ marks.map(({ value }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: tickPath(R, R - 18, deg2(value), px, CENTER), strokeWidth: "3.5" }, value))
2571
+ ] }),
2572
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("g", { stroke: RED5, strokeWidth: "5", children: [scale.low, scale.high].map(
2573
+ (l, i) => typeof l === "number" && Number.isFinite(l) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: tickPath(R + 4, R - 20, deg2(l), px, CENTER) }, i) : null
2574
+ ) }),
2575
+ marks.map(({ value, text }) => {
2576
+ const [x, y] = polar(R - 36, deg2(value), px, CENTER);
2577
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("text", { x, y, fill: "#fff", fontSize: "19", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: text }, `${value}-${text}`);
2578
+ }),
2579
+ scale.label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("text", { x: labelX, y: CENTER - 116, fill: "#ddd", fontSize: scale.label.length > 3 ? 15 : 22, fontWeight: "bold", textAnchor: "middle", children: scale.label }),
2580
+ scale.unit && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("text", { x: labelX, y: CENTER + 128, fill: "#bbb", fontSize: "14", textAnchor: "middle", children: scale.unit }),
2581
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("g", { "data-testid": `dual-${side < 0 ? "left" : "right"}-needle`, style: motionStyle(`rotate(${round24(deg2(scale.value))}deg)`, duration, px, CENTER), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: `M ${px - 4} ${CENTER + 14} L ${px - 3} ${CENTER - R + 22} L ${px} ${CENTER - R + 6} L ${px + 3} ${CENTER - R + 22} L ${px + 4} ${CENTER + 14} Z`, fill: "#fff" }) }),
2582
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: px, cy: CENTER, r: "11", fill: "#2a2a2a", stroke: "#555", strokeWidth: "2" })
2583
+ ] });
2584
+ }
2585
+ var describe = (s, fallback) => `${s.label ?? fallback} ${s.value.toFixed(Math.max(0, Math.floor(finite(s.decimals, 0))))}${s.unit ? ` ${s.unit}` : ""}`;
2586
+ function DualGauge({ left, right, label: label2, sublabel, ...props }) {
2587
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2588
+ const l = resolve2(left);
2589
+ const r = resolve2(right);
2590
+ const title = `${label2 ?? "Gauge"}: ${describe(l, "left")}, ${describe(r, "right")}`;
2591
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(InstrumentFrame, { ...props, label: title, children: [
2592
+ label2 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("text", { x: CENTER, y: CENTER - 146, fill: "#eee", fontSize: "17", fontWeight: "bold", textAnchor: "middle", letterSpacing: "1", children: label2 }),
2593
+ sublabel && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("text", { x: CENTER, y: CENTER + 158, fill: "#bbb", fontSize: "14", textAnchor: "middle", letterSpacing: "1", children: sublabel }),
2594
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Half, { side: -1, scale: l, duration }),
2595
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Half, { side: 1, scale: r, duration })
2596
+ ] });
2597
+ }
2598
+ var FUEL_QUANTITY_SCALE = { min: 0, max: 44, marks: [0, 10, 20, 30, { value: 44, text: "F" }], ticks: 11, yellow: [0, 5], low: 0, unit: "GAL" };
2599
+ var OIL_TEMPERATURE_SCALE = { label: "OIL TEMP", min: 75, max: 250, marks: [100, 150, 200, 250], ticks: 7, green: [100, 245], high: 245, unit: "\xB0F" };
2600
+ var OIL_PRESSURE_SCALE = { label: "OIL PRESS", min: 0, max: 115, marks: [0, 50, 100], ticks: 23, green: [50, 90], low: 20, high: 115, unit: "PSI" };
2601
+ var VACUUM_SCALE = { label: "VAC", min: 3, max: 7, marks: [3, 5, 7], ticks: 8, green: [4.5, 5.5], unit: "IN HG", decimals: 1 };
2602
+ var AMMETER_SCALE = { label: "AMP", min: -60, max: 60, marks: [{ value: -60, text: "\u2212" }, 0, { value: 60, text: "+" }], ticks: 12, unit: "AMPS" };
2603
+ var EGT_SCALE = { label: "EGT", min: 1250, max: 1650, marks: [], ticks: 8, unit: "\xB0F" };
2604
+ var FUEL_FLOW_SCALE = { label: "FUEL FLOW", min: 0, max: 20, marks: [0, 10, 20], ticks: 10, green: [0, 17], unit: "GAL/HR", decimals: 1 };
2605
+ var MANIFOLD_SCALE = { label: "MAN PRESS", min: 10, max: 35, marks: [10, 20, 30], ticks: 25, green: [15, 23], unit: "IN HG", decimals: 1 };
2606
+ function FuelQuantityGauge({ leftQuantity, rightQuantity, leftScale, rightScale, ...props }) {
2607
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2608
+ DualGauge,
2609
+ {
2610
+ ...props,
2611
+ label: "FUEL QTY",
2612
+ left: { ...FUEL_QUANTITY_SCALE, label: "L", ...leftScale, value: leftQuantity },
2613
+ right: { ...FUEL_QUANTITY_SCALE, label: "R", ...rightScale, value: rightQuantity }
2614
+ }
2615
+ );
2616
+ }
2617
+ function OilGauge({ temperature, pressure, leftScale, rightScale, ...props }) {
2618
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2619
+ DualGauge,
2620
+ {
2621
+ ...props,
2622
+ label: "OIL",
2623
+ left: { ...OIL_TEMPERATURE_SCALE, ...leftScale, value: temperature },
2624
+ right: { ...OIL_PRESSURE_SCALE, ...rightScale, value: pressure }
2625
+ }
2626
+ );
2627
+ }
2628
+ function VacuumAmmeterGauge({ vacuum, amps, leftScale, rightScale, ...props }) {
2629
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2630
+ DualGauge,
2631
+ {
2632
+ ...props,
2633
+ label: "VAC / AMP",
2634
+ left: { ...VACUUM_SCALE, ...leftScale, value: vacuum },
2635
+ right: { ...AMMETER_SCALE, ...rightScale, value: amps }
2636
+ }
2637
+ );
2638
+ }
2639
+ function EgtFuelFlowGauge({ egt, fuelFlow, leftScale, rightScale, ...props }) {
2640
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2641
+ DualGauge,
2642
+ {
2643
+ ...props,
2644
+ label: "EGT / FF",
2645
+ left: { ...EGT_SCALE, ...leftScale, value: egt },
2646
+ right: { ...FUEL_FLOW_SCALE, ...rightScale, value: fuelFlow }
2647
+ }
2648
+ );
2649
+ }
2650
+ function ManifoldFuelFlowGauge({ manifold, fuelFlow, leftScale, rightScale, ...props }) {
2651
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2652
+ DualGauge,
2653
+ {
2654
+ ...props,
2655
+ label: "MAP / FF",
2656
+ left: { ...MANIFOLD_SCALE, ...leftScale, value: manifold },
2657
+ right: { ...FUEL_FLOW_SCALE, ...rightScale, value: fuelFlow }
2658
+ }
2659
+ );
2660
+ }
2661
+
2662
+ // src/components/Odometer.tsx
2663
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2664
+ function drumPositions(value, digits) {
2665
+ const n = Math.max(1, Math.floor(digits));
2666
+ const span = 10 ** n;
2667
+ const tenths = (finite(value) * 10 % span + span) % span;
2668
+ return Array.from({ length: n }, (_, i) => {
2669
+ if (i === 0) return Math.round(tenths % 10 * 1e3) / 1e3;
2670
+ const unit = 10 ** i;
2671
+ const digit = Math.floor(tenths / unit) % 10;
2672
+ const below = tenths % unit;
2673
+ const carry = below > unit - 1 ? below - (unit - 1) : 0;
2674
+ return Math.round((digit + carry) * 1e3) / 1e3;
2675
+ });
2676
+ }
2677
+ function Odometer({ value, digits, x, y, digitWidth, height, clipId, testId = "odometer" }) {
2678
+ const positions = drumPositions(value, digits);
2679
+ const n = positions.length;
2680
+ const left = x - n * digitWidth / 2;
2681
+ const top = y - height / 2;
2682
+ const fontSize = height * 0.72;
2683
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("g", { "data-testid": testId, children: [
2684
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: left, y: top, width: n * digitWidth, height }) }) }),
2685
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: left - 4, y: top - 4, width: n * digitWidth + 8, height: height + 8, rx: "3", fill: "#000", stroke: "#555", strokeWidth: "2" }),
2686
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("g", { clipPath: `url(#${clipId})`, children: positions.map((p, k) => {
2687
+ const i = n - 1 - k;
2688
+ const dx = left + i * digitWidth;
2689
+ const tenths = k === 0;
2690
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("g", { children: [
2691
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: dx + 1, y: top, width: digitWidth - 2, height, fill: tenths ? "#eee" : "#151515" }),
2692
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("g", { "data-testid": `${testId}-drum-${k}`, transform: `translate(0 ${Math.round(-p * height * 100) / 100})`, children: Array.from({ length: 11 }, (_, d) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2693
+ "text",
2694
+ {
2695
+ x: dx + digitWidth / 2,
2696
+ y: top + height / 2 + d * height,
2697
+ fill: tenths ? "#111" : "#f2f2f2",
2698
+ fontSize,
2699
+ fontFamily: "monospace",
2700
+ fontWeight: "bold",
2701
+ textAnchor: "middle",
2702
+ dominantBaseline: "central",
2703
+ children: d % 10
2704
+ },
2705
+ d
2706
+ )) })
2707
+ ] }, k);
2708
+ }) }),
2709
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: left, y: top, width: n * digitWidth, height: height * 0.18, fill: "#000", opacity: "0.35", pointerEvents: "none" }),
2710
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: left, y: top + height * 0.82, width: n * digitWidth, height: height * 0.18, fill: "#000", opacity: "0.35", pointerEvents: "none" })
2711
+ ] });
2712
+ }
2713
+
2714
+ // src/components/Tachometer.tsx
2715
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2716
+ var START = -135;
2717
+ var SWEEP3 = 270;
2718
+ function Tachometer({ rpm = 0, max = 3500, green = [2e3, 2400], redline = 2400, hours, ...props }) {
2719
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2720
+ const clipId = useSvgId("fi-tach");
2721
+ const top = Math.max(500, finite(max, 3500));
2722
+ const value = clamp(finite(rpm), 0, top);
2723
+ const angle = (v) => START + clamp(v, 0, top) / top * SWEEP3;
2724
+ const showHours = typeof hours === "number" && Number.isFinite(hours);
2725
+ const engineHours = showHours ? Math.max(0, hours) : 0;
2726
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(InstrumentFrame, { ...props, label: `Tachometer: ${Math.round(value)} RPM${showHours ? `, ${engineHours.toFixed(1)} hours` : ""}`, children: [
2727
+ green && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: arcPath(166, angle(green[0]), angle(green[1])), stroke: "#2fb54a", strokeWidth: "12", fill: "none" }),
2728
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, top, 100).map((v) => {
2729
+ const major = v % 500 === 0;
2730
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: tickPath(178, major ? 148 : 162, angle(v)), strokeWidth: major ? 3.5 : 2 }, v);
2731
+ }) }),
2732
+ typeof redline === "number" && Number.isFinite(redline) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: tickPath(180, 146, angle(redline)), stroke: "#e02020", strokeWidth: "6" }),
2733
+ range(0, top, 500).map((v) => {
2734
+ const [x, y] = polar(122, angle(v));
2735
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("text", { x, y, fill: "#fff", fontSize: "26", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: v / 100 }, v);
2736
+ }),
2737
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("text", { x: CENTER, y: CENTER - 50, fill: "#ddd", fontSize: "20", fontWeight: "bold", textAnchor: "middle", children: "RPM" }),
2738
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("text", { x: CENTER, y: CENTER - 28, fill: "#bbb", fontSize: "13", textAnchor: "middle", children: "\xD7 100" }),
2739
+ showHours && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
2740
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Odometer, { value: engineHours, digits: 6, x: CENTER, y: CENTER + 70, digitWidth: 20, height: 28, clipId, testId: "tach-hours" }),
2741
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("text", { x: CENTER, y: CENTER + 103, fill: "#bbb", fontSize: "11", textAnchor: "middle", letterSpacing: "2", children: "HOURS" })
2742
+ ] }),
2743
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("g", { "data-testid": "tach-needle", style: motionStyle(`rotate(${Math.round(angle(value) * 100) / 100}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: `M ${CENTER - 5} ${CENTER + 30} L ${CENTER - 4} ${CENTER - 140} L ${CENTER} ${CENTER - 165} L ${CENTER + 4} ${CENTER - 140} L ${CENTER + 5} ${CENTER + 30} Z`, fill: "#fff" }) }),
2744
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Hub, {})
2745
+ ] });
2746
+ }
2747
+
2748
+ // src/components/MagneticCompass.tsx
2749
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2750
+ var CARDINALS7 = { 0: "N", 90: "E", 180: "S", 270: "W" };
2751
+ var PPD = 4;
2752
+ var WINDOW_W = 284;
2753
+ var WINDOW_H = 120;
2754
+ var WINDOW_Y = CENTER - 70;
2755
+ var SPAN = 90;
2756
+ var norm6 = (deg2) => (deg2 % 360 + 360) % 360;
2757
+ var cardLabel = (deg2) => CARDINALS7[Math.round(norm6(deg2)) % 360] ?? String(Math.round(norm6(deg2)));
2758
+ var pad33 = (deg2) => String(Math.round(norm6(deg2)) % 360 || 360).padStart(3, "0");
2759
+ function MagneticCompass({ heading = 0, deviationCard, ...props }) {
2760
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2761
+ const hdg = finite(heading);
2762
+ const display2 = useContinuousAngle(hdg);
2763
+ const base = Math.round(display2 / 5) * 5;
2764
+ const cardX = (d) => CENTER - d * PPD;
2765
+ const left = CENTER - WINDOW_W / 2;
2766
+ const clipId = useSvgId("fi-compass-window");
2767
+ const shadeId = useSvgId("fi-compass-shade");
2768
+ const rows = (deviationCard ?? []).slice(0, 6);
2769
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(InstrumentFrame, { ...props, label: `Magnetic compass: ${pad33(hdg)}\xB0`, children: [
2770
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("defs", { children: [
2771
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: left, y: WINDOW_Y, width: WINDOW_W, height: WINDOW_H, rx: "16" }) }),
2772
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("linearGradient", { id: shadeId, x1: "0", y1: "0", x2: "1", y2: "0", children: [
2773
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { offset: "0", stopColor: "#000", stopOpacity: "0.85" }),
2774
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { offset: "0.22", stopColor: "#000", stopOpacity: "0" }),
2775
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { offset: "0.78", stopColor: "#000", stopOpacity: "0" }),
2776
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { offset: "1", stopColor: "#000", stopOpacity: "0.85" })
2777
+ ] })
2778
+ ] }),
2779
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: left - 6, y: WINDOW_Y - 6, width: WINDOW_W + 12, height: WINDOW_H + 12, rx: "20", fill: "#000", stroke: "#444", strokeWidth: "3" }),
2780
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { clipPath: `url(#${clipId})`, children: [
2781
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: left, y: WINDOW_Y, width: WINDOW_W, height: WINDOW_H, fill: "#16181a" }),
2782
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("g", { "data-testid": "compass-card", style: motionStyle(`translate(${Math.round(display2 * PPD * 100) / 100}px, 0px)`, duration), children: range(base - SPAN, base + SPAN, 5).map((d) => {
2783
+ const x = cardX(d);
2784
+ const n = norm6(d);
2785
+ const label2 = n % 30 === 0 ? CARDINALS7[n] ?? String(n / 10) : null;
2786
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { children: [
2787
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: `M ${x} ${WINDOW_Y + 4} v ${n % 10 === 0 ? 26 : 16}`, stroke: "#eee", strokeWidth: n % 10 === 0 ? 3 : 2 }),
2788
+ label2 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("text", { x, y: WINDOW_Y + 66, fill: CARDINALS7[n] ? "#fff" : "#e8e8e8", fontSize: CARDINALS7[n] ? 40 : 34, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 })
2789
+ ] }, d);
2790
+ }) }),
2791
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: left, y: WINDOW_Y, width: WINDOW_W, height: WINDOW_H, fill: `url(#${shadeId})`, pointerEvents: "none" })
2792
+ ] }),
2793
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: `M ${CENTER} ${WINDOW_Y - 4} V ${WINDOW_Y + WINDOW_H + 4}`, stroke: "#ff5a2a", strokeWidth: "3" }),
2794
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("text", { x: CENTER, y: WINDOW_Y - 24, fill: "#ccc", fontSize: "16", textAnchor: "middle", letterSpacing: "3", children: "COMPASS" }),
2795
+ rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { "data-testid": "compass-deviation-card", fontSize: "13", fill: "#222", textAnchor: "middle", dominantBaseline: "central", children: [
2796
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: CENTER - 136, y: CENTER + 70, width: "272", height: "64", rx: "4", fill: "#ececec" }),
2797
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("text", { x: CENTER - 110, y: CENTER + 86, fontWeight: "bold", children: "FOR" }),
2798
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("text", { x: CENTER - 110, y: CENTER + 116, fontWeight: "bold", children: "STEER" }),
2799
+ rows.map((r, i) => {
2800
+ const x = CENTER - 56 + i * (166 / Math.max(1, rows.length - 1));
2801
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { children: [
2802
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("text", { x, y: CENTER + 86, children: cardLabel(finite(r.for)) }),
2803
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("text", { x, y: CENTER + 116, children: Math.round(norm6(finite(r.steer))) })
2804
+ ] }, i);
2805
+ })
2806
+ ] })
2807
+ ] });
2808
+ }
2809
+
2810
+ // src/components/TrimIndicator.tsx
2811
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2812
+ var SLOT_X = 248;
2813
+ var TOP2 = 74;
2814
+ var BOTTOM2 = 326;
2815
+ var MID = (TOP2 + BOTTOM2) / 2;
2816
+ var HALF2 = (BOTTOM2 - TOP2) / 2;
2817
+ var WHEEL_X = 150;
2818
+ var WHEEL_W = 56;
2819
+ var WHEEL_TRAVEL = 140;
2820
+ var RIB = 14;
2821
+ var round25 = (n) => Math.round(n * 100) / 100;
2822
+ function TrimIndicator({ trim = 0, takeoff = [0.05, 0.35], ...props }) {
2823
+ const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
2824
+ const clipId = useSvgId("fi-trim-wheel");
2825
+ const value = clamp(finite(trim), -1, 1);
2826
+ const yAt = (t) => round25(MID + clamp(t, -1, 1) * HALF2);
2827
+ const inTakeoff = takeoff ? value >= Math.min(...takeoff) && value <= Math.max(...takeoff) : false;
2828
+ const percent = Math.round(Math.abs(value) * 100);
2829
+ const describe2 = percent === 0 ? "neutral" : `${percent}% nose ${value > 0 ? "up" : "down"}`;
2830
+ const ribCount = Math.ceil((BOTTOM2 - TOP2 + 2 * WHEEL_TRAVEL) / RIB) + 1;
2831
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(InstrumentFrame, { ...props, label: `Elevator trim: ${describe2}${inTakeoff ? ", take-off range" : ""}`, children: [
2832
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2, width: WHEEL_W, height: BOTTOM2 - TOP2, rx: "10" }) }) }),
2833
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: WHEEL_X - WHEEL_W / 2 - 6, y: TOP2 - 6, width: WHEEL_W + 12, height: BOTTOM2 - TOP2 + 12, rx: "14", fill: "#000", stroke: "#333", strokeWidth: "2" }),
2834
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("g", { clipPath: `url(#${clipId})`, children: [
2835
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2, width: WHEEL_W, height: BOTTOM2 - TOP2, fill: "#2c2c2c" }),
2836
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("g", { "data-testid": "trim-wheel", style: motionStyle(`translate(0px, ${round25(value * WHEEL_TRAVEL)}px)`, duration), children: Array.from({ length: ribCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2 - WHEEL_TRAVEL + i * RIB, width: WHEEL_W, height: RIB / 2, fill: "#121212" }, i)) }),
2837
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: WHEEL_X - WHEEL_W / 2, y: TOP2, width: WHEEL_W, height: "40", fill: "#000", opacity: "0.5" }),
2838
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: WHEEL_X - WHEEL_W / 2, y: BOTTOM2 - 40, width: WHEEL_W, height: "40", fill: "#000", opacity: "0.5" })
2839
+ ] }),
2840
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: SLOT_X - 7, y: TOP2, width: "14", height: BOTTOM2 - TOP2, rx: "7", fill: "#000", stroke: "#444", strokeWidth: "2" }),
2841
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("g", { stroke: "#ddd", strokeWidth: "2", children: Array.from({ length: 11 }, (_, i) => {
2842
+ const y = TOP2 + i * (BOTTOM2 - TOP2) / 10;
2843
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: `M ${SLOT_X + 12} ${y} h ${i === 5 ? 20 : 12}` }, i);
2844
+ }) }),
2845
+ takeoff && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("g", { "data-testid": "trim-takeoff", children: [
2846
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: SLOT_X - 20, y: yAt(Math.min(...takeoff)), width: "8", height: Math.max(2, yAt(Math.max(...takeoff)) - yAt(Math.min(...takeoff))), fill: "#fff" }),
2847
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2848
+ "text",
2849
+ {
2850
+ x: SLOT_X - 30,
2851
+ y: (yAt(takeoff[0]) + yAt(takeoff[1])) / 2,
2852
+ fill: "#fff",
2853
+ fontSize: "12",
2854
+ fontWeight: "bold",
2855
+ textAnchor: "end",
2856
+ dominantBaseline: "central",
2857
+ children: "TAKE OFF"
2858
+ }
2859
+ )
2860
+ ] }),
2861
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("g", { "data-testid": "trim-pointer", style: motionStyle(`translate(0px, ${round25(value * HALF2)}px)`, duration), children: [
2862
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: `M ${SLOT_X + 8} ${MID} l 26 -11 v 22 z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }),
2863
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("rect", { x: SLOT_X - 5, y: MID - 4, width: "10", height: "8", rx: "2", fill: "#fff" })
2864
+ ] }),
2865
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("g", { fill: "#ddd", fontSize: "15", fontWeight: "bold", textAnchor: "middle", children: [
2866
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("text", { x: CENTER + 92, y: TOP2 - 14, children: "NOSE" }),
2867
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("text", { x: CENTER + 92, y: TOP2 + 2, children: "DOWN" }),
2868
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("text", { x: CENTER + 92, y: BOTTOM2 + 8, children: "NOSE" }),
2869
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("text", { x: CENTER + 92, y: BOTTOM2 + 24, children: "UP" })
2870
+ ] }),
2871
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("text", { x: WHEEL_X, y: BOTTOM2 + 32, fill: "#ccc", fontSize: "14", textAnchor: "middle", letterSpacing: "2", children: "TRIM" })
2872
+ ] });
2873
+ }
2874
+
2875
+ // src/components/HobbsMeter.tsx
2876
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2877
+ var W = 400;
2878
+ var H = 170;
2879
+ function HobbsMeter({ hours = 0, digits = 6, running = false, label: label2 = "HOURS", ...props }) {
2880
+ const clipId = useSvgId("fi-hobbs");
2881
+ const value = Math.max(0, finite(hours));
2882
+ const n = Math.min(8, Math.max(2, Math.floor(finite(digits, 6))));
2883
+ const digitW = Math.min(40, 260 / n);
2884
+ const counterRight = W / 2 + 10 + n * digitW / 2;
2885
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(PanelFrame, { ...props, width: W, height: H, label: `${label2}: ${value.toFixed(1)}${running ? ", running" : ""}`, children: [
2886
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "44", y: "18", width: W - 88, height: H - 36, rx: "10", fill: "#111", stroke: "#000", strokeWidth: "3" }),
2887
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("text", { x: W / 2 + 10, y: "44", fill: "#ddd", fontSize: "15", fontWeight: "bold", textAnchor: "middle", letterSpacing: "3", children: label2 }),
2888
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Odometer, { value, digits: n, x: W / 2 + 10, y: 92, digitWidth: digitW, height: 52, clipId, testId: "hobbs" }),
2889
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("text", { x: counterRight - digitW / 2, y: "136", fill: "#999", fontSize: "11", textAnchor: "middle", children: "1/10" }),
2890
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("g", { "data-testid": "hobbs-running", "data-running": running ? "true" : "false", children: [
2891
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { cx: "66", cy: "92", r: "13", fill: "#000", stroke: "#555", strokeWidth: "2" }),
2892
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("g", { children: [
2893
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M 66 92 L 66 80 A 12 12 0 0 1 76.4 86 Z", fill: running ? "#eee" : "#666" }),
2894
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M 66 92 L 66 104 A 12 12 0 0 1 55.6 98 Z", fill: running ? "#eee" : "#666" }),
2895
+ running && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("animateTransform", { attributeName: "transform", type: "rotate", from: "0 66 92", to: "360 66 92", dur: "2s", repeatCount: "indefinite" })
2896
+ ] })
2897
+ ] })
2898
+ ] });
2899
+ }
2900
+
2901
+ // src/components/AnnunciatorPanel.tsx
2902
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2903
+ var DEFAULT_ANNUNCIATORS = [
2904
+ { id: "fuel", label: "FUEL", level: "caution", split: true },
2905
+ { id: "oil", label: "OIL PRESS", level: "warning" },
2906
+ { id: "trim", label: "PITCH TRIM", level: "warning" },
2907
+ { id: "vac", label: "VAC", level: "caution", split: true },
2908
+ { id: "volts", label: "VOLTS", level: "warning" }
2909
+ ];
2910
+ var COLORS = { warning: "#ff2a2a", caution: "#ffb000", advisory: "#3ddc3d" };
2911
+ var OFF = "#3a3a3a";
2912
+ var W2 = 400;
2913
+ var PAD_X = 44;
2914
+ function litParts(state, split, test) {
2915
+ if (test) return { left: true, right: true, main: true };
2916
+ if (!split) return { left: false, right: false, main: !!state };
2917
+ const left = state === true || state === "left" || state === "both";
2918
+ const right = state === true || state === "right" || state === "both";
2919
+ return { left, right, main: left || right };
2920
+ }
2921
+ function AnnunciatorPanel({ annunciators = DEFAULT_ANNUNCIATORS, lights = {}, test = false, ...props }) {
2922
+ const items = annunciators.slice(0, 12);
2923
+ const rows = items.length > 3 ? 2 : 1;
2924
+ const cols = Math.max(1, Math.ceil(items.length / rows));
2925
+ const rowH = 34;
2926
+ const H2 = 28 + rows * rowH;
2927
+ const cellW = (W2 - 2 * PAD_X) / cols;
2928
+ const on = [];
2929
+ items.forEach((a) => {
2930
+ const p = litParts(lights[a.id], !!a.split, test);
2931
+ if (!p.main) return;
2932
+ if (a.split && !(p.left && p.right)) on.push(`${p.left ? "L" : "R"} ${a.label}`);
2933
+ else on.push(a.split ? `L ${a.label} R` : a.label);
2934
+ });
2935
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(PanelFrame, { ...props, width: W2, height: H2, label: `Annunciator: ${on.length ? on.join(", ") : "all clear"}`, children: [
2936
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { x: PAD_X - 6, y: "10", width: W2 - 2 * PAD_X + 12, height: H2 - 20, rx: "4", fill: "#0b0b0b", stroke: "#000", strokeWidth: "2" }),
2937
+ items.map((a, i) => {
2938
+ const row = Math.floor(i / cols);
2939
+ const col = i % cols;
2940
+ const cx = PAD_X + col * cellW + cellW / 2;
2941
+ const cy = 14 + row * rowH + rowH / 2;
2942
+ const color = COLORS[a.level ?? "caution"];
2943
+ const p = litParts(lights[a.id], !!a.split, test);
2944
+ const fill = (lit) => lit ? color : OFF;
2945
+ const glow = (lit) => lit ? { filter: `drop-shadow(0 0 3px ${color})` } : void 0;
2946
+ const fontSize = Math.min(15, (cellW - 10) / Math.max(4, (a.label.length + (a.split ? 4 : 0)) * 0.62));
2947
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("g", { "data-testid": `annunciator-${a.id}`, "data-lit": p.main ? "true" : "false", fontWeight: "bold", fontSize, dominantBaseline: "central", children: [
2948
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { x: cx - cellW / 2 + 3, y: cy - rowH / 2 + 3, width: cellW - 6, height: rowH - 6, rx: "2", fill: "#141414" }),
2949
+ a.split ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("text", { x: cx, y: cy, textAnchor: "middle", children: [
2950
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tspan", { "data-testid": `annunciator-${a.id}-left`, fill: fill(p.left), style: glow(p.left), children: "L" }),
2951
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tspan", { fill: fill(p.main), style: glow(p.main), children: ` ${a.label} ` }),
2952
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("tspan", { "data-testid": `annunciator-${a.id}-right`, fill: fill(p.right), style: glow(p.right), children: "R" })
2953
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("text", { x: cx, y: cy, textAnchor: "middle", fill: fill(p.main), style: glow(p.main), children: a.label })
2954
+ ] }, a.id);
2955
+ })
1821
2956
  ] });
1822
2957
  }
1823
2958
  // Annotate the CommonJS export names for ESM import in node:
1824
2959
  0 && (module.exports = {
2960
+ AMMETER_SCALE,
1825
2961
  AdfIndicator,
1826
2962
  Airspeed,
1827
2963
  Altimeter,
2964
+ AnnunciatorPanel,
1828
2965
  AoaIndicator,
1829
2966
  AttitudeIndicator,
2967
+ DEFAULT_ANNUNCIATORS,
1830
2968
  DEFAULT_BAR_GAUGES,
1831
2969
  DEFAULT_MANIFOLD,
1832
2970
  DEFAULT_RPM,
1833
2971
  DataPanel,
2972
+ DigitalClock,
2973
+ DualGauge,
2974
+ EGT_SCALE,
2975
+ EgtFuelFlowGauge,
1834
2976
  EngineIndicator,
2977
+ FUEL_FLOW_SCALE,
2978
+ FUEL_QUANTITY_SCALE,
1835
2979
  FlapIndicator,
1836
2980
  FuelIndicator,
2981
+ FuelQuantityGauge,
2982
+ HOLD_TIME,
1837
2983
  HeadingIndicator,
2984
+ HobbsMeter,
2985
+ HsiIndicator,
1838
2986
  IlsIndicator,
2987
+ MANIFOLD_SCALE,
1839
2988
  MAX_BAR_GAUGES,
1840
2989
  MAX_CYLINDERS,
1841
2990
  MAX_FIELDS,
1842
2991
  MAX_TANKS,
2992
+ MagneticCompass,
2993
+ ManifoldFuelFlowGauge,
2994
+ OIL_PRESSURE_SCALE,
2995
+ OIL_TEMPERATURE_SCALE,
2996
+ OilGauge,
1843
2997
  RadioPanel,
1844
2998
  RadioStack,
2999
+ Tachometer,
3000
+ TrimIndicator,
1845
3001
  TurnCoordinator,
3002
+ VACUUM_SCALE,
3003
+ VacuumAmmeterGauge,
1846
3004
  VerticalSpeed,
1847
3005
  VorIndicator,
1848
3006
  WindIndicator,
3007
+ drumPositions,
1849
3008
  formatAdf,
1850
3009
  formatDme,
1851
3010
  formatNav,
3011
+ formatTimer,
1852
3012
  formatValue,
1853
3013
  parseAdf,
1854
3014
  parseNav,