//#region ../../node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs
function e(e$1, i$1 = !1) {
	let a$1 = e$1.length, o$1 = 0, s = ``, c = 0, l = 16, u = 0, d$1 = 0, f$1 = 0, p$1 = 0, m$1 = 0;
	function h$1(t$1, n$1) {
		let r$1 = 0, i$2 = 0;
		for (; r$1 < t$1 || !n$1;) {
			let t$2 = e$1.charCodeAt(o$1);
			if (t$2 >= 48 && t$2 <= 57) i$2 = i$2 * 16 + t$2 - 48;
			else if (t$2 >= 65 && t$2 <= 70) i$2 = i$2 * 16 + t$2 - 65 + 10;
			else if (t$2 >= 97 && t$2 <= 102) i$2 = i$2 * 16 + t$2 - 97 + 10;
			else break;
			o$1++, r$1++;
		}
		return r$1 < t$1 && (i$2 = -1), i$2;
	}
	function g(e$2) {
		o$1 = e$2, s = ``, c = 0, l = 16, m$1 = 0;
	}
	function _() {
		let t$1 = o$1;
		if (e$1.charCodeAt(o$1) === 48) o$1++;
		else for (o$1++; o$1 < e$1.length && r(e$1.charCodeAt(o$1));) o$1++;
		if (o$1 < e$1.length && e$1.charCodeAt(o$1) === 46) if (o$1++, o$1 < e$1.length && r(e$1.charCodeAt(o$1))) for (o$1++; o$1 < e$1.length && r(e$1.charCodeAt(o$1));) o$1++;
		else return m$1 = 3, e$1.substring(t$1, o$1);
		let n$1 = o$1;
		if (o$1 < e$1.length && (e$1.charCodeAt(o$1) === 69 || e$1.charCodeAt(o$1) === 101)) if (o$1++, (o$1 < e$1.length && e$1.charCodeAt(o$1) === 43 || e$1.charCodeAt(o$1) === 45) && o$1++, o$1 < e$1.length && r(e$1.charCodeAt(o$1))) {
			for (o$1++; o$1 < e$1.length && r(e$1.charCodeAt(o$1));) o$1++;
			n$1 = o$1;
		} else m$1 = 3;
		return e$1.substring(t$1, n$1);
	}
	function v() {
		let t$1 = ``, r$1 = o$1;
		for (;;) {
			if (o$1 >= a$1) {
				t$1 += e$1.substring(r$1, o$1), m$1 = 2;
				break;
			}
			let i$2 = e$1.charCodeAt(o$1);
			if (i$2 === 34) {
				t$1 += e$1.substring(r$1, o$1), o$1++;
				break;
			}
			if (i$2 === 92) {
				if (t$1 += e$1.substring(r$1, o$1), o$1++, o$1 >= a$1) {
					m$1 = 2;
					break;
				}
				switch (e$1.charCodeAt(o$1++)) {
					case 34:
						t$1 += `"`;
						break;
					case 92:
						t$1 += `\\`;
						break;
					case 47:
						t$1 += `/`;
						break;
					case 98:
						t$1 += `\b`;
						break;
					case 102:
						t$1 += `\f`;
						break;
					case 110:
						t$1 += `
`;
						break;
					case 114:
						t$1 += `\r`;
						break;
					case 116:
						t$1 += `	`;
						break;
					case 117:
						let e$2 = h$1(4, !0);
						e$2 >= 0 ? t$1 += String.fromCharCode(e$2) : m$1 = 4;
						break;
					default: m$1 = 5;
				}
				r$1 = o$1;
				continue;
			}
			if (i$2 >= 0 && i$2 <= 31) if (n(i$2)) {
				t$1 += e$1.substring(r$1, o$1), m$1 = 2;
				break;
			} else m$1 = 6;
			o$1++;
		}
		return t$1;
	}
	function y() {
		if (s = ``, m$1 = 0, c = o$1, d$1 = u, p$1 = f$1, o$1 >= a$1) return c = a$1, l = 17;
		let i$2 = e$1.charCodeAt(o$1);
		if (t(i$2)) {
			do
				o$1++, s += String.fromCharCode(i$2), i$2 = e$1.charCodeAt(o$1);
			while (t(i$2));
			return l = 15;
		}
		if (n(i$2)) return o$1++, s += String.fromCharCode(i$2), i$2 === 13 && e$1.charCodeAt(o$1) === 10 && (o$1++, s += `
`), u++, f$1 = o$1, l = 14;
		switch (i$2) {
			case 123: return o$1++, l = 1;
			case 125: return o$1++, l = 2;
			case 91: return o$1++, l = 3;
			case 93: return o$1++, l = 4;
			case 58: return o$1++, l = 6;
			case 44: return o$1++, l = 5;
			case 34: return o$1++, s = v(), l = 10;
			case 47:
				let t$1 = o$1 - 1;
				if (e$1.charCodeAt(o$1 + 1) === 47) {
					for (o$1 += 2; o$1 < a$1 && !n(e$1.charCodeAt(o$1));) o$1++;
					return s = e$1.substring(t$1, o$1), l = 12;
				}
				if (e$1.charCodeAt(o$1 + 1) === 42) {
					o$1 += 2;
					let r$1 = a$1 - 1, i$3 = !1;
					for (; o$1 < r$1;) {
						let t$2 = e$1.charCodeAt(o$1);
						if (t$2 === 42 && e$1.charCodeAt(o$1 + 1) === 47) {
							o$1 += 2, i$3 = !0;
							break;
						}
						o$1++, n(t$2) && (t$2 === 13 && e$1.charCodeAt(o$1) === 10 && o$1++, u++, f$1 = o$1);
					}
					return i$3 || (o$1++, m$1 = 1), s = e$1.substring(t$1, o$1), l = 13;
				}
				return s += String.fromCharCode(i$2), o$1++, l = 16;
			case 45: if (s += String.fromCharCode(i$2), o$1++, o$1 === a$1 || !r(e$1.charCodeAt(o$1))) return l = 16;
			case 48:
			case 49:
			case 50:
			case 51:
			case 52:
			case 53:
			case 54:
			case 55:
			case 56:
			case 57: return s += _(), l = 11;
			default:
				for (; o$1 < a$1 && b(i$2);) o$1++, i$2 = e$1.charCodeAt(o$1);
				if (c !== o$1) {
					switch (s = e$1.substring(c, o$1), s) {
						case `true`: return l = 8;
						case `false`: return l = 9;
						case `null`: return l = 7;
					}
					return l = 16;
				}
				return s += String.fromCharCode(i$2), o$1++, l = 16;
		}
	}
	function b(e$2) {
		if (t(e$2) || n(e$2)) return !1;
		switch (e$2) {
			case 125:
			case 93:
			case 123:
			case 91:
			case 34:
			case 58:
			case 44:
			case 47: return !1;
		}
		return !0;
	}
	function x() {
		let e$2;
		do
			e$2 = y();
		while (e$2 >= 12 && e$2 <= 15);
		return e$2;
	}
	return {
		setPosition: g,
		getPosition: () => o$1,
		scan: i$1 ? x : y,
		getToken: () => l,
		getTokenValue: () => s,
		getTokenOffset: () => c,
		getTokenLength: () => o$1 - c,
		getTokenStartLine: () => d$1,
		getTokenStartCharacter: () => c - p$1,
		getTokenError: () => m$1
	};
}
function t(e$1) {
	return e$1 === 32 || e$1 === 9;
}
function n(e$1) {
	return e$1 === 10 || e$1 === 13;
}
function r(e$1) {
	return e$1 >= 48 && e$1 <= 57;
}
var i;
(function(e$1) {
	e$1[e$1.lineFeed = 10] = `lineFeed`, e$1[e$1.carriageReturn = 13] = `carriageReturn`, e$1[e$1.space = 32] = `space`, e$1[e$1._0 = 48] = `_0`, e$1[e$1._1 = 49] = `_1`, e$1[e$1._2 = 50] = `_2`, e$1[e$1._3 = 51] = `_3`, e$1[e$1._4 = 52] = `_4`, e$1[e$1._5 = 53] = `_5`, e$1[e$1._6 = 54] = `_6`, e$1[e$1._7 = 55] = `_7`, e$1[e$1._8 = 56] = `_8`, e$1[e$1._9 = 57] = `_9`, e$1[e$1.a = 97] = `a`, e$1[e$1.b = 98] = `b`, e$1[e$1.c = 99] = `c`, e$1[e$1.d = 100] = `d`, e$1[e$1.e = 101] = `e`, e$1[e$1.f = 102] = `f`, e$1[e$1.g = 103] = `g`, e$1[e$1.h = 104] = `h`, e$1[e$1.i = 105] = `i`, e$1[e$1.j = 106] = `j`, e$1[e$1.k = 107] = `k`, e$1[e$1.l = 108] = `l`, e$1[e$1.m = 109] = `m`, e$1[e$1.n = 110] = `n`, e$1[e$1.o = 111] = `o`, e$1[e$1.p = 112] = `p`, e$1[e$1.q = 113] = `q`, e$1[e$1.r = 114] = `r`, e$1[e$1.s = 115] = `s`, e$1[e$1.t = 116] = `t`, e$1[e$1.u = 117] = `u`, e$1[e$1.v = 118] = `v`, e$1[e$1.w = 119] = `w`, e$1[e$1.x = 120] = `x`, e$1[e$1.y = 121] = `y`, e$1[e$1.z = 122] = `z`, e$1[e$1.A = 65] = `A`, e$1[e$1.B = 66] = `B`, e$1[e$1.C = 67] = `C`, e$1[e$1.D = 68] = `D`, e$1[e$1.E = 69] = `E`, e$1[e$1.F = 70] = `F`, e$1[e$1.G = 71] = `G`, e$1[e$1.H = 72] = `H`, e$1[e$1.I = 73] = `I`, e$1[e$1.J = 74] = `J`, e$1[e$1.K = 75] = `K`, e$1[e$1.L = 76] = `L`, e$1[e$1.M = 77] = `M`, e$1[e$1.N = 78] = `N`, e$1[e$1.O = 79] = `O`, e$1[e$1.P = 80] = `P`, e$1[e$1.Q = 81] = `Q`, e$1[e$1.R = 82] = `R`, e$1[e$1.S = 83] = `S`, e$1[e$1.T = 84] = `T`, e$1[e$1.U = 85] = `U`, e$1[e$1.V = 86] = `V`, e$1[e$1.W = 87] = `W`, e$1[e$1.X = 88] = `X`, e$1[e$1.Y = 89] = `Y`, e$1[e$1.Z = 90] = `Z`, e$1[e$1.asterisk = 42] = `asterisk`, e$1[e$1.backslash = 92] = `backslash`, e$1[e$1.closeBrace = 125] = `closeBrace`, e$1[e$1.closeBracket = 93] = `closeBracket`, e$1[e$1.colon = 58] = `colon`, e$1[e$1.comma = 44] = `comma`, e$1[e$1.dot = 46] = `dot`, e$1[e$1.doubleQuote = 34] = `doubleQuote`, e$1[e$1.minus = 45] = `minus`, e$1[e$1.openBrace = 123] = `openBrace`, e$1[e$1.openBracket = 91] = `openBracket`, e$1[e$1.plus = 43] = `plus`, e$1[e$1.slash = 47] = `slash`, e$1[e$1.formFeed = 12] = `formFeed`, e$1[e$1.tab = 9] = `tab`;
})(i ||= {}), Array(20).fill(0).map((e$1, t$1) => ` `.repeat(t$1)), Array(200).fill(0).map((e$1, t$1) => `
` + ` `.repeat(t$1)), Array(200).fill(0).map((e$1, t$1) => `\r` + ` `.repeat(t$1)), Array(200).fill(0).map((e$1, t$1) => `\r
` + ` `.repeat(t$1)), Array(200).fill(0).map((e$1, t$1) => `
` + `	`.repeat(t$1)), Array(200).fill(0).map((e$1, t$1) => `\r` + `	`.repeat(t$1)), Array(200).fill(0).map((e$1, t$1) => `\r
` + `	`.repeat(t$1));
var a;
(function(e$1) {
	e$1.DEFAULT = { allowTrailingComma: !1 };
})(a ||= {});
function o(e$1, t$1 = [], n$1 = a.DEFAULT) {
	let r$1 = null, i$1 = [], o$1 = [];
	function s(e$2) {
		Array.isArray(i$1) ? i$1.push(e$2) : r$1 !== null && (i$1[r$1] = e$2);
	}
	return d(e$1, {
		onObjectBegin: () => {
			let e$2 = {};
			s(e$2), o$1.push(i$1), i$1 = e$2, r$1 = null;
		},
		onObjectProperty: (e$2) => {
			r$1 = e$2;
		},
		onObjectEnd: () => {
			i$1 = o$1.pop();
		},
		onArrayBegin: () => {
			let e$2 = [];
			s(e$2), o$1.push(i$1), i$1 = e$2, r$1 = null;
		},
		onArrayEnd: () => {
			i$1 = o$1.pop();
		},
		onLiteralValue: s,
		onError: (e$2, n$2, r$2) => {
			t$1.push({
				error: e$2,
				offset: n$2,
				length: r$2
			});
		}
	}, n$1), i$1[0];
}
function d(t$1, n$1, r$1 = a.DEFAULT) {
	let i$1 = e(t$1, !1), o$1 = [], s = 0;
	function c(e$1) {
		return e$1 ? () => s === 0 && e$1(i$1.getTokenOffset(), i$1.getTokenLength(), i$1.getTokenStartLine(), i$1.getTokenStartCharacter()) : () => !0;
	}
	function l(e$1) {
		return e$1 ? (t$2) => s === 0 && e$1(t$2, i$1.getTokenOffset(), i$1.getTokenLength(), i$1.getTokenStartLine(), i$1.getTokenStartCharacter()) : () => !0;
	}
	function u(e$1) {
		return e$1 ? (t$2) => s === 0 && e$1(t$2, i$1.getTokenOffset(), i$1.getTokenLength(), i$1.getTokenStartLine(), i$1.getTokenStartCharacter(), () => o$1.slice()) : () => !0;
	}
	function d$1(e$1) {
		return e$1 ? () => {
			s > 0 ? s++ : e$1(i$1.getTokenOffset(), i$1.getTokenLength(), i$1.getTokenStartLine(), i$1.getTokenStartCharacter(), () => o$1.slice()) === !1 && (s = 1);
		} : () => !0;
	}
	function f$1(e$1) {
		return e$1 ? () => {
			s > 0 && s--, s === 0 && e$1(i$1.getTokenOffset(), i$1.getTokenLength(), i$1.getTokenStartLine(), i$1.getTokenStartCharacter());
		} : () => !0;
	}
	let p$1 = d$1(n$1.onObjectBegin), m$1 = u(n$1.onObjectProperty), h$1 = f$1(n$1.onObjectEnd), g = d$1(n$1.onArrayBegin), _ = f$1(n$1.onArrayEnd), v = u(n$1.onLiteralValue), y = l(n$1.onSeparator), b = c(n$1.onComment), x = l(n$1.onError), S = r$1 && r$1.disallowComments, C = r$1 && r$1.allowTrailingComma;
	function w() {
		for (;;) {
			let e$1 = i$1.scan();
			switch (i$1.getTokenError()) {
				case 4:
					T(14);
					break;
				case 5:
					T(15);
					break;
				case 3:
					T(13);
					break;
				case 1:
					S || T(11);
					break;
				case 2:
					T(12);
					break;
				case 6:
					T(16);
					break;
			}
			switch (e$1) {
				case 12:
				case 13:
					S ? T(10) : b();
					break;
				case 16:
					T(1);
					break;
				case 15:
				case 14: break;
				default: return e$1;
			}
		}
	}
	function T(e$1, t$2 = [], n$2 = []) {
		if (x(e$1), t$2.length + n$2.length > 0) {
			let e$2 = i$1.getToken();
			for (; e$2 !== 17;) {
				if (t$2.indexOf(e$2) !== -1) {
					w();
					break;
				} else if (n$2.indexOf(e$2) !== -1) break;
				e$2 = w();
			}
		}
	}
	function E(e$1) {
		let t$2 = i$1.getTokenValue();
		return e$1 ? v(t$2) : (m$1(t$2), o$1.push(t$2)), w(), !0;
	}
	function D() {
		switch (i$1.getToken()) {
			case 11:
				let e$1 = i$1.getTokenValue(), t$2 = Number(e$1);
				isNaN(t$2) && (T(2), t$2 = 0), v(t$2);
				break;
			case 7:
				v(null);
				break;
			case 8:
				v(!0);
				break;
			case 9:
				v(!1);
				break;
			default: return !1;
		}
		return w(), !0;
	}
	function O() {
		return i$1.getToken() === 10 ? (E(!1), i$1.getToken() === 6 ? (y(`:`), w(), j() || T(4, [], [2, 5])) : T(5, [], [2, 5]), o$1.pop(), !0) : (T(3, [], [2, 5]), !1);
	}
	function k() {
		p$1(), w();
		let e$1 = !1;
		for (; i$1.getToken() !== 2 && i$1.getToken() !== 17;) {
			if (i$1.getToken() === 5) {
				if (e$1 || T(4, [], []), y(`,`), w(), i$1.getToken() === 2 && C) break;
			} else e$1 && T(6, [], []);
			O() || T(4, [], [2, 5]), e$1 = !0;
		}
		return h$1(), i$1.getToken() === 2 ? w() : T(7, [2], []), !0;
	}
	function A() {
		g(), w();
		let e$1 = !0, t$2 = !1;
		for (; i$1.getToken() !== 4 && i$1.getToken() !== 17;) {
			if (i$1.getToken() === 5) {
				if (t$2 || T(4, [], []), y(`,`), w(), i$1.getToken() === 4 && C) break;
			} else t$2 && T(6, [], []);
			e$1 ? (o$1.push(0), e$1 = !1) : o$1[o$1.length - 1]++, j() || T(4, [], [4, 5]), t$2 = !0;
		}
		return _(), e$1 || o$1.pop(), i$1.getToken() === 4 ? w() : T(8, [4], []), !0;
	}
	function j() {
		switch (i$1.getToken()) {
			case 3: return A();
			case 1: return k();
			case 10: return E(!0);
			default: return D();
		}
	}
	return w(), i$1.getToken() === 17 ? r$1.allowEmptyContent ? !0 : (T(4, [], []), !1) : j() ? (i$1.getToken() !== 17 && T(9, [], []), !0) : (T(4, [], []), !1);
}
var f;
(function(e$1) {
	e$1[e$1.None = 0] = `None`, e$1[e$1.UnexpectedEndOfComment = 1] = `UnexpectedEndOfComment`, e$1[e$1.UnexpectedEndOfString = 2] = `UnexpectedEndOfString`, e$1[e$1.UnexpectedEndOfNumber = 3] = `UnexpectedEndOfNumber`, e$1[e$1.InvalidUnicode = 4] = `InvalidUnicode`, e$1[e$1.InvalidEscapeCharacter = 5] = `InvalidEscapeCharacter`, e$1[e$1.InvalidCharacter = 6] = `InvalidCharacter`;
})(f ||= {});
var p;
(function(e$1) {
	e$1[e$1.OpenBraceToken = 1] = `OpenBraceToken`, e$1[e$1.CloseBraceToken = 2] = `CloseBraceToken`, e$1[e$1.OpenBracketToken = 3] = `OpenBracketToken`, e$1[e$1.CloseBracketToken = 4] = `CloseBracketToken`, e$1[e$1.CommaToken = 5] = `CommaToken`, e$1[e$1.ColonToken = 6] = `ColonToken`, e$1[e$1.NullKeyword = 7] = `NullKeyword`, e$1[e$1.TrueKeyword = 8] = `TrueKeyword`, e$1[e$1.FalseKeyword = 9] = `FalseKeyword`, e$1[e$1.StringLiteral = 10] = `StringLiteral`, e$1[e$1.NumericLiteral = 11] = `NumericLiteral`, e$1[e$1.LineCommentTrivia = 12] = `LineCommentTrivia`, e$1[e$1.BlockCommentTrivia = 13] = `BlockCommentTrivia`, e$1[e$1.LineBreakTrivia = 14] = `LineBreakTrivia`, e$1[e$1.Trivia = 15] = `Trivia`, e$1[e$1.Unknown = 16] = `Unknown`, e$1[e$1.EOF = 17] = `EOF`;
})(p ||= {});
const m = o;
var h;
(function(e$1) {
	e$1[e$1.InvalidSymbol = 1] = `InvalidSymbol`, e$1[e$1.InvalidNumberFormat = 2] = `InvalidNumberFormat`, e$1[e$1.PropertyNameExpected = 3] = `PropertyNameExpected`, e$1[e$1.ValueExpected = 4] = `ValueExpected`, e$1[e$1.ColonExpected = 5] = `ColonExpected`, e$1[e$1.CommaExpected = 6] = `CommaExpected`, e$1[e$1.CloseBraceExpected = 7] = `CloseBraceExpected`, e$1[e$1.CloseBracketExpected = 8] = `CloseBracketExpected`, e$1[e$1.EndOfFileExpected = 9] = `EndOfFileExpected`, e$1[e$1.InvalidCommentToken = 10] = `InvalidCommentToken`, e$1[e$1.UnexpectedEndOfComment = 11] = `UnexpectedEndOfComment`, e$1[e$1.UnexpectedEndOfString = 12] = `UnexpectedEndOfString`, e$1[e$1.UnexpectedEndOfNumber = 13] = `UnexpectedEndOfNumber`, e$1[e$1.InvalidUnicode = 14] = `InvalidUnicode`, e$1[e$1.InvalidEscapeCharacter = 15] = `InvalidEscapeCharacter`, e$1[e$1.InvalidCharacter = 16] = `InvalidCharacter`;
})(h ||= {});

//#endregion
export { m };
//# sourceMappingURL=jsonc-parser.mjs.map