@burdenoff/ui-engine 2026.1127.3 → 2026.1127.5

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 (65) hide show
  1. package/README.md +71 -5
  2. package/dist/analyze/analyze.d.ts +19 -0
  3. package/dist/analyze/context.d.ts +40 -0
  4. package/dist/analyze/index.d.ts +10 -0
  5. package/dist/analyze/messages.d.ts +39 -0
  6. package/dist/analyze/rules/fixed-wait.d.ts +6 -0
  7. package/dist/analyze/rules/hardware-input.d.ts +2 -0
  8. package/dist/analyze/rules/index.d.ts +3 -0
  9. package/dist/analyze/rules/inline-target.d.ts +2 -0
  10. package/dist/analyze/rules/masked-value.d.ts +8 -0
  11. package/dist/analyze/rules/no-cleanup.d.ts +2 -0
  12. package/dist/analyze/rules/plain-text-secret.d.ts +2 -0
  13. package/dist/analyze/rules/rule.d.ts +15 -0
  14. package/dist/analyze/rules/secret-origin.d.ts +7 -0
  15. package/dist/analyze/rules/sensitive-screenshot.d.ts +2 -0
  16. package/dist/analyze/rules/single-method-target.d.ts +2 -0
  17. package/dist/analyze/rules/unknown-variable.d.ts +2 -0
  18. package/dist/analyze/rules/unused-value.d.ts +2 -0
  19. package/dist/analyze/sensitive.d.ts +14 -0
  20. package/dist/analyze/types.d.ts +66 -0
  21. package/dist/analyze.d.ts +2 -0
  22. package/dist/analyze.js +26 -0
  23. package/dist/dom-runtime.iife.js +1 -1
  24. package/dist/dom-runtime.js +27 -532
  25. package/dist/drivers/dom-driver.d.ts +44 -0
  26. package/dist/drivers/index.d.ts +7 -0
  27. package/dist/drivers/snapshot-driver.d.ts +59 -0
  28. package/dist/drivers.d.ts +2 -0
  29. package/dist/drivers.js +172 -0
  30. package/dist/index-21hvbvx1.js +340 -0
  31. package/dist/{index-q1b0j9yr.js → index-5k26keah.js} +58 -592
  32. package/dist/index-77pcz6n3.js +303 -0
  33. package/dist/index-8w0f6rsz.js +402 -0
  34. package/dist/index-9s5nphx0.js +99 -0
  35. package/dist/index-c88tvyj1.js +743 -0
  36. package/dist/index-ct2xctrq.js +229 -0
  37. package/dist/index-g7724awk.js +224 -0
  38. package/dist/index-gvavb597.js +195 -0
  39. package/dist/index-r2a9rftv.js +1740 -0
  40. package/dist/index-s7qdecev.js +489 -0
  41. package/dist/index-vg8r40y7.js +220 -0
  42. package/dist/index-xner4tgb.js +810 -0
  43. package/dist/index-ycs2bz1a.js +589 -0
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.js +163 -49
  46. package/dist/interpret/compile.d.ts +58 -0
  47. package/dist/interpret/driver.d.ts +171 -0
  48. package/dist/interpret/errors.d.ts +194 -0
  49. package/dist/interpret/events.d.ts +73 -0
  50. package/dist/interpret/expr.d.ts +35 -0
  51. package/dist/interpret/index.d.ts +13 -0
  52. package/dist/interpret/run.d.ts +77 -0
  53. package/dist/interpret.d.ts +2 -0
  54. package/dist/interpret.js +84 -0
  55. package/dist/script/adapters/browser-action-contract.d.ts +5 -2
  56. package/dist/script/limits.d.ts +2 -0
  57. package/dist/script.js +60 -50
  58. package/dist/target/index.d.ts +1 -1
  59. package/dist/target/resolve.d.ts +18 -1
  60. package/dist/target.js +23 -19
  61. package/dist/testing/fake-web-driver.d.ts +28 -0
  62. package/dist/testing/index.d.ts +3 -2
  63. package/dist/testing.js +55 -0
  64. package/package.json +15 -3
  65. package/dist/index-zwrxw3zp.js +0 -1988
