declare enum Tag { False = 128, True = 129, End = 132, Annotation = 133, Embedded = 134, Ieee754 = 135, SignedInteger = 176, String = 177, ByteString = 178, Symbol = 179, Record = 180, Sequence = 181, Set = 182, Dictionary = 183 } type constants_Tag = Tag; declare const constants_Tag: typeof Tag; declare namespace constants { export { constants_Tag as Tag }; } type Writable = Value | PreserveWritable | Iterable> | ArrayBufferView; interface PreserveWritable { __preserve_text_on__(writer: Writer): void; } declare function isPreserveWritable(v: any): v is PreserveWritable; type EmbeddedWriter = { write(s: WriterState, v: T): void; } | { toValue(v: T): Value; }; declare const genericEmbeddedTypeEncode: EmbeddedTypeEncode & EmbeddedWriter; declare const neverEmbeddedTypeEncode: EmbeddedTypeEncode & EmbeddedWriter; interface WriterStateOptions { includeAnnotations?: boolean; indent?: number; maxBinaryAsciiLength?: number; maxBinaryAsciiProportion?: number; } interface WriterOptions extends WriterStateOptions { embeddedWrite?: EmbeddedWriter; } declare class WriterState { pieces: string[]; options: WriterStateOptions; indentDelta: string; indentCount: number; constructor(options: WriterStateOptions); get isIndenting(): boolean; get includeAnnotations(): boolean; writeIndent(): void; writeIndentSpace(): void; escapeStringlikeChar(c: string, k?: (c: string) => string): string; escapeStringlike(s: string, quoteChar: string): string; writeSeq(opener: string, closer: string, vs: Iterable, appender: (v: V) => void): void; writeBytes(bs: Uint8Array): void; writeBase64(bs: Uint8Array): void; writeBinaryStringlike(bs: Uint8Array): void; couldBeFlat(vs: Writable[]): boolean; } declare class Writer { state: WriterState; embeddedWrite: EmbeddedWriter; constructor(state: WriterState, embeddedWrite: EmbeddedWriter); constructor(options?: WriterOptions); static stringify(v: Writable, options?: WriterOptions): string; contents(): string; get includeAnnotations(): boolean; push(v: Writable): this; } type FloatType = 'Double'; declare const FloatType: unique symbol; declare abstract class Float { readonly value: number; constructor(value: number | bigint | Float); __preserve_text_on__(w: Writer): void; abstract toBytes(): Bytes; equals(other: any): boolean; hashCode(): number; abstract get [FloatType](): FloatType; static isFloat: (x: any) => x is Float; static isDouble: (x: any) => x is DoubleFloat; } declare function floatValue(f: any): number; declare function floatlikeString(f: number): string; declare class DoubleFloat extends Float implements Preservable, PreserveWritable { __as_preserve__(): Value; static fromBytes(bs: Bytes | DataView): DoubleFloat; static __from_preserve__(v: Value): undefined | DoubleFloat; __preserve_on__(encoder: Encoder): void; toBytes(): Bytes; toString(): string; get [FloatType](): 'Double'; } declare function Double(value: number | bigint | Float): DoubleFloat; declare namespace Double { var __from_preserve__: typeof DoubleFloat.__from_preserve__; } type Canonicalizer = (v: V) => string; type Equivalence = (v1: V, v2: V) => boolean; type IdentityMap = Map; declare const IdentityMap: MapConstructor; type IdentitySet = Set; declare const IdentitySet: SetConstructor; declare const IsMap: unique symbol; declare const IsSet: unique symbol; declare global { interface Map { get [IsMap](): boolean; } interface MapConstructor { isMap(x: any): x is Map; } interface Set { get [IsSet](): boolean; } interface SetConstructor { isSet(x: any): x is Set; } } declare function _iterMap(i: Iterator, f: (s: S) => T): IterableIterator; declare class FlexMap implements Map { readonly items: Map; readonly canonicalizer: Canonicalizer; constructor(c: Canonicalizer, items?: Iterable); _key(k: K): string; get(k: K, defaultValue?: V): V | undefined; getOrSet(k: K, initializer: () => V): V; set(k: K, v: V): this; forEach(f: >(v: V, k: K, map: T) => void, thisArg?: any): void; entries(): MapIterator<[K, V]>; keys(): MapIterator; values(): MapIterator; delete(k: K): boolean; getAndDelete(k: K, defaultValue?: V): V | undefined; clear(): void; has(k: K): boolean; get size(): number; [Symbol.iterator](): MapIterator<[K, V]>; get [Symbol.toStringTag](): string; equals(other: any, eqv?: Equivalence): boolean; update(key: K, f: (oldValue?: V) => V | undefined, defaultValue?: V, eqv?: Equivalence): number; canonicalKeys(): MapIterator; get [IsMap](): boolean; } declare class FlexSet implements Set { readonly items: Map; readonly canonicalizer: Canonicalizer; constructor(c: Canonicalizer, items?: Iterable); _key(v: V): string; has(v: V): boolean; get(v: V): { item: V; } | null; add(v: V): this; forEach(f: >(v: V, v2: V, set: T) => void, thisArg?: any): void; entries(): SetIterator<[V, V]>; keys(): SetIterator; values(): SetIterator; delete(v: V): boolean; clear(): void; get size(): number; [Symbol.iterator](): SetIterator; get [Symbol.toStringTag](): string; equals(other: any): boolean; canonicalValues(): SetIterator; union(other: Set): FlexSet; intersect(other: Set): FlexSet; subtract(other: Set): FlexSet; get [IsSet](): boolean; } interface JsDictionary { [key: string]: V; } declare namespace JsDictionary { function isJsDictionary(x: any): x is JsDictionary; function from(entries: Iterable<[symbol, V]>): JsDictionary; function clear(j: JsDictionary): void; function remove(j: JsDictionary, key: symbol): boolean; function forEach(j: JsDictionary, callbackfn: (value: V, key: symbol) => void): void; function get(j: JsDictionary, key: symbol): V | undefined; function has(j: JsDictionary, key: symbol): boolean; function set(j: JsDictionary, key: symbol, value: V): JsDictionary; function size(j: JsDictionary): number; function entries(j: JsDictionary): IterableIterator<[symbol, V]>; function keys(j: JsDictionary): IterableIterator; function values(j: JsDictionary): IterableIterator; function clone(j: JsDictionary): JsDictionary; function equals(j1: JsDictionary, j2: JsDictionary, eqv?: Equivalence): boolean; } type Value = Atom | Compound$1 | T | Annotated; type Atom = boolean | DoubleFloat | number | bigint | string | Bytes | symbol; type Compound$1 = (Array> | [Value]) & { label: Value; } | Array> | Set$2 | JsDictionary> | KeyedDictionary; declare const IsPreservesBytes: unique symbol; type BytesLike = Bytes | Uint8Array; declare function hexDigit(n: number): string; declare function unhexDigit(asciiCode: number, errorClass?: { new (msg: string): Error; }): number; declare function underlying(b: Bytes | Uint8Array): Uint8Array; declare function dataview(b: Bytes | DataView): DataView; declare class Bytes implements Preservable, PreserveWritable { readonly _view: Uint8Array; constructor(maybeByteIterable?: any); dataview(): DataView; get length(): number; static from(x: any): Bytes; static of(...bytes: number[]): Bytes; static fromLatin1(s: string): Bytes; static fromBase64(s: string): Bytes; static fromHex(s: string): Bytes; static _raw_fromHexInto(s: string, target: Uint8Array): void; static fromIO(io: string | BytesLike): string | Bytes; static toIO(b: string | BytesLike): string | Uint8Array; static concat: (bss: BytesLike[]) => Bytes; get(index: number): number; equals(other: any): boolean; hashCode(): number; static compare(a: Bytes, b: Bytes): number; static decodeUtf8(bs: Bytes | Uint8Array): string; fromUtf8(): string; __as_preserve__(): Value; static __from_preserve__(v: Value): undefined | Bytes; toLatin1(): string; toBase64(): string; toHex(digit?: typeof hexDigit): string; valueOf(): string; __preserve_on__(encoder: Encoder): void; __preserve_text_on__(w: Writer): void; toString(): string; get [IsPreservesBytes](): boolean; static isBytes(x: any): x is Bytes; } interface Bytes { entries(): IterableIterator<[number, number]>; every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; includes(searchElement: number, fromIndex?: number): boolean; indexOf(searchElement: number, fromIndex?: number): number; join(separator?: string): string; keys(): IterableIterator; lastIndexOf(searchElement: number, fromIndex?: number): number; reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; toLocaleString(): string; values(): IterableIterator; filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Bytes; map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Bytes; slice(start?: number, end?: number): Bytes; subarray(begin?: number, end?: number): Bytes; reverse(): Bytes; sort(compareFn?: (a: number, b: number) => number): Bytes; [Symbol.iterator](): IterableIterator; } type Encodable = Value | Preservable | Iterable> | ArrayBufferView; interface Preservable { __preserve_on__(encoder: Encoder): void; } declare function isPreservable(v: any): v is Preservable; interface EncoderOptions { canonical?: boolean; includeAnnotations?: boolean; } interface EncoderEmbeddedOptions extends EncoderOptions { embeddedEncode?: EmbeddedTypeEncode; } declare class IdentityEmbeddedTypeEncode implements EmbeddedTypeEncode { _nextId: number; readonly _registry: WeakMap; embeddedId(v: any): number; encode(s: EncoderState, v: any): void; } declare class EncoderState { chunks: Array; view: DataView; index: number; options: EncoderOptions; constructor(options: EncoderOptions); get canonical(): boolean; get includeAnnotations(): boolean; contents(): Bytes; contentsString(): string; rotatebuffer(size: number): void; makeroom(amount: number): void; emitbyte(b: number): void; emitbytes(bs: Uint8Array): void; claimbytes(count: number): Uint8Array; varint(v: number): void; encodeint(v: number | bigint): void; encodebigint(v: bigint): void; encodebytes(tag: Tag, bs: Uint8Array): void; } declare class Encoder { state: EncoderState; embeddedEncode: EmbeddedTypeEncode; constructor(options: EncoderEmbeddedOptions); constructor(state: EncoderState, embeddedEncode?: EmbeddedTypeEncode); withEmbeddedEncode(embeddedEncode: EmbeddedTypeEncode, body: (e: Encoder) => void): this; get canonical(): boolean; get includeAnnotations(): boolean; contents(): Bytes; contentsString(): string; grouped(tag: Tag, f: () => void): void; push(v: Encodable): this; } declare function encode(v: Encodable, options?: EncoderEmbeddedOptions): Bytes; declare function canonicalEncode(v: Encodable, options?: EncoderEmbeddedOptions): Bytes; declare function canonicalEncode(v: Encodable, options?: EncoderEmbeddedOptions): Bytes; declare function canonicalString(v: Encodable, options?: EncoderEmbeddedOptions): string; declare function encodeWithAnnotations(v: Encodable, options?: EncoderEmbeddedOptions): Bytes; interface FromJSOptions { onNonInteger?(n: number): Value | undefined; } declare function fromJS(x: any): Value; declare function fromJS_options(x: any, options?: FromJSOptions): Value; type DictionaryType = 'Dictionary' | 'Set'; declare const DictionaryType: unique symbol; type CompoundKey = Value | (Preservable & PreserveWritable); declare class EncodableDictionary extends FlexMap implements Preservable, PreserveWritable { readonly encodeK: (k: K) => CompoundKey; readonly encodeV: (v: V) => CompoundKey; constructor(encodeK: (k: K) => CompoundKey, encodeV: (v: V) => CompoundKey, items?: readonly [K, V][] | Iterable); __preserve_on__(encoder: Encoder): void; __preserve_text_on__(w: Writer): void; toString(): string; } declare class KeyedDictionary = Value, V = Value> extends EncodableDictionary { get [DictionaryType](): DictionaryType; static isKeyedDictionary = Value, V = Value>(x: any): x is KeyedDictionary; static fromJS(x: object, options?: FromJSOptions): KeyedDictionary>; constructor(items?: readonly [K, V][] | Iterable); clone(): KeyedDictionary; get [Symbol.toStringTag](): string; equals(otherAny: any, eqv?: Equivalence): boolean; } declare class DictionaryMap> implements Map, V> { get [IsMap](): boolean; j: JsDictionary | undefined; k: KeyedDictionary, V> | undefined; constructor(input?: Dictionary); static from>(entries: [Value, V][] | Iterable<[Value, V]>): DictionaryMap; clear(): void; delete(key: Value): boolean; forEach(callbackfn: (value: V, key: Value, map: Map, V>) => void, thisArg?: any): void; get(key: Value): V | undefined; has(key: Value): boolean; set(key: Value, value: V): this; get size(): number; entries(): MapIterator<[Value, V]>; keys(): MapIterator>; values(): MapIterator; [Symbol.iterator](): MapIterator<[Value, V]>; get [Symbol.toStringTag](): string; clone(): DictionaryMap; get value(): Dictionary; simplify(): void; simplifiedValue(): Dictionary; asJsDictionary(): JsDictionary; asKeyedDictionary(): KeyedDictionary, V>; } type Dictionary> = JsDictionary | KeyedDictionary, V>; declare namespace Dictionary { function isDictionary>(x: any): x is Dictionary; function asMap>(x: Dictionary): DictionaryMap; function asMap>(x: any): DictionaryMap | undefined; function from>(entries: [Value, V][] | Iterable<[Value, V]>): Dictionary; function __from_preserve__(v: Value): undefined | Dictionary; } declare function encodeDictionaryOn(dict: Map, encoder: Encoder, encodeK: (k: K, encoder: Encoder) => void, encodeV: (v: V, encoder: Encoder) => void): void; declare function writeDictionaryOn(dict: Map, w: Writer, writeK: (k: K, w: Writer) => void, writeV: (v: V, w: Writer) => void): void; declare class EncodableSet extends FlexSet implements Preservable, PreserveWritable { readonly encodeV: (v: V) => CompoundKey; constructor(encodeV: (v: V) => CompoundKey, items?: Iterable); __preserve_on__(encoder: Encoder): void; __preserve_text_on__(w: Writer): void; toString(): string; } declare class KeyedSet = Value> extends EncodableSet { get [DictionaryType](): DictionaryType; static isKeyedSet = Value>(x: any): x is KeyedSet; constructor(items?: Iterable); map = Value>(f: (value: K) => S): KeyedSet; filter(f: (value: K) => boolean): KeyedSet; clone(): KeyedSet; get [Symbol.toStringTag](): string; } declare class Set$2 extends KeyedSet { static isSet(x: any): x is Set$2; static __from_preserve__(v: Value): undefined | Set$2; } declare function encodeSetOn(s: IdentitySet, encoder: Encoder, encodeV: (v: V, encoder: Encoder) => void): void; declare function writeSetOn(s: IdentitySet, w: Writer, writeV: (v: V, w: Writer) => void): void; interface DecoderOptions { includeAnnotations?: boolean; } interface DecoderEmbeddedOptions extends DecoderOptions { embeddedDecode?: EmbeddedTypeDecode; } interface TypedDecoder { atEnd(): boolean; mark(): any; restoreMark(m: any): undefined; skip(): void; next(): Value; withEmbeddedDecode(embeddedDecode: EmbeddedTypeDecode, body: (d: TypedDecoder) => R): R; nextBoolean(): boolean | undefined; nextDouble(): DoubleFloat | undefined; nextEmbedded(): T | undefined; nextSignedInteger(): number | bigint | undefined; nextString(): string | undefined; nextByteString(): Bytes | undefined; nextSymbol(): symbol | undefined; openRecord(): boolean; openSequence(): boolean; openSet(): boolean; openDictionary(): boolean; closeCompound(): boolean; } declare function asLiteral, Annotated>>(actual: Value, expected: E): E | undefined; declare class DecoderState { packet: Uint8Array; index: number; options: DecoderOptions; constructor(packet: BytesLike, options: DecoderOptions); get includeAnnotations(): boolean; write(data: BytesLike): void; atEnd(): boolean; mark(): number; restoreMark(m: number): undefined; shortGuard(body: () => R, short: () => R): R; nextbyte(): number; nextbytes(n: number): DataView; varint(): number; peekend(): boolean; nextint(n: number): number | bigint; nextbigint(n: number): bigint; wrap(v: Value): Value; unshiftAnnotation(a: Value, v: Annotated): Annotated; } declare class Decoder implements TypedDecoder { state: DecoderState; embeddedDecode: EmbeddedTypeDecode; constructor(state: DecoderState, embeddedDecode?: EmbeddedTypeDecode); constructor(packet?: BytesLike, options?: DecoderEmbeddedOptions); write(data: BytesLike): void; nextvalues(): Value[]; static dictionaryFromArray(vs: Value[]): Dictionary; next(): Value; try_next(): Value | undefined; atEnd(): boolean; mark(): any; restoreMark(m: any): undefined; skip(): void; withEmbeddedDecode(embeddedDecode: EmbeddedTypeDecode, body: (d: TypedDecoder) => R): R; skipAnnotations(f: (reset: () => undefined) => R): R; nextBoolean(): boolean | undefined; nextDouble(): DoubleFloat | undefined; nextEmbedded(): T | undefined; nextSignedInteger(): number | bigint | undefined; nextString(): string | undefined; nextByteString(): Bytes | undefined; nextSymbol(): symbol | undefined; openRecord(): boolean; openSequence(): boolean; openSet(): boolean; openDictionary(): boolean; closeCompound(): boolean; } declare function decode(bs: BytesLike, options?: DecoderEmbeddedOptions): Value; declare function decodeWithAnnotations(bs: BytesLike, options?: DecoderEmbeddedOptions): Annotated; interface ReaderStateOptions { includeAnnotations?: boolean; name?: string | Position; } interface ReaderOptions extends ReaderStateOptions { embeddedDecode?: EmbeddedTypeDecode; } declare const NUMBER_RE: RegExp; declare class ReaderState { buffer: string; pos: Position; index: number; discarded: number; options: ReaderStateOptions; constructor(buffer: string, options: ReaderStateOptions); error(message: string, pos: Position): never; get includeAnnotations(): boolean; copyPos(): Position; write(data: string): void; atEnd(): boolean; peek(): string; advance(): number; nextchar(): string; nextcharcode(): number; skipws(skipCommas?: boolean): void; readHex2(): number; readHex4(): number; readHexBinary(): Bytes; readHexFloat(): DoubleFloat; readBase64Binary(): Bytes; requireDelimiter(prefix: string): void; static readonly DELIMITERS = "(){}[]<>\"';,@#:"; delimiterFollows(): boolean; readRawSymbolOrNumber(acc: string): number | bigint | symbol | DoubleFloat; readStringlike(xform: (ch: string) => E, finish: (acc: E[]) => R, terminator: string, hexescape: string, hex: () => E): R; readString(terminator: string): string; readLiteralBinary(): Bytes; readCommentLine(): string; } declare const genericEmbeddedTypeDecode: EmbeddedTypeDecode; declare const neverEmbeddedTypeDecode: EmbeddedTypeDecode; declare class ReaderBase { state: ReaderState; embeddedType: EmbeddedTypeDecode; constructor(state: ReaderState, embeddedType: EmbeddedTypeDecode); constructor(buffer: string, options?: ReaderOptions); write(data: string): void; } declare class Reader$1 extends ReaderBase { readCommentLine(): Value; wrap(v: Value, pos: Position): Value; annotateNextWith(v: Value): Value; readToEnd(): Array>; next(): Value; seq(skipCommas: boolean, acc: S, update: (v: Value, acc: S) => void, ch: string): S; readSequence(ch: string, skipCommas: boolean): Array>; readDictionary(): Dictionary; readSet(): Set$2; } declare const IsEmbedded: unique symbol; interface Embeddable { readonly [IsEmbedded]: true; } declare function isEmbedded(v: any): v is T; type EmbeddedTypeEncode = { encode(s: EncoderState, v: T): void; }; type EmbeddedTypeDecode = { decode(s: DecoderState): T; fromValue(v: Value, options: ReaderStateOptions): T; }; type EmbeddedType = EmbeddedTypeEncode & EmbeddedTypeDecode; declare class Embedded$1 { readonly value: T; get [IsEmbedded](): true; constructor(value: T); equals(other: any): boolean; } declare class GenericEmbedded { readonly generic: Value; get [IsEmbedded](): true; constructor(generic: Value); equals(other: any, is: (a: any, b: any) => boolean): boolean; toString(): string; } declare const IsPreservesAnnotated: unique symbol; declare function isAnnotated(x: any): x is Annotated; declare function is(a: any, b: any): boolean; interface Position { line?: number; column?: number; pos: number; name?: string; } declare function newPosition(name?: string): Position; declare function updatePosition(p: Position, ch: string): boolean; declare function formatPosition(p: Position | null | string): string; declare class Annotated implements Preservable, PreserveWritable { readonly annotations: Array>; readonly pos: Position | null; readonly item: Value; constructor(item: Value, pos?: Position); __as_preserve__(): Value; static __from_preserve__(v: Value): undefined | Annotated; __preserve_on__(encoder: Encoder): void; __preserve_text_on__(w: Writer): void; toString(): string; equals(other: any): boolean; get [IsPreservesAnnotated](): boolean; static isAnnotated(x: any): x is Annotated; } declare function annotate(v0: Value, ...anns: Value[]): Annotated; declare function annotations(v: Value): Array>; declare function position(v: Value): Position | null; declare function decodeBase64(s: string): Uint8Array; declare function encodeBase64(bs: Uint8Array): string; type ErrorType = 'DecodeError' | 'EncodeError' | 'ShortPacket'; declare const ErrorType: unique symbol; declare abstract class PreservesCodecError { abstract get [ErrorType](): ErrorType; static isCodecError(e: any, t: ErrorType): e is PreservesCodecError; } declare class DecodeError extends Error { readonly pos: Position | undefined; get [ErrorType](): ErrorType; constructor(message: string, pos?: Position); static isDecodeError(e: any): e is DecodeError; } declare class EncodeError extends Error { get [ErrorType](): ErrorType; static isEncodeError(e: any): e is EncodeError; readonly irritant: any; constructor(message: string, irritant: any); } declare class ShortPacket extends DecodeError { get [ErrorType](): ErrorType; static isShortPacket(e: any): e is ShortPacket; } declare function isCompound(x: Value): x is Compound$1; declare function isSequence(x: Value): x is Array>; declare const genericEmbeddedType: EmbeddedType; declare const neverEmbeddedType: EmbeddedType; type Tuple = Array | [T]; type RecordGetters = { [K in string & keyof Fs]: (r: R) => Fs[K]; }; type CtorTypes> = { [K in keyof Names]: Fs[keyof Fs & Names[K]]; } & any[]; interface RecordConstructor, Fs, Names extends Tuple, T extends Embeddable = GenericEmbedded> { (...fields: CtorTypes): Record$1, T>; constructorInfo: RecordConstructorInfo; isClassOf(v: any): v is Record$1, T>; _: RecordGetters, T>>; fieldNumbers: { [K in string & keyof Fs]: number; }; } interface RecordConstructorInfo, T extends Embeddable = GenericEmbedded> { label: L; arity: number; } type InferredRecordType> = L extends symbol ? (FieldsType extends Tuple> ? (Exclude extends symbol ? Record$1 : Record$1) : (FieldsType extends Tuple> ? Record$1 : "TYPE_ERROR_cannotInferFieldsType" & [never])) : L extends Value ? (FieldsType extends Tuple> ? Record$1 : "TYPE_ERROR_cannotMatchFieldsTypeToLabelType" & [never]) : "TYPE_ERROR_cannotInferEmbeddedType" & [never]; type Record$1, FieldsType extends Tuple>, T extends Embeddable = GenericEmbedded> = FieldsType & { label: LabelType; }; declare function Record$1>(label: L, fields: FieldsType): InferredRecordType; declare namespace Record$1 { function isRecord, FieldsType extends Tuple>, T extends Embeddable = GenericEmbedded>(x: any): x is Record$1; function constructorInfo, FieldsType extends Tuple>, T extends Embeddable = GenericEmbedded>(r: Record$1): RecordConstructorInfo; function isClassOf, FieldsType extends Tuple>, T extends Embeddable = GenericEmbedded>(ci: RecordConstructorInfo, v: any): v is Record$1; function makeConstructor(): (, Names extends Tuple>(label: L, fieldNames: Names) => RecordConstructor); } declare enum ValueClass { Boolean = 0, Double = 1, SignedInteger = 2, String = 3, ByteString = 4, Symbol = 5, Record = 6, Sequence = 7, Set = 8, Dictionary = 9, Embedded = 10, Annotated = 11 } type Fold> = (v: Value) => R; interface FoldMethods { boolean(b: boolean): R; double(f: number): R; integer(i: number | bigint): R; string(s: string): R; bytes(b: Bytes): R; symbol(s: symbol): R; record(r: Record$1, Tuple>, T>, k: Fold): R; array(a: Array>, k: Fold): R; set(s: Set$2, k: Fold): R; dictionary(d: DictionaryMap, k: Fold): R; annotated(a: Annotated, k: Fold): R; embedded(t: T, k: Fold): R; } declare class VoidFold implements FoldMethods { boolean(_b: boolean): void; double(_f: number): void; integer(_i: number | bigint): void; string(_s: string): void; bytes(_b: Bytes): void; symbol(_s: symbol): void; record(r: Record$1, Tuple>, T>, k: Fold): void; array(a: Value[], k: Fold): void; set(s: Set$2, k: Fold): void; dictionary(d: DictionaryMap, k: Fold): void; annotated(a: Annotated, k: Fold): void; embedded(_t: T, _k: Fold): void; } declare class ForEachEmbedded extends VoidFold { readonly f: (t: T, k: Fold) => void; constructor(f: (t: T, k: Fold) => void); embedded(t: T, k: Fold): void; } declare abstract class ValueFold implements FoldMethods> { boolean(b: boolean): Value; double(f: number): Value; integer(i: number | bigint): Value; string(s: string): Value; bytes(b: Bytes): Value; symbol(s: symbol): Value; record(r: Record$1, Tuple>, T>, k: Fold>): Value; array(a: Value[], k: Fold>): Value; set(s: Set$2, k: Fold>): Value; dictionary(d: DictionaryMap, k: Fold>): Value; annotated(a: Annotated, k: Fold>): Value; abstract embedded(t: T, k: Fold>): Value; } declare class IdentityFold extends ValueFold { embedded(t: T, _k: Fold>): Value; } declare class MapFold extends ValueFold { readonly f: (t: T) => Value; constructor(f: (t: T) => Value); embedded(t: T, _k: Fold>): Value; } declare function valueClass(v: Value): ValueClass; declare const IDENTITY_FOLD: IdentityFold; declare function fold(v: Value, o: FoldMethods): R; declare function mapEmbeddeds(v: Value, f: (t: T) => Value): Value; declare function forEachEmbedded(v: Value, f: (t: T, k: Fold) => void): void; declare function merge(mergeEmbeddeds: (a: T, b: T) => T | undefined, item0: Value, ...items: Array>): Value; declare function typeCode(v: Value): number; declare function compare(a: Value, b: Value, compare_embedded?: (a: T, b: T) => number): number; declare function unannotate(v: Value): Value; declare function peel(v: Value): Value; declare function strip(v: Value, depth?: number): Value; declare function parse(buffer: string, options?: ReaderOptions): Value; declare function parseAll(buffer: string, options?: ReaderOptions): Value[]; declare const stringifyEmbeddedWrite: { write(s: WriterState, v: any): void; }; declare function stringify(x: any, options?: WriterOptions): string; declare function preserves(pieces: TemplateStringsArray, ...values: any[]): string; type Expr = SimpleExpr | Punct; type SimpleExpr = Atom | Compound | Embedded; type Positioned = { position: Position; item: I; annotations?: Annotations; }; declare class Punct { text: string; constructor(text: string); __as_preserve__(): Value; isComma(): boolean; static isComma(v: Expr): boolean; isColon(n?: number): boolean; static isColon(v: Expr, n?: number): boolean; } declare class Embedded { expr: SimpleExpr; annotations?: Annotations | undefined; constructor(expr: SimpleExpr, annotations?: Annotations | undefined); __as_preserve__(): Value; } declare class BaseCompound { positions: Position[]; exprs: I[]; annotations?: Annotations[]; get(i: number): Positioned | undefined; push(p: Positioned): true; push(expr: I, position: Position, annotations?: Annotations): true; _ensureAnnotations(): Annotations[]; _annotationsAt(index: number): Annotations; preservesValues(): Value[]; __as_preserve__(): Value; map(f: (item: Positioned, index: number) => R, offset?: number): R[]; [Symbol.iterator](): IterableIterator>; } declare class Document extends BaseCompound { } declare class Annotations extends BaseCompound { wrap(v: Value): Value; } type CompoundVariant = 'sequence' | 'record' | 'block' | 'group' | 'set'; declare abstract class Compound extends BaseCompound { abstract get variant(): CompoundVariant; __as_preserve__(): Value; } declare class Sequence extends Compound { get variant(): CompoundVariant; } declare class Record extends Compound { get variant(): CompoundVariant; } declare class Block extends Compound { get variant(): CompoundVariant; } declare class Group extends Compound { get variant(): CompoundVariant; } declare class Set$1 extends Compound { get variant(): CompoundVariant; } declare class Reader extends ReaderBase { nextDocument(howMany?: 'all' | 'one'): Document; readCompound(c: Compound, terminator: string): Compound; readSimpleExpr(c: BaseCompound): boolean; readExpr(c: BaseCompound, terminator?: string | null): boolean; _checkTerminator(actual: string, expected: string | null, startPos: Position): false; _readInto(c: BaseCompound, acceptPunct: boolean, terminator?: string | null): boolean; } interface AsPreservesOptions { onGroup?: (g: Positioned) => Value; onEmbedded?: (e: Positioned, walk: (p: Positioned) => Value) => Value; error?: (tag: string, position: Position) => Value; } declare function asPreserves(p: Positioned, options?: AsPreservesOptions): Value; type pexpr_Annotations = Annotations; declare const pexpr_Annotations: typeof Annotations; type pexpr_AsPreservesOptions = AsPreservesOptions; type pexpr_BaseCompound = BaseCompound; declare const pexpr_BaseCompound: typeof BaseCompound; type pexpr_Block = Block; declare const pexpr_Block: typeof Block; type pexpr_Compound = Compound; declare const pexpr_Compound: typeof Compound; type pexpr_CompoundVariant = CompoundVariant; type pexpr_Document = Document; declare const pexpr_Document: typeof Document; type pexpr_Embedded = Embedded; declare const pexpr_Embedded: typeof Embedded; type pexpr_Expr = Expr; type pexpr_Group = Group; declare const pexpr_Group: typeof Group; type pexpr_Positioned = Positioned; type pexpr_Punct = Punct; declare const pexpr_Punct: typeof Punct; type pexpr_Reader = Reader; declare const pexpr_Reader: typeof Reader; type pexpr_Record = Record; declare const pexpr_Record: typeof Record; type pexpr_Sequence = Sequence; declare const pexpr_Sequence: typeof Sequence; type pexpr_SimpleExpr = SimpleExpr; declare const pexpr_asPreserves: typeof asPreserves; declare namespace pexpr { export { pexpr_Annotations as Annotations, type pexpr_AsPreservesOptions as AsPreservesOptions, pexpr_BaseCompound as BaseCompound, pexpr_Block as Block, pexpr_Compound as Compound, type pexpr_CompoundVariant as CompoundVariant, pexpr_Document as Document, pexpr_Embedded as Embedded, type pexpr_Expr as Expr, pexpr_Group as Group, type pexpr_Positioned as Positioned, pexpr_Punct as Punct, pexpr_Reader as Reader, pexpr_Record as Record, pexpr_Sequence as Sequence, Set$1 as Set, type pexpr_SimpleExpr as SimpleExpr, pexpr_asPreserves as asPreserves }; } declare function preserves_spec_version(): string; declare global { interface ArrayConstructor { __from_preserve__(v: Value): undefined | Array>; } } declare const _Array: ArrayConstructor; type _Array = Array; declare const _Symbol: SymbolConstructor; type _Symbol = Symbol; export { Annotated, _Array as Array, type Atom, Bytes, type BytesLike, type Canonicalizer, type Compound$1 as Compound, type CompoundKey, constants as Constants, type CtorTypes, DecodeError, Decoder, type DecoderEmbeddedOptions, type DecoderOptions, DecoderState, Dictionary, DictionaryMap, DictionaryType, Double, DoubleFloat, type Embeddable, Embedded$1 as Embedded, type EmbeddedType, type EmbeddedTypeDecode, type EmbeddedTypeEncode, type EmbeddedWriter, type Encodable, EncodableDictionary, EncodableSet, EncodeError, Encoder, type EncoderEmbeddedOptions, type EncoderOptions, EncoderState, type Equivalence, ErrorType, FlexMap, FlexSet, Float, FloatType, type Fold, type FoldMethods, ForEachEmbedded, type FromJSOptions, GenericEmbedded, IDENTITY_FOLD, IdentityEmbeddedTypeEncode, IdentityFold, IdentityMap, IdentitySet, type InferredRecordType, IsEmbedded, IsMap, IsPreservesAnnotated, IsPreservesBytes, IsSet, JsDictionary, KeyedDictionary, KeyedSet, MapFold, NUMBER_RE, pexpr as Pexpr, type Position, type Preservable, type PreserveWritable, PreservesCodecError, Reader$1 as Reader, ReaderBase, type ReaderOptions, ReaderState, type ReaderStateOptions, Record$1 as Record, type RecordConstructor, type RecordConstructorInfo, type RecordGetters, Set$2 as Set, ShortPacket, _Symbol as Symbol, type Tuple, type TypedDecoder, type Value, ValueClass, ValueFold, VoidFold, type Writable, Writer, type WriterOptions, WriterState, type WriterStateOptions, _iterMap, annotate, annotations, asLiteral, canonicalEncode, canonicalString, compare, dataview, decode, decodeBase64, decodeWithAnnotations, encode, encodeBase64, encodeDictionaryOn, encodeSetOn, encodeWithAnnotations, floatValue, floatlikeString, fold, forEachEmbedded, formatPosition, fromJS, fromJS_options, genericEmbeddedType, genericEmbeddedTypeDecode, genericEmbeddedTypeEncode, hexDigit, is, isAnnotated, isCompound, isEmbedded, isPreservable, isPreserveWritable, isSequence, mapEmbeddeds, merge, neverEmbeddedType, neverEmbeddedTypeDecode, neverEmbeddedTypeEncode, newPosition, parse, parseAll, peel, position, preserves, preserves_spec_version, stringify, stringifyEmbeddedWrite, strip, typeCode, unannotate, underlying, unhexDigit, updatePosition, valueClass, writeDictionaryOn, writeSetOn };