@outerlayer/cli 0.4.0 → 0.4.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 (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +4 -2
  3. package/dist/build-info.json +1 -1
  4. package/dist/{check-WQP2CZDW.js → check-7MFH6HNC.js} +11 -11
  5. package/dist/{chunk-L2DBRKRA.js → chunk-3TFPDVTI.js} +1 -1
  6. package/dist/{chunk-G7FSV7JX.js → chunk-4C4THABW.js} +2116 -5
  7. package/dist/{chunk-DVYHCMB2.js → chunk-7WERLFVR.js} +1 -1
  8. package/dist/{chunk-FAJSS2WN.js → chunk-DM3VFDS3.js} +138 -34
  9. package/dist/{chunk-7A6RVXPZ.js → chunk-HZRNMGLF.js} +1 -1
  10. package/dist/{chunk-3YPKXE5L.js → chunk-LT5TZHYH.js} +8 -5
  11. package/dist/{chunk-HE2D4EY5.js → chunk-LYCDNMOH.js} +1 -1
  12. package/dist/{chunk-FV2CCGXK.js → chunk-QDQEUVUF.js} +1 -1
  13. package/dist/{chunk-FS2VYGZT.js → chunk-QY22NZUW.js} +6 -6
  14. package/dist/{chunk-7YIOOFVJ.js → chunk-RFUPN6KX.js} +4 -4
  15. package/dist/{chunk-3TT7RQYB.js → chunk-SY4GK4SP.js} +1 -1
  16. package/dist/{chunk-NYC54VBD.js → chunk-TWNWNS2Q.js} +5 -5
  17. package/dist/{chunk-5DLBAXY5.js → chunk-W5FVUZXV.js} +2 -2
  18. package/dist/{chunk-6Y63SXFO.js → chunk-WFJ65NUD.js} +1 -1
  19. package/dist/{chunk-2E54Z3P5.js → chunk-Y7KJLXYN.js} +3 -3
  20. package/dist/{chunk-CBZB6XY6.js → chunk-YFHIIH4B.js} +2 -2
  21. package/dist/{cli-NHUXABYH.js → cli-W62AFRSW.js} +71 -47
  22. package/dist/{connect-cmd-OOG4TPU7.js → connect-cmd-ZTJONP37.js} +4 -4
  23. package/dist/{dist-RW4UPPC2.js → dist-44CQVWGT.js} +1 -1
  24. package/dist/{doctor-UFVL4PZY.js → doctor-ZLGZYMDK.js} +7 -7
  25. package/dist/{emit-artifact-cmd-KTYW2TN2.js → emit-artifact-cmd-AKZP7TMF.js} +67 -7
  26. package/dist/{emit-criteria-cmd-VAUUSAYD.js → emit-criteria-cmd-7MXQVCKD.js} +1 -1
  27. package/dist/{emit-finding-cmd-UR4ID45Z.js → emit-finding-cmd-N2FTGCVC.js} +1 -1
  28. package/dist/{emit-result-cmd-FDTUKGKE.js → emit-result-cmd-4CPDBMN2.js} +4 -4
  29. package/dist/index.js +1 -1
  30. package/dist/{init-DXBCOAJK.js → init-55Y4LHWF.js} +6 -6
  31. package/dist/{init-YEXK35CF.js → init-XXEKWZQP.js} +6 -6
  32. package/dist/{init-cmd-NHR7PRSQ.js → init-cmd-WLST2F7G.js} +6 -6
  33. package/dist/{loop-VZOLL4WQ.js → loop-JFIBP4B7.js} +8 -8
  34. package/dist/{machine-WSG52J75.js → machine-ZBPT2J3R.js} +5 -5
  35. package/dist/{mcp-serve-cmd-JPTP5FMS.js → mcp-serve-cmd-N6UD2KBX.js} +1 -1
  36. package/dist/{status-2UZKKNB7.js → status-UJXWZRN5.js} +6 -6
  37. package/dist/{sync-cmd-VPPYCNNM.js → sync-cmd-4G4A7EVN.js} +4 -4
  38. package/dist/{watch-5C4ZBBGO.js → watch-7SKJKGAA.js} +4 -4
  39. package/dist/{work-claim-cmd-LSO2B2EX.js → work-claim-cmd-5F7VZ42N.js} +6 -6
  40. package/dist/{work-cmd-UOQO2AD4.js → work-cmd-QAUZ7MTD.js} +3 -3
  41. package/dist/{work-comment-cmd-WF3EOLAE.js → work-comment-cmd-BNCSBTLH.js} +3 -3
  42. package/dist/{work-open-pr-cmd-4SSQZMYG.js → work-open-pr-cmd-VFYZHIIW.js} +4 -4
  43. package/dist/{work-pr-cmd-6AN6RRQJ.js → work-pr-cmd-PV32ZLSI.js} +2 -2
  44. package/package.json +1 -1
  45. package/skill-pack/maintained/emitting-evidence/SKILL.md +10 -1
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { __export } from './chunk-Z5GEFMRW.js';
3
+ import { __commonJS, __export, __toESM } from './chunk-Z5GEFMRW.js';
4
4
  import { createHash } from 'crypto';
5
5
  import { readFileSync, readdirSync, statSync, mkdirSync, copyFileSync, renameSync, unlinkSync, writeFileSync, stat as stat$1, unwatchFile, watchFile, watch as watch$1 } from 'fs';
6
6
  import { type, homedir } from 'os';
@@ -14,6 +14,1904 @@ import { execFileSync } from 'child_process';
14
14
 
15
15
  createRequire(import.meta.url);
16
16
 
17
+ // ../../node_modules/xmlchars/xml/1.0/ed5.js
18
+ var require_ed5 = __commonJS({
19
+ "../../node_modules/xmlchars/xml/1.0/ed5.js"(exports$1) {
20
+ Object.defineProperty(exports$1, "__esModule", { value: true });
21
+ exports$1.CHAR = " \n\r -\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";
22
+ exports$1.S = " \r\n";
23
+ exports$1.NAME_START_CHAR = ":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";
24
+ exports$1.NAME_CHAR = "-" + exports$1.NAME_START_CHAR + ".0-9\xB7\u0300-\u036F\u203F-\u2040";
25
+ exports$1.CHAR_RE = new RegExp("^[" + exports$1.CHAR + "]$", "u");
26
+ exports$1.S_RE = new RegExp("^[" + exports$1.S + "]+$", "u");
27
+ exports$1.NAME_START_CHAR_RE = new RegExp("^[" + exports$1.NAME_START_CHAR + "]$", "u");
28
+ exports$1.NAME_CHAR_RE = new RegExp("^[" + exports$1.NAME_CHAR + "]$", "u");
29
+ exports$1.NAME_RE = new RegExp("^[" + exports$1.NAME_START_CHAR + "][" + exports$1.NAME_CHAR + "]*$", "u");
30
+ exports$1.NMTOKEN_RE = new RegExp("^[" + exports$1.NAME_CHAR + "]+$", "u");
31
+ var TAB = 9;
32
+ var NL = 10;
33
+ var CR = 13;
34
+ var SPACE = 32;
35
+ exports$1.S_LIST = [SPACE, NL, CR, TAB];
36
+ function isChar(c) {
37
+ return c >= SPACE && c <= 55295 || c === NL || c === CR || c === TAB || c >= 57344 && c <= 65533 || c >= 65536 && c <= 1114111;
38
+ }
39
+ exports$1.isChar = isChar;
40
+ function isS(c) {
41
+ return c === SPACE || c === NL || c === CR || c === TAB;
42
+ }
43
+ exports$1.isS = isS;
44
+ function isNameStartChar(c) {
45
+ return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 58 || c === 95 || c === 8204 || c === 8205 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 767 || c >= 880 && c <= 893 || c >= 895 && c <= 8191 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;
46
+ }
47
+ exports$1.isNameStartChar = isNameStartChar;
48
+ function isNameChar(c) {
49
+ return isNameStartChar(c) || c >= 48 && c <= 57 || c === 45 || c === 46 || c === 183 || c >= 768 && c <= 879 || c >= 8255 && c <= 8256;
50
+ }
51
+ exports$1.isNameChar = isNameChar;
52
+ }
53
+ });
54
+
55
+ // ../../node_modules/xmlchars/xml/1.1/ed2.js
56
+ var require_ed2 = __commonJS({
57
+ "../../node_modules/xmlchars/xml/1.1/ed2.js"(exports$1) {
58
+ Object.defineProperty(exports$1, "__esModule", { value: true });
59
+ exports$1.CHAR = "-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";
60
+ exports$1.RESTRICTED_CHAR = "-\b\v\f-\x7F-\x84\x86-\x9F";
61
+ exports$1.S = " \r\n";
62
+ exports$1.NAME_START_CHAR = ":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";
63
+ exports$1.NAME_CHAR = "-" + exports$1.NAME_START_CHAR + ".0-9\xB7\u0300-\u036F\u203F-\u2040";
64
+ exports$1.CHAR_RE = new RegExp("^[" + exports$1.CHAR + "]$", "u");
65
+ exports$1.RESTRICTED_CHAR_RE = new RegExp("^[" + exports$1.RESTRICTED_CHAR + "]$", "u");
66
+ exports$1.S_RE = new RegExp("^[" + exports$1.S + "]+$", "u");
67
+ exports$1.NAME_START_CHAR_RE = new RegExp("^[" + exports$1.NAME_START_CHAR + "]$", "u");
68
+ exports$1.NAME_CHAR_RE = new RegExp("^[" + exports$1.NAME_CHAR + "]$", "u");
69
+ exports$1.NAME_RE = new RegExp("^[" + exports$1.NAME_START_CHAR + "][" + exports$1.NAME_CHAR + "]*$", "u");
70
+ exports$1.NMTOKEN_RE = new RegExp("^[" + exports$1.NAME_CHAR + "]+$", "u");
71
+ var TAB = 9;
72
+ var NL = 10;
73
+ var CR = 13;
74
+ var SPACE = 32;
75
+ exports$1.S_LIST = [SPACE, NL, CR, TAB];
76
+ function isChar(c) {
77
+ return c >= 1 && c <= 55295 || c >= 57344 && c <= 65533 || c >= 65536 && c <= 1114111;
78
+ }
79
+ exports$1.isChar = isChar;
80
+ function isRestrictedChar(c) {
81
+ return c >= 1 && c <= 8 || c === 11 || c === 12 || c >= 14 && c <= 31 || c >= 127 && c <= 132 || c >= 134 && c <= 159;
82
+ }
83
+ exports$1.isRestrictedChar = isRestrictedChar;
84
+ function isCharAndNotRestricted(c) {
85
+ return c === 9 || c === 10 || c === 13 || c > 31 && c < 127 || c === 133 || c > 159 && c <= 55295 || c >= 57344 && c <= 65533 || c >= 65536 && c <= 1114111;
86
+ }
87
+ exports$1.isCharAndNotRestricted = isCharAndNotRestricted;
88
+ function isS(c) {
89
+ return c === SPACE || c === NL || c === CR || c === TAB;
90
+ }
91
+ exports$1.isS = isS;
92
+ function isNameStartChar(c) {
93
+ return c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 58 || c === 95 || c === 8204 || c === 8205 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 767 || c >= 880 && c <= 893 || c >= 895 && c <= 8191 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;
94
+ }
95
+ exports$1.isNameStartChar = isNameStartChar;
96
+ function isNameChar(c) {
97
+ return isNameStartChar(c) || c >= 48 && c <= 57 || c === 45 || c === 46 || c === 183 || c >= 768 && c <= 879 || c >= 8255 && c <= 8256;
98
+ }
99
+ exports$1.isNameChar = isNameChar;
100
+ }
101
+ });
102
+
103
+ // ../../node_modules/xmlchars/xmlns/1.0/ed3.js
104
+ var require_ed3 = __commonJS({
105
+ "../../node_modules/xmlchars/xmlns/1.0/ed3.js"(exports$1) {
106
+ Object.defineProperty(exports$1, "__esModule", { value: true });
107
+ exports$1.NC_NAME_START_CHAR = "A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";
108
+ exports$1.NC_NAME_CHAR = "-" + exports$1.NC_NAME_START_CHAR + ".0-9\xB7\u0300-\u036F\u203F-\u2040";
109
+ exports$1.NC_NAME_START_CHAR_RE = new RegExp("^[" + exports$1.NC_NAME_START_CHAR + "]$", "u");
110
+ exports$1.NC_NAME_CHAR_RE = new RegExp("^[" + exports$1.NC_NAME_CHAR + "]$", "u");
111
+ exports$1.NC_NAME_RE = new RegExp("^[" + exports$1.NC_NAME_START_CHAR + "][" + exports$1.NC_NAME_CHAR + "]*$", "u");
112
+ function isNCNameStartChar(c) {
113
+ return c >= 65 && c <= 90 || c === 95 || c >= 97 && c <= 122 || c >= 192 && c <= 214 || c >= 216 && c <= 246 || c >= 248 && c <= 767 || c >= 880 && c <= 893 || c >= 895 && c <= 8191 || c >= 8204 && c <= 8205 || c >= 8304 && c <= 8591 || c >= 11264 && c <= 12271 || c >= 12289 && c <= 55295 || c >= 63744 && c <= 64975 || c >= 65008 && c <= 65533 || c >= 65536 && c <= 983039;
114
+ }
115
+ exports$1.isNCNameStartChar = isNCNameStartChar;
116
+ function isNCNameChar(c) {
117
+ return isNCNameStartChar(c) || (c === 45 || c === 46 || c >= 48 && c <= 57 || c === 183 || c >= 768 && c <= 879 || c >= 8255 && c <= 8256);
118
+ }
119
+ exports$1.isNCNameChar = isNCNameChar;
120
+ }
121
+ });
122
+
123
+ // ../../node_modules/saxes/saxes.js
124
+ var require_saxes = __commonJS({
125
+ "../../node_modules/saxes/saxes.js"(exports$1) {
126
+ Object.defineProperty(exports$1, "__esModule", { value: true });
127
+ exports$1.SaxesParser = exports$1.EVENTS = void 0;
128
+ var ed5 = require_ed5();
129
+ var ed2 = require_ed2();
130
+ var NSed3 = require_ed3();
131
+ var isS = ed5.isS;
132
+ var isChar10 = ed5.isChar;
133
+ var isNameStartChar = ed5.isNameStartChar;
134
+ var isNameChar = ed5.isNameChar;
135
+ var S_LIST = ed5.S_LIST;
136
+ var NAME_RE = ed5.NAME_RE;
137
+ var isChar11 = ed2.isChar;
138
+ var isNCNameStartChar = NSed3.isNCNameStartChar;
139
+ var isNCNameChar = NSed3.isNCNameChar;
140
+ var NC_NAME_RE = NSed3.NC_NAME_RE;
141
+ var XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
142
+ var XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
143
+ var rootNS = {
144
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
145
+ __proto__: null,
146
+ xml: XML_NAMESPACE,
147
+ xmlns: XMLNS_NAMESPACE
148
+ };
149
+ var XML_ENTITIES = {
150
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
151
+ __proto__: null,
152
+ amp: "&",
153
+ gt: ">",
154
+ lt: "<",
155
+ quot: '"',
156
+ apos: "'"
157
+ };
158
+ var EOC = -1;
159
+ var NL_LIKE = -2;
160
+ var S_BEGIN = 0;
161
+ var S_BEGIN_WHITESPACE = 1;
162
+ var S_DOCTYPE = 2;
163
+ var S_DOCTYPE_QUOTE = 3;
164
+ var S_DTD = 4;
165
+ var S_DTD_QUOTED = 5;
166
+ var S_DTD_OPEN_WAKA = 6;
167
+ var S_DTD_OPEN_WAKA_BANG = 7;
168
+ var S_DTD_COMMENT = 8;
169
+ var S_DTD_COMMENT_ENDING = 9;
170
+ var S_DTD_COMMENT_ENDED = 10;
171
+ var S_DTD_PI = 11;
172
+ var S_DTD_PI_ENDING = 12;
173
+ var S_TEXT = 13;
174
+ var S_ENTITY = 14;
175
+ var S_OPEN_WAKA = 15;
176
+ var S_OPEN_WAKA_BANG = 16;
177
+ var S_COMMENT = 17;
178
+ var S_COMMENT_ENDING = 18;
179
+ var S_COMMENT_ENDED = 19;
180
+ var S_CDATA = 20;
181
+ var S_CDATA_ENDING = 21;
182
+ var S_CDATA_ENDING_2 = 22;
183
+ var S_PI_FIRST_CHAR = 23;
184
+ var S_PI_REST = 24;
185
+ var S_PI_BODY = 25;
186
+ var S_PI_ENDING = 26;
187
+ var S_XML_DECL_NAME_START = 27;
188
+ var S_XML_DECL_NAME = 28;
189
+ var S_XML_DECL_EQ = 29;
190
+ var S_XML_DECL_VALUE_START = 30;
191
+ var S_XML_DECL_VALUE = 31;
192
+ var S_XML_DECL_SEPARATOR = 32;
193
+ var S_XML_DECL_ENDING = 33;
194
+ var S_OPEN_TAG = 34;
195
+ var S_OPEN_TAG_SLASH = 35;
196
+ var S_ATTRIB = 36;
197
+ var S_ATTRIB_NAME = 37;
198
+ var S_ATTRIB_NAME_SAW_WHITE = 38;
199
+ var S_ATTRIB_VALUE = 39;
200
+ var S_ATTRIB_VALUE_QUOTED = 40;
201
+ var S_ATTRIB_VALUE_CLOSED = 41;
202
+ var S_ATTRIB_VALUE_UNQUOTED = 42;
203
+ var S_CLOSE_TAG = 43;
204
+ var S_CLOSE_TAG_SAW_WHITE = 44;
205
+ var TAB = 9;
206
+ var NL = 10;
207
+ var CR = 13;
208
+ var SPACE = 32;
209
+ var BANG = 33;
210
+ var DQUOTE = 34;
211
+ var AMP = 38;
212
+ var SQUOTE = 39;
213
+ var MINUS = 45;
214
+ var FORWARD_SLASH = 47;
215
+ var SEMICOLON = 59;
216
+ var LESS = 60;
217
+ var EQUAL = 61;
218
+ var GREATER = 62;
219
+ var QUESTION = 63;
220
+ var OPEN_BRACKET = 91;
221
+ var CLOSE_BRACKET = 93;
222
+ var NEL = 133;
223
+ var LS = 8232;
224
+ var isQuote = (c) => c === DQUOTE || c === SQUOTE;
225
+ var QUOTES = [DQUOTE, SQUOTE];
226
+ var DOCTYPE_TERMINATOR = [...QUOTES, OPEN_BRACKET, GREATER];
227
+ var DTD_TERMINATOR = [...QUOTES, LESS, CLOSE_BRACKET];
228
+ var XML_DECL_NAME_TERMINATOR = [EQUAL, QUESTION, ...S_LIST];
229
+ var ATTRIB_VALUE_UNQUOTED_TERMINATOR = [...S_LIST, GREATER, AMP, LESS];
230
+ function nsPairCheck(parser, prefix, uri) {
231
+ switch (prefix) {
232
+ case "xml":
233
+ if (uri !== XML_NAMESPACE) {
234
+ parser.fail(`xml prefix must be bound to ${XML_NAMESPACE}.`);
235
+ }
236
+ break;
237
+ case "xmlns":
238
+ if (uri !== XMLNS_NAMESPACE) {
239
+ parser.fail(`xmlns prefix must be bound to ${XMLNS_NAMESPACE}.`);
240
+ }
241
+ break;
242
+ }
243
+ switch (uri) {
244
+ case XMLNS_NAMESPACE:
245
+ parser.fail(prefix === "" ? `the default namespace may not be set to ${uri}.` : `may not assign a prefix (even "xmlns") to the URI ${XMLNS_NAMESPACE}.`);
246
+ break;
247
+ case XML_NAMESPACE:
248
+ switch (prefix) {
249
+ case "xml":
250
+ break;
251
+ case "":
252
+ parser.fail(`the default namespace may not be set to ${uri}.`);
253
+ break;
254
+ default:
255
+ parser.fail("may not assign the xml namespace to another prefix.");
256
+ }
257
+ break;
258
+ }
259
+ }
260
+ function nsMappingCheck(parser, mapping) {
261
+ for (const local of Object.keys(mapping)) {
262
+ nsPairCheck(parser, local, mapping[local]);
263
+ }
264
+ }
265
+ var isNCName = (name) => NC_NAME_RE.test(name);
266
+ var isName = (name) => NAME_RE.test(name);
267
+ var FORBIDDEN_START = 0;
268
+ var FORBIDDEN_BRACKET = 1;
269
+ var FORBIDDEN_BRACKET_BRACKET = 2;
270
+ exports$1.EVENTS = [
271
+ "xmldecl",
272
+ "text",
273
+ "processinginstruction",
274
+ "doctype",
275
+ "comment",
276
+ "opentagstart",
277
+ "attribute",
278
+ "opentag",
279
+ "closetag",
280
+ "cdata",
281
+ "error",
282
+ "end",
283
+ "ready"
284
+ ];
285
+ var EVENT_NAME_TO_HANDLER_NAME = {
286
+ xmldecl: "xmldeclHandler",
287
+ text: "textHandler",
288
+ processinginstruction: "piHandler",
289
+ doctype: "doctypeHandler",
290
+ comment: "commentHandler",
291
+ opentagstart: "openTagStartHandler",
292
+ attribute: "attributeHandler",
293
+ opentag: "openTagHandler",
294
+ closetag: "closeTagHandler",
295
+ cdata: "cdataHandler",
296
+ error: "errorHandler",
297
+ end: "endHandler",
298
+ ready: "readyHandler"
299
+ };
300
+ var SaxesParser2 = class {
301
+ /**
302
+ * @param opt The parser options.
303
+ */
304
+ constructor(opt) {
305
+ this.opt = opt !== null && opt !== void 0 ? opt : {};
306
+ this.fragmentOpt = !!this.opt.fragment;
307
+ const xmlnsOpt = this.xmlnsOpt = !!this.opt.xmlns;
308
+ this.trackPosition = this.opt.position !== false;
309
+ this.fileName = this.opt.fileName;
310
+ if (xmlnsOpt) {
311
+ this.nameStartCheck = isNCNameStartChar;
312
+ this.nameCheck = isNCNameChar;
313
+ this.isName = isNCName;
314
+ this.processAttribs = this.processAttribsNS;
315
+ this.pushAttrib = this.pushAttribNS;
316
+ this.ns = Object.assign({ __proto__: null }, rootNS);
317
+ const additional = this.opt.additionalNamespaces;
318
+ if (additional != null) {
319
+ nsMappingCheck(this, additional);
320
+ Object.assign(this.ns, additional);
321
+ }
322
+ } else {
323
+ this.nameStartCheck = isNameStartChar;
324
+ this.nameCheck = isNameChar;
325
+ this.isName = isName;
326
+ this.processAttribs = this.processAttribsPlain;
327
+ this.pushAttrib = this.pushAttribPlain;
328
+ }
329
+ this.stateTable = [
330
+ /* eslint-disable @typescript-eslint/unbound-method */
331
+ this.sBegin,
332
+ this.sBeginWhitespace,
333
+ this.sDoctype,
334
+ this.sDoctypeQuote,
335
+ this.sDTD,
336
+ this.sDTDQuoted,
337
+ this.sDTDOpenWaka,
338
+ this.sDTDOpenWakaBang,
339
+ this.sDTDComment,
340
+ this.sDTDCommentEnding,
341
+ this.sDTDCommentEnded,
342
+ this.sDTDPI,
343
+ this.sDTDPIEnding,
344
+ this.sText,
345
+ this.sEntity,
346
+ this.sOpenWaka,
347
+ this.sOpenWakaBang,
348
+ this.sComment,
349
+ this.sCommentEnding,
350
+ this.sCommentEnded,
351
+ this.sCData,
352
+ this.sCDataEnding,
353
+ this.sCDataEnding2,
354
+ this.sPIFirstChar,
355
+ this.sPIRest,
356
+ this.sPIBody,
357
+ this.sPIEnding,
358
+ this.sXMLDeclNameStart,
359
+ this.sXMLDeclName,
360
+ this.sXMLDeclEq,
361
+ this.sXMLDeclValueStart,
362
+ this.sXMLDeclValue,
363
+ this.sXMLDeclSeparator,
364
+ this.sXMLDeclEnding,
365
+ this.sOpenTag,
366
+ this.sOpenTagSlash,
367
+ this.sAttrib,
368
+ this.sAttribName,
369
+ this.sAttribNameSawWhite,
370
+ this.sAttribValue,
371
+ this.sAttribValueQuoted,
372
+ this.sAttribValueClosed,
373
+ this.sAttribValueUnquoted,
374
+ this.sCloseTag,
375
+ this.sCloseTagSawWhite
376
+ /* eslint-enable @typescript-eslint/unbound-method */
377
+ ];
378
+ this._init();
379
+ }
380
+ /**
381
+ * Indicates whether or not the parser is closed. If ``true``, wait for
382
+ * the ``ready`` event to write again.
383
+ */
384
+ get closed() {
385
+ return this._closed;
386
+ }
387
+ _init() {
388
+ var _a5;
389
+ this.openWakaBang = "";
390
+ this.text = "";
391
+ this.name = "";
392
+ this.piTarget = "";
393
+ this.entity = "";
394
+ this.q = null;
395
+ this.tags = [];
396
+ this.tag = null;
397
+ this.topNS = null;
398
+ this.chunk = "";
399
+ this.chunkPosition = 0;
400
+ this.i = 0;
401
+ this.prevI = 0;
402
+ this.carriedFromPrevious = void 0;
403
+ this.forbiddenState = FORBIDDEN_START;
404
+ this.attribList = [];
405
+ const { fragmentOpt } = this;
406
+ this.state = fragmentOpt ? S_TEXT : S_BEGIN;
407
+ this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = fragmentOpt;
408
+ this.xmlDeclPossible = !fragmentOpt;
409
+ this.xmlDeclExpects = ["version"];
410
+ this.entityReturnState = void 0;
411
+ let { defaultXMLVersion } = this.opt;
412
+ if (defaultXMLVersion === void 0) {
413
+ if (this.opt.forceXMLVersion === true) {
414
+ throw new Error("forceXMLVersion set but defaultXMLVersion is not set");
415
+ }
416
+ defaultXMLVersion = "1.0";
417
+ }
418
+ this.setXMLVersion(defaultXMLVersion);
419
+ this.positionAtNewLine = 0;
420
+ this.doctype = false;
421
+ this._closed = false;
422
+ this.xmlDecl = {
423
+ version: void 0,
424
+ encoding: void 0,
425
+ standalone: void 0
426
+ };
427
+ this.line = 1;
428
+ this.column = 0;
429
+ this.ENTITIES = Object.create(XML_ENTITIES);
430
+ (_a5 = this.readyHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this);
431
+ }
432
+ /**
433
+ * The stream position the parser is currently looking at. This field is
434
+ * zero-based.
435
+ *
436
+ * This field is not based on counting Unicode characters but is to be
437
+ * interpreted as a plain index into a JavaScript string.
438
+ */
439
+ get position() {
440
+ return this.chunkPosition + this.i;
441
+ }
442
+ /**
443
+ * The column number of the next character to be read by the parser. *
444
+ * This field is zero-based. (The first column in a line is 0.)
445
+ *
446
+ * This field reports the index at which the next character would be in the
447
+ * line if the line were represented as a JavaScript string. Note that this
448
+ * *can* be different to a count based on the number of *Unicode characters*
449
+ * due to how JavaScript handles astral plane characters.
450
+ *
451
+ * See [[column]] for a number that corresponds to a count of Unicode
452
+ * characters.
453
+ */
454
+ get columnIndex() {
455
+ return this.position - this.positionAtNewLine;
456
+ }
457
+ /**
458
+ * Set an event listener on an event. The parser supports one handler per
459
+ * event type. If you try to set an event handler over an existing handler,
460
+ * the old handler is silently overwritten.
461
+ *
462
+ * @param name The event to listen to.
463
+ *
464
+ * @param handler The handler to set.
465
+ */
466
+ on(name, handler) {
467
+ this[EVENT_NAME_TO_HANDLER_NAME[name]] = handler;
468
+ }
469
+ /**
470
+ * Unset an event handler.
471
+ *
472
+ * @parma name The event to stop listening to.
473
+ */
474
+ off(name) {
475
+ this[EVENT_NAME_TO_HANDLER_NAME[name]] = void 0;
476
+ }
477
+ /**
478
+ * Make an error object. The error object will have a message that contains
479
+ * the ``fileName`` option passed at the creation of the parser. If position
480
+ * tracking was turned on, it will also have line and column number
481
+ * information.
482
+ *
483
+ * @param message The message describing the error to report.
484
+ *
485
+ * @returns An error object with a properly formatted message.
486
+ */
487
+ makeError(message) {
488
+ var _a5;
489
+ let msg = (_a5 = this.fileName) !== null && _a5 !== void 0 ? _a5 : "";
490
+ if (this.trackPosition) {
491
+ if (msg.length > 0) {
492
+ msg += ":";
493
+ }
494
+ msg += `${this.line}:${this.column}`;
495
+ }
496
+ if (msg.length > 0) {
497
+ msg += ": ";
498
+ }
499
+ return new Error(msg + message);
500
+ }
501
+ /**
502
+ * Report a parsing error. This method is made public so that client code may
503
+ * check for issues that are outside the scope of this project and can report
504
+ * errors.
505
+ *
506
+ * @param message The error to report.
507
+ *
508
+ * @returns this
509
+ */
510
+ fail(message) {
511
+ const err = this.makeError(message);
512
+ const handler = this.errorHandler;
513
+ if (handler === void 0) {
514
+ throw err;
515
+ } else {
516
+ handler(err);
517
+ }
518
+ return this;
519
+ }
520
+ /**
521
+ * Write a XML data to the parser.
522
+ *
523
+ * @param chunk The XML data to write.
524
+ *
525
+ * @returns this
526
+ */
527
+ // We do need object for the type here. Yes, it often causes problems
528
+ // but not in this case.
529
+ write(chunk) {
530
+ if (this.closed) {
531
+ return this.fail("cannot write after close; assign an onready handler.");
532
+ }
533
+ let end = false;
534
+ if (chunk === null) {
535
+ end = true;
536
+ chunk = "";
537
+ } else if (typeof chunk === "object") {
538
+ chunk = chunk.toString();
539
+ }
540
+ if (this.carriedFromPrevious !== void 0) {
541
+ chunk = `${this.carriedFromPrevious}${chunk}`;
542
+ this.carriedFromPrevious = void 0;
543
+ }
544
+ let limit = chunk.length;
545
+ const lastCode = chunk.charCodeAt(limit - 1);
546
+ if (!end && // A trailing CR or surrogate must be carried over to the next
547
+ // chunk.
548
+ (lastCode === CR || lastCode >= 55296 && lastCode <= 56319)) {
549
+ this.carriedFromPrevious = chunk[limit - 1];
550
+ limit--;
551
+ chunk = chunk.slice(0, limit);
552
+ }
553
+ const { stateTable } = this;
554
+ this.chunk = chunk;
555
+ this.i = 0;
556
+ while (this.i < limit) {
557
+ stateTable[this.state].call(this);
558
+ }
559
+ this.chunkPosition += limit;
560
+ return end ? this.end() : this;
561
+ }
562
+ /**
563
+ * Close the current stream. Perform final well-formedness checks and reset
564
+ * the parser tstate.
565
+ *
566
+ * @returns this
567
+ */
568
+ close() {
569
+ return this.write(null);
570
+ }
571
+ /**
572
+ * Get a single code point out of the current chunk. This updates the current
573
+ * position if we do position tracking.
574
+ *
575
+ * This is the algorithm to use for XML 1.0.
576
+ *
577
+ * @returns The character read.
578
+ */
579
+ getCode10() {
580
+ const { chunk, i } = this;
581
+ this.prevI = i;
582
+ this.i = i + 1;
583
+ if (i >= chunk.length) {
584
+ return EOC;
585
+ }
586
+ const code = chunk.charCodeAt(i);
587
+ this.column++;
588
+ if (code < 55296) {
589
+ if (code >= SPACE || code === TAB) {
590
+ return code;
591
+ }
592
+ switch (code) {
593
+ case NL:
594
+ this.line++;
595
+ this.column = 0;
596
+ this.positionAtNewLine = this.position;
597
+ return NL;
598
+ case CR:
599
+ if (chunk.charCodeAt(i + 1) === NL) {
600
+ this.i = i + 2;
601
+ }
602
+ this.line++;
603
+ this.column = 0;
604
+ this.positionAtNewLine = this.position;
605
+ return NL_LIKE;
606
+ default:
607
+ this.fail("disallowed character.");
608
+ return code;
609
+ }
610
+ }
611
+ if (code > 56319) {
612
+ if (!(code >= 57344 && code <= 65533)) {
613
+ this.fail("disallowed character.");
614
+ }
615
+ return code;
616
+ }
617
+ const final = 65536 + (code - 55296) * 1024 + (chunk.charCodeAt(i + 1) - 56320);
618
+ this.i = i + 2;
619
+ if (final > 1114111) {
620
+ this.fail("disallowed character.");
621
+ }
622
+ return final;
623
+ }
624
+ /**
625
+ * Get a single code point out of the current chunk. This updates the current
626
+ * position if we do position tracking.
627
+ *
628
+ * This is the algorithm to use for XML 1.1.
629
+ *
630
+ * @returns {number} The character read.
631
+ */
632
+ getCode11() {
633
+ const { chunk, i } = this;
634
+ this.prevI = i;
635
+ this.i = i + 1;
636
+ if (i >= chunk.length) {
637
+ return EOC;
638
+ }
639
+ const code = chunk.charCodeAt(i);
640
+ this.column++;
641
+ if (code < 55296) {
642
+ if (code > 31 && code < 127 || code > 159 && code !== LS || code === TAB) {
643
+ return code;
644
+ }
645
+ switch (code) {
646
+ case NL:
647
+ this.line++;
648
+ this.column = 0;
649
+ this.positionAtNewLine = this.position;
650
+ return NL;
651
+ case CR: {
652
+ const next = chunk.charCodeAt(i + 1);
653
+ if (next === NL || next === NEL) {
654
+ this.i = i + 2;
655
+ }
656
+ }
657
+ /* yes, fall through */
658
+ case NEL:
659
+ // 0x85
660
+ case LS:
661
+ this.line++;
662
+ this.column = 0;
663
+ this.positionAtNewLine = this.position;
664
+ return NL_LIKE;
665
+ default:
666
+ this.fail("disallowed character.");
667
+ return code;
668
+ }
669
+ }
670
+ if (code > 56319) {
671
+ if (!(code >= 57344 && code <= 65533)) {
672
+ this.fail("disallowed character.");
673
+ }
674
+ return code;
675
+ }
676
+ const final = 65536 + (code - 55296) * 1024 + (chunk.charCodeAt(i + 1) - 56320);
677
+ this.i = i + 2;
678
+ if (final > 1114111) {
679
+ this.fail("disallowed character.");
680
+ }
681
+ return final;
682
+ }
683
+ /**
684
+ * Like ``getCode`` but with the return value normalized so that ``NL`` is
685
+ * returned for ``NL_LIKE``.
686
+ */
687
+ getCodeNorm() {
688
+ const c = this.getCode();
689
+ return c === NL_LIKE ? NL : c;
690
+ }
691
+ unget() {
692
+ this.i = this.prevI;
693
+ this.column--;
694
+ }
695
+ /**
696
+ * Capture characters into a buffer until encountering one of a set of
697
+ * characters.
698
+ *
699
+ * @param chars An array of codepoints. Encountering a character in the array
700
+ * ends the capture. (``chars`` may safely contain ``NL``.)
701
+ *
702
+ * @return The character code that made the capture end, or ``EOC`` if we hit
703
+ * the end of the chunk. The return value cannot be NL_LIKE: NL is returned
704
+ * instead.
705
+ */
706
+ captureTo(chars) {
707
+ let { i: start } = this;
708
+ const { chunk } = this;
709
+ while (true) {
710
+ const c = this.getCode();
711
+ const isNLLike = c === NL_LIKE;
712
+ const final = isNLLike ? NL : c;
713
+ if (final === EOC || chars.includes(final)) {
714
+ this.text += chunk.slice(start, this.prevI);
715
+ return final;
716
+ }
717
+ if (isNLLike) {
718
+ this.text += `${chunk.slice(start, this.prevI)}
719
+ `;
720
+ start = this.i;
721
+ }
722
+ }
723
+ }
724
+ /**
725
+ * Capture characters into a buffer until encountering a character.
726
+ *
727
+ * @param char The codepoint that ends the capture. **NOTE ``char`` MAY NOT
728
+ * CONTAIN ``NL``.** Passing ``NL`` will result in buggy behavior.
729
+ *
730
+ * @return ``true`` if we ran into the character. Otherwise, we ran into the
731
+ * end of the current chunk.
732
+ */
733
+ captureToChar(char) {
734
+ let { i: start } = this;
735
+ const { chunk } = this;
736
+ while (true) {
737
+ let c = this.getCode();
738
+ switch (c) {
739
+ case NL_LIKE:
740
+ this.text += `${chunk.slice(start, this.prevI)}
741
+ `;
742
+ start = this.i;
743
+ c = NL;
744
+ break;
745
+ case EOC:
746
+ this.text += chunk.slice(start);
747
+ return false;
748
+ }
749
+ if (c === char) {
750
+ this.text += chunk.slice(start, this.prevI);
751
+ return true;
752
+ }
753
+ }
754
+ }
755
+ /**
756
+ * Capture characters that satisfy ``isNameChar`` into the ``name`` field of
757
+ * this parser.
758
+ *
759
+ * @return The character code that made the test fail, or ``EOC`` if we hit
760
+ * the end of the chunk. The return value cannot be NL_LIKE: NL is returned
761
+ * instead.
762
+ */
763
+ captureNameChars() {
764
+ const { chunk, i: start } = this;
765
+ while (true) {
766
+ const c = this.getCode();
767
+ if (c === EOC) {
768
+ this.name += chunk.slice(start);
769
+ return EOC;
770
+ }
771
+ if (!isNameChar(c)) {
772
+ this.name += chunk.slice(start, this.prevI);
773
+ return c === NL_LIKE ? NL : c;
774
+ }
775
+ }
776
+ }
777
+ /**
778
+ * Skip white spaces.
779
+ *
780
+ * @return The character that ended the skip, or ``EOC`` if we hit
781
+ * the end of the chunk. The return value cannot be NL_LIKE: NL is returned
782
+ * instead.
783
+ */
784
+ skipSpaces() {
785
+ while (true) {
786
+ const c = this.getCodeNorm();
787
+ if (c === EOC || !isS(c)) {
788
+ return c;
789
+ }
790
+ }
791
+ }
792
+ setXMLVersion(version3) {
793
+ this.currentXMLVersion = version3;
794
+ if (version3 === "1.0") {
795
+ this.isChar = isChar10;
796
+ this.getCode = this.getCode10;
797
+ } else {
798
+ this.isChar = isChar11;
799
+ this.getCode = this.getCode11;
800
+ }
801
+ }
802
+ // STATE ENGINE METHODS
803
+ // This needs to be a state separate from S_BEGIN_WHITESPACE because we want
804
+ // to be sure never to come back to this state later.
805
+ sBegin() {
806
+ if (this.chunk.charCodeAt(0) === 65279) {
807
+ this.i++;
808
+ this.column++;
809
+ }
810
+ this.state = S_BEGIN_WHITESPACE;
811
+ }
812
+ sBeginWhitespace() {
813
+ const iBefore = this.i;
814
+ const c = this.skipSpaces();
815
+ if (this.prevI !== iBefore) {
816
+ this.xmlDeclPossible = false;
817
+ }
818
+ switch (c) {
819
+ case LESS:
820
+ this.state = S_OPEN_WAKA;
821
+ if (this.text.length !== 0) {
822
+ throw new Error("no-empty text at start");
823
+ }
824
+ break;
825
+ case EOC:
826
+ break;
827
+ default:
828
+ this.unget();
829
+ this.state = S_TEXT;
830
+ this.xmlDeclPossible = false;
831
+ }
832
+ }
833
+ sDoctype() {
834
+ var _a5;
835
+ const c = this.captureTo(DOCTYPE_TERMINATOR);
836
+ switch (c) {
837
+ case GREATER: {
838
+ (_a5 = this.doctypeHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, this.text);
839
+ this.text = "";
840
+ this.state = S_TEXT;
841
+ this.doctype = true;
842
+ break;
843
+ }
844
+ case EOC:
845
+ break;
846
+ default:
847
+ this.text += String.fromCodePoint(c);
848
+ if (c === OPEN_BRACKET) {
849
+ this.state = S_DTD;
850
+ } else if (isQuote(c)) {
851
+ this.state = S_DOCTYPE_QUOTE;
852
+ this.q = c;
853
+ }
854
+ }
855
+ }
856
+ sDoctypeQuote() {
857
+ const q = this.q;
858
+ if (this.captureToChar(q)) {
859
+ this.text += String.fromCodePoint(q);
860
+ this.q = null;
861
+ this.state = S_DOCTYPE;
862
+ }
863
+ }
864
+ sDTD() {
865
+ const c = this.captureTo(DTD_TERMINATOR);
866
+ if (c === EOC) {
867
+ return;
868
+ }
869
+ this.text += String.fromCodePoint(c);
870
+ if (c === CLOSE_BRACKET) {
871
+ this.state = S_DOCTYPE;
872
+ } else if (c === LESS) {
873
+ this.state = S_DTD_OPEN_WAKA;
874
+ } else if (isQuote(c)) {
875
+ this.state = S_DTD_QUOTED;
876
+ this.q = c;
877
+ }
878
+ }
879
+ sDTDQuoted() {
880
+ const q = this.q;
881
+ if (this.captureToChar(q)) {
882
+ this.text += String.fromCodePoint(q);
883
+ this.state = S_DTD;
884
+ this.q = null;
885
+ }
886
+ }
887
+ sDTDOpenWaka() {
888
+ const c = this.getCodeNorm();
889
+ this.text += String.fromCodePoint(c);
890
+ switch (c) {
891
+ case BANG:
892
+ this.state = S_DTD_OPEN_WAKA_BANG;
893
+ this.openWakaBang = "";
894
+ break;
895
+ case QUESTION:
896
+ this.state = S_DTD_PI;
897
+ break;
898
+ default:
899
+ this.state = S_DTD;
900
+ }
901
+ }
902
+ sDTDOpenWakaBang() {
903
+ const char = String.fromCodePoint(this.getCodeNorm());
904
+ const owb = this.openWakaBang += char;
905
+ this.text += char;
906
+ if (owb !== "-") {
907
+ this.state = owb === "--" ? S_DTD_COMMENT : S_DTD;
908
+ this.openWakaBang = "";
909
+ }
910
+ }
911
+ sDTDComment() {
912
+ if (this.captureToChar(MINUS)) {
913
+ this.text += "-";
914
+ this.state = S_DTD_COMMENT_ENDING;
915
+ }
916
+ }
917
+ sDTDCommentEnding() {
918
+ const c = this.getCodeNorm();
919
+ this.text += String.fromCodePoint(c);
920
+ this.state = c === MINUS ? S_DTD_COMMENT_ENDED : S_DTD_COMMENT;
921
+ }
922
+ sDTDCommentEnded() {
923
+ const c = this.getCodeNorm();
924
+ this.text += String.fromCodePoint(c);
925
+ if (c === GREATER) {
926
+ this.state = S_DTD;
927
+ } else {
928
+ this.fail("malformed comment.");
929
+ this.state = S_DTD_COMMENT;
930
+ }
931
+ }
932
+ sDTDPI() {
933
+ if (this.captureToChar(QUESTION)) {
934
+ this.text += "?";
935
+ this.state = S_DTD_PI_ENDING;
936
+ }
937
+ }
938
+ sDTDPIEnding() {
939
+ const c = this.getCodeNorm();
940
+ this.text += String.fromCodePoint(c);
941
+ if (c === GREATER) {
942
+ this.state = S_DTD;
943
+ }
944
+ }
945
+ sText() {
946
+ if (this.tags.length !== 0) {
947
+ this.handleTextInRoot();
948
+ } else {
949
+ this.handleTextOutsideRoot();
950
+ }
951
+ }
952
+ sEntity() {
953
+ let { i: start } = this;
954
+ const { chunk } = this;
955
+ loop:
956
+ while (true) {
957
+ switch (this.getCode()) {
958
+ case NL_LIKE:
959
+ this.entity += `${chunk.slice(start, this.prevI)}
960
+ `;
961
+ start = this.i;
962
+ break;
963
+ case SEMICOLON: {
964
+ const { entityReturnState } = this;
965
+ const entity = this.entity + chunk.slice(start, this.prevI);
966
+ this.state = entityReturnState;
967
+ let parsed;
968
+ if (entity === "") {
969
+ this.fail("empty entity name.");
970
+ parsed = "&;";
971
+ } else {
972
+ parsed = this.parseEntity(entity);
973
+ this.entity = "";
974
+ }
975
+ if (entityReturnState !== S_TEXT || this.textHandler !== void 0) {
976
+ this.text += parsed;
977
+ }
978
+ break loop;
979
+ }
980
+ case EOC:
981
+ this.entity += chunk.slice(start);
982
+ break loop;
983
+ }
984
+ }
985
+ }
986
+ sOpenWaka() {
987
+ const c = this.getCode();
988
+ if (isNameStartChar(c)) {
989
+ this.state = S_OPEN_TAG;
990
+ this.unget();
991
+ this.xmlDeclPossible = false;
992
+ } else {
993
+ switch (c) {
994
+ case FORWARD_SLASH:
995
+ this.state = S_CLOSE_TAG;
996
+ this.xmlDeclPossible = false;
997
+ break;
998
+ case BANG:
999
+ this.state = S_OPEN_WAKA_BANG;
1000
+ this.openWakaBang = "";
1001
+ this.xmlDeclPossible = false;
1002
+ break;
1003
+ case QUESTION:
1004
+ this.state = S_PI_FIRST_CHAR;
1005
+ break;
1006
+ default:
1007
+ this.fail("disallowed character in tag name");
1008
+ this.state = S_TEXT;
1009
+ this.xmlDeclPossible = false;
1010
+ }
1011
+ }
1012
+ }
1013
+ sOpenWakaBang() {
1014
+ this.openWakaBang += String.fromCodePoint(this.getCodeNorm());
1015
+ switch (this.openWakaBang) {
1016
+ case "[CDATA[":
1017
+ if (!this.sawRoot && !this.reportedTextBeforeRoot) {
1018
+ this.fail("text data outside of root node.");
1019
+ this.reportedTextBeforeRoot = true;
1020
+ }
1021
+ if (this.closedRoot && !this.reportedTextAfterRoot) {
1022
+ this.fail("text data outside of root node.");
1023
+ this.reportedTextAfterRoot = true;
1024
+ }
1025
+ this.state = S_CDATA;
1026
+ this.openWakaBang = "";
1027
+ break;
1028
+ case "--":
1029
+ this.state = S_COMMENT;
1030
+ this.openWakaBang = "";
1031
+ break;
1032
+ case "DOCTYPE":
1033
+ this.state = S_DOCTYPE;
1034
+ if (this.doctype || this.sawRoot) {
1035
+ this.fail("inappropriately located doctype declaration.");
1036
+ }
1037
+ this.openWakaBang = "";
1038
+ break;
1039
+ default:
1040
+ if (this.openWakaBang.length >= 7) {
1041
+ this.fail("incorrect syntax.");
1042
+ }
1043
+ }
1044
+ }
1045
+ sComment() {
1046
+ if (this.captureToChar(MINUS)) {
1047
+ this.state = S_COMMENT_ENDING;
1048
+ }
1049
+ }
1050
+ sCommentEnding() {
1051
+ var _a5;
1052
+ const c = this.getCodeNorm();
1053
+ if (c === MINUS) {
1054
+ this.state = S_COMMENT_ENDED;
1055
+ (_a5 = this.commentHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, this.text);
1056
+ this.text = "";
1057
+ } else {
1058
+ this.text += `-${String.fromCodePoint(c)}`;
1059
+ this.state = S_COMMENT;
1060
+ }
1061
+ }
1062
+ sCommentEnded() {
1063
+ const c = this.getCodeNorm();
1064
+ if (c !== GREATER) {
1065
+ this.fail("malformed comment.");
1066
+ this.text += `--${String.fromCodePoint(c)}`;
1067
+ this.state = S_COMMENT;
1068
+ } else {
1069
+ this.state = S_TEXT;
1070
+ }
1071
+ }
1072
+ sCData() {
1073
+ if (this.captureToChar(CLOSE_BRACKET)) {
1074
+ this.state = S_CDATA_ENDING;
1075
+ }
1076
+ }
1077
+ sCDataEnding() {
1078
+ const c = this.getCodeNorm();
1079
+ if (c === CLOSE_BRACKET) {
1080
+ this.state = S_CDATA_ENDING_2;
1081
+ } else {
1082
+ this.text += `]${String.fromCodePoint(c)}`;
1083
+ this.state = S_CDATA;
1084
+ }
1085
+ }
1086
+ sCDataEnding2() {
1087
+ var _a5;
1088
+ const c = this.getCodeNorm();
1089
+ switch (c) {
1090
+ case GREATER: {
1091
+ (_a5 = this.cdataHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, this.text);
1092
+ this.text = "";
1093
+ this.state = S_TEXT;
1094
+ break;
1095
+ }
1096
+ case CLOSE_BRACKET:
1097
+ this.text += "]";
1098
+ break;
1099
+ default:
1100
+ this.text += `]]${String.fromCodePoint(c)}`;
1101
+ this.state = S_CDATA;
1102
+ }
1103
+ }
1104
+ // We need this separate state to check the first character fo the pi target
1105
+ // with this.nameStartCheck which allows less characters than this.nameCheck.
1106
+ sPIFirstChar() {
1107
+ const c = this.getCodeNorm();
1108
+ if (this.nameStartCheck(c)) {
1109
+ this.piTarget += String.fromCodePoint(c);
1110
+ this.state = S_PI_REST;
1111
+ } else if (c === QUESTION || isS(c)) {
1112
+ this.fail("processing instruction without a target.");
1113
+ this.state = c === QUESTION ? S_PI_ENDING : S_PI_BODY;
1114
+ } else {
1115
+ this.fail("disallowed character in processing instruction name.");
1116
+ this.piTarget += String.fromCodePoint(c);
1117
+ this.state = S_PI_REST;
1118
+ }
1119
+ }
1120
+ sPIRest() {
1121
+ const { chunk, i: start } = this;
1122
+ while (true) {
1123
+ const c = this.getCodeNorm();
1124
+ if (c === EOC) {
1125
+ this.piTarget += chunk.slice(start);
1126
+ return;
1127
+ }
1128
+ if (!this.nameCheck(c)) {
1129
+ this.piTarget += chunk.slice(start, this.prevI);
1130
+ const isQuestion = c === QUESTION;
1131
+ if (isQuestion || isS(c)) {
1132
+ if (this.piTarget === "xml") {
1133
+ if (!this.xmlDeclPossible) {
1134
+ this.fail("an XML declaration must be at the start of the document.");
1135
+ }
1136
+ this.state = isQuestion ? S_XML_DECL_ENDING : S_XML_DECL_NAME_START;
1137
+ } else {
1138
+ this.state = isQuestion ? S_PI_ENDING : S_PI_BODY;
1139
+ }
1140
+ } else {
1141
+ this.fail("disallowed character in processing instruction name.");
1142
+ this.piTarget += String.fromCodePoint(c);
1143
+ }
1144
+ break;
1145
+ }
1146
+ }
1147
+ }
1148
+ sPIBody() {
1149
+ if (this.text.length === 0) {
1150
+ const c = this.getCodeNorm();
1151
+ if (c === QUESTION) {
1152
+ this.state = S_PI_ENDING;
1153
+ } else if (!isS(c)) {
1154
+ this.text = String.fromCodePoint(c);
1155
+ }
1156
+ } else if (this.captureToChar(QUESTION)) {
1157
+ this.state = S_PI_ENDING;
1158
+ }
1159
+ }
1160
+ sPIEnding() {
1161
+ var _a5;
1162
+ const c = this.getCodeNorm();
1163
+ if (c === GREATER) {
1164
+ const { piTarget } = this;
1165
+ if (piTarget.toLowerCase() === "xml") {
1166
+ this.fail("the XML declaration must appear at the start of the document.");
1167
+ }
1168
+ (_a5 = this.piHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, {
1169
+ target: piTarget,
1170
+ body: this.text
1171
+ });
1172
+ this.piTarget = this.text = "";
1173
+ this.state = S_TEXT;
1174
+ } else if (c === QUESTION) {
1175
+ this.text += "?";
1176
+ } else {
1177
+ this.text += `?${String.fromCodePoint(c)}`;
1178
+ this.state = S_PI_BODY;
1179
+ }
1180
+ this.xmlDeclPossible = false;
1181
+ }
1182
+ sXMLDeclNameStart() {
1183
+ const c = this.skipSpaces();
1184
+ if (c === QUESTION) {
1185
+ this.state = S_XML_DECL_ENDING;
1186
+ return;
1187
+ }
1188
+ if (c !== EOC) {
1189
+ this.state = S_XML_DECL_NAME;
1190
+ this.name = String.fromCodePoint(c);
1191
+ }
1192
+ }
1193
+ sXMLDeclName() {
1194
+ const c = this.captureTo(XML_DECL_NAME_TERMINATOR);
1195
+ if (c === QUESTION) {
1196
+ this.state = S_XML_DECL_ENDING;
1197
+ this.name += this.text;
1198
+ this.text = "";
1199
+ this.fail("XML declaration is incomplete.");
1200
+ return;
1201
+ }
1202
+ if (!(isS(c) || c === EQUAL)) {
1203
+ return;
1204
+ }
1205
+ this.name += this.text;
1206
+ this.text = "";
1207
+ if (!this.xmlDeclExpects.includes(this.name)) {
1208
+ switch (this.name.length) {
1209
+ case 0:
1210
+ this.fail("did not expect any more name/value pairs.");
1211
+ break;
1212
+ case 1:
1213
+ this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);
1214
+ break;
1215
+ default:
1216
+ this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`);
1217
+ }
1218
+ }
1219
+ this.state = c === EQUAL ? S_XML_DECL_VALUE_START : S_XML_DECL_EQ;
1220
+ }
1221
+ sXMLDeclEq() {
1222
+ const c = this.getCodeNorm();
1223
+ if (c === QUESTION) {
1224
+ this.state = S_XML_DECL_ENDING;
1225
+ this.fail("XML declaration is incomplete.");
1226
+ return;
1227
+ }
1228
+ if (isS(c)) {
1229
+ return;
1230
+ }
1231
+ if (c !== EQUAL) {
1232
+ this.fail("value required.");
1233
+ }
1234
+ this.state = S_XML_DECL_VALUE_START;
1235
+ }
1236
+ sXMLDeclValueStart() {
1237
+ const c = this.getCodeNorm();
1238
+ if (c === QUESTION) {
1239
+ this.state = S_XML_DECL_ENDING;
1240
+ this.fail("XML declaration is incomplete.");
1241
+ return;
1242
+ }
1243
+ if (isS(c)) {
1244
+ return;
1245
+ }
1246
+ if (!isQuote(c)) {
1247
+ this.fail("value must be quoted.");
1248
+ this.q = SPACE;
1249
+ } else {
1250
+ this.q = c;
1251
+ }
1252
+ this.state = S_XML_DECL_VALUE;
1253
+ }
1254
+ sXMLDeclValue() {
1255
+ const c = this.captureTo([this.q, QUESTION]);
1256
+ if (c === QUESTION) {
1257
+ this.state = S_XML_DECL_ENDING;
1258
+ this.text = "";
1259
+ this.fail("XML declaration is incomplete.");
1260
+ return;
1261
+ }
1262
+ if (c === EOC) {
1263
+ return;
1264
+ }
1265
+ const value = this.text;
1266
+ this.text = "";
1267
+ switch (this.name) {
1268
+ case "version": {
1269
+ this.xmlDeclExpects = ["encoding", "standalone"];
1270
+ const version3 = value;
1271
+ this.xmlDecl.version = version3;
1272
+ if (!/^1\.[0-9]+$/.test(version3)) {
1273
+ this.fail("version number must match /^1\\.[0-9]+$/.");
1274
+ } else if (!this.opt.forceXMLVersion) {
1275
+ this.setXMLVersion(version3);
1276
+ }
1277
+ break;
1278
+ }
1279
+ case "encoding":
1280
+ if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(value)) {
1281
+ this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.");
1282
+ }
1283
+ this.xmlDeclExpects = ["standalone"];
1284
+ this.xmlDecl.encoding = value;
1285
+ break;
1286
+ case "standalone":
1287
+ if (value !== "yes" && value !== "no") {
1288
+ this.fail('standalone value must match "yes" or "no".');
1289
+ }
1290
+ this.xmlDeclExpects = [];
1291
+ this.xmlDecl.standalone = value;
1292
+ break;
1293
+ }
1294
+ this.name = "";
1295
+ this.state = S_XML_DECL_SEPARATOR;
1296
+ }
1297
+ sXMLDeclSeparator() {
1298
+ const c = this.getCodeNorm();
1299
+ if (c === QUESTION) {
1300
+ this.state = S_XML_DECL_ENDING;
1301
+ return;
1302
+ }
1303
+ if (!isS(c)) {
1304
+ this.fail("whitespace required.");
1305
+ this.unget();
1306
+ }
1307
+ this.state = S_XML_DECL_NAME_START;
1308
+ }
1309
+ sXMLDeclEnding() {
1310
+ var _a5;
1311
+ const c = this.getCodeNorm();
1312
+ if (c === GREATER) {
1313
+ if (this.piTarget !== "xml") {
1314
+ this.fail("processing instructions are not allowed before root.");
1315
+ } else if (this.name !== "version" && this.xmlDeclExpects.includes("version")) {
1316
+ this.fail("XML declaration must contain a version.");
1317
+ }
1318
+ (_a5 = this.xmldeclHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, this.xmlDecl);
1319
+ this.name = "";
1320
+ this.piTarget = this.text = "";
1321
+ this.state = S_TEXT;
1322
+ } else {
1323
+ this.fail("The character ? is disallowed anywhere in XML declarations.");
1324
+ }
1325
+ this.xmlDeclPossible = false;
1326
+ }
1327
+ sOpenTag() {
1328
+ var _a5;
1329
+ const c = this.captureNameChars();
1330
+ if (c === EOC) {
1331
+ return;
1332
+ }
1333
+ const tag = this.tag = {
1334
+ name: this.name,
1335
+ attributes: /* @__PURE__ */ Object.create(null)
1336
+ };
1337
+ this.name = "";
1338
+ if (this.xmlnsOpt) {
1339
+ this.topNS = tag.ns = /* @__PURE__ */ Object.create(null);
1340
+ }
1341
+ (_a5 = this.openTagStartHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, tag);
1342
+ this.sawRoot = true;
1343
+ if (!this.fragmentOpt && this.closedRoot) {
1344
+ this.fail("documents may contain only one root.");
1345
+ }
1346
+ switch (c) {
1347
+ case GREATER:
1348
+ this.openTag();
1349
+ break;
1350
+ case FORWARD_SLASH:
1351
+ this.state = S_OPEN_TAG_SLASH;
1352
+ break;
1353
+ default:
1354
+ if (!isS(c)) {
1355
+ this.fail("disallowed character in tag name.");
1356
+ }
1357
+ this.state = S_ATTRIB;
1358
+ }
1359
+ }
1360
+ sOpenTagSlash() {
1361
+ if (this.getCode() === GREATER) {
1362
+ this.openSelfClosingTag();
1363
+ } else {
1364
+ this.fail("forward-slash in opening tag not followed by >.");
1365
+ this.state = S_ATTRIB;
1366
+ }
1367
+ }
1368
+ sAttrib() {
1369
+ const c = this.skipSpaces();
1370
+ if (c === EOC) {
1371
+ return;
1372
+ }
1373
+ if (isNameStartChar(c)) {
1374
+ this.unget();
1375
+ this.state = S_ATTRIB_NAME;
1376
+ } else if (c === GREATER) {
1377
+ this.openTag();
1378
+ } else if (c === FORWARD_SLASH) {
1379
+ this.state = S_OPEN_TAG_SLASH;
1380
+ } else {
1381
+ this.fail("disallowed character in attribute name.");
1382
+ }
1383
+ }
1384
+ sAttribName() {
1385
+ const c = this.captureNameChars();
1386
+ if (c === EQUAL) {
1387
+ this.state = S_ATTRIB_VALUE;
1388
+ } else if (isS(c)) {
1389
+ this.state = S_ATTRIB_NAME_SAW_WHITE;
1390
+ } else if (c === GREATER) {
1391
+ this.fail("attribute without value.");
1392
+ this.pushAttrib(this.name, this.name);
1393
+ this.name = this.text = "";
1394
+ this.openTag();
1395
+ } else if (c !== EOC) {
1396
+ this.fail("disallowed character in attribute name.");
1397
+ }
1398
+ }
1399
+ sAttribNameSawWhite() {
1400
+ const c = this.skipSpaces();
1401
+ switch (c) {
1402
+ case EOC:
1403
+ return;
1404
+ case EQUAL:
1405
+ this.state = S_ATTRIB_VALUE;
1406
+ break;
1407
+ default:
1408
+ this.fail("attribute without value.");
1409
+ this.text = "";
1410
+ this.name = "";
1411
+ if (c === GREATER) {
1412
+ this.openTag();
1413
+ } else if (isNameStartChar(c)) {
1414
+ this.unget();
1415
+ this.state = S_ATTRIB_NAME;
1416
+ } else {
1417
+ this.fail("disallowed character in attribute name.");
1418
+ this.state = S_ATTRIB;
1419
+ }
1420
+ }
1421
+ }
1422
+ sAttribValue() {
1423
+ const c = this.getCodeNorm();
1424
+ if (isQuote(c)) {
1425
+ this.q = c;
1426
+ this.state = S_ATTRIB_VALUE_QUOTED;
1427
+ } else if (!isS(c)) {
1428
+ this.fail("unquoted attribute value.");
1429
+ this.state = S_ATTRIB_VALUE_UNQUOTED;
1430
+ this.unget();
1431
+ }
1432
+ }
1433
+ sAttribValueQuoted() {
1434
+ const { q, chunk } = this;
1435
+ let { i: start } = this;
1436
+ while (true) {
1437
+ switch (this.getCode()) {
1438
+ case q:
1439
+ this.pushAttrib(this.name, this.text + chunk.slice(start, this.prevI));
1440
+ this.name = this.text = "";
1441
+ this.q = null;
1442
+ this.state = S_ATTRIB_VALUE_CLOSED;
1443
+ return;
1444
+ case AMP:
1445
+ this.text += chunk.slice(start, this.prevI);
1446
+ this.state = S_ENTITY;
1447
+ this.entityReturnState = S_ATTRIB_VALUE_QUOTED;
1448
+ return;
1449
+ case NL:
1450
+ case NL_LIKE:
1451
+ case TAB:
1452
+ this.text += `${chunk.slice(start, this.prevI)} `;
1453
+ start = this.i;
1454
+ break;
1455
+ case LESS:
1456
+ this.text += chunk.slice(start, this.prevI);
1457
+ this.fail("disallowed character.");
1458
+ return;
1459
+ case EOC:
1460
+ this.text += chunk.slice(start);
1461
+ return;
1462
+ }
1463
+ }
1464
+ }
1465
+ sAttribValueClosed() {
1466
+ const c = this.getCodeNorm();
1467
+ if (isS(c)) {
1468
+ this.state = S_ATTRIB;
1469
+ } else if (c === GREATER) {
1470
+ this.openTag();
1471
+ } else if (c === FORWARD_SLASH) {
1472
+ this.state = S_OPEN_TAG_SLASH;
1473
+ } else if (isNameStartChar(c)) {
1474
+ this.fail("no whitespace between attributes.");
1475
+ this.unget();
1476
+ this.state = S_ATTRIB_NAME;
1477
+ } else {
1478
+ this.fail("disallowed character in attribute name.");
1479
+ }
1480
+ }
1481
+ sAttribValueUnquoted() {
1482
+ const c = this.captureTo(ATTRIB_VALUE_UNQUOTED_TERMINATOR);
1483
+ switch (c) {
1484
+ case AMP:
1485
+ this.state = S_ENTITY;
1486
+ this.entityReturnState = S_ATTRIB_VALUE_UNQUOTED;
1487
+ break;
1488
+ case LESS:
1489
+ this.fail("disallowed character.");
1490
+ break;
1491
+ case EOC:
1492
+ break;
1493
+ default:
1494
+ if (this.text.includes("]]>")) {
1495
+ this.fail('the string "]]>" is disallowed in char data.');
1496
+ }
1497
+ this.pushAttrib(this.name, this.text);
1498
+ this.name = this.text = "";
1499
+ if (c === GREATER) {
1500
+ this.openTag();
1501
+ } else {
1502
+ this.state = S_ATTRIB;
1503
+ }
1504
+ }
1505
+ }
1506
+ sCloseTag() {
1507
+ const c = this.captureNameChars();
1508
+ if (c === GREATER) {
1509
+ this.closeTag();
1510
+ } else if (isS(c)) {
1511
+ this.state = S_CLOSE_TAG_SAW_WHITE;
1512
+ } else if (c !== EOC) {
1513
+ this.fail("disallowed character in closing tag.");
1514
+ }
1515
+ }
1516
+ sCloseTagSawWhite() {
1517
+ switch (this.skipSpaces()) {
1518
+ case GREATER:
1519
+ this.closeTag();
1520
+ break;
1521
+ case EOC:
1522
+ break;
1523
+ default:
1524
+ this.fail("disallowed character in closing tag.");
1525
+ }
1526
+ }
1527
+ // END OF STATE ENGINE METHODS
1528
+ handleTextInRoot() {
1529
+ let { i: start, forbiddenState } = this;
1530
+ const { chunk, textHandler: handler } = this;
1531
+ scanLoop:
1532
+ while (true) {
1533
+ switch (this.getCode()) {
1534
+ case LESS: {
1535
+ this.state = S_OPEN_WAKA;
1536
+ if (handler !== void 0) {
1537
+ const { text } = this;
1538
+ const slice = chunk.slice(start, this.prevI);
1539
+ if (text.length !== 0) {
1540
+ handler(text + slice);
1541
+ this.text = "";
1542
+ } else if (slice.length !== 0) {
1543
+ handler(slice);
1544
+ }
1545
+ }
1546
+ forbiddenState = FORBIDDEN_START;
1547
+ break scanLoop;
1548
+ }
1549
+ case AMP:
1550
+ this.state = S_ENTITY;
1551
+ this.entityReturnState = S_TEXT;
1552
+ if (handler !== void 0) {
1553
+ this.text += chunk.slice(start, this.prevI);
1554
+ }
1555
+ forbiddenState = FORBIDDEN_START;
1556
+ break scanLoop;
1557
+ case CLOSE_BRACKET:
1558
+ switch (forbiddenState) {
1559
+ case FORBIDDEN_START:
1560
+ forbiddenState = FORBIDDEN_BRACKET;
1561
+ break;
1562
+ case FORBIDDEN_BRACKET:
1563
+ forbiddenState = FORBIDDEN_BRACKET_BRACKET;
1564
+ break;
1565
+ case FORBIDDEN_BRACKET_BRACKET:
1566
+ break;
1567
+ default:
1568
+ throw new Error("impossible state");
1569
+ }
1570
+ break;
1571
+ case GREATER:
1572
+ if (forbiddenState === FORBIDDEN_BRACKET_BRACKET) {
1573
+ this.fail('the string "]]>" is disallowed in char data.');
1574
+ }
1575
+ forbiddenState = FORBIDDEN_START;
1576
+ break;
1577
+ case NL_LIKE:
1578
+ if (handler !== void 0) {
1579
+ this.text += `${chunk.slice(start, this.prevI)}
1580
+ `;
1581
+ }
1582
+ start = this.i;
1583
+ forbiddenState = FORBIDDEN_START;
1584
+ break;
1585
+ case EOC:
1586
+ if (handler !== void 0) {
1587
+ this.text += chunk.slice(start);
1588
+ }
1589
+ break scanLoop;
1590
+ default:
1591
+ forbiddenState = FORBIDDEN_START;
1592
+ }
1593
+ }
1594
+ this.forbiddenState = forbiddenState;
1595
+ }
1596
+ handleTextOutsideRoot() {
1597
+ let { i: start } = this;
1598
+ const { chunk, textHandler: handler } = this;
1599
+ let nonSpace = false;
1600
+ outRootLoop:
1601
+ while (true) {
1602
+ const code = this.getCode();
1603
+ switch (code) {
1604
+ case LESS: {
1605
+ this.state = S_OPEN_WAKA;
1606
+ if (handler !== void 0) {
1607
+ const { text } = this;
1608
+ const slice = chunk.slice(start, this.prevI);
1609
+ if (text.length !== 0) {
1610
+ handler(text + slice);
1611
+ this.text = "";
1612
+ } else if (slice.length !== 0) {
1613
+ handler(slice);
1614
+ }
1615
+ }
1616
+ break outRootLoop;
1617
+ }
1618
+ case AMP:
1619
+ this.state = S_ENTITY;
1620
+ this.entityReturnState = S_TEXT;
1621
+ if (handler !== void 0) {
1622
+ this.text += chunk.slice(start, this.prevI);
1623
+ }
1624
+ nonSpace = true;
1625
+ break outRootLoop;
1626
+ case NL_LIKE:
1627
+ if (handler !== void 0) {
1628
+ this.text += `${chunk.slice(start, this.prevI)}
1629
+ `;
1630
+ }
1631
+ start = this.i;
1632
+ break;
1633
+ case EOC:
1634
+ if (handler !== void 0) {
1635
+ this.text += chunk.slice(start);
1636
+ }
1637
+ break outRootLoop;
1638
+ default:
1639
+ if (!isS(code)) {
1640
+ nonSpace = true;
1641
+ }
1642
+ }
1643
+ }
1644
+ if (!nonSpace) {
1645
+ return;
1646
+ }
1647
+ if (!this.sawRoot && !this.reportedTextBeforeRoot) {
1648
+ this.fail("text data outside of root node.");
1649
+ this.reportedTextBeforeRoot = true;
1650
+ }
1651
+ if (this.closedRoot && !this.reportedTextAfterRoot) {
1652
+ this.fail("text data outside of root node.");
1653
+ this.reportedTextAfterRoot = true;
1654
+ }
1655
+ }
1656
+ pushAttribNS(name, value) {
1657
+ var _a5;
1658
+ const { prefix, local } = this.qname(name);
1659
+ const attr = { name, prefix, local, value };
1660
+ this.attribList.push(attr);
1661
+ (_a5 = this.attributeHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, attr);
1662
+ if (prefix === "xmlns") {
1663
+ const trimmed = value.trim();
1664
+ if (this.currentXMLVersion === "1.0" && trimmed === "") {
1665
+ this.fail("invalid attempt to undefine prefix in XML 1.0");
1666
+ }
1667
+ this.topNS[local] = trimmed;
1668
+ nsPairCheck(this, local, trimmed);
1669
+ } else if (name === "xmlns") {
1670
+ const trimmed = value.trim();
1671
+ this.topNS[""] = trimmed;
1672
+ nsPairCheck(this, "", trimmed);
1673
+ }
1674
+ }
1675
+ pushAttribPlain(name, value) {
1676
+ var _a5;
1677
+ const attr = { name, value };
1678
+ this.attribList.push(attr);
1679
+ (_a5 = this.attributeHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, attr);
1680
+ }
1681
+ /**
1682
+ * End parsing. This performs final well-formedness checks and resets the
1683
+ * parser to a clean state.
1684
+ *
1685
+ * @returns this
1686
+ */
1687
+ end() {
1688
+ var _a5, _b;
1689
+ if (!this.sawRoot) {
1690
+ this.fail("document must contain a root element.");
1691
+ }
1692
+ const { tags } = this;
1693
+ while (tags.length > 0) {
1694
+ const tag = tags.pop();
1695
+ this.fail(`unclosed tag: ${tag.name}`);
1696
+ }
1697
+ if (this.state !== S_BEGIN && this.state !== S_TEXT) {
1698
+ this.fail("unexpected end.");
1699
+ }
1700
+ const { text } = this;
1701
+ if (text.length !== 0) {
1702
+ (_a5 = this.textHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, text);
1703
+ this.text = "";
1704
+ }
1705
+ this._closed = true;
1706
+ (_b = this.endHandler) === null || _b === void 0 ? void 0 : _b.call(this);
1707
+ this._init();
1708
+ return this;
1709
+ }
1710
+ /**
1711
+ * Resolve a namespace prefix.
1712
+ *
1713
+ * @param prefix The prefix to resolve.
1714
+ *
1715
+ * @returns The namespace URI or ``undefined`` if the prefix is not defined.
1716
+ */
1717
+ resolve(prefix) {
1718
+ var _a5, _b;
1719
+ let uri = this.topNS[prefix];
1720
+ if (uri !== void 0) {
1721
+ return uri;
1722
+ }
1723
+ const { tags } = this;
1724
+ for (let index = tags.length - 1; index >= 0; index--) {
1725
+ uri = tags[index].ns[prefix];
1726
+ if (uri !== void 0) {
1727
+ return uri;
1728
+ }
1729
+ }
1730
+ uri = this.ns[prefix];
1731
+ if (uri !== void 0) {
1732
+ return uri;
1733
+ }
1734
+ return (_b = (_a5 = this.opt).resolvePrefix) === null || _b === void 0 ? void 0 : _b.call(_a5, prefix);
1735
+ }
1736
+ /**
1737
+ * Parse a qname into its prefix and local name parts.
1738
+ *
1739
+ * @param name The name to parse
1740
+ *
1741
+ * @returns
1742
+ */
1743
+ qname(name) {
1744
+ const colon = name.indexOf(":");
1745
+ if (colon === -1) {
1746
+ return { prefix: "", local: name };
1747
+ }
1748
+ const local = name.slice(colon + 1);
1749
+ const prefix = name.slice(0, colon);
1750
+ if (prefix === "" || local === "" || local.includes(":")) {
1751
+ this.fail(`malformed name: ${name}.`);
1752
+ }
1753
+ return { prefix, local };
1754
+ }
1755
+ processAttribsNS() {
1756
+ var _a5;
1757
+ const { attribList } = this;
1758
+ const tag = this.tag;
1759
+ {
1760
+ const { prefix, local } = this.qname(tag.name);
1761
+ tag.prefix = prefix;
1762
+ tag.local = local;
1763
+ const uri = tag.uri = (_a5 = this.resolve(prefix)) !== null && _a5 !== void 0 ? _a5 : "";
1764
+ if (prefix !== "") {
1765
+ if (prefix === "xmlns") {
1766
+ this.fail('tags may not have "xmlns" as prefix.');
1767
+ }
1768
+ if (uri === "") {
1769
+ this.fail(`unbound namespace prefix: ${JSON.stringify(prefix)}.`);
1770
+ tag.uri = prefix;
1771
+ }
1772
+ }
1773
+ }
1774
+ if (attribList.length === 0) {
1775
+ return;
1776
+ }
1777
+ const { attributes } = tag;
1778
+ const seen = /* @__PURE__ */ new Set();
1779
+ for (const attr of attribList) {
1780
+ const { name, prefix, local } = attr;
1781
+ let uri;
1782
+ let eqname;
1783
+ if (prefix === "") {
1784
+ uri = name === "xmlns" ? XMLNS_NAMESPACE : "";
1785
+ eqname = name;
1786
+ } else {
1787
+ uri = this.resolve(prefix);
1788
+ if (uri === void 0) {
1789
+ this.fail(`unbound namespace prefix: ${JSON.stringify(prefix)}.`);
1790
+ uri = prefix;
1791
+ }
1792
+ eqname = `{${uri}}${local}`;
1793
+ }
1794
+ if (seen.has(eqname)) {
1795
+ this.fail(`duplicate attribute: ${eqname}.`);
1796
+ }
1797
+ seen.add(eqname);
1798
+ attr.uri = uri;
1799
+ attributes[name] = attr;
1800
+ }
1801
+ this.attribList = [];
1802
+ }
1803
+ processAttribsPlain() {
1804
+ const { attribList } = this;
1805
+ const attributes = this.tag.attributes;
1806
+ for (const { name, value } of attribList) {
1807
+ if (attributes[name] !== void 0) {
1808
+ this.fail(`duplicate attribute: ${name}.`);
1809
+ }
1810
+ attributes[name] = value;
1811
+ }
1812
+ this.attribList = [];
1813
+ }
1814
+ /**
1815
+ * Handle a complete open tag. This parser code calls this once it has seen
1816
+ * the whole tag. This method checks for well-formeness and then emits
1817
+ * ``onopentag``.
1818
+ */
1819
+ openTag() {
1820
+ var _a5;
1821
+ this.processAttribs();
1822
+ const { tags } = this;
1823
+ const tag = this.tag;
1824
+ tag.isSelfClosing = false;
1825
+ (_a5 = this.openTagHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, tag);
1826
+ tags.push(tag);
1827
+ this.state = S_TEXT;
1828
+ this.name = "";
1829
+ }
1830
+ /**
1831
+ * Handle a complete self-closing tag. This parser code calls this once it has
1832
+ * seen the whole tag. This method checks for well-formeness and then emits
1833
+ * ``onopentag`` and ``onclosetag``.
1834
+ */
1835
+ openSelfClosingTag() {
1836
+ var _a5, _b, _c;
1837
+ this.processAttribs();
1838
+ const { tags } = this;
1839
+ const tag = this.tag;
1840
+ tag.isSelfClosing = true;
1841
+ (_a5 = this.openTagHandler) === null || _a5 === void 0 ? void 0 : _a5.call(this, tag);
1842
+ (_b = this.closeTagHandler) === null || _b === void 0 ? void 0 : _b.call(this, tag);
1843
+ const top = this.tag = (_c = tags[tags.length - 1]) !== null && _c !== void 0 ? _c : null;
1844
+ if (top === null) {
1845
+ this.closedRoot = true;
1846
+ }
1847
+ this.state = S_TEXT;
1848
+ this.name = "";
1849
+ }
1850
+ /**
1851
+ * Handle a complete close tag. This parser code calls this once it has seen
1852
+ * the whole tag. This method checks for well-formeness and then emits
1853
+ * ``onclosetag``.
1854
+ */
1855
+ closeTag() {
1856
+ const { tags, name } = this;
1857
+ this.state = S_TEXT;
1858
+ this.name = "";
1859
+ if (name === "") {
1860
+ this.fail("weird empty close tag.");
1861
+ this.text += "</>";
1862
+ return;
1863
+ }
1864
+ const handler = this.closeTagHandler;
1865
+ let l = tags.length;
1866
+ while (l-- > 0) {
1867
+ const tag = this.tag = tags.pop();
1868
+ this.topNS = tag.ns;
1869
+ handler === null || handler === void 0 ? void 0 : handler(tag);
1870
+ if (tag.name === name) {
1871
+ break;
1872
+ }
1873
+ this.fail("unexpected close tag.");
1874
+ }
1875
+ if (l === 0) {
1876
+ this.closedRoot = true;
1877
+ } else if (l < 0) {
1878
+ this.fail(`unmatched closing tag: ${name}.`);
1879
+ this.text += `</${name}>`;
1880
+ }
1881
+ }
1882
+ /**
1883
+ * Resolves an entity. Makes any necessary well-formedness checks.
1884
+ *
1885
+ * @param entity The entity to resolve.
1886
+ *
1887
+ * @returns The parsed entity.
1888
+ */
1889
+ parseEntity(entity) {
1890
+ if (entity[0] !== "#") {
1891
+ const defined = this.ENTITIES[entity];
1892
+ if (defined !== void 0) {
1893
+ return defined;
1894
+ }
1895
+ this.fail(this.isName(entity) ? "undefined entity." : "disallowed character in entity name.");
1896
+ return `&${entity};`;
1897
+ }
1898
+ let num3 = NaN;
1899
+ if (entity[1] === "x" && /^#x[0-9a-f]+$/i.test(entity)) {
1900
+ num3 = parseInt(entity.slice(2), 16);
1901
+ } else if (/^#[0-9]+$/.test(entity)) {
1902
+ num3 = parseInt(entity.slice(1), 10);
1903
+ }
1904
+ if (!this.isChar(num3)) {
1905
+ this.fail("malformed character entity.");
1906
+ return `&${entity};`;
1907
+ }
1908
+ return String.fromCodePoint(num3);
1909
+ }
1910
+ };
1911
+ exports$1.SaxesParser = SaxesParser2;
1912
+ }
1913
+ });
1914
+
17
1915
  // ../../node_modules/zod/v4/classic/external.js
18
1916
  var external_exports = {};
19
1917
  __export(external_exports, {
@@ -19672,6 +21570,7 @@ function date4(params) {
19672
21570
  }
19673
21571
 
19674
21572
  // ../session-schema/dist/index.js
21573
+ var import_saxes = __toESM(require_saxes(), 1);
19675
21574
  var CAPTURE_TIERS = ["metrics", "redacted", "full"];
19676
21575
  var TIER_RANK = { metrics: 0, redacted: 1, full: 2 };
19677
21576
  function tierAtLeast(a, b) {
@@ -20107,7 +22006,188 @@ function turnCountBound(turns) {
20107
22006
  function parseAgentSession(data) {
20108
22007
  return AgentSessionSchema.parse(data);
20109
22008
  }
20110
- var ARTIFACT_KINDS = ["video", "screenshot", "report", "log", "file"];
22009
+ var TEST_NAME_MAX = 500;
22010
+ var TEST_PATH_MAX = 300;
22011
+ var TEST_SELECTION_MAX = 100;
22012
+ var STORED_TESTS_OTHER_MAX = 200;
22013
+ var STORED_TESTS_FAILED_MAX = 500;
22014
+ var MAX_NESTING_DEPTH = 200;
22015
+ var MAX_TESTCASES = 2e5;
22016
+ var LimitError = class extends Error {
22017
+ };
22018
+ var JUNIT_ROOTS = /* @__PURE__ */ new Set(["testsuites", "testsuite"]);
22019
+ function isSafeRelativePath(path) {
22020
+ if (path === "" || path.length > TEST_PATH_MAX) return false;
22021
+ if (path.startsWith("/") || path.startsWith("\\") || /^[A-Za-z]:/.test(path)) return false;
22022
+ if (path.includes("\0")) return false;
22023
+ return !path.split(/[\\/]/).includes("..");
22024
+ }
22025
+ var TestSelectionSchema = external_exports.object({
22026
+ name: external_exports.string().min(1).max(TEST_NAME_MAX),
22027
+ file: external_exports.string().refine(isSafeRelativePath, { message: "must be a relative path inside the repository" }).optional(),
22028
+ line: external_exports.number().int().positive().max(1e7).optional()
22029
+ });
22030
+ var TestSelectionListSchema = external_exports.array(TestSelectionSchema).min(1).max(TEST_SELECTION_MAX);
22031
+ var StoredTestSchema = external_exports.object({
22032
+ name: external_exports.string().max(TEST_NAME_MAX),
22033
+ suite: external_exports.string().max(TEST_NAME_MAX),
22034
+ status: external_exports.enum(["passed", "failed", "errored", "skipped"]),
22035
+ file: external_exports.string().nullable(),
22036
+ line: external_exports.number().int().positive().nullable(),
22037
+ named: external_exports.boolean()
22038
+ });
22039
+ external_exports.object({
22040
+ root: external_exports.enum(["testsuites", "testsuite"]),
22041
+ selected: external_exports.boolean(),
22042
+ counts: external_exports.object({
22043
+ total: external_exports.number().int().nonnegative(),
22044
+ passed: external_exports.number().int().nonnegative(),
22045
+ failed: external_exports.number().int().nonnegative(),
22046
+ errored: external_exports.number().int().nonnegative(),
22047
+ skipped: external_exports.number().int().nonnegative()
22048
+ }),
22049
+ tests: external_exports.array(StoredTestSchema)
22050
+ });
22051
+ function attributeLine(value) {
22052
+ if (value === void 0 || !/^\d{1,9}$/.test(value)) return null;
22053
+ const line = Number(value);
22054
+ return line >= 1 ? line : null;
22055
+ }
22056
+ function parseJunit(bytes) {
22057
+ var _a5;
22058
+ const text = new TextDecoder("utf-8").decode(bytes).replace(/^/, "");
22059
+ const parser = new import_saxes.SaxesParser({ xmlns: false });
22060
+ let firstError = null;
22061
+ let sawDoctype = false;
22062
+ let doctypeName = "";
22063
+ let root = null;
22064
+ const suites = [];
22065
+ const stack = [];
22066
+ const testcases = [];
22067
+ parser.on("error", (error64) => {
22068
+ var _a23;
22069
+ firstError != null ? firstError : firstError = (_a23 = error64.message.split("\n")[0]) != null ? _a23 : "not well-formed";
22070
+ });
22071
+ parser.on("doctype", (declaration) => {
22072
+ var _a23, _b;
22073
+ sawDoctype = true;
22074
+ doctypeName = (_b = (_a23 = /^\s*([^\s[>]+)/.exec(declaration)) == null ? void 0 : _a23[1]) != null ? _b : "";
22075
+ });
22076
+ parser.on("opentag", (tag) => {
22077
+ var _a23, _b, _c;
22078
+ if (root === null) root = tag.name;
22079
+ if (stack.length >= MAX_NESTING_DEPTH) throw new LimitError(`nested more than ${MAX_NESTING_DEPTH} levels deep`);
22080
+ const attributes = tag.attributes;
22081
+ if (tag.name === "testsuite") suites.push((_a23 = attributes.name) != null ? _a23 : "");
22082
+ if (tag.name === "testcase") {
22083
+ if (testcases.length >= MAX_TESTCASES) throw new LimitError(`more than ${MAX_TESTCASES} testcases`);
22084
+ const rawFile = attributes.file;
22085
+ const safeFile = rawFile !== void 0 && isSafeRelativePath(rawFile) ? rawFile : null;
22086
+ testcases.push({
22087
+ name: (_b = attributes.name) != null ? _b : "",
22088
+ suite: (_c = suites[suites.length - 1]) != null ? _c : "",
22089
+ status: "passed",
22090
+ file: safeFile,
22091
+ line: safeFile === null ? null : attributeLine(attributes.line)
22092
+ });
22093
+ stack.push({ name: tag.name, testcase: testcases.length - 1 });
22094
+ return;
22095
+ }
22096
+ const parent = stack[stack.length - 1];
22097
+ if ((parent == null ? void 0 : parent.testcase) != null) {
22098
+ const found = testcases[parent.testcase];
22099
+ if (tag.name === "failure") found.status = "failed";
22100
+ else if (tag.name === "error" && found.status !== "failed") found.status = "errored";
22101
+ else if (tag.name === "skipped" && found.status === "passed") found.status = "skipped";
22102
+ }
22103
+ stack.push({ name: tag.name, testcase: null });
22104
+ });
22105
+ parser.on("closetag", (tag) => {
22106
+ stack.pop();
22107
+ if (tag.name === "testsuite") suites.pop();
22108
+ });
22109
+ try {
22110
+ parser.write(text).close();
22111
+ } catch (error64) {
22112
+ if (error64 instanceof LimitError) {
22113
+ return { kind: "refused", reason: "limit", message: `the file is ${error64.message}, which no test report is` };
22114
+ }
22115
+ firstError != null ? firstError : firstError = error64 instanceof Error ? (_a5 = error64.message.split("\n")[0]) != null ? _a5 : "not well-formed" : "not well-formed";
22116
+ }
22117
+ const junitRoot = root !== null && JUNIT_ROOTS.has(root) || root === null && JUNIT_ROOTS.has(doctypeName);
22118
+ if (sawDoctype && junitRoot) {
22119
+ return {
22120
+ kind: "refused",
22121
+ reason: "dtd",
22122
+ message: "the file declares a DOCTYPE or an entity, which test results never need; remove it"
22123
+ };
22124
+ }
22125
+ if (firstError !== null || root === null) {
22126
+ return { kind: "refused", reason: "malformed", message: `not well-formed XML (${firstError != null ? firstError : "no root element"})` };
22127
+ }
22128
+ if (!JUNIT_ROOTS.has(root)) return { kind: "other" };
22129
+ return { kind: "junit", root, testcases };
22130
+ }
22131
+ function bindTests(parsed, selection) {
22132
+ const named = /* @__PURE__ */ new Map();
22133
+ const duplicates = [];
22134
+ for (const wanted of selection != null ? selection : []) {
22135
+ let matches = 0;
22136
+ parsed.testcases.forEach((testcase, index) => {
22137
+ if (testcase.name !== wanted.name) return;
22138
+ matches += 1;
22139
+ if (!named.has(index)) named.set(index, wanted);
22140
+ });
22141
+ if (matches === 0) return { ok: false, missing: wanted.name };
22142
+ if (matches > 1) duplicates.push(wanted.name);
22143
+ }
22144
+ const counts = { total: parsed.testcases.length, passed: 0, failed: 0, errored: 0, skipped: 0 };
22145
+ const tests = [];
22146
+ let failedKept = 0;
22147
+ let otherKept = 0;
22148
+ parsed.testcases.forEach((testcase, index) => {
22149
+ var _a5, _b;
22150
+ counts[testcase.status === "passed" ? "passed" : testcase.status === "failed" ? "failed" : testcase.status === "errored" ? "errored" : "skipped"] += 1;
22151
+ const chosen = named.get(index);
22152
+ const failed = testcase.status === "failed" || testcase.status === "errored";
22153
+ if (chosen === void 0) {
22154
+ if (failed ? failedKept >= STORED_TESTS_FAILED_MAX : otherKept >= STORED_TESTS_OTHER_MAX) return;
22155
+ if (failed) failedKept += 1;
22156
+ else otherKept += 1;
22157
+ }
22158
+ const ownLocation = testcase.file !== null;
22159
+ tests.push({
22160
+ name: testcase.name.slice(0, TEST_NAME_MAX),
22161
+ suite: testcase.suite.slice(0, TEST_NAME_MAX),
22162
+ status: testcase.status,
22163
+ file: ownLocation ? testcase.file : (_a5 = chosen == null ? void 0 : chosen.file) != null ? _a5 : null,
22164
+ line: ownLocation ? testcase.line : (chosen == null ? void 0 : chosen.file) !== void 0 ? (_b = chosen.line) != null ? _b : null : null,
22165
+ named: chosen !== void 0
22166
+ });
22167
+ });
22168
+ return { ok: true, results: { root: parsed.root, selected: named.size > 0, counts, tests }, duplicates };
22169
+ }
22170
+ function parseTestSelector(raw) {
22171
+ const equals = raw.lastIndexOf("=");
22172
+ const location = equals > 0 ? /^(.+):(\d+)$/.exec(raw.slice(equals + 1)) : null;
22173
+ if (location === null) {
22174
+ if (raw === "") return { ok: false, message: "a test name is empty" };
22175
+ if (raw.length > TEST_NAME_MAX) return { ok: false, message: `a test name is longer than ${TEST_NAME_MAX} characters` };
22176
+ return { ok: true, test: { name: raw } };
22177
+ }
22178
+ const name = raw.slice(0, equals);
22179
+ const file3 = location[1];
22180
+ const line = Number(location[2]);
22181
+ if (name.length > TEST_NAME_MAX) return { ok: false, message: `a test name is longer than ${TEST_NAME_MAX} characters` };
22182
+ if (!isSafeRelativePath(file3)) {
22183
+ return { ok: false, message: `the location "${file3}" must be a relative path inside the repository` };
22184
+ }
22185
+ if (!Number.isSafeInteger(line) || line < 1 || line > 1e7) {
22186
+ return { ok: false, message: `the line in "${raw.slice(equals + 1)}" must be a positive number` };
22187
+ }
22188
+ return { ok: true, test: { name, file: file3, line } };
22189
+ }
22190
+ var ARTIFACT_KINDS = ["video", "screenshot", "report", "log", "test", "file"];
20111
22191
  var KIND_BY_MEDIA_TYPE = {
20112
22192
  "video/webm": "video",
20113
22193
  "video/mp4": "video",
@@ -20132,7 +22212,8 @@ var MEDIA_TYPE_BY_EXTENSION = {
20132
22212
  htm: "text/html",
20133
22213
  pdf: "application/pdf",
20134
22214
  txt: "text/plain",
20135
- log: "text/plain"
22215
+ log: "text/plain",
22216
+ xml: "application/xml"
20136
22217
  };
20137
22218
  function mediaTypeForArtifactPath(path) {
20138
22219
  var _a5, _b;
@@ -20190,7 +22271,10 @@ var ArtifactSpoolRecordSchema = external_exports.looseObject({
20190
22271
  * record fine and treats it as a single-target correction naming
20191
22272
  * `replaces` — it never sees an unfamiliar shape, only an unfamiliar
20192
22273
  * (ignored) extra key. */
20193
- replacesTargets: external_exports.array(external_exports.string().regex(/^[A-Za-z0-9_.:-]{1,64}$/)).min(2).max(ARTIFACT_MAX_REPLACES_TARGETS).optional()
22274
+ replacesTargets: external_exports.array(external_exports.string().regex(/^[A-Za-z0-9_.:-]{1,64}$/)).min(2).max(ARTIFACT_MAX_REPLACES_TARGETS).optional(),
22275
+ /** The tests `--test` selected from a JUnit results file, with any
22276
+ * location the caller gave. Absent when the whole file is bound. */
22277
+ tests: TestSelectionListSchema.optional()
20194
22278
  });
20195
22279
  var ArtifactTombstoneRecordSchema = external_exports.looseObject({
20196
22280
  rec: external_exports.literal("artifact-tombstone"),
@@ -88701,8 +90785,35 @@ function scrubDeep(value) {
88701
90785
  }
88702
90786
  /*! Bundled license information:
88703
90787
 
90788
+ xmlchars/xml/1.0/ed5.js:
90789
+ (**
90790
+ * Character classes and associated utilities for the 5th edition of XML 1.0.
90791
+ *
90792
+ * @author Louis-Dominique Dubeau
90793
+ * @license MIT
90794
+ * @copyright Louis-Dominique Dubeau
90795
+ *)
90796
+
90797
+ xmlchars/xml/1.1/ed2.js:
90798
+ (**
90799
+ * Character classes and associated utilities for the 2nd edition of XML 1.1.
90800
+ *
90801
+ * @author Louis-Dominique Dubeau
90802
+ * @license MIT
90803
+ * @copyright Louis-Dominique Dubeau
90804
+ *)
90805
+
90806
+ xmlchars/xmlns/1.0/ed3.js:
90807
+ (**
90808
+ * Character class utilities for XML NS 1.0 edition 3.
90809
+ *
90810
+ * @author Louis-Dominique Dubeau
90811
+ * @license MIT
90812
+ * @copyright Louis-Dominique Dubeau
90813
+ *)
90814
+
88704
90815
  chokidar/index.js:
88705
90816
  (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
88706
90817
  */
88707
90818
 
88708
- export { ARTIFACT_MAX_CAPTION_LENGTH, ARTIFACT_MAX_FILENAME_LENGTH, ARTIFACT_MAX_REPLACES_TARGETS, ArtifactCriterionIdSchema, ArtifactSpoolRecordSchema, ArtifactTombstoneRecordSchema, CAPTURE_TIERS, CaptureDaemon, CriteriaListSchema, EMITTED_RESULTS, EMITTED_RESULT_MAX_BODY_LENGTH, EMITTED_RESULT_MAX_LINK_LENGTH, EVENT_TYPES, EmittedNameSchema, FindingBatchSchema, PRICE_TABLE_SOURCE, SECRET_PATTERNS, SOURCE_ADAPTERS, SUPPORTED_VERSIONS, StatuslineAggregator, WARNING_CODES, bannedPathsForTier, claudeCodeAdapter, codexAdapter, codexSessionIdFromPath, compareVersions, completePrefix, computeStatuslineState, costOfUsage, cursorAdapter, cursorChatIdFromPath, defaultCodexSessionsDir, defaultCursorChatsDir, defaultCursorProjectsDir, defaultProjectsDir, defaultRawDir, downconvertSession, enrichSessionRepo, findCodexRollouts, findCursorChats, findTranscripts, inferArtifactKind, isHumanUserTurn, isNewerThanSupported, isPriceKnown, mediaTypeForArtifactPath, normalizeErrorSignature, normalizeRemote, parseCodexRollout, parseCursorChat, parseTranscript, readStatuslineState, readSyncWatermarkMs, remoteLookupFailed, resolvePrice, resolveRepoIdentity, rootChildIds, scanAll, scrubDeep, scrubText, sessionIdFromPath, setCustomScrubbers, setLocalIdentity, setRepoRoot, statuslineStatePath, tailTranscript, turnCountBound, workspacesByHash, writeStatuslineState };
90819
+ export { ARTIFACT_MAX_CAPTION_LENGTH, ARTIFACT_MAX_FILENAME_LENGTH, ARTIFACT_MAX_REPLACES_TARGETS, ArtifactCriterionIdSchema, ArtifactSpoolRecordSchema, ArtifactTombstoneRecordSchema, CAPTURE_TIERS, CaptureDaemon, CriteriaListSchema, EMITTED_RESULTS, EMITTED_RESULT_MAX_BODY_LENGTH, EMITTED_RESULT_MAX_LINK_LENGTH, EVENT_TYPES, EmittedNameSchema, FindingBatchSchema, PRICE_TABLE_SOURCE, SECRET_PATTERNS, SOURCE_ADAPTERS, SUPPORTED_VERSIONS, StatuslineAggregator, WARNING_CODES, bannedPathsForTier, bindTests, claudeCodeAdapter, codexAdapter, codexSessionIdFromPath, compareVersions, completePrefix, computeStatuslineState, costOfUsage, cursorAdapter, cursorChatIdFromPath, defaultCodexSessionsDir, defaultCursorChatsDir, defaultCursorProjectsDir, defaultProjectsDir, defaultRawDir, downconvertSession, enrichSessionRepo, findCodexRollouts, findCursorChats, findTranscripts, inferArtifactKind, isHumanUserTurn, isNewerThanSupported, isPriceKnown, mediaTypeForArtifactPath, normalizeErrorSignature, normalizeRemote, parseCodexRollout, parseCursorChat, parseJunit, parseTestSelector, parseTranscript, readStatuslineState, readSyncWatermarkMs, remoteLookupFailed, resolvePrice, resolveRepoIdentity, rootChildIds, scanAll, scrubDeep, scrubText, sessionIdFromPath, setCustomScrubbers, setLocalIdentity, setRepoRoot, statuslineStatePath, tailTranscript, turnCountBound, workspacesByHash, writeStatuslineState };