@@ -0,0 +1,489 @@
1
+ import {
2
+ describeTarget2
3
+ } from "./index-gvavb597.js";
4
+ import {
5
+ UI_FLOW_ACTIONS2,
6
+ walkSteps2,
7
+ stepTargets2,
8
+ stepExpressions2,
9
+ visitExpression2
10
+ } from "./index-g7724awk.js";
11
+
12
+ // src/analyze/context.ts
13
+ function stepNumber2(path) {
14
+ return path.split(".").filter((part) => part !== "then" && part !== "steps").map((part) => /^\d+$/.test(part) ? String(Number(part) + 1) : part).join(".");
15
+ }
16
+ function createContext(script, options) {
17
+ const elements = script.elements ?? {};
18
+ const steps = [];
19
+ const disabledBlocks = [];
20
+ let order = 0;
21
+ for (const { step, path } of walkSteps2(script)) {
22
+ const index = order;
23
+ order += 1;
24
+ if (disabledBlocks.some((prefix) => path.startsWith(prefix)))
25
+ continue;
26
+ if (step.disabled === true) {
27
+ disabledBlocks.push(`${path}.`);
28
+ continue;
29
+ }
30
+ steps.push({ step, path, number: stepNumber2(path), order: index });
31
+ }
32
+ return {
33
+ script,
34
+ options,
35
+ elements,
36
+ steps,
37
+ totalSteps: order,
38
+ targetOf: (ref) => ("element" in ref) ? elements[ref.element]?.target : ref,
39
+ describeTarget: (ref) => describeTarget2(ref, elements)
40
+ };
41
+ }
42
+ function variablesRead(expression) {
43
+ const names = [];
44
+ visitExpression2(expression, (node) => {
45
+ if (node !== null && typeof node === "object" && "var" in node)
46
+ names.push(node.var);
47
+ });
48
+ return names;
49
+ }
50
+ function stepVariablesRead(step) {
51
+ return stepExpressions2(step).flatMap(([, expression]) => variablesRead(expression));
52
+ }
53
+ function stepVariablesSet(step) {
54
+ const names = [];
55
+ if (step.saveAs !== undefined)
56
+ names.push(step.saveAs);
57
+ if (step.action === "set")
58
+ names.push(step.name);
59
+ if (step.action === "forEach") {
60
+ names.push(step.as);
61
+ if (step.index !== undefined)
62
+ names.push(step.index);
63
+ }
64
+ return names;
65
+ }
66
+ function signsIn(step) {
67
+ return step.action === "login" || step.action === "typeSecret";
68
+ }
69
+
70
+ // src/analyze/messages.ts
71
+ var UI_SCRIPT_PROBLEM_KEY_PREFIX2 = "fluidgrids.builder.uiScript.problem.";
72
+ var UI_SCRIPT_PROBLEM_MESSAGES2 = {
73
+ fixedWait: "Step {{step}} waits a fixed {{milliseconds}} ms. Wait for an element, a text or an address instead, so the step neither fails on a slow page nor wastes time on a fast one.",
74
+ singleMethodTarget: "Step {{step}} finds {{target}} by one method only. Add another method so a page change does not break the step.",
75
+ noEnabledMethod: "Step {{step}} has every method of {{target}} switched off, so it can never find the element. Switch a method on.",
76
+ hardwareInput: "Step {{step}} uses hardware input, which needs the browser window in front and the screen unlocked. Use automatic input unless the page refuses it.",
77
+ hardwareInputSettings: "The script uses hardware input for every step, which needs the browser window in front and the screen unlocked. Use automatic input unless a page refuses it.",
78
+ unknownVariable: "Step {{step}} reads {{name}}, but no step sets it and the script does not declare it, so it is empty when the step runs.",
79
+ unknownVariableOutput: "The output {{output}} reads {{name}}, but no step sets it and the script does not declare it, so the output is always empty.",
80
+ unknownVariableInitial: "The initial value of the variable {{variable}} reads {{name}}, but no step sets it and the script does not declare it, so it reads as empty.",
81
+ unknownVariableDefault: "The default of the input {{input}} reads {{name}}, but no step sets it and the script does not declare it, so it reads as empty.",
82
+ maskedValue: "Step {{step}} types a value that was hidden during recording. Give it a value, such as a workflow input, or the run stops at this step.",
83
+ typeWithoutValue: "Step {{step}} has no value to type, so it types nothing. Give it a value or remove the step.",
84
+ noCleanup: "The script signs in at step {{step}} but has no clean-up steps. Add clean-up steps that sign out or close the tab, so a failed run does not leave the session open.",
85
+ plainTextSecret: "Step {{step}} types into {{target}}, which looks like a password or code field, with a plain Type step. Use Type secret with a connection so the value is never stored or shown.",
86
+ secretOrigin: "Step {{step}} types a secret without an expected site. Set the site the secret may be typed into, so it is never typed into another page.",
87
+ sensitiveScreenshot: "Step {{step}} signs in or types a secret and takes a screenshot every time it runs. Take screenshots of this step on failure only.",
88
+ sensitiveScreenshotSettings: "The script takes a screenshot of every step, including step {{step}}, which signs in or types a secret. Take screenshots on failure only, or turn them off for that step.",
89
+ inlineTarget: "Step {{step}} uses an inline target. Add it to the Element library so other workflows can reuse it.",
90
+ unusedValue: "Step {{step}} stores {{name}}, but no step, output or later node reads it.",
91
+ unusedVariable: "The variable {{name}} is declared, but no step reads it."
92
+ };
93
+ function problemMessageKey2(name) {
94
+ return `${UI_SCRIPT_PROBLEM_KEY_PREFIX2}${name}`;
95
+ }
96
+ function problemMessage2(name, vars) {
97
+ return UI_SCRIPT_PROBLEM_MESSAGES2[name].replace(/\{\{(\w+)\}\}/g, (_match, variable) => String(vars[variable] ?? ""));
98
+ }
99
+
100
+ // src/analyze/rules/rule.ts
101
+ function stepFinding(active, message, vars = {}, field) {
102
+ return {
103
+ message,
104
+ vars: { step: active.number, ...vars },
105
+ path: active.path,
106
+ stepId: active.step.id,
107
+ ...field === undefined ? {} : { field },
108
+ order: active.order
109
+ };
110
+ }
111
+
112
+ // src/analyze/rules/fixed-wait.ts
113
+ var fixedWaitRule = {
114
+ id: "fixedWait",
115
+ group: "reliability",
116
+ severity: "warning",
117
+ description: "A Wait step that waits a fixed time instead of for an element, a text or an address.",
118
+ check: (context) => context.steps.flatMap((active) => active.step.action === "waitFor" && active.step.milliseconds !== undefined ? [stepFinding(active, "fixedWait", { milliseconds: active.step.milliseconds }, "milliseconds")] : [])
119
+ };
120
+
121
+ // src/analyze/rules/hardware-input.ts
122
+ var FLOW_ACTIONS = new Set(UI_FLOW_ACTIONS2);
123
+ var hardwareInputRule = {
124
+ id: "hardwareInput",
125
+ group: "reliability",
126
+ severity: "warning",
127
+ description: "Hardware input, set for the whole script or for one step.",
128
+ check: (context) => {
129
+ const findings = [];
130
+ const scriptWide = context.script.settings?.inputMethod === "hardware" && context.steps.some((active) => !FLOW_ACTIONS.has(active.step.action) && active.step.inputMethod === undefined);
131
+ if (scriptWide) {
132
+ findings.push({ message: "hardwareInputSettings", vars: {}, field: "settings.inputMethod", order: -1 });
133
+ }
134
+ for (const active of context.steps) {
135
+ if (active.step.inputMethod === "hardware" && !scriptWide) {
136
+ findings.push(stepFinding(active, "hardwareInput", {}, "inputMethod"));
137
+ }
138
+ }
139
+ return findings;
140
+ }
141
+ };
142
+
143
+ // src/analyze/rules/inline-target.ts
144
+ var inlineTargetRule = {
145
+ id: "inlineTarget",
146
+ group: "maintainability",
147
+ severity: "info",
148
+ description: "A step that holds its target inline instead of using an Element library element.",
149
+ check: (context) => context.steps.flatMap((active) => {
150
+ const inline = stepTargets2(active.step).find(([, ref]) => !("element" in ref));
151
+ if (!inline)
152
+ return [];
153
+ const [field, ref] = inline;
154
+ return [stepFinding(active, "inlineTarget", { target: context.describeTarget(ref) }, field)];
155
+ })
156
+ };
157
+
158
+ // src/analyze/rules/masked-value.ts
159
+ var maskedValueRule = {
160
+ id: "maskedValue",
161
+ group: "reliability",
162
+ severity: "warning",
163
+ description: "A Type step whose value was masked during recording, or that has no value at all.",
164
+ check: (context) => context.steps.flatMap((active) => {
165
+ const step = active.step;
166
+ if (step.action !== "type" || step.text !== undefined)
167
+ return [];
168
+ return [stepFinding(active, step.masked === true ? "maskedValue" : "typeWithoutValue", {}, "text")];
169
+ })
170
+ };
171
+
172
+ // src/analyze/rules/no-cleanup.ts
173
+ var noCleanupRule = {
174
+ id: "noCleanup",
175
+ group: "reliability",
176
+ severity: "warning",
177
+ description: "A script that signs in or types a secret but has no clean-up step that runs.",
178
+ check: (context) => {
179
+ const hasCleanup = context.steps.some((active) => active.path.startsWith("cleanup."));
180
+ if (hasCleanup)
181
+ return [];
182
+ const first = context.steps.find((active) => signsIn(active.step));
183
+ return first ? [stepFinding(first, "noCleanup")] : [];
184
+ }
185
+ };
186
+
187
+ // src/analyze/sensitive.ts
188
+ var SECRET_FIELD = /password|passcode|passwd|\bpin\b|\botp\b|one[\s-]?time|\bverification\b|security code|auth(?:entication)? code|\bcvv\b|\bcvc\b|card number|\bsecrets?\b|\btokens?\b|\brecovery\b/i;
189
+ var PASSWORD_TYPE = /type\s*=\s*["']?password/i;
190
+ function words(text) {
191
+ return text.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[^\p{L}\p{N}]+/gu, " ").trim();
192
+ }
193
+ function readsLikeSecret(text) {
194
+ return PASSWORD_TYPE.test(text) || SECRET_FIELD.test(words(text));
195
+ }
196
+ function targetWords(target) {
197
+ const texts = [];
198
+ for (const method of target.methods) {
199
+ switch (method.kind) {
200
+ case "role":
201
+ case "fuzzy":
202
+ texts.push(method.name);
203
+ break;
204
+ case "css":
205
+ texts.push(method.selector);
206
+ break;
207
+ case "testId":
208
+ texts.push(method.value);
209
+ break;
210
+ case "xpath":
211
+ texts.push(method.xpath);
212
+ break;
213
+ case "anchor":
214
+ texts.push(method.anchor.kind === "text" ? method.anchor.text : method.anchor.name);
215
+ break;
216
+ default:
217
+ texts.push(method.text);
218
+ break;
219
+ }
220
+ }
221
+ return texts;
222
+ }
223
+ function looksLikeSecretField(target, elementName) {
224
+ if (elementName !== undefined && readsLikeSecret(elementName))
225
+ return true;
226
+ return target !== undefined && targetWords(target).some(readsLikeSecret);
227
+ }
228
+
229
+ // src/analyze/rules/plain-text-secret.ts
230
+ var plainTextSecretRule = {
231
+ id: "plainTextSecret",
232
+ group: "security",
233
+ severity: "warning",
234
+ description: "A plain Type step into a field that looks like a password or code field.",
235
+ check: (context) => context.steps.flatMap((active) => {
236
+ const step = active.step;
237
+ if (step.action !== "type" || !step.target)
238
+ return [];
239
+ const name = "element" in step.target ? context.elements[step.target.element]?.name : undefined;
240
+ if (!looksLikeSecretField(context.targetOf(step.target), name))
241
+ return [];
242
+ return [stepFinding(active, "plainTextSecret", { target: context.describeTarget(step.target) }, "target")];
243
+ })
244
+ };
245
+
246
+ // src/analyze/rules/secret-origin.ts
247
+ var secretOriginRule = {
248
+ id: "secretOrigin",
249
+ group: "security",
250
+ severity: "warning",
251
+ description: "A Type secret step without an expected site.",
252
+ check: (context) => context.steps.flatMap((active) => active.step.action === "typeSecret" && active.step.expectedOrigin === undefined ? [stepFinding(active, "secretOrigin", {}, "expectedOrigin")] : [])
253
+ };
254
+
255
+ // src/analyze/rules/sensitive-screenshot.ts
256
+ var sensitiveScreenshotRule = {
257
+ id: "sensitiveScreenshot",
258
+ group: "security",
259
+ severity: "warning",
260
+ description: "A step that signs in or types a secret and takes a screenshot every time it runs.",
261
+ check: (context) => {
262
+ const everyStep = context.script.settings?.screenshots === "everyStep";
263
+ const findings = [];
264
+ for (const active of context.steps) {
265
+ const step = active.step;
266
+ const sensitive = signsIn(step) || step.action === "type" && step.target !== undefined && looksLikeSecretField(context.targetOf(step.target), "element" in step.target ? context.elements[step.target.element]?.name : undefined);
267
+ if (!sensitive)
268
+ continue;
269
+ if (step.screenshot === "always")
270
+ findings.push(stepFinding(active, "sensitiveScreenshot", {}, "screenshot"));
271
+ else if (step.screenshot === undefined && everyStep) {
272
+ findings.push(stepFinding(active, "sensitiveScreenshotSettings", {}, "settings.screenshots"));
273
+ }
274
+ }
275
+ return findings;
276
+ }
277
+ };
278
+
279
+ // src/analyze/rules/single-method-target.ts
280
+ var singleMethodTargetRule = {
281
+ id: "singleMethodTarget",
282
+ group: "reliability",
283
+ severity: "warning",
284
+ description: "A target with only one method switched on, or with none.",
285
+ check: (context) => {
286
+ const findings = [];
287
+ const seenElements = new Set;
288
+ for (const active of context.steps) {
289
+ for (const [field, ref] of stepTargets2(active.step)) {
290
+ if ("element" in ref) {
291
+ if (seenElements.has(ref.element))
292
+ continue;
293
+ seenElements.add(ref.element);
294
+ }
295
+ const target = context.targetOf(ref);
296
+ if (!target)
297
+ continue;
298
+ const enabled = target.methods.filter((method) => method.enabled !== false).length;
299
+ if (enabled > 1)
300
+ continue;
301
+ findings.push(stepFinding(active, enabled === 0 ? "noEnabledMethod" : "singleMethodTarget", { target: context.describeTarget(ref) }, field));
302
+ }
303
+ }
304
+ return findings;
305
+ }
306
+ };
307
+
308
+ // src/analyze/rules/unknown-variable.ts
309
+ var unknownVariableRule = {
310
+ id: "unknownVariable",
311
+ group: "reliability",
312
+ severity: "warning",
313
+ description: "A variable that a step, an output, a variable initial value or an input default reads, but that no step sets and the script does not declare.",
314
+ check: (context) => {
315
+ const { script } = context;
316
+ const known = new Set((script.variables ?? []).map((variable) => variable.name));
317
+ for (const active of context.steps)
318
+ for (const name of stepVariablesSet(active.step))
319
+ known.add(name);
320
+ const unknown = (expression) => [...new Set(variablesRead(expression))].filter((name) => !known.has(name));
321
+ const findings = [];
322
+ script.inputs?.forEach((input, index) => {
323
+ if (input.default === undefined)
324
+ return;
325
+ for (const name of unknown(input.default)) {
326
+ findings.push({
327
+ message: "unknownVariableDefault",
328
+ vars: { input: input.name, name },
329
+ field: `inputs.${index}.default`,
330
+ order: -1
331
+ });
332
+ }
333
+ });
334
+ script.variables?.forEach((variable, index) => {
335
+ if (variable.initial === undefined)
336
+ return;
337
+ for (const name of unknown(variable.initial)) {
338
+ findings.push({
339
+ message: "unknownVariableInitial",
340
+ vars: { variable: variable.name, name },
341
+ field: `variables.${index}.initial`,
342
+ order: -1
343
+ });
344
+ }
345
+ });
346
+ for (const active of context.steps) {
347
+ for (const name of new Set(stepVariablesRead(active.step))) {
348
+ if (!known.has(name))
349
+ findings.push(stepFinding(active, "unknownVariable", { name }));
350
+ }
351
+ }
352
+ script.outputs?.forEach((output, index) => {
353
+ for (const name of unknown(output.value)) {
354
+ findings.push({
355
+ message: "unknownVariableOutput",
356
+ vars: { output: output.name, name },
357
+ field: `outputs.${index}.value`,
358
+ order: context.totalSteps + index
359
+ });
360
+ }
361
+ });
362
+ return findings;
363
+ }
364
+ };
365
+
366
+ // src/analyze/rules/unused-value.ts
367
+ var LOCAL_PREFIX = "__";
368
+ var unusedValueRule = {
369
+ id: "unusedValue",
370
+ group: "maintainability",
371
+ severity: "info",
372
+ description: "A stored value or a declared variable that nothing reads.",
373
+ check: (context) => {
374
+ const { script, options } = context;
375
+ const read = new Set(options.externalReads ?? []);
376
+ for (const active of context.steps)
377
+ for (const name of stepVariablesRead(active.step))
378
+ read.add(name);
379
+ for (const output of script.outputs ?? [])
380
+ for (const name of variablesRead(output.value))
381
+ read.add(name);
382
+ for (const variable of script.variables ?? []) {
383
+ if (variable.initial !== undefined)
384
+ for (const name of variablesRead(variable.initial))
385
+ read.add(name);
386
+ }
387
+ for (const input of script.inputs ?? []) {
388
+ if (input.default !== undefined)
389
+ for (const name of variablesRead(input.default))
390
+ read.add(name);
391
+ }
392
+ const reportable = (name) => !read.has(name) && (options.externalReads !== undefined || name.startsWith(LOCAL_PREFIX));
393
+ const findings = [];
394
+ const setByStep = new Set;
395
+ for (const active of context.steps) {
396
+ const step = active.step;
397
+ if (step.action === "set") {
398
+ setByStep.add(step.name);
399
+ if (reportable(step.name))
400
+ findings.push(stepFinding(active, "unusedValue", { name: step.name }, "name"));
401
+ }
402
+ if (step.saveAs !== undefined) {
403
+ setByStep.add(step.saveAs);
404
+ if (reportable(step.saveAs))
405
+ findings.push(stepFinding(active, "unusedValue", { name: step.saveAs }, "saveAs"));
406
+ }
407
+ }
408
+ script.variables?.forEach((variable, index) => {
409
+ if (read.has(variable.name) || setByStep.has(variable.name))
410
+ return;
411
+ findings.push({
412
+ message: "unusedVariable",
413
+ vars: { name: variable.name },
414
+ field: `variables.${index}`,
415
+ order: -1
416
+ });
417
+ });
418
+ return findings;
419
+ }
420
+ };
421
+
422
+ // src/analyze/rules/index.ts
423
+ var UI_ANALYZER_RULES2 = [
424
+ fixedWaitRule,
425
+ singleMethodTargetRule,
426
+ hardwareInputRule,
427
+ unknownVariableRule,
428
+ maskedValueRule,
429
+ noCleanupRule,
430
+ plainTextSecretRule,
431
+ secretOriginRule,
432
+ sensitiveScreenshotRule,
433
+ inlineTargetRule,
434
+ unusedValueRule
435
+ ];
436
+
437
+ // src/analyze/types.ts
438
+ var UI_PROBLEM_SEVERITIES2 = ["warning", "info"];
439
+ var UI_ANALYZER_RULE_GROUPS2 = ["reliability", "security", "maintainability"];
440
+ var UI_ANALYZER_RULE_IDS2 = [
441
+ "fixedWait",
442
+ "singleMethodTarget",
443
+ "hardwareInput",
444
+ "unknownVariable",
445
+ "maskedValue",
446
+ "noCleanup",
447
+ "plainTextSecret",
448
+ "secretOrigin",
449
+ "sensitiveScreenshot",
450
+ "inlineTarget",
451
+ "unusedValue"
452
+ ];
453
+
454
+ // src/analyze/analyze.ts
455
+ var UI_ANALYZER_DEFAULT_SEVERITY2 = Object.freeze(Object.fromEntries(UI_ANALYZER_RULES2.map((rule) => [rule.id, rule.severity])));
456
+ function severitySetting(setting, fallback) {
457
+ if (setting === "off")
458
+ return "off";
459
+ return UI_PROBLEM_SEVERITIES2.find((severity) => severity === setting) ?? fallback;
460
+ }
461
+ function analyzeUiScript2(script, options = {}) {
462
+ const context = createContext(script, options);
463
+ const found = [];
464
+ UI_ANALYZER_RULES2.forEach((rule, rank) => {
465
+ const setting = severitySetting(options.severity?.[rule.id], rule.severity);
466
+ if (setting === "off")
467
+ return;
468
+ for (const finding of rule.check(context)) {
469
+ found.push({
470
+ problem: {
471
+ rule: rule.id,
472
+ group: rule.group,
473
+ severity: setting,
474
+ messageKey: problemMessageKey2(finding.message),
475
+ vars: finding.vars,
476
+ message: problemMessage2(finding.message, finding.vars),
477
+ ...finding.path === undefined ? {} : { path: finding.path },
478
+ ...finding.stepId === undefined ? {} : { stepId: finding.stepId },
479
+ ...finding.field === undefined ? {} : { field: finding.field }
480
+ },
481
+ order: finding.order,
482
+ rank,
483
+ seq: found.length
484
+ });
485
+ }
486
+ });
487
+ return found.sort((a, b) => a.order - b.order || a.rank - b.rank || a.seq - b.seq).map(({ problem }) => problem);
488
+ }
489
+ export { stepNumber2, UI_SCRIPT_PROBLEM_KEY_PREFIX2, UI_SCRIPT_PROBLEM_MESSAGES2, problemMessageKey2, problemMessage2, UI_ANALYZER_RULES2, UI_PROBLEM_SEVERITIES2, UI_ANALYZER_RULE_GROUPS2, UI_ANALYZER_RULE_IDS2, UI_ANALYZER_DEFAULT_SEVERITY2, analyzeUiScript2 };