@vessel-dsp/core 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/dist/editor/commands.d.ts +48 -0
  2. package/dist/editor/commands.d.ts.map +1 -0
  3. package/{src/editor/commands.ts → dist/editor/commands.js} +44 -91
  4. package/dist/editor/commands.js.map +1 -0
  5. package/dist/editor/factory.d.ts +10 -0
  6. package/dist/editor/factory.d.ts.map +1 -0
  7. package/{src/editor/factory.ts → dist/editor/factory.js} +11 -27
  8. package/dist/editor/factory.js.map +1 -0
  9. package/dist/editor/history.d.ts +29 -0
  10. package/dist/editor/history.d.ts.map +1 -0
  11. package/{src/editor/history.ts → dist/editor/history.js} +12 -42
  12. package/dist/editor/history.js.map +1 -0
  13. package/{src/editor/index.ts → dist/editor/index.d.ts} +1 -3
  14. package/dist/editor/index.d.ts.map +1 -0
  15. package/dist/editor/index.js +5 -0
  16. package/dist/editor/index.js.map +1 -0
  17. package/dist/editor/layout.d.ts +8 -0
  18. package/dist/editor/layout.d.ts.map +1 -0
  19. package/{src/editor/layout.ts → dist/editor/layout.js} +36 -90
  20. package/dist/editor/layout.js.map +1 -0
  21. package/dist/formats/circuit-json/serializer.d.ts +86 -0
  22. package/dist/formats/circuit-json/serializer.d.ts.map +1 -0
  23. package/{src/formats/circuit-json/serializer.ts → dist/formats/circuit-json/serializer.js} +114 -414
  24. package/dist/formats/circuit-json/serializer.js.map +1 -0
  25. package/dist/formats/document.d.ts +64 -0
  26. package/dist/formats/document.d.ts.map +1 -0
  27. package/{src/formats/document.ts → dist/formats/document.js} +43 -159
  28. package/dist/formats/document.js.map +1 -0
  29. package/dist/formats/interchange/parser.d.ts +3 -0
  30. package/dist/formats/interchange/parser.d.ts.map +1 -0
  31. package/{src/formats/interchange/parser.ts → dist/formats/interchange/parser.js} +157 -463
  32. package/dist/formats/interchange/parser.js.map +1 -0
  33. package/dist/formats/interchange/serializer.d.ts +9 -0
  34. package/dist/formats/interchange/serializer.d.ts.map +1 -0
  35. package/{src/formats/interchange/serializer.ts → dist/formats/interchange/serializer.js} +84 -186
  36. package/dist/formats/interchange/serializer.js.map +1 -0
  37. package/dist/formats/ltspice/catalog.d.ts +19 -0
  38. package/dist/formats/ltspice/catalog.d.ts.map +1 -0
  39. package/{src/formats/ltspice/catalog.ts → dist/formats/ltspice/catalog.js} +18 -52
  40. package/dist/formats/ltspice/catalog.js.map +1 -0
  41. package/dist/formats/ltspice/encoding.d.ts +2 -0
  42. package/dist/formats/ltspice/encoding.d.ts.map +1 -0
  43. package/{src/formats/ltspice/encoding.ts → dist/formats/ltspice/encoding.js} +17 -41
  44. package/dist/formats/ltspice/encoding.js.map +1 -0
  45. package/dist/formats/ltspice/parser.d.ts +3 -0
  46. package/dist/formats/ltspice/parser.d.ts.map +1 -0
  47. package/{src/formats/ltspice/parser.ts → dist/formats/ltspice/parser.js} +39 -141
  48. package/dist/formats/ltspice/parser.js.map +1 -0
  49. package/dist/formats/ltspice/serializer.d.ts +7 -0
  50. package/dist/formats/ltspice/serializer.d.ts.map +1 -0
  51. package/{src/formats/ltspice/serializer.ts → dist/formats/ltspice/serializer.js} +18 -45
  52. package/dist/formats/ltspice/serializer.js.map +1 -0
  53. package/dist/formats/schx/catalog.d.ts +19 -0
  54. package/dist/formats/schx/catalog.d.ts.map +1 -0
  55. package/{src/formats/schx/catalog.ts → dist/formats/schx/catalog.js} +48 -101
  56. package/dist/formats/schx/catalog.js.map +1 -0
  57. package/dist/formats/schx/parser.d.ts +3 -0
  58. package/dist/formats/schx/parser.d.ts.map +1 -0
  59. package/{src/formats/schx/parser.ts → dist/formats/schx/parser.js} +31 -86
  60. package/dist/formats/schx/parser.js.map +1 -0
  61. package/dist/formats/schx/runtime-descriptors.d.ts +3 -0
  62. package/dist/formats/schx/runtime-descriptors.d.ts.map +1 -0
  63. package/{src/formats/schx/runtime-descriptors.ts → dist/formats/schx/runtime-descriptors.js} +36 -123
  64. package/dist/formats/schx/runtime-descriptors.js.map +1 -0
  65. package/dist/formats/schx/serializer.d.ts +5 -0
  66. package/dist/formats/schx/serializer.d.ts.map +1 -0
  67. package/{src/formats/schx/serializer.ts → dist/formats/schx/serializer.js} +17 -42
  68. package/dist/formats/schx/serializer.js.map +1 -0
  69. package/dist/formats/schx/transforms.d.ts +4 -0
  70. package/dist/formats/schx/transforms.d.ts.map +1 -0
  71. package/{src/formats/schx/transforms.ts → dist/formats/schx/transforms.js} +6 -10
  72. package/dist/formats/schx/transforms.js.map +1 -0
  73. package/dist/formats/spice/parser.d.ts +3 -0
  74. package/dist/formats/spice/parser.d.ts.map +1 -0
  75. package/{src/formats/spice/parser.ts → dist/formats/spice/parser.js} +50 -96
  76. package/dist/formats/spice/parser.js.map +1 -0
  77. package/dist/formats/spice/serializer.d.ts +3 -0
  78. package/dist/formats/spice/serializer.d.ts.map +1 -0
  79. package/{src/formats/spice/serializer.ts → dist/formats/spice/serializer.js} +8 -13
  80. package/dist/formats/spice/serializer.js.map +1 -0
  81. package/dist/index.d.ts +47 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +32 -0
  84. package/dist/index.js.map +1 -0
  85. package/dist/model/connectivity.d.ts +16 -0
  86. package/dist/model/connectivity.d.ts.map +1 -0
  87. package/{src/model/connectivity.ts → dist/model/connectivity.js} +28 -63
  88. package/dist/model/connectivity.js.map +1 -0
  89. package/dist/model/netlist.d.ts +24 -0
  90. package/dist/model/netlist.d.ts.map +1 -0
  91. package/{src/model/netlist.ts → dist/model/netlist.js} +42 -110
  92. package/dist/model/netlist.js.map +1 -0
  93. package/dist/model/properties.d.ts +9 -0
  94. package/dist/model/properties.d.ts.map +1 -0
  95. package/{src/model/properties.ts → dist/model/properties.js} +10 -18
  96. package/dist/model/properties.js.map +1 -0
  97. package/dist/model/quantity.d.ts +3 -0
  98. package/dist/model/quantity.d.ts.map +1 -0
  99. package/{src/model/quantity.ts → dist/model/quantity.js} +7 -30
  100. package/dist/model/quantity.js.map +1 -0
  101. package/{src/model/types.ts → dist/model/types.d.ts} +17 -196
  102. package/dist/model/types.d.ts.map +1 -0
  103. package/dist/model/types.js +10 -0
  104. package/dist/model/types.js.map +1 -0
  105. package/dist/model/validation.d.ts +32 -0
  106. package/dist/model/validation.d.ts.map +1 -0
  107. package/{src/model/validation.ts → dist/model/validation.js} +172 -653
  108. package/dist/model/validation.js.map +1 -0
  109. package/dist/model/wires.d.ts +3 -0
  110. package/dist/model/wires.d.ts.map +1 -0
  111. package/{src/model/wires.ts → dist/model/wires.js} +10 -16
  112. package/dist/model/wires.js.map +1 -0
  113. package/dist/panel/extract.d.ts +5 -0
  114. package/dist/panel/extract.d.ts.map +1 -0
  115. package/{src/panel/extract.ts → dist/panel/extract.js} +146 -235
  116. package/dist/panel/extract.js.map +1 -0
  117. package/dist/panel/index.d.ts +6 -0
  118. package/dist/panel/index.d.ts.map +1 -0
  119. package/dist/panel/index.js +5 -0
  120. package/dist/panel/index.js.map +1 -0
  121. package/dist/panel/knobs.d.ts +7 -0
  122. package/dist/panel/knobs.d.ts.map +1 -0
  123. package/{src/panel/knobs.ts → dist/panel/knobs.js} +7 -18
  124. package/dist/panel/knobs.js.map +1 -0
  125. package/dist/panel/protocol.d.ts +9 -0
  126. package/dist/panel/protocol.d.ts.map +1 -0
  127. package/{src/panel/protocol.ts → dist/panel/protocol.js} +10 -26
  128. package/dist/panel/protocol.js.map +1 -0
  129. package/{src/panel/types.ts → dist/panel/types.d.ts} +50 -89
  130. package/dist/panel/types.d.ts.map +1 -0
  131. package/dist/panel/types.js +2 -0
  132. package/dist/panel/types.js.map +1 -0
  133. package/dist/preview/bounds.d.ts +12 -0
  134. package/dist/preview/bounds.d.ts.map +1 -0
  135. package/{src/preview/bounds.ts → dist/preview/bounds.js} +15 -29
  136. package/dist/preview/bounds.js.map +1 -0
  137. package/dist/preview/box-layout.d.ts +4 -0
  138. package/dist/preview/box-layout.d.ts.map +1 -0
  139. package/{src/preview/box-layout.ts → dist/preview/box-layout.js} +2 -6
  140. package/dist/preview/box-layout.js.map +1 -0
  141. package/dist/preview/colors.d.ts +3 -0
  142. package/dist/preview/colors.d.ts.map +1 -0
  143. package/{src/preview/colors.ts → dist/preview/colors.js} +3 -5
  144. package/dist/preview/colors.js.map +1 -0
  145. package/dist/preview/hanging.d.ts +8 -0
  146. package/dist/preview/hanging.d.ts.map +1 -0
  147. package/{src/preview/hanging.ts → dist/preview/hanging.js} +9 -28
  148. package/dist/preview/hanging.js.map +1 -0
  149. package/dist/preview/junctions.d.ts +3 -0
  150. package/dist/preview/junctions.d.ts.map +1 -0
  151. package/{src/preview/junctions.ts → dist/preview/junctions.js} +9 -24
  152. package/dist/preview/junctions.js.map +1 -0
  153. package/dist/preview/label-layout.d.ts +12 -0
  154. package/dist/preview/label-layout.d.ts.map +1 -0
  155. package/{src/preview/label-layout.ts → dist/preview/label-layout.js} +15 -36
  156. package/dist/preview/label-layout.js.map +1 -0
  157. package/dist/preview/ports.d.ts +17 -0
  158. package/dist/preview/ports.d.ts.map +1 -0
  159. package/{src/preview/ports.ts → dist/preview/ports.js} +10 -37
  160. package/dist/preview/ports.js.map +1 -0
  161. package/dist/preview/renderable-wires.d.ts +3 -0
  162. package/dist/preview/renderable-wires.d.ts.map +1 -0
  163. package/{src/preview/renderable-wires.ts → dist/preview/renderable-wires.js} +12 -29
  164. package/dist/preview/renderable-wires.js.map +1 -0
  165. package/dist/preview/routing.d.ts +4 -0
  166. package/dist/preview/routing.d.ts.map +1 -0
  167. package/dist/preview/routing.js +13 -0
  168. package/dist/preview/routing.js.map +1 -0
  169. package/dist/preview/snap.d.ts +9 -0
  170. package/dist/preview/snap.d.ts.map +1 -0
  171. package/{src/preview/snap.ts → dist/preview/snap.js} +9 -31
  172. package/dist/preview/snap.js.map +1 -0
  173. package/dist/preview/symbols/svg-content.d.ts +7 -0
  174. package/dist/preview/symbols/svg-content.d.ts.map +1 -0
  175. package/{src/preview/symbols/svg-content.ts → dist/preview/symbols/svg-content.js} +3 -6
  176. package/dist/preview/symbols/svg-content.js.map +1 -0
  177. package/dist/preview/symbols.d.ts +7 -0
  178. package/dist/preview/symbols.d.ts.map +1 -0
  179. package/{src/preview/symbols.ts → dist/preview/symbols.js} +18 -43
  180. package/dist/preview/symbols.js.map +1 -0
  181. package/dist/preview/wire-chains.d.ts +4 -0
  182. package/dist/preview/wire-chains.d.ts.map +1 -0
  183. package/{src/preview/wire-chains.ts → dist/preview/wire-chains.js} +37 -37
  184. package/dist/preview/wire-chains.js.map +1 -0
  185. package/package.json +3 -3
  186. package/src/index.ts +0 -255
  187. package/src/panel/index.ts +0 -39
  188. package/src/preview/routing.ts +0 -15
  189. package/src/preview/symbols/analog-switch.svg +0 -17
  190. package/src/preview/symbols/battery.svg +0 -16
  191. package/src/preview/symbols/bbd.svg +0 -21
  192. package/src/preview/symbols/bjt-npn.svg +0 -16
  193. package/src/preview/symbols/bjt-pnp.svg +0 -17
  194. package/src/preview/symbols/capacitor-electrolytic.svg +0 -13
  195. package/src/preview/symbols/capacitor.svg +0 -12
  196. package/src/preview/symbols/current-source.svg +0 -14
  197. package/src/preview/symbols/delay-ic.svg +0 -22
  198. package/src/preview/symbols/diode-schottky.svg +0 -12
  199. package/src/preview/symbols/diode-zener.svg +0 -12
  200. package/src/preview/symbols/diode.svg +0 -13
  201. package/src/preview/symbols/flipflop.svg +0 -20
  202. package/src/preview/symbols/ground.svg +0 -12
  203. package/src/preview/symbols/ic-block.svg +0 -20
  204. package/src/preview/symbols/ic.svg +0 -19
  205. package/src/preview/symbols/inductor.svg +0 -11
  206. package/src/preview/symbols/jack-input.svg +0 -16
  207. package/src/preview/symbols/jack-output.svg +0 -16
  208. package/src/preview/symbols/jfet-junction-n.svg +0 -17
  209. package/src/preview/symbols/jfet-n.svg +0 -17
  210. package/src/preview/symbols/jfet-p.svg +0 -17
  211. package/src/preview/symbols/label.svg +0 -8
  212. package/src/preview/symbols/led.svg +0 -18
  213. package/src/preview/symbols/mosfet-n.svg +0 -21
  214. package/src/preview/symbols/mosfet-p.svg +0 -21
  215. package/src/preview/symbols/named-wire.svg +0 -11
  216. package/src/preview/symbols/opamp.svg +0 -21
  217. package/src/preview/symbols/optocoupler.svg +0 -30
  218. package/src/preview/symbols/ota.svg +0 -20
  219. package/src/preview/symbols/pentode.svg +0 -25
  220. package/src/preview/symbols/photoresistor.svg +0 -19
  221. package/src/preview/symbols/port.svg +0 -8
  222. package/src/preview/symbols/potentiometer.svg +0 -15
  223. package/src/preview/symbols/power-amp.svg +0 -20
  224. package/src/preview/symbols/rail.svg +0 -11
  225. package/src/preview/symbols/regulator.svg +0 -13
  226. package/src/preview/symbols/relay.svg +0 -20
  227. package/src/preview/symbols/resistor.svg +0 -11
  228. package/src/preview/symbols/switch-3pdt.svg +0 -32
  229. package/src/preview/symbols/switch-rotary.svg +0 -23
  230. package/src/preview/symbols/switch-spdt.svg +0 -16
  231. package/src/preview/symbols/switch-spst.svg +0 -14
  232. package/src/preview/symbols/switch-toggle.svg +0 -14
  233. package/src/preview/symbols/transformer.svg +0 -17
  234. package/src/preview/symbols/triode.svg +0 -17
  235. package/src/preview/symbols/tube-diode.svg +0 -13
  236. package/src/preview/symbols/unsupported.svg +0 -8
  237. package/src/preview/symbols/variable-resistor.svg +0 -13
  238. package/src/preview/symbols/voltage-source.svg +0 -15
