@sjawhar/claude-envoy 5.10.1 → 5.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/codex-hook.js +1241 -2
- package/dist/dispatch.js +1239 -0
- package/dist/envoy-channel.js +1382 -3
- package/dist/session-hook.js +1241 -2
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -25680,13 +25680,1129 @@ var DELIMITERS = {
|
|
|
25680
25680
|
pipe: "|"
|
|
25681
25681
|
};
|
|
25682
25682
|
var DEFAULT_DELIMITER = DELIMITERS.comma;
|
|
25683
|
+
function trimSpaces(value) {
|
|
25684
|
+
let start = 0;
|
|
25685
|
+
let end = value.length;
|
|
25686
|
+
while (start < end && value[start] === " ")
|
|
25687
|
+
start++;
|
|
25688
|
+
while (end > start && value[end - 1] === " ")
|
|
25689
|
+
end--;
|
|
25690
|
+
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
25691
|
+
}
|
|
25683
25692
|
function escapeString(value) {
|
|
25684
25693
|
return value.replace(/\\/g, `\\\\`).replace(/"/g, `\\"`).replace(/\n/g, `\\n`).replace(/\r/g, `\\r`).replace(/\t/g, `\\t`).replace(/[\u0000-\u001F]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
25685
25694
|
}
|
|
25695
|
+
function unescapeString(value) {
|
|
25696
|
+
let unescaped = "";
|
|
25697
|
+
let i = 0;
|
|
25698
|
+
while (i < value.length) {
|
|
25699
|
+
if (value[i] === "\\") {
|
|
25700
|
+
if (i + 1 >= value.length)
|
|
25701
|
+
throw new SyntaxError("Invalid escape sequence: backslash at end of string");
|
|
25702
|
+
const next = value[i + 1];
|
|
25703
|
+
if (next === "n") {
|
|
25704
|
+
unescaped += `
|
|
25705
|
+
`;
|
|
25706
|
+
i += 2;
|
|
25707
|
+
continue;
|
|
25708
|
+
}
|
|
25709
|
+
if (next === "t") {
|
|
25710
|
+
unescaped += "\t";
|
|
25711
|
+
i += 2;
|
|
25712
|
+
continue;
|
|
25713
|
+
}
|
|
25714
|
+
if (next === "r") {
|
|
25715
|
+
unescaped += "\r";
|
|
25716
|
+
i += 2;
|
|
25717
|
+
continue;
|
|
25718
|
+
}
|
|
25719
|
+
if (next === "\\") {
|
|
25720
|
+
unescaped += "\\";
|
|
25721
|
+
i += 2;
|
|
25722
|
+
continue;
|
|
25723
|
+
}
|
|
25724
|
+
if (next === '"') {
|
|
25725
|
+
unescaped += '"';
|
|
25726
|
+
i += 2;
|
|
25727
|
+
continue;
|
|
25728
|
+
}
|
|
25729
|
+
if (next === "u") {
|
|
25730
|
+
if (i + 6 > value.length)
|
|
25731
|
+
throw new SyntaxError(`Invalid escape sequence: truncated \\u escape at "${value.slice(i, i + 6)}"`);
|
|
25732
|
+
const hex = value.slice(i + 2, i + 6);
|
|
25733
|
+
if (!/^[0-9a-f]{4}$/i.test(hex))
|
|
25734
|
+
throw new SyntaxError(`Invalid escape sequence: \\u must be followed by 4 hex digits, got "${hex}"`);
|
|
25735
|
+
const codeUnit = Number.parseInt(hex, 16);
|
|
25736
|
+
if (codeUnit >= 55296 && codeUnit <= 57343)
|
|
25737
|
+
throw new SyntaxError(`Invalid escape sequence: \\u${hex} is a lone surrogate. Supplementary code points MUST appear as literal UTF-8`);
|
|
25738
|
+
unescaped += String.fromCodePoint(codeUnit);
|
|
25739
|
+
i += 6;
|
|
25740
|
+
continue;
|
|
25741
|
+
}
|
|
25742
|
+
throw new SyntaxError(`Invalid escape sequence: \\${next}`);
|
|
25743
|
+
}
|
|
25744
|
+
unescaped += value[i];
|
|
25745
|
+
i++;
|
|
25746
|
+
}
|
|
25747
|
+
return unescaped;
|
|
25748
|
+
}
|
|
25749
|
+
function findClosingQuote(content, start) {
|
|
25750
|
+
let i = start + 1;
|
|
25751
|
+
while (i < content.length) {
|
|
25752
|
+
if (content[i] === "\\" && i + 1 < content.length) {
|
|
25753
|
+
i += 2;
|
|
25754
|
+
continue;
|
|
25755
|
+
}
|
|
25756
|
+
if (content[i] === '"')
|
|
25757
|
+
return i;
|
|
25758
|
+
i++;
|
|
25759
|
+
}
|
|
25760
|
+
return -1;
|
|
25761
|
+
}
|
|
25762
|
+
function findUnquotedChar(content, char, start = 0) {
|
|
25763
|
+
let inQuotes = false;
|
|
25764
|
+
let i = start;
|
|
25765
|
+
while (i < content.length) {
|
|
25766
|
+
if (content[i] === "\\" && i + 1 < content.length && inQuotes) {
|
|
25767
|
+
i += 2;
|
|
25768
|
+
continue;
|
|
25769
|
+
}
|
|
25770
|
+
if (content[i] === '"') {
|
|
25771
|
+
inQuotes = !inQuotes;
|
|
25772
|
+
i++;
|
|
25773
|
+
continue;
|
|
25774
|
+
}
|
|
25775
|
+
if (content[i] === char && !inQuotes)
|
|
25776
|
+
return i;
|
|
25777
|
+
i++;
|
|
25778
|
+
}
|
|
25779
|
+
return -1;
|
|
25780
|
+
}
|
|
25781
|
+
var ToonDecodeError = class extends SyntaxError {
|
|
25782
|
+
constructor(message, context) {
|
|
25783
|
+
const prefix = context?.line !== undefined ? `Line ${context.line}: ` : "";
|
|
25784
|
+
super(prefix + message, context?.cause !== undefined ? { cause: context.cause } : undefined);
|
|
25785
|
+
this.name = "ToonDecodeError";
|
|
25786
|
+
this.line = context?.line;
|
|
25787
|
+
this.source = context?.source;
|
|
25788
|
+
}
|
|
25789
|
+
};
|
|
25790
|
+
function withLine(line, fn) {
|
|
25791
|
+
try {
|
|
25792
|
+
return fn();
|
|
25793
|
+
} catch (error) {
|
|
25794
|
+
if (error instanceof ToonDecodeError)
|
|
25795
|
+
throw error;
|
|
25796
|
+
if (error instanceof Error)
|
|
25797
|
+
throw new ToonDecodeError(error.message, {
|
|
25798
|
+
line: line.lineNumber,
|
|
25799
|
+
source: line.raw,
|
|
25800
|
+
cause: error
|
|
25801
|
+
});
|
|
25802
|
+
throw error;
|
|
25803
|
+
}
|
|
25804
|
+
}
|
|
25805
|
+
var LEADING_WHITESPACE_PATTERN = /^[ \t]*/;
|
|
25806
|
+
function createScanState() {
|
|
25807
|
+
return {
|
|
25808
|
+
lineNumber: 0,
|
|
25809
|
+
blankLines: []
|
|
25810
|
+
};
|
|
25811
|
+
}
|
|
25812
|
+
function parseLineIncremental(raw, state, indentSize, strict) {
|
|
25813
|
+
state.lineNumber++;
|
|
25814
|
+
const lineNumber = state.lineNumber;
|
|
25815
|
+
if (lineNumber === 1 && raw[0] === "\uFEFF")
|
|
25816
|
+
raw = raw.slice(1);
|
|
25817
|
+
if (raw[raw.length - 1] === "\r")
|
|
25818
|
+
raw = raw.slice(0, -1);
|
|
25819
|
+
const leadingWhitespace = LEADING_WHITESPACE_PATTERN.exec(raw)[0];
|
|
25820
|
+
const firstTabIndex = leadingWhitespace.indexOf("\t");
|
|
25821
|
+
const indent = strict && firstTabIndex !== -1 ? firstTabIndex : leadingWhitespace.length;
|
|
25822
|
+
const tabIndent = strict || firstTabIndex === -1 ? 0 : leadingWhitespace.split("\t").length - 1;
|
|
25823
|
+
const content = trimTrailingSpaces(raw.slice(indent));
|
|
25824
|
+
if (firstTabIndex === -1 && content[0] === "#")
|
|
25825
|
+
return;
|
|
25826
|
+
const depth = computeDepthFromIndent(indent - tabIndent, indentSize) + tabIndent;
|
|
25827
|
+
if (!content) {
|
|
25828
|
+
state.blankLines.push({
|
|
25829
|
+
lineNumber,
|
|
25830
|
+
indent,
|
|
25831
|
+
depth
|
|
25832
|
+
});
|
|
25833
|
+
return;
|
|
25834
|
+
}
|
|
25835
|
+
if (strict) {
|
|
25836
|
+
if (firstTabIndex !== -1)
|
|
25837
|
+
throw new ToonDecodeError("Tabs are not allowed in indentation in strict mode", {
|
|
25838
|
+
line: lineNumber,
|
|
25839
|
+
source: raw
|
|
25840
|
+
});
|
|
25841
|
+
if (indent > 0 && indent % indentSize !== 0)
|
|
25842
|
+
throw new ToonDecodeError(`Indentation must be exact multiple of ${indentSize}, but found ${indent} spaces`, {
|
|
25843
|
+
line: lineNumber,
|
|
25844
|
+
source: raw
|
|
25845
|
+
});
|
|
25846
|
+
}
|
|
25847
|
+
return {
|
|
25848
|
+
raw,
|
|
25849
|
+
indent,
|
|
25850
|
+
content,
|
|
25851
|
+
depth,
|
|
25852
|
+
lineNumber
|
|
25853
|
+
};
|
|
25854
|
+
}
|
|
25855
|
+
function computeDepthFromIndent(indentSpaces, indentSize) {
|
|
25856
|
+
return Math.floor(indentSpaces / indentSize);
|
|
25857
|
+
}
|
|
25858
|
+
function trimTrailingSpaces(value) {
|
|
25859
|
+
let end = value.length;
|
|
25860
|
+
while (end > 0 && value[end - 1] === " ")
|
|
25861
|
+
end--;
|
|
25862
|
+
return end === value.length ? value : value.slice(0, end);
|
|
25863
|
+
}
|
|
25686
25864
|
var FETCH_LINE = Symbol("fetch-line");
|
|
25865
|
+
function createLineReader(context) {
|
|
25866
|
+
return {
|
|
25867
|
+
buffer: [],
|
|
25868
|
+
done: false,
|
|
25869
|
+
lastLine: undefined,
|
|
25870
|
+
scanState: createScanState(),
|
|
25871
|
+
indentSize: context.indentSize,
|
|
25872
|
+
strict: context.strict
|
|
25873
|
+
};
|
|
25874
|
+
}
|
|
25875
|
+
function* fillBuffer(reader) {
|
|
25876
|
+
while (reader.buffer.length === 0 && !reader.done) {
|
|
25877
|
+
const raw = yield FETCH_LINE;
|
|
25878
|
+
if (raw === undefined) {
|
|
25879
|
+
reader.done = true;
|
|
25880
|
+
return;
|
|
25881
|
+
}
|
|
25882
|
+
const parsedLine = parseLineIncremental(raw, reader.scanState, reader.indentSize, reader.strict);
|
|
25883
|
+
if (parsedLine !== undefined)
|
|
25884
|
+
reader.buffer.push(parsedLine);
|
|
25885
|
+
}
|
|
25886
|
+
}
|
|
25887
|
+
function* peekLine(reader) {
|
|
25888
|
+
yield* fillBuffer(reader);
|
|
25889
|
+
return reader.buffer[0];
|
|
25890
|
+
}
|
|
25891
|
+
function* readLine2(reader) {
|
|
25892
|
+
yield* fillBuffer(reader);
|
|
25893
|
+
const line = reader.buffer[0];
|
|
25894
|
+
if (line !== undefined) {
|
|
25895
|
+
reader.buffer.shift();
|
|
25896
|
+
reader.lastLine = line;
|
|
25897
|
+
}
|
|
25898
|
+
return line;
|
|
25899
|
+
}
|
|
25900
|
+
function* driveSync(rawSource, rule) {
|
|
25901
|
+
const iterator = rawSource[Symbol.iterator]();
|
|
25902
|
+
let step = rule.next();
|
|
25903
|
+
while (!step.done)
|
|
25904
|
+
if (step.value === FETCH_LINE) {
|
|
25905
|
+
const result = iterator.next();
|
|
25906
|
+
step = rule.next(result.done ? undefined : result.value);
|
|
25907
|
+
} else {
|
|
25908
|
+
yield step.value;
|
|
25909
|
+
step = rule.next();
|
|
25910
|
+
}
|
|
25911
|
+
}
|
|
25912
|
+
var NUMERIC_LITERAL_PATTERN = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:e[+-]?\d+)?$/i;
|
|
25687
25913
|
function isBooleanOrNullLiteral(token) {
|
|
25688
25914
|
return token === "true" || token === "false" || token === "null";
|
|
25689
25915
|
}
|
|
25916
|
+
function isNumericLiteral(token) {
|
|
25917
|
+
if (!token)
|
|
25918
|
+
return false;
|
|
25919
|
+
if (!NUMERIC_LITERAL_PATTERN.test(token))
|
|
25920
|
+
return false;
|
|
25921
|
+
const numericValue = Number(token);
|
|
25922
|
+
return !Number.isNaN(numericValue) && Number.isFinite(numericValue);
|
|
25923
|
+
}
|
|
25924
|
+
function parseArrayHeaderLine(content, defaultDelimiter) {
|
|
25925
|
+
const trimmedToken = content.trimStart();
|
|
25926
|
+
let bracketStart = -1;
|
|
25927
|
+
if (trimmedToken.startsWith('"')) {
|
|
25928
|
+
const closingQuoteIndex = findClosingQuote(trimmedToken, 0);
|
|
25929
|
+
if (closingQuoteIndex === -1)
|
|
25930
|
+
return { kind: "notHeader" };
|
|
25931
|
+
if (!trimmedToken.slice(closingQuoteIndex + 1).startsWith("["))
|
|
25932
|
+
return { kind: "notHeader" };
|
|
25933
|
+
const keyEndIndex = content.length - trimmedToken.length + closingQuoteIndex + 1;
|
|
25934
|
+
bracketStart = content.indexOf("[", keyEndIndex);
|
|
25935
|
+
} else
|
|
25936
|
+
bracketStart = findUnquotedChar(content, "[");
|
|
25937
|
+
if (bracketStart === -1)
|
|
25938
|
+
return { kind: "notHeader" };
|
|
25939
|
+
const firstColonIndex = findUnquotedChar(content, ":");
|
|
25940
|
+
if (firstColonIndex !== -1 && firstColonIndex < bracketStart)
|
|
25941
|
+
return { kind: "notHeader" };
|
|
25942
|
+
const bracketEnd = findUnquotedChar(content, "]", bracketStart);
|
|
25943
|
+
if (bracketEnd === -1)
|
|
25944
|
+
return { kind: "notHeader" };
|
|
25945
|
+
let colonIndex = bracketEnd + 1;
|
|
25946
|
+
let braceEnd = colonIndex;
|
|
25947
|
+
const braceStart = findUnquotedChar(content, "{", bracketEnd);
|
|
25948
|
+
if (braceStart !== -1 && braceStart < findUnquotedChar(content, ":", bracketEnd)) {
|
|
25949
|
+
const gapBeforeBrace = content.slice(bracketEnd + 1, braceStart);
|
|
25950
|
+
if (gapBeforeBrace !== "") {
|
|
25951
|
+
const trimmedGap = gapBeforeBrace.trim();
|
|
25952
|
+
return {
|
|
25953
|
+
kind: "invalid",
|
|
25954
|
+
reason: trimmedGap === "" ? `Unexpected whitespace between bracket segment and field list` : `Unexpected content "${trimmedGap}" between bracket segment and field list`
|
|
25955
|
+
};
|
|
25956
|
+
}
|
|
25957
|
+
const foundBraceEnd = findMatchingBrace(content, braceStart);
|
|
25958
|
+
if (foundBraceEnd !== -1)
|
|
25959
|
+
braceEnd = foundBraceEnd + 1;
|
|
25960
|
+
}
|
|
25961
|
+
colonIndex = findUnquotedChar(content, ":", Math.max(bracketEnd, braceEnd));
|
|
25962
|
+
if (colonIndex === -1)
|
|
25963
|
+
return { kind: "notHeader" };
|
|
25964
|
+
const gapStart = Math.max(bracketEnd + 1, braceEnd);
|
|
25965
|
+
const gapBeforeColon = content.slice(gapStart, colonIndex);
|
|
25966
|
+
if (gapBeforeColon !== "") {
|
|
25967
|
+
const trimmedGap = gapBeforeColon.trim();
|
|
25968
|
+
return {
|
|
25969
|
+
kind: "invalid",
|
|
25970
|
+
reason: trimmedGap === "" ? `Unexpected whitespace between bracket segment and colon` : `Unexpected content "${trimmedGap}" between bracket segment and colon`
|
|
25971
|
+
};
|
|
25972
|
+
}
|
|
25973
|
+
let key;
|
|
25974
|
+
if (bracketStart > 0) {
|
|
25975
|
+
const rawKey = content.slice(0, bracketStart);
|
|
25976
|
+
if (rawKey !== rawKey.trimEnd())
|
|
25977
|
+
return {
|
|
25978
|
+
kind: "invalid",
|
|
25979
|
+
reason: "Unexpected whitespace between key and bracket segment"
|
|
25980
|
+
};
|
|
25981
|
+
key = rawKey.startsWith('"') ? parseStringLiteral(rawKey) : rawKey;
|
|
25982
|
+
}
|
|
25983
|
+
const afterColon = trimSpaces(content.slice(colonIndex + 1));
|
|
25984
|
+
const bracketContent = content.slice(bracketStart + 1, bracketEnd);
|
|
25985
|
+
let parsedBracket;
|
|
25986
|
+
try {
|
|
25987
|
+
parsedBracket = parseBracketSegment(bracketContent, defaultDelimiter);
|
|
25988
|
+
} catch (error) {
|
|
25989
|
+
return {
|
|
25990
|
+
kind: "invalid",
|
|
25991
|
+
reason: error.message
|
|
25992
|
+
};
|
|
25993
|
+
}
|
|
25994
|
+
const { length, delimiter, keyed } = parsedBracket;
|
|
25995
|
+
let fields;
|
|
25996
|
+
if (braceStart !== -1 && braceStart < colonIndex) {
|
|
25997
|
+
const foundBraceEnd = findMatchingBrace(content, braceStart);
|
|
25998
|
+
if (foundBraceEnd !== -1 && foundBraceEnd < colonIndex) {
|
|
25999
|
+
const fieldsContent = content.slice(braceStart + 1, foundBraceEnd);
|
|
26000
|
+
const mismatchedDelimiter = findUnquotedMismatchedDelimiter(fieldsContent, delimiter);
|
|
26001
|
+
if (mismatchedDelimiter !== undefined)
|
|
26002
|
+
return {
|
|
26003
|
+
kind: "invalid",
|
|
26004
|
+
reason: `Header delimiter mismatch: bracket declares "${formatDelimiter(delimiter)}" but field list contains unquoted "${formatDelimiter(mismatchedDelimiter)}"`
|
|
26005
|
+
};
|
|
26006
|
+
try {
|
|
26007
|
+
fields = parseFieldEntries(fieldsContent, delimiter);
|
|
26008
|
+
} catch (error) {
|
|
26009
|
+
return {
|
|
26010
|
+
kind: "invalid",
|
|
26011
|
+
reason: error.message
|
|
26012
|
+
};
|
|
26013
|
+
}
|
|
26014
|
+
}
|
|
26015
|
+
}
|
|
26016
|
+
const duplicateFieldName = fields ? findDuplicateFieldName(fields) : undefined;
|
|
26017
|
+
const duplicateReason = duplicateFieldName ? `Duplicate field name "${duplicateFieldName}" in field list` : undefined;
|
|
26018
|
+
if (keyed && !fields)
|
|
26019
|
+
return {
|
|
26020
|
+
kind: "invalid",
|
|
26021
|
+
reason: "Keyed header requires a field list"
|
|
26022
|
+
};
|
|
26023
|
+
if (fields && afterColon)
|
|
26024
|
+
return {
|
|
26025
|
+
kind: "invalid",
|
|
26026
|
+
reason: duplicateReason ?? "Unexpected content after fields-bearing header colon"
|
|
26027
|
+
};
|
|
26028
|
+
return {
|
|
26029
|
+
kind: "header",
|
|
26030
|
+
header: {
|
|
26031
|
+
key,
|
|
26032
|
+
length,
|
|
26033
|
+
delimiter,
|
|
26034
|
+
fields,
|
|
26035
|
+
keyed
|
|
26036
|
+
},
|
|
26037
|
+
inlineValues: afterColon || undefined,
|
|
26038
|
+
strictError: duplicateReason
|
|
26039
|
+
};
|
|
26040
|
+
}
|
|
26041
|
+
var BRACKET_LENGTH_PATTERN = /^(?:0|[1-9]\d*)$/;
|
|
26042
|
+
function parseBracketSegment(seg, defaultDelimiter) {
|
|
26043
|
+
let content = seg;
|
|
26044
|
+
let delimiter = defaultDelimiter;
|
|
26045
|
+
if (content.endsWith("\t")) {
|
|
26046
|
+
delimiter = DELIMITERS.tab;
|
|
26047
|
+
content = content.slice(0, -1);
|
|
26048
|
+
} else if (content.endsWith("|")) {
|
|
26049
|
+
delimiter = DELIMITERS.pipe;
|
|
26050
|
+
content = content.slice(0, -1);
|
|
26051
|
+
}
|
|
26052
|
+
let keyed = false;
|
|
26053
|
+
if (content.endsWith(":")) {
|
|
26054
|
+
keyed = true;
|
|
26055
|
+
content = content.slice(0, -1);
|
|
26056
|
+
}
|
|
26057
|
+
if (!BRACKET_LENGTH_PATTERN.test(content))
|
|
26058
|
+
throw new SyntaxError(`Invalid array length: "${seg}" (expected non-negative integer with no leading zeros)`);
|
|
26059
|
+
return {
|
|
26060
|
+
length: Number.parseInt(content, 10),
|
|
26061
|
+
delimiter,
|
|
26062
|
+
keyed
|
|
26063
|
+
};
|
|
26064
|
+
}
|
|
26065
|
+
function parseFieldEntries(fieldsContent, delimiter) {
|
|
26066
|
+
return splitFieldEntries(fieldsContent, delimiter).map((entry) => {
|
|
26067
|
+
const trimmedEntry = trimSpaces(entry);
|
|
26068
|
+
if (!trimmedEntry)
|
|
26069
|
+
throw new SyntaxError("Empty field name in field list");
|
|
26070
|
+
const groupStart = findUnquotedChar(trimmedEntry, "{");
|
|
26071
|
+
if (groupStart === -1)
|
|
26072
|
+
return { name: parseStringLiteral(trimmedEntry) };
|
|
26073
|
+
const namePart = trimSpaces(trimmedEntry.slice(0, groupStart));
|
|
26074
|
+
if (!namePart)
|
|
26075
|
+
throw new SyntaxError("Missing field name before nested field group");
|
|
26076
|
+
const groupEnd = findMatchingBrace(trimmedEntry, groupStart);
|
|
26077
|
+
if (groupEnd === -1)
|
|
26078
|
+
throw new SyntaxError("Unmatched brace in field list");
|
|
26079
|
+
if (groupEnd !== trimmedEntry.length - 1)
|
|
26080
|
+
throw new SyntaxError("Unexpected content after nested field group");
|
|
26081
|
+
const children = parseFieldEntries(trimmedEntry.slice(groupStart + 1, groupEnd), delimiter);
|
|
26082
|
+
return {
|
|
26083
|
+
name: parseStringLiteral(namePart),
|
|
26084
|
+
children
|
|
26085
|
+
};
|
|
26086
|
+
});
|
|
26087
|
+
}
|
|
26088
|
+
function splitFieldEntries(content, delimiter) {
|
|
26089
|
+
const entries = [];
|
|
26090
|
+
let entryBuffer = "";
|
|
26091
|
+
let inQuotes = false;
|
|
26092
|
+
let braceDepth = 0;
|
|
26093
|
+
let i = 0;
|
|
26094
|
+
while (i < content.length) {
|
|
26095
|
+
const char = content[i];
|
|
26096
|
+
if (char === "\\" && i + 1 < content.length && inQuotes) {
|
|
26097
|
+
entryBuffer += char + content[i + 1];
|
|
26098
|
+
i += 2;
|
|
26099
|
+
continue;
|
|
26100
|
+
}
|
|
26101
|
+
if (char === '"') {
|
|
26102
|
+
inQuotes = !inQuotes;
|
|
26103
|
+
entryBuffer += char;
|
|
26104
|
+
i++;
|
|
26105
|
+
continue;
|
|
26106
|
+
}
|
|
26107
|
+
if (!inQuotes) {
|
|
26108
|
+
if (char === "{")
|
|
26109
|
+
braceDepth++;
|
|
26110
|
+
else if (char === "}")
|
|
26111
|
+
braceDepth--;
|
|
26112
|
+
else if (char === delimiter && braceDepth === 0) {
|
|
26113
|
+
entries.push(entryBuffer);
|
|
26114
|
+
entryBuffer = "";
|
|
26115
|
+
i++;
|
|
26116
|
+
continue;
|
|
26117
|
+
}
|
|
26118
|
+
}
|
|
26119
|
+
entryBuffer += char;
|
|
26120
|
+
i++;
|
|
26121
|
+
}
|
|
26122
|
+
entries.push(entryBuffer);
|
|
26123
|
+
return entries;
|
|
26124
|
+
}
|
|
26125
|
+
function findMatchingBrace(content, braceStart) {
|
|
26126
|
+
let inQuotes = false;
|
|
26127
|
+
let braceDepth = 0;
|
|
26128
|
+
let i = braceStart;
|
|
26129
|
+
while (i < content.length) {
|
|
26130
|
+
const char = content[i];
|
|
26131
|
+
if (char === "\\" && i + 1 < content.length && inQuotes) {
|
|
26132
|
+
i += 2;
|
|
26133
|
+
continue;
|
|
26134
|
+
}
|
|
26135
|
+
if (char === '"') {
|
|
26136
|
+
inQuotes = !inQuotes;
|
|
26137
|
+
i++;
|
|
26138
|
+
continue;
|
|
26139
|
+
}
|
|
26140
|
+
if (!inQuotes) {
|
|
26141
|
+
if (char === "{")
|
|
26142
|
+
braceDepth++;
|
|
26143
|
+
else if (char === "}") {
|
|
26144
|
+
braceDepth--;
|
|
26145
|
+
if (braceDepth === 0)
|
|
26146
|
+
return i;
|
|
26147
|
+
}
|
|
26148
|
+
}
|
|
26149
|
+
i++;
|
|
26150
|
+
}
|
|
26151
|
+
return -1;
|
|
26152
|
+
}
|
|
26153
|
+
function findDuplicateFieldName(fields) {
|
|
26154
|
+
const seenNames = /* @__PURE__ */ new Set;
|
|
26155
|
+
for (const field of fields) {
|
|
26156
|
+
if (seenNames.has(field.name))
|
|
26157
|
+
return field.name;
|
|
26158
|
+
seenNames.add(field.name);
|
|
26159
|
+
if (field.children) {
|
|
26160
|
+
const nestedDuplicate = findDuplicateFieldName(field.children);
|
|
26161
|
+
if (nestedDuplicate !== undefined)
|
|
26162
|
+
return nestedDuplicate;
|
|
26163
|
+
}
|
|
26164
|
+
}
|
|
26165
|
+
}
|
|
26166
|
+
function countLeafFields(fields) {
|
|
26167
|
+
let leafCount = 0;
|
|
26168
|
+
for (const field of fields)
|
|
26169
|
+
leafCount += field.children ? countLeafFields(field.children) : 1;
|
|
26170
|
+
return leafCount;
|
|
26171
|
+
}
|
|
26172
|
+
var DELIMITER_CANDIDATES = [
|
|
26173
|
+
",",
|
|
26174
|
+
"\t",
|
|
26175
|
+
"|"
|
|
26176
|
+
];
|
|
26177
|
+
function findUnquotedMismatchedDelimiter(content, activeDelimiter) {
|
|
26178
|
+
for (const candidate of DELIMITER_CANDIDATES) {
|
|
26179
|
+
if (candidate === activeDelimiter)
|
|
26180
|
+
continue;
|
|
26181
|
+
if (findUnquotedChar(content, candidate) !== -1)
|
|
26182
|
+
return candidate;
|
|
26183
|
+
}
|
|
26184
|
+
}
|
|
26185
|
+
function formatDelimiter(delimiter) {
|
|
26186
|
+
if (delimiter === "\t")
|
|
26187
|
+
return "\\t";
|
|
26188
|
+
return delimiter;
|
|
26189
|
+
}
|
|
26190
|
+
function parseDelimitedValues(input, delimiter) {
|
|
26191
|
+
const values = [];
|
|
26192
|
+
let valueBuffer = "";
|
|
26193
|
+
let inQuotes = false;
|
|
26194
|
+
let i = 0;
|
|
26195
|
+
while (i < input.length) {
|
|
26196
|
+
const char = input[i];
|
|
26197
|
+
if (char === "\\" && i + 1 < input.length && inQuotes) {
|
|
26198
|
+
valueBuffer += char + input[i + 1];
|
|
26199
|
+
i += 2;
|
|
26200
|
+
continue;
|
|
26201
|
+
}
|
|
26202
|
+
if (char === '"') {
|
|
26203
|
+
inQuotes = !inQuotes;
|
|
26204
|
+
valueBuffer += char;
|
|
26205
|
+
i++;
|
|
26206
|
+
continue;
|
|
26207
|
+
}
|
|
26208
|
+
if (char === delimiter && !inQuotes) {
|
|
26209
|
+
values.push(trimSpaces(valueBuffer));
|
|
26210
|
+
valueBuffer = "";
|
|
26211
|
+
i++;
|
|
26212
|
+
continue;
|
|
26213
|
+
}
|
|
26214
|
+
valueBuffer += char;
|
|
26215
|
+
i++;
|
|
26216
|
+
}
|
|
26217
|
+
if (valueBuffer || values.length > 0)
|
|
26218
|
+
values.push(trimSpaces(valueBuffer));
|
|
26219
|
+
return values;
|
|
26220
|
+
}
|
|
26221
|
+
function mapRowValuesToPrimitives(values) {
|
|
26222
|
+
return values.map((v) => parsePrimitiveToken(v));
|
|
26223
|
+
}
|
|
26224
|
+
function parsePrimitiveToken(token) {
|
|
26225
|
+
const trimmedToken = trimSpaces(token);
|
|
26226
|
+
if (!trimmedToken)
|
|
26227
|
+
return "";
|
|
26228
|
+
if (trimmedToken.startsWith('"'))
|
|
26229
|
+
return parseStringLiteral(trimmedToken);
|
|
26230
|
+
if (isBooleanOrNullLiteral(trimmedToken)) {
|
|
26231
|
+
if (trimmedToken === "true")
|
|
26232
|
+
return true;
|
|
26233
|
+
if (trimmedToken === "false")
|
|
26234
|
+
return false;
|
|
26235
|
+
if (trimmedToken === "null")
|
|
26236
|
+
return null;
|
|
26237
|
+
}
|
|
26238
|
+
if (isNumericLiteral(trimmedToken)) {
|
|
26239
|
+
const parsedNumber = Number.parseFloat(trimmedToken);
|
|
26240
|
+
return Object.is(parsedNumber, -0) ? 0 : parsedNumber;
|
|
26241
|
+
}
|
|
26242
|
+
return trimmedToken;
|
|
26243
|
+
}
|
|
26244
|
+
function parseStringLiteral(token) {
|
|
26245
|
+
const trimmedToken = trimSpaces(token);
|
|
26246
|
+
if (trimmedToken.startsWith('"')) {
|
|
26247
|
+
const closingQuoteIndex = findClosingQuote(trimmedToken, 0);
|
|
26248
|
+
if (closingQuoteIndex === -1)
|
|
26249
|
+
throw new SyntaxError("Unterminated string: missing closing quote");
|
|
26250
|
+
if (closingQuoteIndex !== trimmedToken.length - 1)
|
|
26251
|
+
throw new SyntaxError("Unexpected characters after closing quote");
|
|
26252
|
+
return unescapeString(trimmedToken.slice(1, closingQuoteIndex));
|
|
26253
|
+
}
|
|
26254
|
+
return trimmedToken;
|
|
26255
|
+
}
|
|
26256
|
+
function parseUnquotedKey(content, start) {
|
|
26257
|
+
const colonIndex = findUnquotedChar(content, ":", start);
|
|
26258
|
+
if (colonIndex === -1)
|
|
26259
|
+
throw new SyntaxError("Missing colon after key");
|
|
26260
|
+
return {
|
|
26261
|
+
key: trimSpaces(content.slice(start, colonIndex)),
|
|
26262
|
+
end: colonIndex + 1
|
|
26263
|
+
};
|
|
26264
|
+
}
|
|
26265
|
+
function parseQuotedKey(content, start) {
|
|
26266
|
+
const closingQuoteIndex = findClosingQuote(content, start);
|
|
26267
|
+
if (closingQuoteIndex === -1)
|
|
26268
|
+
throw new SyntaxError("Unterminated quoted key");
|
|
26269
|
+
const key = unescapeString(content.slice(start + 1, closingQuoteIndex));
|
|
26270
|
+
let parsePosition = closingQuoteIndex + 1;
|
|
26271
|
+
if (parsePosition >= content.length || content[parsePosition] !== ":")
|
|
26272
|
+
throw new SyntaxError("Missing colon after key");
|
|
26273
|
+
parsePosition++;
|
|
26274
|
+
return {
|
|
26275
|
+
key,
|
|
26276
|
+
end: parsePosition
|
|
26277
|
+
};
|
|
26278
|
+
}
|
|
26279
|
+
function parseKeyToken(content, start) {
|
|
26280
|
+
return content[start] === '"' ? parseQuotedKey(content, start) : parseUnquotedKey(content, start);
|
|
26281
|
+
}
|
|
26282
|
+
function isArrayHeaderContent(content) {
|
|
26283
|
+
return content.trim().startsWith("[") && findUnquotedChar(content, ":") !== -1;
|
|
26284
|
+
}
|
|
26285
|
+
function isKeyValueContent(content) {
|
|
26286
|
+
return findUnquotedChar(content, ":") !== -1;
|
|
26287
|
+
}
|
|
26288
|
+
function assertExpectedCount(actual, expected, itemType, options, line) {
|
|
26289
|
+
if (options.strict && actual !== expected)
|
|
26290
|
+
throw new ToonDecodeError(`Expected ${expected} ${itemType}, but got ${actual}`, {
|
|
26291
|
+
line: line.lineNumber,
|
|
26292
|
+
source: line.raw
|
|
26293
|
+
});
|
|
26294
|
+
}
|
|
26295
|
+
function validateNoExtraListItems(nextLine, itemDepth, expectedCount) {
|
|
26296
|
+
if (nextLine?.depth === itemDepth && nextLine.content.startsWith("- "))
|
|
26297
|
+
throw new ToonDecodeError(`Expected ${expectedCount} list-form items, but found more`, {
|
|
26298
|
+
line: nextLine.lineNumber,
|
|
26299
|
+
source: nextLine.raw
|
|
26300
|
+
});
|
|
26301
|
+
}
|
|
26302
|
+
function validateNoExtraTabularRows(nextLine, rowDepth, header) {
|
|
26303
|
+
if (nextLine?.depth === rowDepth && !nextLine.content.startsWith("- ") && isDataRow(nextLine.content, header.delimiter))
|
|
26304
|
+
throw new ToonDecodeError(`Expected ${header.length} tabular rows, but found more`, {
|
|
26305
|
+
line: nextLine.lineNumber,
|
|
26306
|
+
source: nextLine.raw
|
|
26307
|
+
});
|
|
26308
|
+
}
|
|
26309
|
+
function validateNoBlankLinesInRange(startLine, endLine, blankLines, strict, context) {
|
|
26310
|
+
if (!strict)
|
|
26311
|
+
return;
|
|
26312
|
+
const firstBlank = blankLines.find((blank) => blank.lineNumber > startLine && blank.lineNumber < endLine);
|
|
26313
|
+
if (firstBlank)
|
|
26314
|
+
throw new ToonDecodeError(`Blank lines inside ${context} are not allowed in strict mode`, { line: firstBlank.lineNumber });
|
|
26315
|
+
}
|
|
26316
|
+
function isDataRow(content, delimiter) {
|
|
26317
|
+
const colonPos = findUnquotedChar(content, ":");
|
|
26318
|
+
const delimiterPos = findUnquotedChar(content, delimiter);
|
|
26319
|
+
if (colonPos === -1)
|
|
26320
|
+
return true;
|
|
26321
|
+
if (delimiterPos !== -1 && delimiterPos < colonPos)
|
|
26322
|
+
return true;
|
|
26323
|
+
return false;
|
|
26324
|
+
}
|
|
26325
|
+
function resolveContext(options) {
|
|
26326
|
+
return {
|
|
26327
|
+
indentSize: options?.indentSize ?? options?.indent ?? 2,
|
|
26328
|
+
strict: options?.strict ?? true
|
|
26329
|
+
};
|
|
26330
|
+
}
|
|
26331
|
+
function decodeStreamSync$1(source, options) {
|
|
26332
|
+
const resolvedOptions = resolveContext(options);
|
|
26333
|
+
return driveSync(source, decodeDocument(createLineReader(resolvedOptions), resolvedOptions));
|
|
26334
|
+
}
|
|
26335
|
+
function* decodeDocument(reader, options) {
|
|
26336
|
+
const first = yield* peekLine(reader);
|
|
26337
|
+
if (!first) {
|
|
26338
|
+
yield { type: "startObject" };
|
|
26339
|
+
yield { type: "endObject" };
|
|
26340
|
+
return;
|
|
26341
|
+
}
|
|
26342
|
+
if (trimSpaces(first.content) === "[]") {
|
|
26343
|
+
yield* readLine2(reader);
|
|
26344
|
+
yield {
|
|
26345
|
+
type: "startArray",
|
|
26346
|
+
length: 0
|
|
26347
|
+
};
|
|
26348
|
+
yield { type: "endArray" };
|
|
26349
|
+
yield* assertFullyConsumed(reader, options.strict);
|
|
26350
|
+
return;
|
|
26351
|
+
}
|
|
26352
|
+
if (isArrayHeaderContent(first.content)) {
|
|
26353
|
+
const headerInfo = withLine(first, () => resolveArrayHeader(parseArrayHeaderLine(first.content, DEFAULT_DELIMITER), options.strict));
|
|
26354
|
+
if (headerInfo) {
|
|
26355
|
+
yield* readLine2(reader);
|
|
26356
|
+
yield* decodeArrayFromHeader(headerInfo.header, headerInfo.inlineValues, reader, 0, options, first);
|
|
26357
|
+
yield* assertFullyConsumed(reader, options.strict);
|
|
26358
|
+
return;
|
|
26359
|
+
}
|
|
26360
|
+
}
|
|
26361
|
+
yield* readLine2(reader);
|
|
26362
|
+
const following = yield* peekLine(reader);
|
|
26363
|
+
if (!(following !== undefined) && !isKeyValueLine(first)) {
|
|
26364
|
+
yield {
|
|
26365
|
+
type: "primitive",
|
|
26366
|
+
value: withLine(first, () => parsePrimitiveToken(first.content))
|
|
26367
|
+
};
|
|
26368
|
+
return;
|
|
26369
|
+
}
|
|
26370
|
+
if (!isKeyValueLine(first) && following?.depth === 0)
|
|
26371
|
+
throw new ToonDecodeError("Top-level document must start with a key-value or array-header line", {
|
|
26372
|
+
line: first.lineNumber,
|
|
26373
|
+
source: first.raw
|
|
26374
|
+
});
|
|
26375
|
+
const rootSeenKeys = options.strict ? /* @__PURE__ */ new Set : undefined;
|
|
26376
|
+
yield { type: "startObject" };
|
|
26377
|
+
yield* decodeKeyValue(first, reader, 0, options, rootSeenKeys);
|
|
26378
|
+
while (true) {
|
|
26379
|
+
const line = yield* peekLine(reader);
|
|
26380
|
+
if (!line)
|
|
26381
|
+
break;
|
|
26382
|
+
if (line.depth !== 0) {
|
|
26383
|
+
if (options.strict)
|
|
26384
|
+
throw overIndentedLineError(line, 0);
|
|
26385
|
+
assertNotScalarLine(line);
|
|
26386
|
+
yield* readLine2(reader);
|
|
26387
|
+
continue;
|
|
26388
|
+
}
|
|
26389
|
+
yield* readLine2(reader);
|
|
26390
|
+
yield* decodeKeyValue(line, reader, 0, options, rootSeenKeys);
|
|
26391
|
+
}
|
|
26392
|
+
yield { type: "endObject" };
|
|
26393
|
+
}
|
|
26394
|
+
function assertNoDepthJump(firstNestedLine, parentDepth, strict) {
|
|
26395
|
+
if (strict && firstNestedLine.depth > parentDepth + 1)
|
|
26396
|
+
throw new ToonDecodeError(`Indentation depth jump: expected depth ${parentDepth + 1}, but found ${firstNestedLine.depth}`, {
|
|
26397
|
+
line: firstNestedLine.lineNumber,
|
|
26398
|
+
source: firstNestedLine.raw
|
|
26399
|
+
});
|
|
26400
|
+
}
|
|
26401
|
+
function overIndentedLineError(line, expectedDepth) {
|
|
26402
|
+
return new ToonDecodeError(`Over-indented line: expected depth ${expectedDepth}, but found ${line.depth}`, {
|
|
26403
|
+
line: line.lineNumber,
|
|
26404
|
+
source: line.raw
|
|
26405
|
+
});
|
|
26406
|
+
}
|
|
26407
|
+
function assertNotScalarLine(line) {
|
|
26408
|
+
if (line.content.startsWith("- ") || line.content === "-" || findUnquotedChar(line.content, ":") !== -1)
|
|
26409
|
+
return;
|
|
26410
|
+
throw new ToonDecodeError("Unexpected bare token line outside root primitive position", {
|
|
26411
|
+
line: line.lineNumber,
|
|
26412
|
+
source: line.raw
|
|
26413
|
+
});
|
|
26414
|
+
}
|
|
26415
|
+
function keylessKeyedError(line) {
|
|
26416
|
+
return new ToonDecodeError("Keyless keyed header is only valid at the document root", {
|
|
26417
|
+
line: line.lineNumber,
|
|
26418
|
+
source: line.raw
|
|
26419
|
+
});
|
|
26420
|
+
}
|
|
26421
|
+
function keylessHeaderError(line) {
|
|
26422
|
+
return new ToonDecodeError("Keyless array header is only valid at the document root or as a list item", {
|
|
26423
|
+
line: line.lineNumber,
|
|
26424
|
+
source: line.raw
|
|
26425
|
+
});
|
|
26426
|
+
}
|
|
26427
|
+
function keylessFieldsHeaderError(line) {
|
|
26428
|
+
return new ToonDecodeError("Keyless header with a field list is only valid at the document root", {
|
|
26429
|
+
line: line.lineNumber,
|
|
26430
|
+
source: line.raw
|
|
26431
|
+
});
|
|
26432
|
+
}
|
|
26433
|
+
function* assertFullyConsumed(reader, strict) {
|
|
26434
|
+
if (!strict)
|
|
26435
|
+
return;
|
|
26436
|
+
const line = yield* peekLine(reader);
|
|
26437
|
+
if (line)
|
|
26438
|
+
throw new ToonDecodeError("Unexpected content after the document root", {
|
|
26439
|
+
line: line.lineNumber,
|
|
26440
|
+
source: line.raw
|
|
26441
|
+
});
|
|
26442
|
+
}
|
|
26443
|
+
function assertNoDuplicateKey(key, line, seenKeys) {
|
|
26444
|
+
if (!seenKeys)
|
|
26445
|
+
return;
|
|
26446
|
+
if (seenKeys.has(key))
|
|
26447
|
+
throw new ToonDecodeError(`Duplicate sibling key "${key}"`, {
|
|
26448
|
+
line: line.lineNumber,
|
|
26449
|
+
source: line.raw
|
|
26450
|
+
});
|
|
26451
|
+
seenKeys.add(key);
|
|
26452
|
+
}
|
|
26453
|
+
function* decodeKeyValue(line, reader, baseDepth, options, seenKeys) {
|
|
26454
|
+
const content = line.content;
|
|
26455
|
+
const arrayHeader = withLine(line, () => resolveArrayHeader(parseArrayHeaderLine(content, DEFAULT_DELIMITER), options.strict));
|
|
26456
|
+
if (arrayHeader && arrayHeader.header.key !== undefined) {
|
|
26457
|
+
assertNoDuplicateKey(arrayHeader.header.key, line, seenKeys);
|
|
26458
|
+
yield {
|
|
26459
|
+
type: "key",
|
|
26460
|
+
key: arrayHeader.header.key
|
|
26461
|
+
};
|
|
26462
|
+
yield* decodeArrayFromHeader(arrayHeader.header, arrayHeader.inlineValues, reader, baseDepth, options, line);
|
|
26463
|
+
return;
|
|
26464
|
+
}
|
|
26465
|
+
if (arrayHeader && arrayHeader.header.key === undefined && options.strict)
|
|
26466
|
+
throw arrayHeader.header.keyed ? keylessKeyedError(line) : keylessHeaderError(line);
|
|
26467
|
+
const { key, end } = withLine(line, () => parseKeyToken(content, 0));
|
|
26468
|
+
const rest = trimSpaces(content.slice(end));
|
|
26469
|
+
assertNoDuplicateKey(key, line, seenKeys);
|
|
26470
|
+
yield {
|
|
26471
|
+
type: "key",
|
|
26472
|
+
key
|
|
26473
|
+
};
|
|
26474
|
+
if (!rest) {
|
|
26475
|
+
const nextLine = yield* peekLine(reader);
|
|
26476
|
+
if (nextLine && nextLine.depth > baseDepth) {
|
|
26477
|
+
assertNoDepthJump(nextLine, baseDepth, options.strict);
|
|
26478
|
+
yield { type: "startObject" };
|
|
26479
|
+
yield* decodeObjectFields(reader, baseDepth + 1, options);
|
|
26480
|
+
yield { type: "endObject" };
|
|
26481
|
+
return;
|
|
26482
|
+
}
|
|
26483
|
+
yield { type: "startObject" };
|
|
26484
|
+
yield { type: "endObject" };
|
|
26485
|
+
return;
|
|
26486
|
+
}
|
|
26487
|
+
if (rest === "[]") {
|
|
26488
|
+
yield {
|
|
26489
|
+
type: "startArray",
|
|
26490
|
+
length: 0
|
|
26491
|
+
};
|
|
26492
|
+
yield { type: "endArray" };
|
|
26493
|
+
return;
|
|
26494
|
+
}
|
|
26495
|
+
yield {
|
|
26496
|
+
type: "primitive",
|
|
26497
|
+
value: withLine(line, () => parsePrimitiveToken(rest))
|
|
26498
|
+
};
|
|
26499
|
+
}
|
|
26500
|
+
function* decodeObjectFields(reader, baseDepth, options) {
|
|
26501
|
+
let computedDepth;
|
|
26502
|
+
const seenKeys = options.strict ? /* @__PURE__ */ new Set : undefined;
|
|
26503
|
+
while (true) {
|
|
26504
|
+
const line = yield* peekLine(reader);
|
|
26505
|
+
if (!line || line.depth < baseDepth)
|
|
26506
|
+
break;
|
|
26507
|
+
if (computedDepth === undefined && line.depth >= baseDepth)
|
|
26508
|
+
computedDepth = line.depth;
|
|
26509
|
+
if (line.depth === computedDepth) {
|
|
26510
|
+
yield* readLine2(reader);
|
|
26511
|
+
yield* decodeKeyValue(line, reader, computedDepth, options, seenKeys);
|
|
26512
|
+
} else if (computedDepth !== undefined && line.depth > computedDepth) {
|
|
26513
|
+
if (options.strict)
|
|
26514
|
+
throw overIndentedLineError(line, computedDepth);
|
|
26515
|
+
assertNotScalarLine(line);
|
|
26516
|
+
yield* readLine2(reader);
|
|
26517
|
+
} else
|
|
26518
|
+
break;
|
|
26519
|
+
}
|
|
26520
|
+
}
|
|
26521
|
+
function* decodeArrayFromHeader(header, inlineValues, reader, baseDepth, options, headerLine) {
|
|
26522
|
+
if (header.keyed) {
|
|
26523
|
+
yield* decodeKeyedObject(header, reader, baseDepth, options, headerLine);
|
|
26524
|
+
return;
|
|
26525
|
+
}
|
|
26526
|
+
yield {
|
|
26527
|
+
type: "startArray",
|
|
26528
|
+
length: header.length
|
|
26529
|
+
};
|
|
26530
|
+
if (inlineValues) {
|
|
26531
|
+
yield* decodeInlinePrimitiveArray(header, inlineValues, options, headerLine);
|
|
26532
|
+
yield { type: "endArray" };
|
|
26533
|
+
return;
|
|
26534
|
+
}
|
|
26535
|
+
if (header.fields && header.fields.length > 0) {
|
|
26536
|
+
yield* decodeTabularArray(header, reader, baseDepth, options, headerLine);
|
|
26537
|
+
yield { type: "endArray" };
|
|
26538
|
+
return;
|
|
26539
|
+
}
|
|
26540
|
+
yield* decodeListArray(header, reader, baseDepth, options, headerLine);
|
|
26541
|
+
yield { type: "endArray" };
|
|
26542
|
+
}
|
|
26543
|
+
function* decodeInlinePrimitiveArray(header, inlineValues, options, headerLine) {
|
|
26544
|
+
if (!trimSpaces(inlineValues)) {
|
|
26545
|
+
assertExpectedCount(0, header.length, "inline-form values", options, headerLine);
|
|
26546
|
+
return;
|
|
26547
|
+
}
|
|
26548
|
+
const values = withLine(headerLine, () => parseDelimitedValues(inlineValues, header.delimiter));
|
|
26549
|
+
const primitives = withLine(headerLine, () => mapRowValuesToPrimitives(values));
|
|
26550
|
+
assertExpectedCount(primitives.length, header.length, "inline-form values", options, headerLine);
|
|
26551
|
+
for (const primitive of primitives)
|
|
26552
|
+
yield {
|
|
26553
|
+
type: "primitive",
|
|
26554
|
+
value: primitive
|
|
26555
|
+
};
|
|
26556
|
+
}
|
|
26557
|
+
function* decodeKeyedObject(header, reader, baseDepth, options, headerLine) {
|
|
26558
|
+
const entryDepth = baseDepth + 1;
|
|
26559
|
+
const leafFieldCount = countLeafFields(header.fields);
|
|
26560
|
+
const seenEntryKeys = options.strict ? /* @__PURE__ */ new Set : undefined;
|
|
26561
|
+
let entryCount = 0;
|
|
26562
|
+
let startLine;
|
|
26563
|
+
let endLine;
|
|
26564
|
+
let lastEntryLine = headerLine;
|
|
26565
|
+
yield { type: "startObject" };
|
|
26566
|
+
while (true) {
|
|
26567
|
+
const line = yield* peekLine(reader);
|
|
26568
|
+
if (!line || line.depth <= baseDepth)
|
|
26569
|
+
break;
|
|
26570
|
+
if (line.depth > entryDepth) {
|
|
26571
|
+
if (options.strict)
|
|
26572
|
+
throw new ToonDecodeError("Unexpected indentation inside keyed tabular object", {
|
|
26573
|
+
line: line.lineNumber,
|
|
26574
|
+
source: line.raw
|
|
26575
|
+
});
|
|
26576
|
+
yield* readLine2(reader);
|
|
26577
|
+
continue;
|
|
26578
|
+
}
|
|
26579
|
+
if (findUnquotedChar(line.content, ":") === -1) {
|
|
26580
|
+
if (options.strict)
|
|
26581
|
+
throw new ToonDecodeError("Expected entry row inside keyed tabular object", {
|
|
26582
|
+
line: line.lineNumber,
|
|
26583
|
+
source: line.raw
|
|
26584
|
+
});
|
|
26585
|
+
yield* readLine2(reader);
|
|
26586
|
+
continue;
|
|
26587
|
+
}
|
|
26588
|
+
yield* readLine2(reader);
|
|
26589
|
+
if (startLine === undefined)
|
|
26590
|
+
startLine = line.lineNumber;
|
|
26591
|
+
endLine = line.lineNumber;
|
|
26592
|
+
lastEntryLine = line;
|
|
26593
|
+
const { key, end } = withLine(line, () => parseKeyToken(line.content, 0));
|
|
26594
|
+
assertNoDuplicateKey(key, line, seenEntryKeys);
|
|
26595
|
+
yield {
|
|
26596
|
+
type: "key",
|
|
26597
|
+
key
|
|
26598
|
+
};
|
|
26599
|
+
const cellsContent = trimSpaces(line.content.slice(end));
|
|
26600
|
+
const values = cellsContent === "" ? [] : withLine(line, () => parseDelimitedValues(cellsContent, header.delimiter));
|
|
26601
|
+
assertExpectedCount(values.length, leafFieldCount, "keyed entry cells", options, line);
|
|
26602
|
+
const primitives = withLine(line, () => mapRowValuesToPrimitives(values));
|
|
26603
|
+
yield* yieldObjectFromFields(header.fields, primitives);
|
|
26604
|
+
entryCount++;
|
|
26605
|
+
}
|
|
26606
|
+
assertExpectedCount(entryCount, header.length, "keyed entries", options, lastEntryLine);
|
|
26607
|
+
if (options.strict && startLine !== undefined && endLine !== undefined)
|
|
26608
|
+
validateNoBlankLinesInRange(startLine, endLine, reader.scanState.blankLines, options.strict, "keyed tabular object");
|
|
26609
|
+
yield { type: "endObject" };
|
|
26610
|
+
}
|
|
26611
|
+
function* decodeTabularArray(header, reader, baseDepth, options, headerLine) {
|
|
26612
|
+
const rowDepth = baseDepth + 1;
|
|
26613
|
+
let rowCount = 0;
|
|
26614
|
+
let startLine;
|
|
26615
|
+
let endLine;
|
|
26616
|
+
let lastRowLine = headerLine;
|
|
26617
|
+
while (!options.strict || rowCount < header.length) {
|
|
26618
|
+
const line = yield* peekLine(reader);
|
|
26619
|
+
if (!line || line.depth < rowDepth)
|
|
26620
|
+
break;
|
|
26621
|
+
if (line.depth === rowDepth) {
|
|
26622
|
+
if (!isDataRow(line.content, header.delimiter))
|
|
26623
|
+
break;
|
|
26624
|
+
if (startLine === undefined)
|
|
26625
|
+
startLine = line.lineNumber;
|
|
26626
|
+
endLine = line.lineNumber;
|
|
26627
|
+
lastRowLine = line;
|
|
26628
|
+
yield* readLine2(reader);
|
|
26629
|
+
const values = withLine(line, () => parseDelimitedValues(line.content, header.delimiter));
|
|
26630
|
+
assertExpectedCount(values.length, countLeafFields(header.fields), "tabular row values", options, line);
|
|
26631
|
+
const primitives = withLine(line, () => mapRowValuesToPrimitives(values));
|
|
26632
|
+
yield* yieldObjectFromFields(header.fields, primitives);
|
|
26633
|
+
rowCount++;
|
|
26634
|
+
} else
|
|
26635
|
+
break;
|
|
26636
|
+
}
|
|
26637
|
+
assertExpectedCount(rowCount, header.length, "tabular rows", options, lastRowLine);
|
|
26638
|
+
if (options.strict && startLine !== undefined && endLine !== undefined)
|
|
26639
|
+
validateNoBlankLinesInRange(startLine, endLine, reader.scanState.blankLines, options.strict, "tabular array");
|
|
26640
|
+
if (options.strict)
|
|
26641
|
+
validateNoExtraTabularRows(yield* peekLine(reader), rowDepth, header);
|
|
26642
|
+
}
|
|
26643
|
+
function* decodeListArray(header, reader, baseDepth, options, headerLine) {
|
|
26644
|
+
const itemDepth = baseDepth + 1;
|
|
26645
|
+
let itemCount = 0;
|
|
26646
|
+
let startLine;
|
|
26647
|
+
let endLine;
|
|
26648
|
+
let lastItemLine = headerLine;
|
|
26649
|
+
while (!options.strict || itemCount < header.length) {
|
|
26650
|
+
const line = yield* peekLine(reader);
|
|
26651
|
+
if (!line || line.depth < itemDepth)
|
|
26652
|
+
break;
|
|
26653
|
+
const isListItem = line.content.startsWith("- ") || line.content === "-";
|
|
26654
|
+
if (line.depth === itemDepth && isListItem) {
|
|
26655
|
+
if (startLine === undefined)
|
|
26656
|
+
startLine = line.lineNumber;
|
|
26657
|
+
endLine = line.lineNumber;
|
|
26658
|
+
lastItemLine = line;
|
|
26659
|
+
yield* decodeListItem(reader, itemDepth, options);
|
|
26660
|
+
const lastConsumedLine = reader.lastLine;
|
|
26661
|
+
if (lastConsumedLine) {
|
|
26662
|
+
endLine = lastConsumedLine.lineNumber;
|
|
26663
|
+
lastItemLine = lastConsumedLine;
|
|
26664
|
+
}
|
|
26665
|
+
itemCount++;
|
|
26666
|
+
} else
|
|
26667
|
+
break;
|
|
26668
|
+
}
|
|
26669
|
+
assertExpectedCount(itemCount, header.length, "list-form items", options, lastItemLine);
|
|
26670
|
+
if (options.strict && startLine !== undefined && endLine !== undefined)
|
|
26671
|
+
validateNoBlankLinesInRange(startLine, endLine, reader.scanState.blankLines, options.strict, "list-form array");
|
|
26672
|
+
if (options.strict)
|
|
26673
|
+
validateNoExtraListItems(yield* peekLine(reader), itemDepth, header.length);
|
|
26674
|
+
}
|
|
26675
|
+
function* decodeListItem(reader, baseDepth, options) {
|
|
26676
|
+
const line = yield* readLine2(reader);
|
|
26677
|
+
if (!line)
|
|
26678
|
+
throw new ReferenceError("Expected list item");
|
|
26679
|
+
let afterHyphen;
|
|
26680
|
+
if (line.content === "-") {
|
|
26681
|
+
yield { type: "startObject" };
|
|
26682
|
+
yield { type: "endObject" };
|
|
26683
|
+
return;
|
|
26684
|
+
} else if (line.content.startsWith("- "))
|
|
26685
|
+
afterHyphen = line.content.slice(2);
|
|
26686
|
+
else
|
|
26687
|
+
throw new ToonDecodeError(`Expected list item to start with "- "`, {
|
|
26688
|
+
line: line.lineNumber,
|
|
26689
|
+
source: line.raw
|
|
26690
|
+
});
|
|
26691
|
+
if (!trimSpaces(afterHyphen)) {
|
|
26692
|
+
yield { type: "startObject" };
|
|
26693
|
+
yield { type: "endObject" };
|
|
26694
|
+
return;
|
|
26695
|
+
}
|
|
26696
|
+
if (trimSpaces(afterHyphen) === "[]") {
|
|
26697
|
+
yield {
|
|
26698
|
+
type: "startArray",
|
|
26699
|
+
length: 0
|
|
26700
|
+
};
|
|
26701
|
+
yield { type: "endArray" };
|
|
26702
|
+
return;
|
|
26703
|
+
}
|
|
26704
|
+
const itemLine = {
|
|
26705
|
+
...line,
|
|
26706
|
+
content: afterHyphen
|
|
26707
|
+
};
|
|
26708
|
+
if (isArrayHeaderContent(afterHyphen)) {
|
|
26709
|
+
const arrayHeader = withLine(itemLine, () => resolveArrayHeader(parseArrayHeaderLine(afterHyphen, DEFAULT_DELIMITER), options.strict));
|
|
26710
|
+
if (arrayHeader)
|
|
26711
|
+
if (arrayHeader.header.keyed || arrayHeader.header.fields !== undefined) {
|
|
26712
|
+
if (options.strict)
|
|
26713
|
+
throw arrayHeader.header.keyed ? keylessKeyedError(itemLine) : keylessFieldsHeaderError(itemLine);
|
|
26714
|
+
} else {
|
|
26715
|
+
yield* decodeArrayFromHeader(arrayHeader.header, arrayHeader.inlineValues, reader, baseDepth, options, itemLine);
|
|
26716
|
+
return;
|
|
26717
|
+
}
|
|
26718
|
+
}
|
|
26719
|
+
const headerInfo = withLine(itemLine, () => resolveArrayHeader(parseArrayHeaderLine(afterHyphen, DEFAULT_DELIMITER), options.strict));
|
|
26720
|
+
if (headerInfo && headerInfo.header.key !== undefined && headerInfo.header.fields !== undefined) {
|
|
26721
|
+
const header = headerInfo.header;
|
|
26722
|
+
const seenKeys = options.strict ? /* @__PURE__ */ new Set([header.key]) : undefined;
|
|
26723
|
+
yield { type: "startObject" };
|
|
26724
|
+
yield {
|
|
26725
|
+
type: "key",
|
|
26726
|
+
key: header.key
|
|
26727
|
+
};
|
|
26728
|
+
yield* decodeArrayFromHeader(header, headerInfo.inlineValues, reader, baseDepth + 1, options, itemLine);
|
|
26729
|
+
yield* followSiblingFields(reader, baseDepth + 1, options, seenKeys);
|
|
26730
|
+
yield { type: "endObject" };
|
|
26731
|
+
return;
|
|
26732
|
+
}
|
|
26733
|
+
if (isKeyValueContent(afterHyphen)) {
|
|
26734
|
+
const seenKeys = options.strict ? /* @__PURE__ */ new Set : undefined;
|
|
26735
|
+
yield { type: "startObject" };
|
|
26736
|
+
yield* decodeKeyValue(itemLine, reader, baseDepth + 1, options, seenKeys);
|
|
26737
|
+
yield* followSiblingFields(reader, baseDepth + 1, options, seenKeys);
|
|
26738
|
+
yield { type: "endObject" };
|
|
26739
|
+
return;
|
|
26740
|
+
}
|
|
26741
|
+
yield {
|
|
26742
|
+
type: "primitive",
|
|
26743
|
+
value: withLine(itemLine, () => parsePrimitiveToken(afterHyphen))
|
|
26744
|
+
};
|
|
26745
|
+
}
|
|
26746
|
+
function* followSiblingFields(reader, followDepth, options, seenKeys) {
|
|
26747
|
+
while (true) {
|
|
26748
|
+
const nextLine = yield* peekLine(reader);
|
|
26749
|
+
if (!nextLine || nextLine.depth < followDepth)
|
|
26750
|
+
break;
|
|
26751
|
+
if (nextLine.depth === followDepth && !nextLine.content.startsWith("- ")) {
|
|
26752
|
+
yield* readLine2(reader);
|
|
26753
|
+
yield* decodeKeyValue(nextLine, reader, followDepth, options, seenKeys);
|
|
26754
|
+
} else
|
|
26755
|
+
break;
|
|
26756
|
+
}
|
|
26757
|
+
}
|
|
26758
|
+
function isKeyValueLine(line) {
|
|
26759
|
+
const content = line.content;
|
|
26760
|
+
if (content.startsWith('"')) {
|
|
26761
|
+
const closingQuoteIndex = findClosingQuote(content, 0);
|
|
26762
|
+
if (closingQuoteIndex === -1)
|
|
26763
|
+
return false;
|
|
26764
|
+
return content.slice(closingQuoteIndex + 1).includes(":");
|
|
26765
|
+
} else
|
|
26766
|
+
return content.includes(":");
|
|
26767
|
+
}
|
|
26768
|
+
function resolveArrayHeader(result, strict) {
|
|
26769
|
+
if (result.kind === "notHeader")
|
|
26770
|
+
return;
|
|
26771
|
+
if (result.kind === "invalid") {
|
|
26772
|
+
if (strict)
|
|
26773
|
+
throw new SyntaxError(result.reason);
|
|
26774
|
+
return;
|
|
26775
|
+
}
|
|
26776
|
+
if (strict && result.strictError !== undefined)
|
|
26777
|
+
throw new SyntaxError(result.strictError);
|
|
26778
|
+
return {
|
|
26779
|
+
header: result.header,
|
|
26780
|
+
inlineValues: result.inlineValues
|
|
26781
|
+
};
|
|
26782
|
+
}
|
|
26783
|
+
function* yieldObjectFromFields(fields, primitives) {
|
|
26784
|
+
let cellIndex = 0;
|
|
26785
|
+
function* walkFieldGroup(nodes) {
|
|
26786
|
+
yield { type: "startObject" };
|
|
26787
|
+
for (const node of nodes) {
|
|
26788
|
+
if (!node.children && cellIndex >= primitives.length)
|
|
26789
|
+
continue;
|
|
26790
|
+
yield {
|
|
26791
|
+
type: "key",
|
|
26792
|
+
key: node.name
|
|
26793
|
+
};
|
|
26794
|
+
if (node.children)
|
|
26795
|
+
yield* walkFieldGroup(node.children);
|
|
26796
|
+
else
|
|
26797
|
+
yield {
|
|
26798
|
+
type: "primitive",
|
|
26799
|
+
value: primitives[cellIndex++]
|
|
26800
|
+
};
|
|
26801
|
+
}
|
|
26802
|
+
yield { type: "endObject" };
|
|
26803
|
+
}
|
|
26804
|
+
yield* walkFieldGroup(fields);
|
|
26805
|
+
}
|
|
25690
26806
|
function setOwnProperty(target, key, value) {
|
|
25691
26807
|
if (key === "__proto__") {
|
|
25692
26808
|
Object.defineProperty(target, key, {
|
|
@@ -25699,6 +26815,116 @@ function setOwnProperty(target, key, value) {
|
|
|
25699
26815
|
}
|
|
25700
26816
|
target[key] = value;
|
|
25701
26817
|
}
|
|
26818
|
+
function buildValueFromEvents(events) {
|
|
26819
|
+
const state = {
|
|
26820
|
+
stack: [],
|
|
26821
|
+
root: undefined
|
|
26822
|
+
};
|
|
26823
|
+
for (const event of events)
|
|
26824
|
+
applyEvent(state, event);
|
|
26825
|
+
return finalizeState(state);
|
|
26826
|
+
}
|
|
26827
|
+
function applyEvent(state, event) {
|
|
26828
|
+
const { stack } = state;
|
|
26829
|
+
switch (event.type) {
|
|
26830
|
+
case "startObject": {
|
|
26831
|
+
const obj = {};
|
|
26832
|
+
if (stack.length === 0)
|
|
26833
|
+
stack.push({
|
|
26834
|
+
type: "object",
|
|
26835
|
+
obj
|
|
26836
|
+
});
|
|
26837
|
+
else {
|
|
26838
|
+
const parent = stack[stack.length - 1];
|
|
26839
|
+
if (parent.type === "object") {
|
|
26840
|
+
if (parent.currentKey === undefined)
|
|
26841
|
+
throw new Error("Object startObject event without preceding key");
|
|
26842
|
+
setOwnProperty(parent.obj, parent.currentKey, obj);
|
|
26843
|
+
parent.currentKey = undefined;
|
|
26844
|
+
} else if (parent.type === "array")
|
|
26845
|
+
parent.arr.push(obj);
|
|
26846
|
+
stack.push({
|
|
26847
|
+
type: "object",
|
|
26848
|
+
obj
|
|
26849
|
+
});
|
|
26850
|
+
}
|
|
26851
|
+
break;
|
|
26852
|
+
}
|
|
26853
|
+
case "endObject": {
|
|
26854
|
+
if (stack.length === 0)
|
|
26855
|
+
throw new Error("Unexpected endObject event");
|
|
26856
|
+
const context = stack.pop();
|
|
26857
|
+
if (context.type !== "object")
|
|
26858
|
+
throw new Error("Mismatched endObject event");
|
|
26859
|
+
if (stack.length === 0)
|
|
26860
|
+
state.root = context.obj;
|
|
26861
|
+
break;
|
|
26862
|
+
}
|
|
26863
|
+
case "startArray": {
|
|
26864
|
+
const arr = [];
|
|
26865
|
+
if (stack.length === 0)
|
|
26866
|
+
stack.push({
|
|
26867
|
+
type: "array",
|
|
26868
|
+
arr
|
|
26869
|
+
});
|
|
26870
|
+
else {
|
|
26871
|
+
const parent = stack[stack.length - 1];
|
|
26872
|
+
if (parent.type === "object") {
|
|
26873
|
+
if (parent.currentKey === undefined)
|
|
26874
|
+
throw new Error("Array startArray event without preceding key");
|
|
26875
|
+
setOwnProperty(parent.obj, parent.currentKey, arr);
|
|
26876
|
+
parent.currentKey = undefined;
|
|
26877
|
+
} else if (parent.type === "array")
|
|
26878
|
+
parent.arr.push(arr);
|
|
26879
|
+
stack.push({
|
|
26880
|
+
type: "array",
|
|
26881
|
+
arr
|
|
26882
|
+
});
|
|
26883
|
+
}
|
|
26884
|
+
break;
|
|
26885
|
+
}
|
|
26886
|
+
case "endArray": {
|
|
26887
|
+
if (stack.length === 0)
|
|
26888
|
+
throw new Error("Unexpected endArray event");
|
|
26889
|
+
const context = stack.pop();
|
|
26890
|
+
if (context.type !== "array")
|
|
26891
|
+
throw new Error("Mismatched endArray event");
|
|
26892
|
+
if (stack.length === 0)
|
|
26893
|
+
state.root = context.arr;
|
|
26894
|
+
break;
|
|
26895
|
+
}
|
|
26896
|
+
case "key": {
|
|
26897
|
+
if (stack.length === 0)
|
|
26898
|
+
throw new Error("Key event outside of object context");
|
|
26899
|
+
const parent = stack[stack.length - 1];
|
|
26900
|
+
if (parent.type !== "object")
|
|
26901
|
+
throw new Error("Key event outside of object context");
|
|
26902
|
+
parent.currentKey = event.key;
|
|
26903
|
+
break;
|
|
26904
|
+
}
|
|
26905
|
+
case "primitive":
|
|
26906
|
+
if (stack.length === 0)
|
|
26907
|
+
state.root = event.value;
|
|
26908
|
+
else {
|
|
26909
|
+
const parent = stack[stack.length - 1];
|
|
26910
|
+
if (parent.type === "object") {
|
|
26911
|
+
if (parent.currentKey === undefined)
|
|
26912
|
+
throw new Error("Primitive event without preceding key in object");
|
|
26913
|
+
setOwnProperty(parent.obj, parent.currentKey, event.value);
|
|
26914
|
+
parent.currentKey = undefined;
|
|
26915
|
+
} else if (parent.type === "array")
|
|
26916
|
+
parent.arr.push(event.value);
|
|
26917
|
+
}
|
|
26918
|
+
break;
|
|
26919
|
+
}
|
|
26920
|
+
}
|
|
26921
|
+
function finalizeState(state) {
|
|
26922
|
+
if (state.stack.length !== 0)
|
|
26923
|
+
throw new Error("Incomplete event stream: unclosed objects or arrays");
|
|
26924
|
+
if (state.root === undefined)
|
|
26925
|
+
throw new Error("No root value built from events");
|
|
26926
|
+
return state.root;
|
|
26927
|
+
}
|
|
25702
26928
|
var COMMENT_LINE_PATTERN = new RegExp(`(?:^\uFEFF?|\\n) *#`);
|
|
25703
26929
|
var RawString = class {
|
|
25704
26930
|
constructor(value) {
|
|
@@ -26180,11 +27406,18 @@ function encode5(input, options) {
|
|
|
26180
27406
|
return Array.from(encodeLines(input, options)).join(`
|
|
26181
27407
|
`);
|
|
26182
27408
|
}
|
|
27409
|
+
function decode4(input, options) {
|
|
27410
|
+
return decodeFromLines(input.split(`
|
|
27411
|
+
`), options);
|
|
27412
|
+
}
|
|
26183
27413
|
function encodeLines(input, options) {
|
|
26184
27414
|
const normalizedValue = normalizeValue(input);
|
|
26185
27415
|
const resolvedOptions = resolveOptions(options);
|
|
26186
27416
|
return encodeJsonValue(resolvedOptions.replacer ? applyReplacer(normalizedValue, resolvedOptions.replacer) : normalizedValue, resolvedOptions, 0);
|
|
26187
27417
|
}
|
|
27418
|
+
function decodeFromLines(lines, options) {
|
|
27419
|
+
return buildValueFromEvents(decodeStreamSync$1(lines, resolveDecodeOptions(options)));
|
|
27420
|
+
}
|
|
26188
27421
|
function resolveOptions(options) {
|
|
26189
27422
|
const delimiter = options?.delimiter ?? DEFAULT_DELIMITER;
|
|
26190
27423
|
assertValidDelimiter(delimiter);
|
|
@@ -26194,6 +27427,12 @@ function resolveOptions(options) {
|
|
|
26194
27427
|
replacer: options?.replacer
|
|
26195
27428
|
};
|
|
26196
27429
|
}
|
|
27430
|
+
function resolveDecodeOptions(options) {
|
|
27431
|
+
return {
|
|
27432
|
+
indentSize: options?.indentSize ?? options?.indent ?? 2,
|
|
27433
|
+
strict: options?.strict ?? true
|
|
27434
|
+
};
|
|
27435
|
+
}
|
|
26197
27436
|
|
|
26198
27437
|
// ../envoy-client/src/dispatch-pictures.ts
|
|
26199
27438
|
var PICTURE_UPLOAD_MAX_BYTES = 25 * 1024 * 1024;
|