import { E as Emitter, C as Callback, I as InferCallbackValue } from '../../emitter-l0W9gC1A.js'; import { Serializable } from '../../internals/serializable.js'; import { ParserField } from './field.js'; import { ValueOf } from '../../internals/types.js'; import { LinePrefixParserError } from './errors.js'; import '../../internals/helpers/guards.js'; import 'zod'; import '@streamparser/json'; import 'jsonrepair/stream'; import '../../errors.js'; /** * Copyright 2025 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ interface ParserNode> { prefix: string; next: readonly T[]; isStart?: boolean; isEnd?: boolean; field: P; } type Customizer, T2 extends NonNullable = T> = (nodes: T, options: Options) => { nodes: T2; options: Options; }; type StringKey> = Extract; interface Callbacks, ParserField>>> { update: Callback<{ [K in StringKey]: { key: K; value: ParserField.inferValue; field: T[K]["field"]; }; }[StringKey]>; partialUpdate: Callback<{ [K in StringKey]: { key: K; delta: string; value: ParserField.inferPartialValue; field: T[K]["field"]; }; }[StringKey]>; } interface Line { value: string; newLine: boolean; } interface ExtractedLine> { key: StringKey; value: string; partial: boolean; } interface Options> { fallback?: (value: string) => readonly { key: StringKey; value: string; }[]; endOnRepeat?: boolean; waitForStartNode?: boolean; silentNodes?: StringKey[]; } type Input = Record>>; declare class LinePrefixParser>> extends Serializable { protected readonly nodes: T; protected readonly options: Options; readonly emitter: Emitter>; protected readonly lines: Line[]; protected readonly excludedLines: Line[]; protected done: boolean; protected lastNodeKey: StringKey | null; readonly finalState: LinePrefixParser.infer; readonly partialState: Partial, string>>; get isDone(): boolean; constructor(nodes: T, options?: Options); fork(customizer: Customizer): LinePrefixParser; add(chunk: string): Promise; protected throwWithContext(message: string, reason: ValueOf, extra?: { line?: Line; errors?: Error[]; }): never; end(): Promise>; protected emitPartialUpdate(data: InferCallbackValue["partialUpdate"]>): Promise; protected emitFinalUpdate(key: StringKey, field: ParserField): Promise; protected get normalizedNodes(): (readonly [string, { readonly lowerCasePrefix: string; readonly ref: Required[string] | Required[number]; }])[]; protected extractLine(line: string): ExtractedLine | null; createSnapshot(): { nodes: T; lines: Line[]; emitter: Emitter>; done: boolean; lastNodeKey: Extract | null; options: Options; }; loadSnapshot(snapshot: ReturnType): this & { nodes: T; lines: Line[]; emitter: Emitter>; done: boolean; lastNodeKey: Extract | null; options: Options; }; } declare namespace LinePrefixParser { type infer, ParserField>>> = { [K in keyof T]: ParserField.inferValue; }; type inferPartial, ParserField>>> = { [K in StringKey]: ParserField.inferPartialValue; }; type inferCallback = T extends LinePrefixParser ? (T["emitter"] extends Emitter ? L : never) : never; type inferOutput = T extends LinePrefixParser ? LinePrefixParser.infer

: never; type inferPartialOutput = T extends LinePrefixParser ? LinePrefixParser.inferPartial

: never; type define>> = { [K in StringKey]: ParserNode, T[K]>; }; } export { LinePrefixParser, LinePrefixParserError, type ParserNode };