@@ -1,44 +1,6 @@
1
- import { isParsedQuantity, propertyNumericValue, propertyStringValue } from '../model/properties';
2
- import type {
3
- CircuitDocument,
4
- Component,
5
- ControlInterface,
6
- DeviceInterfaceBinding,
7
- DeviceInterfaceControl,
8
- DeviceInterfaceControlKind,
9
- ParsedQuantity,
10
- PropertyValue,
11
- Warning,
12
- } from '../model/types';
13
- import type {
14
- DeviceInterfaceProvenance,
15
- ExtractedDeviceInterface,
16
- ExtractedDeviceInterfaceControl,
17
- ExternalControlAssignmentHint,
18
- JackAudioRole,
19
- JackPort,
20
- JackRole,
21
- Knob,
22
- KnobStep,
23
- KnobTaper,
24
- LedIndicator,
25
- Panel,
26
- SliderControl,
27
- SliderOrientation,
28
- SliderRange,
29
- SwitchControl,
30
- SwitchKind,
31
- } from './types';
32
- import { buildKnobSteps, snapKnobPosition } from './knobs';
33
-
34
- type RuntimeContinuousControlSpec = Readonly<{
35
- key: string;
36
- controlProperty: string;
37
- wipeProperty: string;
38
- sweepProperty: string;
39
- }>;
40
-
41
- const RUNTIME_CONTINUOUS_CONTROL_SPECS: readonly RuntimeContinuousControlSpec[] = [
1
+ import { isParsedQuantity, propertyNumericValue, propertyStringValue } from '../model/properties.js';
2
+ import { buildKnobSteps, snapKnobPosition } from './knobs.js';
3
+ const RUNTIME_CONTINUOUS_CONTROL_SPECS = [
42
4
  { key: 'time', controlProperty: 'TimeControl', wipeProperty: 'TimeControlWipe', sweepProperty: 'TimeControlSweep' },
43
5
  { key: 'feedback', controlProperty: 'FeedbackControl', wipeProperty: 'FeedbackControlWipe', sweepProperty: 'FeedbackControlSweep' },
44
6
  { key: 'mix', controlProperty: 'MixControl', wipeProperty: 'MixControlWipe', sweepProperty: 'MixControlSweep' },
@@ -47,23 +9,22 @@ const RUNTIME_CONTINUOUS_CONTROL_SPECS: readonly RuntimeContinuousControlSpec[]
47
9
  { key: 'mod-rate', controlProperty: 'ModRateControl', wipeProperty: 'ModRateControlWipe', sweepProperty: 'ModRateControlSweep' },
48
10
  { key: 'mod-depth', controlProperty: 'ModDepthControl', wipeProperty: 'ModDepthControlWipe', sweepProperty: 'ModDepthControlSweep' },
49
11
  ];
50
-
51
12
  // extractPanel inspects a CircuitDocument and emits the typed Panel descriptor
52
13
  // that drives the runtime control surface. It's a pure read over the existing
53
14
  // schematic model — no parsing of the source format, no UI knowledge.
54
- export function extractPanel(doc: CircuitDocument): Panel {
55
- const knobs: Knob[] = [];
56
- const sliders: SliderControl[] = [];
57
- const switches: SwitchControl[] = [];
58
- const leds: LedIndicator[] = [];
59
- const jacks: JackPort[] = [];
60
-
15
+ export function extractPanel(doc) {
16
+ const knobs = [];
17
+ const sliders = [];
18
+ const switches = [];
19
+ const leds = [];
20
+ const jacks = [];
61
21
  for (const component of doc.components) {
62
22
  switch (component.kind) {
63
23
  case 'potentiometer': {
64
24
  if (isSliderControl(component)) {
65
25
  sliders.push(toSlider(component));
66
- } else {
26
+ }
27
+ else {
67
28
  knobs.push(toKnob(component));
68
29
  }
69
30
  break;
@@ -96,7 +57,6 @@ export function extractPanel(doc: CircuitDocument): Panel {
96
57
  }
97
58
  }
98
59
  applyControlInterfaces(doc.controlInterfaces, jacks);
99
-
100
60
  return {
101
61
  ...(doc.panel === undefined ? {} : { placement: doc.panel }),
102
62
  knobs,
@@ -106,27 +66,23 @@ export function extractPanel(doc: CircuitDocument): Panel {
106
66
  jacks,
107
67
  };
108
68
  }
109
-
110
- export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInterface {
69
+ export function extractDeviceInterface(doc) {
111
70
  const panel = extractPanel(doc);
112
71
  const inferredControls = inferDeviceInterfaceControls(doc, panel);
113
- const diagnostics: Warning[] = [];
114
- const controls = new Map<string, ExtractedDeviceInterfaceControl>();
115
-
72
+ const diagnostics = [];
73
+ const controls = new Map();
116
74
  for (const control of doc.deviceInterface?.controls ?? []) {
117
75
  controls.set(control.id, {
118
76
  ...control,
119
77
  provenance: 'vdsp-declared',
120
78
  });
121
79
  }
122
-
123
80
  for (const inferred of inferredControls) {
124
81
  const declared = controls.get(inferred.id);
125
82
  if (declared === undefined) {
126
83
  controls.set(inferred.id, inferred);
127
84
  continue;
128
85
  }
129
-
130
86
  if (declared.binding === undefined && inferred.binding !== undefined) {
131
87
  controls.set(declared.id, {
132
88
  ...declared,
@@ -134,12 +90,9 @@ export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInt
134
90
  });
135
91
  continue;
136
92
  }
137
-
138
- if (
139
- declared.binding !== undefined
93
+ if (declared.binding !== undefined
140
94
  && inferred.binding !== undefined
141
- && bindingSignature(declared.binding) !== bindingSignature(inferred.binding)
142
- ) {
95
+ && bindingSignature(declared.binding) !== bindingSignature(inferred.binding)) {
143
96
  diagnostics.push({
144
97
  code: 'device-interface-inferred-binding-conflict',
145
98
  message: `Declared device interface control "${declared.id}" conflicts with inferred binding`,
@@ -147,7 +100,6 @@ export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInt
147
100
  });
148
101
  }
149
102
  }
150
-
151
103
  return {
152
104
  groups: doc.controlGroups ?? [],
153
105
  contexts: doc.controlContexts ?? [],
@@ -156,20 +108,15 @@ export function extractDeviceInterface(doc: CircuitDocument): ExtractedDeviceInt
156
108
  diagnostics,
157
109
  };
158
110
  }
159
-
160
- function inferDeviceInterfaceControls(
161
- doc: CircuitDocument,
162
- panel: Panel,
163
- ): readonly ExtractedDeviceInterfaceControl[] {
164
- const controls: ExtractedDeviceInterfaceControl[] = [];
165
- const controlInterfaceIds = new Set<string>();
111
+ function inferDeviceInterfaceControls(doc, panel) {
112
+ const controls = [];
113
+ const controlInterfaceIds = new Set();
166
114
  for (const controlInterface of doc.controlInterfaces ?? []) {
167
115
  controlInterfaceIds.add(controlInterface.id);
168
116
  if (controlInterface.componentId !== undefined) {
169
117
  controlInterfaceIds.add(controlInterface.componentId);
170
118
  }
171
119
  }
172
-
173
120
  for (const knob of panel.knobs) {
174
121
  const componentId = componentIdFromControlId(knob.id);
175
122
  const property = runtimeControlProperty(knob.id);
@@ -187,7 +134,6 @@ function inferDeviceInterfaceControls(
187
134
  provenance: provenanceForComponentControl(doc, componentId),
188
135
  });
189
136
  }
190
-
191
137
  for (const slider of panel.sliders ?? []) {
192
138
  controls.push({
193
139
  id: slider.id,
@@ -202,7 +148,6 @@ function inferDeviceInterfaceControls(
202
148
  provenance: 'source-inferred',
203
149
  });
204
150
  }
205
-
206
151
  for (const switchControl of panel.switches) {
207
152
  controls.push({
208
153
  id: switchControl.id,
@@ -217,7 +162,6 @@ function inferDeviceInterfaceControls(
217
162
  provenance: provenanceForComponentControl(doc, componentIdFromControlId(switchControl.id)),
218
163
  });
219
164
  }
220
-
221
165
  for (const led of panel.leds) {
222
166
  controls.push({
223
167
  id: led.id,
@@ -232,7 +176,6 @@ function inferDeviceInterfaceControls(
232
176
  provenance: 'source-inferred',
233
177
  });
234
178
  }
235
-
236
179
  for (const jack of panel.jacks) {
237
180
  const componentId = jack.sourceComponentId ?? componentIdFromControlId(jack.id);
238
181
  const binding = deviceBindingForJack(jack, componentId);
@@ -247,11 +190,9 @@ function inferDeviceInterfaceControls(
247
190
  : provenanceForComponentControl(doc, componentId),
248
191
  });
249
192
  }
250
-
251
193
  return controls;
252
194
  }
253
-
254
- function deviceBindingForJack(jack: JackPort, componentId: string): DeviceInterfaceBinding | undefined {
195
+ function deviceBindingForJack(jack, componentId) {
255
196
  if (jack.binding !== undefined) {
256
197
  return deviceBindingFromControlInterfaceBinding(jack.binding, componentId);
257
198
  }
@@ -272,11 +213,7 @@ function deviceBindingForJack(jack: JackPort, componentId: string): DeviceInterf
272
213
  }
273
214
  return undefined;
274
215
  }
275
-
276
- function deviceBindingFromControlInterfaceBinding(
277
- binding: ControlInterface['binding'],
278
- fallbackComponentId: string,
279
- ): DeviceInterfaceBinding | undefined {
216
+ function deviceBindingFromControlInterfaceBinding(binding, fallbackComponentId) {
280
217
  if (binding === undefined) {
281
218
  return undefined;
282
219
  }
@@ -288,26 +225,22 @@ function deviceBindingFromControlInterfaceBinding(
288
225
  ...(binding.property === undefined ? {} : { property: binding.property }),
289
226
  };
290
227
  }
291
-
292
- function provenanceForComponentControl(doc: CircuitDocument, componentId: string): DeviceInterfaceProvenance {
228
+ function provenanceForComponentControl(doc, componentId) {
293
229
  const component = doc.components.find((candidate) => candidate.id === componentId);
294
230
  return component !== undefined && isRuntimeDescriptor(component)
295
231
  ? 'runtime-descriptor-inferred'
296
232
  : 'source-inferred';
297
233
  }
298
-
299
- function componentIdFromControlId(id: string): string {
234
+ function componentIdFromControlId(id) {
300
235
  const separator = id.indexOf(':');
301
236
  return separator <= 0 ? id : id.slice(0, separator);
302
237
  }
303
-
304
- function roleFromControlId(id: string): string {
238
+ function roleFromControlId(id) {
305
239
  const separator = id.indexOf(':');
306
240
  const raw = separator >= 0 ? id.slice(separator + 1) : id;
307
241
  return normalizeToken(raw);
308
242
  }
309
-
310
- function runtimeControlProperty(id: string): string | undefined {
243
+ function runtimeControlProperty(id) {
311
244
  const key = roleFromControlId(id);
312
245
  for (const spec of RUNTIME_CONTINUOUS_CONTROL_SPECS) {
313
246
  if (spec.key === key) {
@@ -325,8 +258,7 @@ function runtimeControlProperty(id: string): string | undefined {
325
258
  }
326
259
  return undefined;
327
260
  }
328
-
329
- function bindingSignature(binding: DeviceInterfaceBinding): string {
261
+ function bindingSignature(binding) {
330
262
  return [
331
263
  binding.componentId,
332
264
  binding.controlId ?? '',
@@ -335,11 +267,7 @@ function bindingSignature(binding: DeviceInterfaceBinding): string {
335
267
  binding.externalInterfaceId ?? '',
336
268
  ].join(':');
337
269
  }
338
-
339
- function applyControlInterfaces(
340
- controlInterfaces: readonly ControlInterface[] | undefined,
341
- jacks: JackPort[],
342
- ): void {
270
+ function applyControlInterfaces(controlInterfaces, jacks) {
343
271
  for (const controlInterface of controlInterfaces ?? []) {
344
272
  const port = toControlInterfaceJack(controlInterface);
345
273
  const existingIndex = controlInterface.componentId === undefined
@@ -350,13 +278,13 @@ function applyControlInterfaces(
350
278
  if (existing !== undefined) {
351
279
  jacks[existingIndex] = { ...existing, ...port };
352
280
  }
353
- } else {
281
+ }
282
+ else {
354
283
  jacks.push(port);
355
284
  }
356
285
  }
357
286
  }
358
-
359
- function toControlInterfaceJack(controlInterface: ControlInterface): JackPort {
287
+ function toControlInterfaceJack(controlInterface) {
360
288
  const sourceComponentId = controlInterface.binding?.sourceComponentId;
361
289
  const controlRole = controlInterface.controlRole ?? defaultControlRole(controlInterface);
362
290
  const interfaceName = controlInterface.interface ?? defaultInterfaceName(controlInterface);
@@ -374,8 +302,7 @@ function toControlInterfaceJack(controlInterface: ControlInterface): JackPort {
374
302
  ...(controlInterface.description === undefined ? {} : { description: controlInterface.description }),
375
303
  };
376
304
  }
377
-
378
- function jackRoleForControlInterface(controlInterface: ControlInterface): JackRole {
305
+ function jackRoleForControlInterface(controlInterface) {
379
306
  switch (controlInterface.role) {
380
307
  case 'tempo-tap':
381
308
  return 'tempo-tap';
@@ -390,14 +317,12 @@ function jackRoleForControlInterface(controlInterface: ControlInterface): JackRo
390
317
  return 'unknown';
391
318
  }
392
319
  }
393
-
394
- function defaultControlRole(controlInterface: ControlInterface): string | undefined {
320
+ function defaultControlRole(controlInterface) {
395
321
  return controlInterface.role === 'unknown' || controlInterface.role === 'external-control'
396
322
  ? undefined
397
323
  : controlInterface.role;
398
324
  }
399
-
400
- function defaultInterfaceName(controlInterface: ControlInterface): string | undefined {
325
+ function defaultInterfaceName(controlInterface) {
401
326
  if (controlInterface.role === 'tempo-tap') {
402
327
  return 'tap-tempo';
403
328
  }
@@ -406,8 +331,7 @@ function defaultInterfaceName(controlInterface: ControlInterface): string | unde
406
331
  }
407
332
  return 'external-control-input';
408
333
  }
409
-
410
- function toKnob(component: Component): Knob {
334
+ function toKnob(component) {
411
335
  const taper = resolveTaper(propertyString(component, 'Sweep') ?? propertyString(component, 'Taper'));
412
336
  const stepLabels = parseStepLabels(propertyStringAny(component, ['StepLabels', 'Steps']));
413
337
  const explicitStepCount = parseStepCount(propertyStringAny(component, ['StepCount', 'Detents', 'Positions', 'Steps']));
@@ -429,8 +353,7 @@ function toKnob(component: Component): Knob {
429
353
  ...(description !== undefined && description.length > 0 ? { description } : {}),
430
354
  };
431
355
  }
432
-
433
- function toSlider(component: Component): SliderControl {
356
+ function toSlider(component) {
434
357
  const defaultPosition = clamp01(parseNumeric(component.properties.Wipe) ?? 0.5);
435
358
  const orientation = resolveSliderOrientation(propertyStringAny(component, ['Orientation', 'SliderOrientation']));
436
359
  const range = sliderRange(component);
@@ -446,8 +369,7 @@ function toSlider(component: Component): SliderControl {
446
369
  ...(description !== undefined && description.length > 0 ? { description } : {}),
447
370
  };
448
371
  }
449
-
450
- function toSwitch(component: Component): SwitchControl {
372
+ function toSwitch(component) {
451
373
  const switchKind = resolveSwitchKind(component);
452
374
  const { poles, positions } = switchGeometry(switchKind);
453
375
  const defaultPosition = clampInt(parseNumeric(component.properties.Position) ?? 0, 0, positions - 1);
@@ -466,8 +388,7 @@ function toSwitch(component: Component): SwitchControl {
466
388
  ...(description !== undefined && description.length > 0 ? { description } : {}),
467
389
  };
468
390
  }
469
-
470
- function toLed(component: Component): LedIndicator {
391
+ function toLed(component) {
471
392
  const color = propertyString(component, 'Color') ?? inferLedColor(component);
472
393
  const partNumber = propertyString(component, 'PartNumber') ?? undefined;
473
394
  const description = propertyString(component, 'Description') ?? undefined;
@@ -479,11 +400,10 @@ function toLed(component: Component): LedIndicator {
479
400
  ...(description !== undefined && description.length > 0 ? { description } : {}),
480
401
  };
481
402
  }
482
-
483
- function toJack(component: Component): JackPort {
403
+ function toJack(component) {
484
404
  const role = resolveJackRole(component);
485
405
  const name = nonEmptyString(propertyStringAny(component, ['JackLabel', 'Label'])) ?? component.name;
486
- const audioRole = nonEmptyString(propertyString(component, 'AudioRole')) as JackAudioRole | undefined;
406
+ const audioRole = nonEmptyString(propertyString(component, 'AudioRole'));
487
407
  const impedance = quantityProperty(component, 'Impedance');
488
408
  const controlRole = nonEmptyString(propertyString(component, 'ControlRole'));
489
409
  const interfaceName = nonEmptyString(propertyString(component, 'Interface'));
@@ -501,16 +421,13 @@ function toJack(component: Component): JackPort {
501
421
  ...(description !== undefined && description.length > 0 ? { description } : {}),
502
422
  };
503
423
  }
504
-
505
- function runtimeDescriptorKnobs(component: Component): readonly Knob[] {
506
- const knobs: Knob[] = [];
507
-
424
+ function runtimeDescriptorKnobs(component) {
425
+ const knobs = [];
508
426
  for (const spec of RUNTIME_CONTINUOUS_CONTROL_SPECS) {
509
427
  const name = nonEmptyString(propertyString(component, spec.controlProperty));
510
428
  if (name === undefined) {
511
429
  continue;
512
430
  }
513
-
514
431
  knobs.push({
515
432
  id: `${component.id}:${spec.key}`,
516
433
  name,
@@ -519,16 +436,13 @@ function runtimeDescriptorKnobs(component: Component): readonly Knob[] {
519
436
  defaultPosition: clamp01(parseNumeric(component.properties[spec.wipeProperty]) ?? 0.5),
520
437
  });
521
438
  }
522
-
523
439
  const mode = runtimeDescriptorMode(component);
524
440
  if (mode !== undefined) {
525
441
  knobs.push(mode);
526
442
  }
527
-
528
443
  return knobs;
529
444
  }
530
-
531
- function runtimeDescriptorMode(component: Component): Knob | undefined {
445
+ function runtimeDescriptorMode(component) {
532
446
  const name = nonEmptyString(propertyString(component, 'ModeControl'));
533
447
  const labels = parseStepLabels(propertyStringAny(component, ['ModeLabels', 'ModeOptions']));
534
448
  const explicitStepCount = parseStepCount(propertyStringAny(component, ['ModeStepCount', 'ModeSteps', 'ModeCount']));
@@ -536,28 +450,22 @@ function runtimeDescriptorMode(component: Component): Knob | undefined {
536
450
  if (name === undefined || steps === undefined) {
537
451
  return undefined;
538
452
  }
539
-
540
453
  return {
541
454
  id: `${component.id}:mode`,
542
455
  name,
543
456
  taper: 'unknown',
544
457
  controlMode: 'stepped',
545
- defaultPosition: runtimeModeDefaultPosition(
546
- steps,
547
- parseNumericAny(component, ['ModeControlWipe', 'ModeDefaultIndex', 'ModeIndex']),
548
- ),
458
+ defaultPosition: runtimeModeDefaultPosition(steps, parseNumericAny(component, ['ModeControlWipe', 'ModeDefaultIndex', 'ModeIndex'])),
549
459
  steps,
550
460
  };
551
461
  }
552
-
553
- function runtimeDescriptorTempoTap(component: Component): JackPort | undefined {
462
+ function runtimeDescriptorTempoTap(component) {
554
463
  const name = nonEmptyString(propertyStringAny(component, ['TempoTapControl', 'TapTempoControl', 'TempoControl']));
555
464
  if (name === undefined) {
556
465
  return undefined;
557
466
  }
558
-
559
467
  const sourceTypeName = component.sourceTypeName ?? undefined;
560
- const assignmentHint: ExternalControlAssignmentHint = 'momentary';
468
+ const assignmentHint = 'momentary';
561
469
  return {
562
470
  id: `${component.id}:tempo-tap`,
563
471
  name,
@@ -569,8 +477,7 @@ function runtimeDescriptorTempoTap(component: Component): JackPort | undefined {
569
477
  ...(sourceTypeName !== undefined ? { sourceTypeName } : {}),
570
478
  };
571
479
  }
572
-
573
- function runtimeDescriptorDirectOut(component: Component): JackPort | undefined {
480
+ function runtimeDescriptorDirectOut(component) {
574
481
  const name = nonEmptyString(propertyStringAny(component, [
575
482
  'DirectOutputJack',
576
483
  'DirectOutJack',
@@ -580,7 +487,6 @@ function runtimeDescriptorDirectOut(component: Component): JackPort | undefined
580
487
  if (name === undefined) {
581
488
  return undefined;
582
489
  }
583
-
584
490
  const sourceTypeName = component.sourceTypeName ?? undefined;
585
491
  const description = nonEmptyString(propertyStringAny(component, [
586
492
  'DirectOutputRuntimeBoundary',
@@ -605,8 +511,7 @@ function runtimeDescriptorDirectOut(component: Component): JackPort | undefined
605
511
  ...(description === undefined ? {} : { description }),
606
512
  };
607
513
  }
608
-
609
- function isSliderControl(component: Component): boolean {
514
+ function isSliderControl(component) {
610
515
  const style = propertyStringAny(component, ['ControlStyle', 'ControlType', 'PanelControl', 'UiControl', 'Style']);
611
516
  if (style === null) {
612
517
  return false;
@@ -614,15 +519,13 @@ function isSliderControl(component: Component): boolean {
614
519
  const lower = style.toLowerCase();
615
520
  return lower.includes('slider') || lower.includes('fader');
616
521
  }
617
-
618
- function resolveSliderOrientation(value: string | null): SliderOrientation {
522
+ function resolveSliderOrientation(value) {
619
523
  if (value?.toLowerCase().includes('horizontal')) {
620
524
  return 'horizontal';
621
525
  }
622
526
  return 'vertical';
623
527
  }
624
-
625
- function sliderRange(component: Component): SliderRange | undefined {
528
+ function sliderRange(component) {
626
529
  const min = parseNumericAny(component, ['RangeMin', 'Min', 'Minimum']);
627
530
  const max = parseNumericAny(component, ['RangeMax', 'Max', 'Maximum']);
628
531
  if (min === undefined || max === undefined || min >= max) {
@@ -637,8 +540,7 @@ function sliderRange(component: Component): SliderRange | undefined {
637
540
  ...(center !== undefined ? { center } : {}),
638
541
  };
639
542
  }
640
-
641
- function resolveTaper(value: string | null | undefined): KnobTaper {
543
+ function resolveTaper(value) {
642
544
  if (value === null || value === undefined) {
643
545
  return 'unknown';
644
546
  }
@@ -654,31 +556,38 @@ function resolveTaper(value: string | null | undefined): KnobTaper {
654
556
  }
655
557
  return 'unknown';
656
558
  }
657
-
658
- function resolveSwitchKind(component: Component): SwitchKind {
559
+ function resolveSwitchKind(component) {
659
560
  const short = shortType(component.sourceTypeName);
660
561
  if (short === null) {
661
562
  return inferFromTerminals(component.terminals.length);
662
563
  }
663
564
  const upper = short.toUpperCase();
664
- if (upper === 'SPDT') return 'spdt';
665
- if (upper === 'SP3T') return 'sp3t';
666
- if (upper === 'SP4T') return 'sp4t';
667
- if (upper === '3PDT') return '3pdt';
668
- if (upper === 'TOGGLE') return 'toggle';
669
- if (upper === 'ROTARY') return 'rotary';
670
- if (upper === 'SWITCH') return 'spst';
565
+ if (upper === 'SPDT')
566
+ return 'spdt';
567
+ if (upper === 'SP3T')
568
+ return 'sp3t';
569
+ if (upper === 'SP4T')
570
+ return 'sp4t';
571
+ if (upper === '3PDT')
572
+ return '3pdt';
573
+ if (upper === 'TOGGLE')
574
+ return 'toggle';
575
+ if (upper === 'ROTARY')
576
+ return 'rotary';
577
+ if (upper === 'SWITCH')
578
+ return 'spst';
671
579
  return inferFromTerminals(component.terminals.length);
672
580
  }
673
-
674
- function inferFromTerminals(count: number): SwitchKind {
675
- if (count <= 2) return 'spst';
676
- if (count === 3) return 'spdt';
677
- if (count === 9) return '3pdt';
581
+ function inferFromTerminals(count) {
582
+ if (count <= 2)
583
+ return 'spst';
584
+ if (count === 3)
585
+ return 'spdt';
586
+ if (count === 9)
587
+ return '3pdt';
678
588
  return 'unknown';
679
589
  }
680
-
681
- function switchGeometry(kind: SwitchKind): { poles: number; positions: number } {
590
+ function switchGeometry(kind) {
682
591
  switch (kind) {
683
592
  case 'spst':
684
593
  case 'toggle':
@@ -697,28 +606,30 @@ function switchGeometry(kind: SwitchKind): { poles: number; positions: number }
697
606
  return { poles: 1, positions: 2 };
698
607
  }
699
608
  }
700
-
701
- function resolveJackRole(component: Component): JackRole {
609
+ function resolveJackRole(component) {
702
610
  const semanticRole = resolveSemanticJackRole(component);
703
611
  if (semanticRole !== null) {
704
612
  return semanticRole;
705
613
  }
706
-
707
614
  const short = shortType(component.sourceTypeName);
708
615
  if (short === null) {
709
616
  return 'unknown';
710
617
  }
711
618
  const upper = short.toUpperCase();
712
- if (upper === 'INPUT' || upper === 'INPUTJACK') return 'input';
713
- if (upper === 'SPEAKER' || upper === 'OUTPUTJACK') return 'output';
714
- if (upper === 'SEND') return 'send';
715
- if (upper === 'RETURN') return 'return';
716
- if (upper === 'EXPRESSION' || upper === 'EXP') return 'expression';
619
+ if (upper === 'INPUT' || upper === 'INPUTJACK')
620
+ return 'input';
621
+ if (upper === 'SPEAKER' || upper === 'OUTPUTJACK')
622
+ return 'output';
623
+ if (upper === 'SEND')
624
+ return 'send';
625
+ if (upper === 'RETURN')
626
+ return 'return';
627
+ if (upper === 'EXPRESSION' || upper === 'EXP')
628
+ return 'expression';
717
629
  return 'unknown';
718
630
  }
719
-
720
- function resolveSemanticJackRole(component: Component): JackRole | null {
721
- const semanticProperties = ['Role', 'ControlRole', 'Interface'] as const;
631
+ function resolveSemanticJackRole(component) {
632
+ const semanticProperties = ['Role', 'ControlRole', 'Interface'];
722
633
  for (const name of semanticProperties) {
723
634
  const value = propertyString(component, name);
724
635
  if (value === null) {
@@ -731,45 +642,53 @@ function resolveSemanticJackRole(component: Component): JackRole | null {
731
642
  }
732
643
  return null;
733
644
  }
734
-
735
- function normalizeJackRole(value: string): JackRole | null {
645
+ function normalizeJackRole(value) {
736
646
  const normalized = normalizeToken(value);
737
- if (['input', 'audio-input', 'in'].includes(normalized)) return 'input';
738
- if (['direct-output', 'direct-out', 'dry-output', 'dry-out'].includes(normalized)) return 'direct-output';
739
- if (['output', 'audio-output', 'out'].includes(normalized)) return 'output';
740
- if (normalized === 'send') return 'send';
741
- if (normalized === 'return') return 'return';
742
- if (['expression', 'exp', 'expression-pedal'].includes(normalized)) return 'expression';
743
- if (['tempo-tap', 'tap-tempo', 'tempo-in', 'tap', 'tempo'].includes(normalized)) return 'tempo-tap';
744
- if (
745
- [
746
- 'external-control',
747
- 'external-control-input',
748
- 'control-input',
749
- 'remote',
750
- 'footswitch',
751
- 'trigger',
752
- 'reset',
753
- ].includes(normalized)
754
- ) {
647
+ if (['input', 'audio-input', 'in'].includes(normalized))
648
+ return 'input';
649
+ if (['direct-output', 'direct-out', 'dry-output', 'dry-out'].includes(normalized))
650
+ return 'direct-output';
651
+ if (['output', 'audio-output', 'out'].includes(normalized))
652
+ return 'output';
653
+ if (normalized === 'send')
654
+ return 'send';
655
+ if (normalized === 'return')
656
+ return 'return';
657
+ if (['expression', 'exp', 'expression-pedal'].includes(normalized))
658
+ return 'expression';
659
+ if (['tempo-tap', 'tap-tempo', 'tempo-in', 'tap', 'tempo'].includes(normalized))
660
+ return 'tempo-tap';
661
+ if ([
662
+ 'external-control',
663
+ 'external-control-input',
664
+ 'control-input',
665
+ 'remote',
666
+ 'footswitch',
667
+ 'trigger',
668
+ 'reset',
669
+ ].includes(normalized)) {
755
670
  return 'external-control';
756
671
  }
757
672
  return null;
758
673
  }
759
-
760
- function inferLedColor(component: Component): string | undefined {
674
+ function inferLedColor(component) {
761
675
  // Common pedal LED colors are usually red / amber / green. Try the part number.
762
676
  const part = propertyString(component, 'PartNumber')?.toLowerCase() ?? '';
763
- if (part.includes('red')) return 'red';
764
- if (part.includes('green')) return 'green';
765
- if (part.includes('amber')) return 'amber';
766
- if (part.includes('blue')) return 'blue';
767
- if (part.includes('yellow')) return 'yellow';
768
- if (part.includes('white')) return 'white';
677
+ if (part.includes('red'))
678
+ return 'red';
679
+ if (part.includes('green'))
680
+ return 'green';
681
+ if (part.includes('amber'))
682
+ return 'amber';
683
+ if (part.includes('blue'))
684
+ return 'blue';
685
+ if (part.includes('yellow'))
686
+ return 'yellow';
687
+ if (part.includes('white'))
688
+ return 'white';
769
689
  return undefined;
770
690
  }
771
-
772
- function shortType(sourceTypeName: string | null): string | null {
691
+ function shortType(sourceTypeName) {
773
692
  if (sourceTypeName === null) {
774
693
  return null;
775
694
  }
@@ -780,17 +699,14 @@ function shortType(sourceTypeName: string | null): string | null {
780
699
  const ltspice = sourceTypeName.match(/^ltspice:([A-Za-z0-9_]+)/);
781
700
  return ltspice?.[1] ?? null;
782
701
  }
783
-
784
- function propertyString(component: Component, name: string): string | null {
702
+ function propertyString(component, name) {
785
703
  return propertyStringValue(component.properties[name]);
786
704
  }
787
-
788
- function nonEmptyString(value: string | null): string | undefined {
705
+ function nonEmptyString(value) {
789
706
  const trimmed = value?.trim();
790
707
  return trimmed === undefined || trimmed.length === 0 ? undefined : trimmed;
791
708
  }
792
-
793
- function propertyStringAny(component: Component, names: readonly string[]): string | null {
709
+ function propertyStringAny(component, names) {
794
710
  for (const name of names) {
795
711
  const value = propertyString(component, name);
796
712
  if (value !== null) {
@@ -799,17 +715,14 @@ function propertyStringAny(component: Component, names: readonly string[]): stri
799
715
  }
800
716
  return null;
801
717
  }
802
-
803
- function quantityProperty(component: Component, name: string): ParsedQuantity | undefined {
718
+ function quantityProperty(component, name) {
804
719
  const value = component.properties[name];
805
720
  return isParsedQuantity(value) ? value : undefined;
806
721
  }
807
-
808
- function parseNumeric(value: PropertyValue | undefined): number | undefined {
722
+ function parseNumeric(value) {
809
723
  return propertyNumericValue(value);
810
724
  }
811
-
812
- function parseNumericAny(component: Component, names: readonly string[]): number | undefined {
725
+ function parseNumericAny(component, names) {
813
726
  for (const name of names) {
814
727
  const value = parseNumeric(component.properties[name]);
815
728
  if (value !== undefined) {
@@ -818,8 +731,7 @@ function parseNumericAny(component: Component, names: readonly string[]): number
818
731
  }
819
732
  return undefined;
820
733
  }
821
-
822
- function parseStepLabels(value: string | null): readonly string[] {
734
+ function parseStepLabels(value) {
823
735
  if (value === null) {
824
736
  return [];
825
737
  }
@@ -829,8 +741,7 @@ function parseStepLabels(value: string | null): readonly string[] {
829
741
  .filter((part) => part.length > 0);
830
742
  return parts.length >= 2 ? parts : [];
831
743
  }
832
-
833
- function parseStepCount(value: string | null): number | undefined {
744
+ function parseStepCount(value) {
834
745
  if (value === null) {
835
746
  return undefined;
836
747
  }
@@ -841,8 +752,7 @@ function parseStepCount(value: string | null): number | undefined {
841
752
  const count = Number(trimmed);
842
753
  return Number.isInteger(count) && count >= 2 ? count : undefined;
843
754
  }
844
-
845
- function runtimeModeDefaultPosition(steps: readonly KnobStep[], rawValue: number | undefined): number {
755
+ function runtimeModeDefaultPosition(steps, rawValue) {
846
756
  if (steps.length === 0) {
847
757
  return 0;
848
758
  }
@@ -855,24 +765,25 @@ function runtimeModeDefaultPosition(steps: readonly KnobStep[], rawValue: number
855
765
  }
856
766
  return snapKnobPosition({ steps }, clamp01(rawValue));
857
767
  }
858
-
859
- function isRuntimeDescriptor(component: Component): boolean {
768
+ function isRuntimeDescriptor(component) {
860
769
  return component.kind === 'ic' && component.properties.RuntimeDescriptor === 'true';
861
770
  }
862
-
863
- function normalizeToken(value: string): string {
771
+ function normalizeToken(value) {
864
772
  return value.trim().toLowerCase().replace(/[\s_]+/g, '-');
865
773
  }
866
-
867
- function clamp01(v: number): number {
868
- if (v < 0) return 0;
869
- if (v > 1) return 1;
774
+ function clamp01(v) {
775
+ if (v < 0)
776
+ return 0;
777
+ if (v > 1)
778
+ return 1;
870
779
  return v;
871
780
  }
872
-
873
- function clampInt(v: number, lo: number, hi: number): number {
781
+ function clampInt(v, lo, hi) {
874
782
  const n = Math.trunc(v);
875
- if (n < lo) return lo;
876
- if (n > hi) return hi;
783
+ if (n < lo)
784
+ return lo;
785
+ if (n > hi)
786
+ return hi;
877
787
  return n;
878
788
  }
789
+ //# sourceMappingURL=extract.js.map