math.d.ts

133.5 kB · typescript · 2129 lines

1export { default, initSync } from "./pkg/math/mrlyjs_math.js";23/** An rgba color as four bytes. */4export type Color = [number, number, number, number];5/** A tensor: its shape and its flat data as a typed array of its dtype. */6export interface Tensor {7    shape: number[];8    data: Uint8Array | Uint16Array | Uint32Array | Int32Array;9}10/** A cell: the shape, the type bytes, and the flat rgba colors and the tags when present. */11export interface Cell {12    shape: number[];13    types: Uint8Array | Uint16Array | Uint32Array | Int32Array;14    colors?: Uint8Array;15    tags?: Uint8Array | Uint16Array | Uint32Array | Int32Array;16}17/** A hex cell: a flat cell with its projection, orientation and start row. */18export interface Cell6d {19    cell: Cell;20    projection: "Iso" | "Pro" | "Cut";21    orientation: "Horizontal" | "Vertical";22    start: number;23}24/** A color inside plain data, serde's form. */25export interface ColorData {26    r: number;27    g: number;28    b: number;29    a: number;30}31/** A tensor inside plain data, serde's form. */32export interface TensorData {33    shape: number[];34    data: { U8: number[] } | { U16: number[] } | { U32: number[] } | { I32: number[] };35}36/** A cell inside plain data, serde's form. */37export interface CellData {38    types: TensorData;39    colors?: number[][];40    tags?: TensorData;41}42/** A hex cell inside plain data, serde's form. */43export interface Cell6dData {44    cell: { cell: CellData };45    projection: "Iso" | "Pro" | "Cut";46    orientation: "Horizontal" | "Vertical";47    start: number;48}49/** A seeded random stream, opened from a number or a bigint seed. */50export class Rng {51    constructor(seed: number | bigint | string);52    free(): void;53    /** Draws a float at or above zero and below one. */54    unit(): number;55    /** Draws an integer below n, or zero when n is zero. */56    below(n: number): number;57    /** Draws an integer between lo and hi inclusive, or lo when hi is not above lo. */58    range(lo: number, hi: number): number;59    /** Draws a fair coin flip. */60    boolean(): boolean;61    /** Returns true with probability p. */62    chance(p: number): boolean;63    /** Draws amount distinct indices below length, or every index when amount is larger. */64    sample_indices(length: number, amount: number): Uint32Array;65    /** Draws one item of the array, the same draw as Rust's choice. */66    choice<T>(items: ArrayLike<T>): T;67    /** Shuffles the array in place, the same permutation as Rust's shuffle. */68    shuffle<T>(items: T[]): void;69}70export declare namespace atoms {71    /** Builds an n by n carpet, on where at most one coordinate is odd. */72    export function carpet_2d(n: number): Tensor;73    /** Builds an n by n by n carpet, on where at most one coordinate is odd. */74    export function carpet_3d(n: number): Tensor;75    /** Builds a carpet of the given side at any rank, on where at most one coordinate is odd. */76    export function carpet_nd(n: number, rank: number): Tensor;77    /** Builds an n by n dust, on where both coordinates are even. */78    export function dust_2d(n: number): Tensor;79    /** Builds an n by n by n dust, on where all three coordinates are even. */80    export function dust_3d(n: number): Tensor;81    /** Builds a dust of the given side at any rank, on where every coordinate is even. */82    export function dust_nd(n: number, rank: number): Tensor;83    /** Builds an n by n line, free on axis 1, on along the odd rows. */84    export function hline_2d(n: number): Tensor;85    /** Builds an n by n tree, free on axis 1, on along the even rows. */86    export function htree_2d(n: number): Tensor;87    /** Builds a line of the given side at any rank, odd on every axis but the free one; an axis past the rank frees none. */88    export function line_nd(n: number, rank: number, axis: number): Tensor;89    /** Builds an n by n net, on where at least one coordinate is odd. */90    export function net_2d(n: number): Tensor;91    /** Builds an n by n by n net, on where at least two coordinates are odd. */92    export function net_3d(n: number): Tensor;93    /** Builds a net of the given side at any rank, on where the odd coordinates plus one reach the rank. */94    export function net_nd(n: number, rank: number): Tensor;95    /** Builds an n by n tensor where each cell turns on with probability density, drawn from the stream. */96    export function noise_2d(n: number, density: number, rng: Rng): Tensor;97    /** Builds an n by n by n tensor where each cell turns on with probability density, drawn from the stream. */98    export function noise_3d(n: number, density: number, rng: Rng): Tensor;99    /** Builds an n by n tensor of ones. */100    export function ones_2d(n: number): Tensor;101    /** Builds an n by n by n tensor of ones. */102    export function ones_3d(n: number): Tensor;103    /** Builds an n by n point, on where both coordinates are odd. */104    export function point_2d(n: number): Tensor;105    /** Builds an n by n by n point, on where all three coordinates are odd. */106    export function point_3d(n: number): Tensor;107    /** Builds a point of the given side at any rank, on where every coordinate is odd. */108    export function point_nd(n: number, rank: number): Tensor;109    /** Builds an n by n star, on where exactly one coordinate is odd. */110    export function star_2d(n: number): Tensor;111    /** Builds an n by n by n star, on where exactly one coordinate is odd. */112    export function star_3d(n: number): Tensor;113    /** Builds a star of the given side at any rank, on where exactly one coordinate is odd. */114    export function star_nd(n: number, rank: number): Tensor;115    /** Builds a tree of the given side at any rank, even on every axis but the free one; an axis past the rank frees none. */116    export function tree_nd(n: number, rank: number, axis: number): Tensor;117    /** Builds an n by n line, free on axis 0, on along the odd columns. */118    export function vline_2d(n: number): Tensor;119    /** Builds an n by n void, on where both coordinates share one parity. */120    export function void_2d(n: number): Tensor;121    /** Builds an n by n by n void, on where all three coordinates share one parity. */122    export function void_3d(n: number): Tensor;123    /** Builds a void of the given side at any rank, on where every coordinate shares one parity. */124    export function void_nd(n: number, rank: number): Tensor;125    /** Builds an n by n tree, free on axis 0, on along the even columns. */126    export function vtree_2d(n: number): Tensor;127    /** Builds an n by n by n line, free on axis 0, its rods running along x. */128    export function xline_3d(n: number): Tensor;129    /** Builds an n by n by n tree, free on axis 0, its beams running along x. */130    export function xtree_3d(n: number): Tensor;131    /** Builds an n by n by n line, free on axis 1, its rods running along y. */132    export function yline_3d(n: number): Tensor;133    /** Builds an n by n by n tree, free on axis 1, its beams running along y. */134    export function ytree_3d(n: number): Tensor;135    /** Builds an n by n tensor of zeros. */136    export function zeros_2d(n: number): Tensor;137    /** Builds an n by n by n tensor of zeros. */138    export function zeros_3d(n: number): Tensor;139    /** Builds an n by n by n line, free on axis 2, its rods running along z. */140    export function zline_3d(n: number): Tensor;141    /** Builds an n by n by n tree, free on axis 2, its beams running along z. */142    export function ztree_3d(n: number): Tensor;143}144export declare namespace bang {145    /** Builds the universe of a dimension. */146    export function bang(dimension: number): bang.Universe;147    /** Unpacks a code into its filled residue corners. */148    export function code_to_corners(code: string | number | bigint, dimension: number, base: number): Uint8Array[];149    /** Returns the binary corners of a dimension in code order. */150    export function corners(dimension: number): Uint8Array[];151    /** Packs filled residue corners back into their code. */152    export function corners_to_code(filled: ArrayLike<number>[], dimension: number, base: number): string;153    /** Returns the code of the design filled wherever a corner's residue sum lands in the levels. */154    export function levels_code(dimension: number, base: number, levels: ArrayLike<number>): string;155    /** Composes the layers into one mixed-design cell by the ordered Kronecker product, first layer outermost. */156    export function magic(layers: bang.MagicLayer[]): Tensor;157    /** Composes JSON-named layers in order. */158    export function magic_named(layers: [string, number][]): Tensor;159    /** Builds the tile sources a catalog names at a dimension. */160    export function sources(catalog: gen.recipe.Catalog, dimension: number): gen.recipe.Source[];161    /** Returns the full symmetry group as axis permutations paired with flip patterns. */162    export function symmetries(dimension: number): [Uint32Array, Uint8Array][];163    /** Returns whether no two filled corners of a code sit at Hamming distance one. */164    export function total_exposure(code: string | number | bigint, dimension: number): boolean;165    /** Returns whether a code fills the all-even corner, the rule that touches every grid corner at odd side. */166    export function touches_every_corner(code: string | number | bigint, dimension: number): boolean;167    /** Returns the canonical design codes of a dimension, computed once and cached for the process. */168    export function universe_codes(dimension: number): string[];169    export interface DesignData {170        /** The design's code. */171        i: bigint;172        /** The design's dimension. */173        dimension: number;174        /** Whether this code is the smallest in its orbit. */175        canonical: boolean;176        /** The smallest code in the orbit. */177        class_rep: bigint;178        /** The number of codes in the orbit. */179        orbit_size: number;180    }181    /** A single design with its place in the orbit structure. */182    export class Design {183        private constructor();184        free(): void;185        /** Reads the Design from its plain data. */186        static from(data: DesignData): Design;187        /** Writes the Design as plain data. */188        toJSON(): DesignData;189        /** The design's code. */190        get i(): string;191        set i(value: string | number | bigint);192        /** The design's dimension. */193        get dimension(): number;194        set dimension(value: number);195        /** Whether this code is the smallest in its orbit. */196        get canonical(): boolean;197        set canonical(value: boolean);198        /** The smallest code in the orbit. */199        get class_rep(): string;200        set class_rep(value: string | number | bigint);201        /** The number of codes in the orbit. */202        get orbit_size(): number;203        set orbit_size(value: number);204        /** Returns the design's algebraic normal form as a string. */205        anf(): string;206        /** Returns the design's algebraic degree, or -1 for the zero design. */207        degree(): number;208        /** Returns the design's name as a line of prose, `bang dim 2, code 7`. */209        name(): string;210        /** Returns the design's filled corners in sorted order. */211        rule(): Uint8Array[];212    }213    /** One ordered layer of a magic composition: a coded design at its own side number. */214    export interface MagicLayer {215        /** The layer's coded design. */216        design: name.BangData;217        /** The layer's side number. */218        number: number;219    }220    export const MagicLayer: {221        /** Pins a design to the side number it renders at. */222        "new"(design: name.Bang, number: number): bang.MagicLayer;223    };224    export type UniverseData = Record<string, unknown>;225    /** The complete enumeration of one dimension's designs and orbits. */226    export class Universe {227        /** Enumerates every orbit of a dimension from 1 to 4. */228        constructor(dimension: number);229        free(): void;230        /** Reads the Universe from its plain data. */231        static from(data: UniverseData): Universe;232        /** Writes the Universe as plain data. */233        toJSON(): UniverseData;234        /** The universe's dimension. */235        get dimension(): number;236        set dimension(value: number);237        /** The number of codes in the universe. */238        get total(): number;239        set total(value: number);240        /** Returns every design in code order. */241        all(): bang.Design[];242        /** Returns the designs whose codes lead their orbits. */243        canonical(): bang.Design[];244        /** Returns the design at a code with its precomputed orbit facts. */245        design(code: string | number | bigint): bang.Design;246        /** Returns the number of distinct orbits. */247        distinct(): number;248    }249    export namespace baseq {250        /** Returns the distinct rotation and reflection maps of a base-q axis. */251        export function axis_maps(base: number): Uint32Array[];252        /** Returns the distinct one-dimensional design counts for bases 1 through max_base. */253        export function bracelets(max_base: number): string[];254        /** Returns the least code of the design's orbit. */255        export function canonical(group: ArrayLike<number>[], code: string | number | bigint): string;256        /** Carries a code through one group element. */257        export function carry(element: ArrayLike<number>, code: string | number | bigint): string;258        /** Returns the fill-class counts for dimensions 1 through max_dimension. */259        export function class_sequence(max_dimension: number): string[];260        /** Counts the fill classes of a dimension, the popcount profiles a base-2 design can have: one more than the corners of each weight, multiplied over the weights, A129824 at the dimension. */261        export function classes(dimension: number): string;262        /** Counts base-q designs distinct under symmetry. */263        export function distinct_designs(base: number, dimension: number): string;264        /** Returns the collapsed fill count at an even side number. */265        export function even_fill_is_balanced(number: number, dimension: number, popcount: string | number | bigint): string;266        /** Returns the filled-cell count of a binary design at a side number, folded from its filled corners. */267        export function fill_from_corners(filled: ArrayLike<number>[], number: number, dimension: number): string;268        /** Returns the symmetry group as cell maps, each sending the cell at index `i` to `element[i]`. */269        export function group(base: number, dimension: number): Uint32Array[];270        /** Returns the symmetry group order counted from the enumerated axis maps. */271        export function group_order(base: number, dimension: number): string;272        /** Returns every code a design reaches under the group. */273        export function orbit(group: ArrayLike<number>[], code: string | number | bigint): string[];274        /** Returns the closed-form group order the axis-map count must match. */275        export function predicted_group_order(base: number, dimension: number): string;276        /** Walks every code of a base and dimension and returns each orbit's least code with the orbit's size. */277        export function representatives(base: number, dimension: number): [string, number][];278        /** Returns the distinct-design counts for dimensions 1 through max_dimension. */279        export function sequence(base: number, max_dimension: number): string[];280        /** Returns the raw design count before symmetry, two to the number of cells. */281        export function total_designs(base: number, dimension: number): string;282        /** The most cells a code walk visits, so that the walk stays within `2^20` codes. */283        export function WALK_LIMIT(): number;284    }285    export namespace catalog {286        /** Returns the anti designs for a dimension. */287        export function antis(dimension: number): gen.recipe.Design[];288        /** The five antis of the plane, the complements of the five classics in order. */289        export function ANTIS_2D(): gen.recipe.Design[];290        /** The six antis of the cube: point, dust, the three lines and the star. */291        export function ANTIS_3D(): gen.recipe.Design[];292    }293    export namespace code {294        /** Returns the bitmask the code carries. */295        export function get(code: string | number | bigint): string;296    }297    export namespace factory {298        /** Renders a coded design to a tensor at its side number, dimension, base and fractal level. */299        export function create(code: string | number | bigint, number: number, dimension: number, base: number, level: number): Tensor;300        /** Renders a design straight from its filled residue corners. */301        export function create_from_corners(filled: ArrayLike<number>[], number: number, dimension: number, base: number, level: number): Tensor;302        /** Renders a design from its canonical JSON name. */303        export function create_named(spec: string, number: number, level: number): Tensor;304        /** Returns every base-q residue corner of a dimension in row-major order. */305        export function residue_corners(dimension: number, base: number): Uint8Array[];306        /** Returns the code count of a dimension and base, two to the number of corners. */307        export function total_codes(dimension: number, base: number): string;308    }309    export namespace universe {310        /** Returns the algebraic normal form coefficients of a code, one per corner. */311        export function anf(code: string | number | bigint, dimension: number): Uint8Array;312        /** Formats the algebraic normal form of a code as a sum of monomials. */313        export function anf_string(code: string | number | bigint, dimension: number): string;314        /** Applies a symmetry element to a corner. */315        export function apply(element: [ArrayLike<number>, ArrayLike<number>], corner: ArrayLike<number>): Uint8Array;316        /** Returns the bit position a binary corner occupies in a code. */317        export function corner_index(corner: ArrayLike<number>): number;318        /** Returns the algebraic degree of a code, or -1 for the zero design. */319        export function degree(code: string | number | bigint, dimension: number): number;320        /** Returns every code a design reaches under the full symmetry group. */321        export function orbit(code: string | number | bigint, dimension: number): string[];322        /** Returns every permutation of 0..n in sorted order. */323        export function permutations(n: number): Uint32Array[];324    }325    export namespace word {326        /** Counts the 4-connected components of a plane word without drawing it. */327        export function components(layers: bang.MagicLayer[]): string;328        /** Returns the constant-word component functional of a plane word's letter frequencies, */329        export function constant_functional(layers: bang.MagicLayer[]): number;330        /** Returns the scale dimension of a word, the sum of the log fills over the sum of the log sides. */331        export function dimension(layers: bang.MagicLayer[]): number;332        /** Returns the filled cells of a word, the product of its letter fills. */333        export function fill(layers: bang.MagicLayer[]): string;334        /** Lists the filled cells of every letter, the product of which is the word's fill. */335        export function fills(layers: bang.MagicLayer[]): string[];336        /** Reads one plane letter: its fill, its runs, the rows and columns that wrap into a */337        export function letter(layer: bang.MagicLayer): bang.word.Letter;338        /** Returns whether every letter renders at its own residue base, the native case where a */339        export function native(layers: bang.MagicLayer[]): boolean;340        /** Returns the shortest whole period of the letter list, its own length when no shorter block repeats. */341        export function period(layers: bang.MagicLayer[]): number;342        /** Folds a plane word letter by letter and returns the counts at every prefix. */343        export function prefixes(layers: bang.MagicLayer[]): bang.word.Counts[];344        /** Returns the prefix rates of a plane word in log two units, the component rate */345        export function rates(layers: bang.MagicLayer[]): [number, number][];346        /** Returns the side of a word, the product of its letter sides. */347        export function side(layers: bang.MagicLayer[]): string;348        /** Spells the first letters of a schedule over an ordered pair of letters. */349        export function spell(schedule: bang.word.Schedule, pair: [bang.MagicLayer, bang.MagicLayer], length: number): bang.MagicLayer[];350        /** Builds the carpet staircase word to the depth, the stacked prefixes `magic(3)`, */351        export function staircase(depth: number): bang.MagicLayer[];352        /** Returns the Thue-Morse letter at the place, the parity of its binary digit sum. */353        export function thue_morse(index: number): number;354        /** The counts a word carries at one prefix length. */355        export interface Counts {356            /** The side, the product of the prefix's letter sides. */357            side: bigint;358            /** The filled cells, the product of the prefix's letter fills. */359            fill: bigint;360            /** The 4-connected components. */361            components: bigint;362            /** The maximal horizontal runs of filled cells. */363            runs_h: bigint;364            /** The maximal vertical runs of filled cells. */365            runs_v: bigint;366        }367        /** The plane geometry of one letter, the numbers a word's counts fold through. */368        export interface Letter {369            /** The count of filled cells. */370            fill: bigint;371            /** The count of maximal horizontal runs of filled cells. */372            runs_h: bigint;373            /** The count of maximal vertical runs of filled cells. */374            runs_v: bigint;375            /** The count of rows whose first and last cells are both filled. */376            touch_h: bigint;377            /** The count of columns whose first and last cells are both filled. */378            touch_v: bigint;379            /** The count of 4-connected components. */380            components: bigint;381        }382        /** The named infinite schedules over an ordered pair of letters. */383        export type Schedule = "ThueMorse" | "Periodic" | "Constant";384        export const Schedule: {385            /** Returns every Schedule in canonical order. */386            all(): bang.word.Schedule[];387            /** Returns the letter frequencies the schedule tends to. */388            frequencies(schedule: bang.word.Schedule): [number, number];389            /** Returns the letter the schedule takes at the place, zero or one. */390            place(schedule: bang.word.Schedule, index: number): number;391        };392    }393}394export declare namespace cell {395    /** Grows a seed pattern into a cell, deepened to its fractal past level one. */396    export function grow(pattern: Tensor, level: number): Cell;397    /** Colors the cell through the given mapping and mode, defaulting to the standard palette by type. */398    export function paint(cell: Cell, custom?: Record<string, Color[]>, mode?: core.Mode, rng?: Rng): Cell;399    export namespace census {400        /** Counts the distinct unit edges the filled sites carry, the edge graph's branches. */401        export function edges(cell: Cell): number;402        /** Counts the faces of filled sites open to emptiness or the border. */403        export function exposure(cell: Cell): string;404        /** Counts the filled sites of the cell. */405        export function fills(cell: Cell): number;406        /** Counts the distinct corners the filled sites touch, the edge graph's nodes. */407        export function vertices(cell: Cell): number;408        /** Counts the empty sites of the cell. */409        export function voids(cell: Cell): number;410    }411    export namespace geometry {412        /** Merges same-shaped cells into one block laid out by the per-axis repetition counts. */413        export function merge_reps(cells: Cell[], reps: ArrayLike<number>): Cell;414        /** Writes the value into the cell wherever the tiled mask is nonzero. */415        export function perforate(mask: Tensor, cell: Cell, value: number): Cell;416    }417    export namespace models {418        /** Inverts the cell. */419        export function anti(cell: Cell): Cell;420        /** Maps each site to one at or above the threshold, zero below. */421        export function binarize(cell: Cell, threshold: number): Cell;422        /** Binarizes the cell at the threshold Otsu's method picks. */423        export function binarize_otsu(cell: Cell): Cell;424        /** Rounds each site to the mean of its masked neighborhood, wrapping on request. */425        export function blur(cell: Cell, mask: Tensor, wrap: boolean): Cell;426        /** Returns the Kronecker product of the two cells. */427        export function combine(cell: Cell, other: Cell): Cell;428        /** Returns the narrowest count dtype that fits the mask's popcount. */429        export function counting_dtype(mask: Tensor): core.Dtype;430        /** Returns the size of axis 0, the cube's leading axis. */431        export function depth(cell: Cell): number;432        /** Returns the narrowest unsigned dtype that holds the peak value. */433        export function dtype_for(peak: number | bigint): core.Dtype;434        /** Deepens the cell into its level-fold fractal. */435        export function fractal(cell: Cell, level: number): Cell;436        /** Returns the size of the axis before the last. */437        export function height(cell: Cell): number;438        /** Swaps filled and empty sites. */439        export function invert(cell: Cell): Cell;440        /** Tags each site with its ring distance from the center. */441        export function layers(cell: Cell): Cell;442        /** Tags each site with its count of masked neighbors matching the target, wrapping on request. */443        export function neighbors(cell: Cell, mask: Tensor, target: number, wrap: boolean): Cell;444        /** Builds a cell from an N-dimensional tensor of types. */445        export function new_(types: Tensor): Cell;446        /** Turns the cell into one of the 24 cube orientations. */447        export function orient(cell: Cell, index: number): Cell;448        /** Wraps the cell in count layers of the given value on every side. */449        export function pad(cell: Cell, count: number, value: number): Cell;450        /** Colors each site by its type through the mapping in the given mode. */451        export function paint(cell: Cell, mapping: Record<string, Color[]>, mode: core.Mode, rng?: Rng): Cell;452        /** Writes the value wherever the tiled mask is nonzero. */453        export function perforate(cell: Cell, mask: Tensor, value: number): Cell;454        /** Rotates the cell k quarter turns in the plane. */455        export function rotate(cell: Cell, k: number, axes?: [number, number]): Cell;456        /** Repeats the cell into a width-by-height array of copies. */457        export function tile(cell: Cell, width: number, height: number, depth?: number): Cell;458        /** Returns the tensor of types. */459        export function types(cell: Cell): Tensor;460        /** Returns the size of the last axis. */461        export function width(cell: Cell): number;462    }463    export namespace serializer {464        /** Reads a triply nested JSON array into layers of byte rows. */465        export function byte_cube(value: any): Uint8Array[][];466        /** Reads a nested JSON array into rows of bytes. */467        export function byte_grid(value: any): Uint8Array[];468        /** Reads a nested JSON array into rows of four-channel colors. */469        export function color_grid(value: any): Uint8Array[][];470        /** Reads a triply nested JSON array of counts into one flat run; a count must fit in thirty-two bits. */471        export function count_cube(value: any): BigInt64Array;472        /** Reads a nested JSON array of counts into one flat run; a count must fit in thirty-two bits. */473        export function count_grid(value: any): BigInt64Array;474        /** Parses JSON text into a value tree. */475        export function parse(text: string): any;476        /** Packs a flat run of counts into a tensor of the shape, at the narrowest dtype that holds them. */477        export function tag_layer(counts: ArrayLike<number | bigint>, shape: ArrayLike<number>): Tensor;478        /** Returns the types field of the data. */479        export function types_field(data: any): any;480    }481}482export declare namespace core {483    /** A rule that turns counter values into colors. */484    export type Colorizer = { Bins: { background: ColorData; ramp: ColorData[] } };485    /** The element widths a tensor can hold. */486    export type Dtype = "U8" | "U16" | "U32" | "I32";487    /** The ways paint picks a color within a type's palette. */488    export type Mode = "Type" | "Tag" | "Index" | "Enumerate" | "Random" | "Row" | "Column" | "Depth";489}490export declare namespace counts {491    /** Returns the centered hexagonal number at the index, the lattice points of a hexagon of side m-1. */492    export function centered_hexagonal(m: number): string;493    /** Returns the filled triangle count of the code's cut section at the given level, without rendering it. */494    export function cut_fills(code: string | number | bigint, number: number, level: number): string;495    /** Returns the empty triangle count of the code's cut section at the given level. */496    export function cut_voids(code: string | number | bigint, number: number, level: number): string;497    /** Returns the code's fractal dimension, the log of its one-level fill over the log of number. */498    export function dimension(code: string | number | bigint, number: number, base_dimension: number, base: number): number;499    /** Returns the branch count of the tile's level-fold Kronecker power, fitted to its two-term */500    export function edges_of_tile(tile: Tensor, level: number): string | undefined;501    /** Returns the exposed face count of the code's fractal in any dimension at the given level, folded from its corners. */502    export function exposure(code: string | number | bigint, number: number, dimension: number, level: number, base: number): string;503    /** Returns the exposed face count of the tile's level-fold Kronecker power in closed form, or none past a u128. */504    export function exposure_of_tile(tile: Tensor, level: number): string | undefined;505    /** Returns the coefficients of the recurrence the tile's exposure obeys. */506    export function exposure_recurrence(tile: Tensor): string[];507    /** Returns the filled cell count of the code's fractal at the given level, without rendering it. */508    export function fill(code: string | number | bigint, number: number, dimension: number, level: number, base: number): string;509    /** Sums each corner's position products into a base fill and raises it to the level. */510    export function fill_from_corners(filled: ArrayLike<number>[], number: number, _dimension: number, level: number, base: number): string;511    /** Returns the total cells of the grid, number to the dimension, to the level. */512    export function grid(number: number, dimension: number, level: number): string;513    /** Returns the fill ratio the code walks toward as the side number grows, reduced. */514    export function limit(code: string | number | bigint, dimension: number, level: number, base: number): [string, string];515    /** Counts, per axis, the adjacent filled pairs and the cross positions whose two end cells are both filled. */516    export function pairs(tile: Tensor): [string, string][];517    /** Counts the indices below number that equal residue modulo base. */518    export function positions(residue: number, number: number, base: number): string;519    /** Returns the filled triangle count of the code's pro projection at the given level, without rendering it. */520    export function pro_fills(code: string | number | bigint, number: number, level: number): string;521    /** Returns the empty triangle count of the code's pro projection at the given level. */522    export function pro_voids(code: string | number | bigint, number: number, level: number): string;523    /** Counts the filled cells of the tile's level-fold power on every diagonal plane `x_1 + ... + x_D = s`. */524    export function profile_of_tile(tile: Tensor, level: number): string[];525    /** Returns the filled fraction of the grid, or 0.0 for an empty grid. */526    export function ratio(code: string | number | bigint, number: number, dimension: number, level: number, base: number): number;527    /** Returns the exact filled fraction as a fraction of fill over grid, reduced. */528    export function rational(code: string | number | bigint, number: number, dimension: number, level: number, base: number): [string, string];529    /** Returns the exposed face count of the code's 3D fractal at the given level. */530    export function surface(code: string | number | bigint, number: number, level: number, base: number): string;531    /** Returns the empty cell count, grid minus fill. */532    export function void_(code: string | number | bigint, number: number, dimension: number, level: number, base: number): string;533    export interface ExposureData {534        /** The filled cells of the tile. */535        occupancy: bigint;536        /** The exposed faces of the tile. */537        exposed: bigint;538        /** Per axis, the adjacent filled pairs and the spanning positions. */539        axes: [bigint, bigint][];540    }541    /** The counts the exposure recurrence runs on: the filled cells and exposed faces of the tile, and per axis its adjacent pairs and spanning positions. */542    export class Exposure {543        private constructor();544        free(): void;545        /** Reads the Exposure from its plain data. */546        static from(data: ExposureData): Exposure;547        /** Writes the Exposure as plain data. */548        toJSON(): ExposureData;549        /** The filled cells of the tile. */550        get occupancy(): string;551        set occupancy(value: string | number | bigint);552        /** The exposed faces of the tile. */553        get exposed(): string;554        set exposed(value: string | number | bigint);555        /** Per axis, the adjacent filled pairs and the spanning positions. */556        get axes(): [string, string][];557        set axes(value: ([string | number | bigint, string | number | bigint])[]);558        /** Returns the exposed faces of the level-fold Kronecker power, or none past a u128. */559        at(level: number): string | undefined;560        /** Folds the counts from the filled residue corners at a side number, without rendering the tile. */561        static from_corners(filled: ArrayLike<number>[], number: number, dimension: number, base: number): counts.Exposure;562        /** Reads the counts off a rendered tile. */563        static of_tile(tile: Tensor): counts.Exposure;564        /** Returns the coefficients `c` of the recurrence `a(L) = c[0] a(L-1) + c[1] a(L-2) + ...` the exposure obeys. */565        recurrence(): string[];566    }567    export namespace diagonal {568        /** The widest side a profile spans. */569        export function WIDEST(): number;570    }571    export namespace ladder {572        /** The widest dimension the exact carry arithmetic reaches at the base. */573        export function cap(base: number): number;574        /** The carry matrix over the reachable carries `|c| <= (D-1)/2`, rows indexed by the carry out. */575        export function carry_matrix(base: number, dimension: number): string[][];576        /** The monic characteristic polynomial of a square integer matrix, highest power first. */577        export function characteristic(rows: ((string | number | bigint)[])[]): string[];578        /** The determinant of a square integer matrix, read off its characteristic polynomial. */579        export function determinant(rows: ((string | number | bigint)[])[]): string;580        /** The digit polynomial of the base-`q` middle-digit design in dimension `D`, lowest power first. */581        export function digit_polynomial(base: number, dimension: number): string[];582        /** The reflection-even block of the carry matrix, of size `ceil(D/2)`. */583        export function even_block(base: number, dimension: number): string[][];584        /** The count of level-one cells the design keeps, `f_D = (q - 1)^(D-1) (q - 1 + D)`. */585        export function fill(base: number, dimension: number): string;586        /** The counts `a_D(L)` of level-`L` cells meeting the central diagonal hyperplane, from `L = 0`. */587        export function ladder(base: number, dimension: number, levels: number): string[];588        /** The Perron root of a nonnegative square integer matrix. */589        export function perron(rows: ((string | number | bigint)[])[]): number;590        /** The sign of `log_q rho_D - (log_q f_D - 1)`, the slice sign law's reading, in exact integers. */591        export function sign(base: number, dimension: number): number;592        /** The Perron root over the modulus of the second eigenvalue, or none where the block is one wide. */593        export function spectral_ratio(base: number, dimension: number): number | undefined;594        /** The trace of a square integer matrix. */595        export function trace(rows: ((string | number | bigint)[])[]): string;596    }597    export namespace six {598        /** Returns the triangles of the full hexagon with side number to the level. */599        export function grid_triangles(number: number, level: number): string;600        /** Returns the boundary edge count of the solid slice, defined for odd number. */601        export function solid_slice_boundary(number: number): string;602        /** Returns the core edge count of the solid slice, defined for odd number. */603        export function solid_slice_core_edges(number: number): string;604        /** Returns the core node count of the solid slice, defined for odd number. */605        export function solid_slice_core_nodes(number: number): string;606        /** Returns the distinct triangle-edge count of the solid slice, defined for odd number. */607        export function solid_slice_edges(number: number): string;608        /** Returns the interior edge count of the solid slice, defined for odd number. */609        export function solid_slice_interior(number: number): string;610        /** Returns the triangle count of the solid slice, defined for odd number. */611        export function solid_slice_triangles(number: number): string;612        /** Returns the vertex count of the solid slice, defined for odd number. */613        export function solid_slice_vertices(number: number): string;614    }615}616export declare namespace gen {617    export namespace recipe {618        /** The pool of sources a tile may draw from. */619        export type Catalog = "Classics" | "Universe" | { Codes: bigint[] } | { Designs: gen.recipe.Design[] };620        /** The named designs a source can point at: the four classics and their four antis. */621        export type Design = "Carpet" | "Net" | "Htree" | "Vtree" | "Void" | "Xtree" | "Ytree" | "Ztree" | "Point" | "Dust" | "Hline" | "Vline" | "Star" | "Xline" | "Yline" | "Zline";622        /** The origin of one tile layer, a one-field json object. */623        export type Source = { design: gen.recipe.Design } | { code: bigint };624    }625}626export declare namespace graph {627    /** Takes the full census of a network. */628    export function census(network: graph.Network): graph.Census;629    /** Counts the connected components of the network. */630    export function components(network: graph.Network): number;631    /** Extracts the network of filled sites joined to their axis neighbors. */632    export function core_graph(grid: Tensor): graph.Network;633    /** Extracts the network of corners and edges outlining every filled site. */634    export function edge_graph(grid: Tensor): graph.Network;635    /** Estimates the box-counting dimension of the node cloud over a ladder of halving boxes, one rung per sample. */636    export function fractal_dimension(network: graph.Network, samples: number): number;637    /** Counts the nodes of degree three or more. */638    export function junctions(network: graph.Network): number;639    /** Extracts the largest connected piece as a network of its own, branches re-indexed. */640    export function largest_component(network: graph.Network): graph.Network;641    /** Tags every node by its degree, indexed like the node list. */642    export function roles(network: graph.Network): graph.Role[];643    /** Counts the nodes of degree one. */644    export function tips(network: graph.Network): number;645    /** Sums the straight-line lengths of every branch. */646    export function total_length(network: graph.Network): number;647    /** Extracts the core graph of the inverted grid, joining empty sites instead. */648    export function tunnel_graph(grid: Tensor): graph.Network;649    /** A link between two nodes. */650    export interface Branch {651        /** The index of the node the branch leaves. */652        parent: number;653        /** The index of the node the branch reaches. */654        child: number;655        /** The thickness of the branch. */656        radius: number;657    }658    /** The measurements of one network. */659    export interface Census {660        /** The node count. */661        nodes: number;662        /** The branch count. */663        branches: number;664        /** The count of degree-one nodes. */665        tips: number;666        /** The count of nodes of degree three or more. */667        junctions: number;668        /** The connected component count. */669        components: number;670        /** The summed branch length. */671        total_length: number;672        /** The box-counting dimension estimate. */673        fractal_dimension: number;674    }675    export type LayoutData = Record<string, unknown>;676    /** A force-directed layout: every node repels every other, every branch pulls its ends together, and a cooling cap on the move per tick lets the lattice settle. */677    export class Layout {678        /** Starts a layout from flat positions, `dim` floats per node, and the branch pairs. */679        constructor(positions: ArrayLike<number>, branches: [number, number][], dim: number, seed: number | bigint);680        free(): void;681        /** Returns the mean net force per node in units of `k` after the last tick. */682        energy(): number;683        /** Starts a layout from a network's own positions and branches. */684        static from_network(network: graph.Network, seed: number | bigint): graph.Layout;685        /** Returns the ideal branch length `k`. */686        ideal(): number;687        /** Returns the mean distance a node moved in the last tick. */688        moved(): number;689        /** Returns the node count. */690        nodes(): number;691        /** Returns the positions, `dim` floats per node. */692        positions(): Float64Array;693        /** Runs the ticks and returns the energy left: the mean net force per node in units of `k`. */694        step(ticks: number): number;695        /** Returns the cap on one node's move in the next tick. */696        temperature(): number;697        /** Returns the ticks stepped so far. */698        ticks(): number;699    }700    export interface NetworkData {701        /** The dimension every position must match. */702        dim: number;703        /** The nodes in insertion order. */704        nodes: graph.Node[];705        /** The branches in insertion order. */706        branches: graph.Branch[];707    }708    /** A spatial graph of nodes and branches. */709    export class Network {710        /** Builds an empty network of the given dimension. */711        constructor(dim: number);712        free(): void;713        /** Reads the Network from its plain data. */714        static from(data: NetworkData): Network;715        /** Writes the Network as plain data. */716        toJSON(): NetworkData;717        /** The dimension every position must match. */718        get dim(): number;719        set dim(value: number);720        /** The nodes in insertion order. */721        get nodes(): graph.Node[];722        set nodes(value: graph.Node[]);723        /** The branches in insertion order. */724        get branches(): graph.Branch[];725        set branches(value: graph.Branch[]);726        /** Appends a branch between two node indices. */727        add_branch(parent: number, child: number, radius: number): void;728        /** Appends a node at the position and returns its index. */729        add_node(position: ArrayLike<number>): number;730        /** Returns the undirected neighbor lists of every node. */731        adjacency(): Record<string, Uint32Array>;732        /** Returns each node's branch count, indexed like the node list. */733        degree(): Uint32Array;734    }735    /** A point of the network. */736    export interface Node {737        /** The coordinates, one per dimension. */738        position: number[];739        /** The node's place in the network's list. */740        index: number;741    }742    /** What a node's degree makes it. */743    export type Role = "Alone" | "Tip" | "Through" | "Junction";744}745export declare namespace moire {746    /** Returns every preset stacked up to the given scale. */747    export function all(limit: number): moire.Preset[];748    /** Frames the plane normal to the direction, at the offset from zero to one across the box along it; the window is the smallest square holding every section on that normal. */749    export function frame(normal: ArrayLike<number>, offset: number): moire.Frame;750    /** Samples a design over the pixel grid into a boolean mask. */751    export function layer(params: moire.Layer): boolean[];752    /** Returns the preset the name picks. */753    export function named(name: string, limit: number): moire.Preset;754    /** Quantizes a field into colored levels and encodes PNG bytes. */755    export function render(field: moire.Field, colorizer: core.Colorizer, levels: number, symmetric: boolean, invert: boolean, scale: number): Uint8Array;756    /** Layers one design at several side numbers into a field under the chosen combine. */757    export function stack(spec: moire.Spec, numbers: ArrayLike<number>, combine: moire.Combine, level: number, lattice: moire.Lattice, size: number, slices: ArrayLike<number>): moire.Field;758    /** Sums layers of several designs at one side number into a field. */759    export function stack_codes(specs: moire.Spec[], number: number, level: number, lattice: moire.Lattice, size: number, slices: ArrayLike<number>): moire.Field;760    /** Layers one cube design at several side numbers into a volume under the chosen combine. */761    export function volume(spec: moire.Spec, numbers: ArrayLike<number>, combine: moire.Combine, level: number, size: number): moire.Volume;762    /** The way stacked layers merge. */763    export type Combine = "Sum" | "And" | "Xor";764    export interface FieldData {765        /** The samples in row-major order. */766        data: number[];767        /** The side length in samples. */768        size: number;769    }770    /** A square grid of f32 samples. */771    export class Field {772        /** Builds a zeroed field of the given side. */773        constructor(size: number);774        free(): void;775        /** Reads the Field from its plain data. */776        static from(data: FieldData): Field;777        /** Writes the Field as plain data. */778        toJSON(): FieldData;779        /** The samples in row-major order. */780        get data(): Float32Array;781        set data(value: ArrayLike<number>);782        /** The side length in samples. */783        get size(): number;784        set size(value: number);785        /** Returns the samples widened to f64. */786        as_f64(): Float64Array;787        /** Wraps row-major samples of the given side. */788        static from_data(data: ArrayLike<number>, size: number): moire.Field;789        /** Returns the largest sample. */790        max(): number;791        /** Returns the mean sample, or zero for an empty field. */792        mean(): number;793        /** Returns the smallest sample. */794        min(): number;795        /** Returns the samples scaled into 0..1, symmetric about zero on request. */796        normalized(symmetric: boolean): Float32Array;797    }798    /** A plane through the unit box, framed for sampling: its centre, its two in-plane axes and the width of the square window that holds the whole section, all in the box `[-1, 1]^3`. */799    export interface Frame {800        /** The point of the plane the window is centred on. */801        centre: number[];802        /** The unit axis the window's columns run along. */803        u: number[];804        /** The unit axis the window's rows run along. */805        v: number[];806        /** The unit normal. */807        normal: number[];808        /** The side of the square window. */809        width: number;810    }811    /** The sampling lattice of a moire field. */812    export type Lattice = "Square" | "Hex";813    /** The recipe for one moire layer. */814    export interface Layer {815        /** The design to sample. */816        spec: moire.Spec;817        /** The side number of the residue grid. */818        number: number;819        /** The fractal depth. */820        level: number;821        /** The sampling lattice. */822        lattice: moire.Lattice;823        /** The output side in pixels. */824        size: number;825        /** The 0..1 positions fixing the axes beyond the first two. */826        slices: number[];827    }828    export const Layer: {829        /** Builds a layer at level 1 on a 512-pixel square lattice. */830        "new"(spec: moire.Spec, number: number): moire.Layer;831    };832    export interface PresetData {833        /** The name the recipe answers to. */834        name: string;835        /** The design sampled at every scale. */836        spec: moire.Spec;837        /** The side numbers stacked. */838        numbers: number[];839        /** The way the layers merge. */840        combine: moire.Combine;841        /** The fractal depth of each layer. */842        level: number;843        /** The lattice the layers are sampled on. */844        lattice: moire.Lattice;845    }846    /** One named moire recipe: the design, the scales it stacks and the lattice it samples. */847    export class Preset {848        private constructor();849        free(): void;850        /** Writes the Preset as plain data. */851        toJSON(): PresetData;852        /** The name the recipe answers to. */853        readonly name: string;854        /** The design sampled at every scale. */855        get spec(): moire.Spec;856        set spec(value: moire.Spec);857        /** The side numbers stacked. */858        get numbers(): Uint32Array;859        set numbers(value: ArrayLike<number>);860        /** The way the layers merge. */861        get combine(): moire.Combine;862        set combine(value: moire.Combine);863        /** The fractal depth of each layer. */864        get level(): number;865        set level(value: number);866        /** The lattice the layers are sampled on. */867        get lattice(): moire.Lattice;868        set lattice(value: moire.Lattice);869        /** The carpet stack: every base-three corner but the centre, summed over odd scales. */870        static carpet(limit: number): moire.Preset;871        /** Samples the preset into a square field of the given side. */872        field(size: number): moire.Field;873        /** The parity heatmap: odd scales of the low corner summed on the square lattice. */874        static heatmap(limit: number): moire.Preset;875        /** The hive: the parity heatmap sampled on the hexagonal lattice. */876        static hive(limit: number): moire.Preset;877        /** The parity weave: the same odd scales folded to their parity instead of summed. */878        static weave(limit: number): moire.Preset;879    }880    /** The identity of a design: its code, base and dimension. */881    export interface Spec {882        /** The design code. */883        code: bigint;884        /** The residue base. */885        base: number;886        /** The design dimension. */887        dimension: number;888    }889    export const Spec: {890        /** Builds a spec from a code, base and dimension. */891        "new"(code: string | number | bigint, base: number, dimension: number): moire.Spec;892    };893    export interface VolumeData {894        /** The samples, x-major, then y, then z. */895        data: number[];896        /** The side in samples. */897        size: number;898    }899    /** A cubic grid of f32 samples, x-major. */900    export class Volume {901        /** Builds a zeroed volume of the side. */902        constructor(size: number);903        free(): void;904        /** Reads the Volume from its plain data. */905        static from(data: VolumeData): Volume;906        /** Writes the Volume as plain data. */907        toJSON(): VolumeData;908        /** The samples, x-major, then y, then z. */909        get data(): Float32Array;910        set data(value: ArrayLike<number>);911        /** The side in samples. */912        get size(): number;913        set size(value: number);914        /** Reads the sample at a voxel. */915        at(x: number, y: number, z: number): number;916        /** Counts the samples at or above the level. */917        count(level: number): number;918        /** Wraps x-major samples of the side. */919        static from_data(data: ArrayLike<number>, size: number): moire.Volume;920        /** Returns the largest sample. */921        max(): number;922        /** Returns the smallest sample. */923        min(): number;924        /** Samples the plane of the frame on an out by out window: the values row by row, and one byte per pixel saying whether it lies inside the cube. */925        plane(frame: moire.Frame, out: number): [Float32Array, Uint8Array];926        /** Reads the voxel a point of the unit cube falls in, or zero outside it. */927        sample(p: ArrayLike<number>): number | undefined;928        /** Thresholds into a byte tensor: one where a sample reaches the level, zero below. */929        solid(level: number): Tensor;930    }931    export namespace pairs {932        /** Returns the exact Pearson correlation of the flat carpet layers at two scales, area-weighted on their lcm grid. */933        export function correlation(m: number, n: number): number;934        /** Returns the Pearson correlation of two rendered carpet layers on their lcm grid, sampled rather than integrated. */935        export function sampled(m: number, n: number): number;936        /** Puts an odd scale of three or more on trial against every earlier odd scale. */937        export function witness(scale: number): moire.pairs.Witness;938        /** The witness row of an odd scale: its correlation with every earlier odd scale from three, and the verdict the row gives. */939        export interface Witness {940            /** The scale on trial. */941            scale: number;942            /** The earlier odd scales, three up to the scale less two. */943            scales: number[];944            /** The exact correlation with each earlier scale. */945            row: number[];946            /** The largest correlation in the row, zero for an empty row. */947            max: number;948            /** The earlier scale carrying the largest correlation, zero when the row is clear. */949            at: number;950            /** Whether the row is exactly clear, which is the scale being prime. */951            prime: boolean;952        }953    }954    export namespace sample {955        /** Returns the two lattice coordinates of each pixel centre along a row. */956        export function axes(size: number, lattice: moire.Lattice, row: number): [Float64Array, Float64Array];957        /** Unpacks a code into its residue-corner truth table. */958        export function membership(code: string | number | bigint, base: number, dimension: number): boolean[];959        /** Folds residues into a base-q index of the truth table. */960        export function pack(residues: ArrayLike<number>, base: number): number;961    }962}963export declare namespace name {964    export interface BangData {965        /** The kind word. */966        kind: string;967        /** The number of axes. */968        dim: number;969        /** The lattice, square unless said. */970        lattice: name.Lattice;971        /** The digits per axis, 2 unless said. */972        base: number;973        /** The design as a number. */974        code: bigint;975        /** One unit index per filled digit, absent when nothing turns. */976        twist?: number[];977    }978    /** A design code pinned to its dimension, lattice and base, with one unit index per filled digit when it twists. */979    export class Bang {980        /** Pins a code to its dimension and base on the square lattice. */981        constructor(code: string | number | bigint, dim: number, base: number);982        free(): void;983        /** Reads the Bang from its plain data. */984        static from(data: BangData): Bang;985        /** Writes the Bang as plain data. */986        toJSON(): BangData;987        /** The number of axes. */988        get dim(): number;989        set dim(value: number);990        /** The lattice, square unless said. */991        get lattice(): name.Lattice;992        set lattice(value: name.Lattice);993        /** The digits per axis, 2 unless said. */994        get base(): number;995        set base(value: number);996        /** The design as a number. */997        get code(): string;998        set code(value: string | number | bigint);999        /** One unit index per filled digit, absent when nothing turns. */1000        get twist(): Uint32Array | undefined;1001        set twist(value: ArrayLike<number> | undefined);1002        /** Returns the number of digits the code addresses. */1003        cells(): number;1004        /** Folds a decoded value to its canonical form, or an error for one outside the kind. */1005        checked(): name.Bang;1006        /** Reads a filename back into the value, or an error. */1007        static from_file(text: string): name.Bang;1008        /** Reads a JSON object into its canonical value, or an error naming the broken key. */1009        static from_json(text: string): name.Bang;1010        /** Reads a path and query string back into the value, or an error. */1011        static from_url(text: string): name.Bang;1012        /** Prints the kind and the `key=value` pairs joined by underscores, lists in brackets, or an error when the name does not read back. */1013        to_file(): string;1014        /** Prints the first eight hex digits of the sha256 of the canonical JSON. */1015        to_id(): string;1016        /** Prints the canonical JSON object. */1017        to_json(): string;1018        /** Prints the kind and the keys as a line of prose for pages, or an error when the name does not read back. */1019        to_mrly(): string;1020        /** Prints the kind as a path and the keys as a query string, lists comma-joined, or an error when the name does not read back. */1021        to_url(): string;1022    }1023    /** The lattice the cells sit on. */1024    export type Lattice = "square" | "hex";1025    export const Lattice: {1026        /** Returns the default Lattice. */1027        default(): name.Lattice;1028        /** Returns whether this is the square lattice. */1029        is_square(lattice: name.Lattice): boolean;1030        /** Returns the number of unit directions a twist may pick from. */1031        units(lattice: name.Lattice): number;1032    };1033    export interface SequenceData {1034        /** The kind word. */1035        kind: string;1036        /** The number of axes. */1037        dim: number;1038        /** The digits per axis, 2 unless said. */1039        base: number;1040        /** The design as a number. */1041        code: bigint;1042        /** The reading taken. */1043        measure: string;1044        /** The index the reading runs along. */1045        axis: string;1046    }1047    /** A design sequence's address: the design, the reading taken off it and the index it runs along. */1048    export class Sequence {1049        /** Pins a design's reading to its measure and axis. */1050        constructor(code: string | number | bigint, dim: number, base: number, measure: string, axis: string);1051        free(): void;1052        /** Reads the Sequence from its plain data. */1053        static from(data: SequenceData): Sequence;1054        /** Writes the Sequence as plain data. */1055        toJSON(): SequenceData;1056        /** The number of axes. */1057        get dim(): number;1058        set dim(value: number);1059        /** The digits per axis, 2 unless said. */1060        get base(): number;1061        set base(value: number);1062        /** The design as a number. */1063        get code(): string;1064        set code(value: string | number | bigint);1065        /** The reading taken. */1066        get measure(): string;1067        set measure(value: string);1068        /** The index the reading runs along. */1069        get axis(): string;1070        set axis(value: string);1071        /** Folds a decoded value to its canonical form, or an error for one outside the kind. */1072        checked(): name.Sequence;1073        /** Returns the design pinned to its dimension and base. */1074        design(): name.Bang;1075        /** Reads a filename back into the value, or an error. */1076        static from_file(text: string): name.Sequence;1077        /** Reads a JSON object into its canonical value, or an error naming the broken key. */1078        static from_json(text: string): name.Sequence;1079        /** Reads a path and query string back into the value, or an error. */1080        static from_url(text: string): name.Sequence;1081        /** Prints the kind and the `key=value` pairs joined by underscores, lists in brackets, or an error when the name does not read back. */1082        to_file(): string;1083        /** Prints the first eight hex digits of the sha256 of the canonical JSON. */1084        to_id(): string;1085        /** Prints the canonical JSON object. */1086        to_json(): string;1087        /** Prints the kind and the keys as a line of prose for pages, or an error when the name does not read back. */1088        to_mrly(): string;1089        /** Prints the kind as a path and the keys as a query string, lists comma-joined, or an error when the name does not read back. */1090        to_url(): string;1091    }1092    export interface WordData {1093        /** The kind word. */1094        kind: string;1095        /** The number of axes every letter shares. */1096        dim: number;1097        /** The codes of the letters in order. */1098        magic: bigint[];1099        /** The side each letter renders at. */1100        side: number[];1101        /** The base of each letter, absent when every letter is base 2. */1102        base?: number[];1103    }1104    /** A magic word: an ordered list of design letters, first letter outermost, each at its own side. */1105    export class Word {1106        /** Pins an ordered letter list at base 2. */1107        constructor(dim: number, letters: ([string | number | bigint, number])[]);1108        free(): void;1109        /** Reads the Word from its plain data. */1110        static from(data: WordData): Word;1111        /** Writes the Word as plain data. */1112        toJSON(): WordData;1113        /** The number of axes every letter shares. */1114        get dim(): number;1115        set dim(value: number);1116        /** The codes of the letters in order. */1117        get magic(): string[];1118        set magic(value: (string | number | bigint)[]);1119        /** The side each letter renders at. */1120        get side(): Uint32Array;1121        set side(value: ArrayLike<number>);1122        /** The base of each letter, absent when every letter is base 2. */1123        get base(): Uint32Array | undefined;1124        set base(value: ArrayLike<number> | undefined);1125        /** Returns the base of every letter, 2 where the name says nothing. */1126        bases(): Uint32Array;1127        /** Folds a decoded value to its canonical form, or an error for one outside the kind. */1128        checked(): name.Word;1129        /** Reads a filename back into the value, or an error. */1130        static from_file(text: string): name.Word;1131        /** Reads a JSON object into its canonical value, or an error naming the broken key. */1132        static from_json(text: string): name.Word;1133        /** Reads a path and query string back into the value, or an error. */1134        static from_url(text: string): name.Word;1135        /** Returns every letter as a design pinned to the word's dimension and its own base. */1136        letters(): name.Bang[];1137        /** Prints the kind and the `key=value` pairs joined by underscores, lists in brackets, or an error when the name does not read back. */1138        to_file(): string;1139        /** Prints the first eight hex digits of the sha256 of the canonical JSON. */1140        to_id(): string;1141        /** Prints the canonical JSON object. */1142        to_json(): string;1143        /** Prints the kind and the keys as a line of prose for pages, or an error when the name does not read back. */1144        to_mrly(): string;1145        /** Prints the kind as a path and the keys as a query string, lists comma-joined, or an error when the name does not read back. */1146        to_url(): string;1147    }1148}1149export declare namespace press {1150    /** Returns the number of designs of the dimension and base that contain the number. */1151    export function containing(number: string | number | bigint, dimension: number, base: number): string;1152    /** Splits a number into its dimension coordinates, one base digit peeled per axis in parallel. */1153    export function coordinates(number: string | number | bigint, dimension: number, base: number): string[];1154    /** Counts the members of a design below the limit. */1155    export function count_below(code: string | number | bigint, dimension: number, base: number, limit: string | number | bigint): string;1156    /** Returns the count of distinct digit vectors the number uses. */1157    export function distinct(number: string | number | bigint, dimension: number, base: number): number;1158    /** Weaves dimension coordinates back into their single interleaved number. */1159    export function interleave(coords: (string | number | bigint)[], base: number): string;1160    /** Returns the allowed digit table of one magic layer, one flag per cell of its tile. */1161    export function layer_table(layer: bang.MagicLayer): boolean[];1162    /** Returns whether every digit vector of the number lies in the design. */1163    export function member(code: string | number | bigint, number: string | number | bigint, dimension: number, base: number): boolean;1164    /** Returns the first members of a design in ascending order. */1165    export function members(code: string | number | bigint, dimension: number, base: number, count: number): string[];1166    /** Returns the diagonal slice profile of one design pressed to a fractal level. */1167    export function profile(code: string | number | bigint, dimension: number, base: number, level: number): string[];1168    /** Returns the corner-usage mask of a number, one bit per digit vector its expansion uses. */1169    export function usage(number: string | number | bigint, dimension: number, base: number): string;1170    /** Counts the members of a magic word from its layer fills, without enumeration. */1171    export function word_count(layers: bang.MagicLayer[]): string;1172    /** Returns whether the number lies in the magic word's composed design. */1173    export function word_member(layers: bang.MagicLayer[], number: string | number | bigint): boolean;1174    /** Enumerates every member of the magic word in ascending order. */1175    export function word_members(layers: bang.MagicLayer[]): string[];1176    /** Returns the diagonal slice profile of a magic word by the substitution product. */1177    export function word_profile(layers: bang.MagicLayer[]): string[];1178    /** The largest corner count the tally press accepts, keeping its table a million rows. */1179    export function CORNERS(): number;1180    export type PressData = Record<string, unknown>;1181    /** The tally press: one pass over the integers weighs every design of a universe at once. */1182    export class Press {1183        /** Builds an empty press over every design of the dimension and base. */1184        constructor(dimension: number, base: number);1185        free(): void;1186        /** Reads the Press from its plain data. */1187        static from(data: PressData): Press;1188        /** Writes the Press as plain data. */1189        toJSON(): PressData;1190        /** The design dimension of the universe. */1191        get dimension(): number;1192        set dimension(value: number);1193        /** The numeral base of the universe. */1194        get base(): number;1195        set base(value: number);1196        /** Adds a weighted number to its usage bucket. */1197        add(number: string | number | bigint, weight: string | number | bigint): void;1198        /** Returns the total weight the design at a code has collected. */1199        total(code: string | number | bigint): string;1200        /** Returns every design's total in code order by one subset-sum transform. */1201        totals(): string[];1202    }1203}1204export declare namespace roulette {1205    /** Counts the nodes of the roulette the pencils draw on the track: `mrlyrs::math::spirograph::trace` at `samples` points a pencil, every pair of polyline segments tested for a proper crossing by orientation signs on a grid of buckets, and crossings within `tol` of the picture's longer side read as one node. A pair of segments is counted in one bucket alone, the first they share, so no crossing is counted twice; the sign of an orientation is `side`, exact for any endpoints whose two differences are exact, which two `f32` endpoints are while the picture's coordinates keep their exponents within 29 of one another, as these pictures do. A seat at the wheel's centre draws one circle `b` times over and the count is meaningless there, the passes crossing one another as the sampling wanders. */1206    export function nodes(track: spirograph.Track, pencils: spirograph.Pencil[], samples: number, tol: number): roulette.Nodes;1207    /** Which side of the line from `a` to `b` the point `c` lies: plus one to the left, minus one to the right, zero on it. The sign is exact whenever the two differences `b - a` and `c - a` are exact, whatever the size of the products: the determinant is taken by the fused multiply-add identity of Kahan, whose error is at most twice the rounding unit times the determinant itself, so it can neither flip a sign nor invent one. */1208    export function side(a: ArrayLike<number>, b: ArrayLike<number>, c: ArrayLike<number>): number;1209    /** One pencil for every distinct curve, the coincidence law read on the exact seats when `exact` says the seats carry no jitter: the first pencil of each family, in the order they came in. On a circle the seats fall into classes under the rotation group of order `gcd(b, 4)`, which is the clause `mrlyrs::math::spirograph::distinct` and `mrlyrs::math::spirograph::representatives` read; on a line and on a polygon every distinct seat draws its own curve, two seats of one radius on a line drawing translates of one shape and never one curve. */1210    export function spread(track: spirograph.Track, pencils: spirograph.Pencil[], exact: boolean): spirograph.Pencil[];1211    export interface NodesData {1212        /** The curves counted, in the order the pencils came in. */1213        curves: number;1214        /** How often each curve crosses itself, curve by curve. */1215        selves: number[];1216        /** How often each pair of curves crosses, the lower curve first, in lexicographic order. */1217        pairs: number[];1218        /** The most crossings one node carries: one at a plain double point, and `n(n - 1)/2` where `n` branches meet. */1219        most: number;1220        /** The nodes more than one crossing clusters at. */1221        crowded: number;1222        /** The distinct points the crossings sit at, one for every cluster. */1223        points: number;1224        /** The branches through every node added up, which is the edge count of the picture as a plane graph, `n` at a node where `n` branches meet and `2` times `points` when no node is crowded. */1225        branches: number;1226        /** The segment pairs that meet without crossing: collinear or end to end. */1227        touches: number;1228    }1229    /** Every crossing of a traced roulette: the curves against themselves, the curves against one another, and how crowded the worst node is. */1230    export class Nodes {1231        private constructor();1232        free(): void;1233        /** Reads the Nodes from its plain data. */1234        static from(data: NodesData): Nodes;1235        /** Writes the Nodes as plain data. */1236        toJSON(): NodesData;1237        /** The curves counted, in the order the pencils came in. */1238        get curves(): number;1239        set curves(value: number);1240        /** How often each curve crosses itself, curve by curve. */1241        get selves(): Uint32Array;1242        set selves(value: ArrayLike<number>);1243        /** How often each pair of curves crosses, the lower curve first, in lexicographic order. */1244        get pairs(): Uint32Array;1245        set pairs(value: ArrayLike<number>);1246        /** The most crossings one node carries: one at a plain double point, and `n(n - 1)/2` where `n` branches meet. */1247        get most(): number;1248        set most(value: number);1249        /** The nodes more than one crossing clusters at. */1250        get crowded(): number;1251        set crowded(value: number);1252        /** The distinct points the crossings sit at, one for every cluster. */1253        get points(): number;1254        set points(value: number);1255        /** The branches through every node added up, which is the edge count of the picture as a plane graph, `n` at a node where `n` branches meet and `2` times `points` when no node is crowded. */1256        get branches(): number;1257        set branches(value: number);1258        /** The segment pairs that meet without crossing: collinear or end to end. */1259        get touches(): number;1260        set touches(value: number);1261        /** Returns the default Nodes. */1262        static default(): roulette.Nodes;1263        /** How often the curves `i` and `j` cross, either order, and zero when they are one curve. */1264        pair(i: number, j: number): number;1265        /** Every crossing of two curves. */1266        paired(): number;1267        /** Every self crossing. */1268        selved(): number;1269        /** Every crossing, self and pair together, which counts a node where `n` branches meet `n(n - 1)/2` times; `points` is the count of distinct nodes and the two agree exactly when `crowded` is zero. */1270        total(): number;1271    }1272}1273export declare namespace rules {1274    /** Builds a hypercube of the given side and rank, marking each cell whose coordinate residues are in the filled list. */1275    export function render(filled: ArrayLike<number>[], number: number, dimension: number, base: number): Tensor;1276    /** Returns every axis but the free one. */1277    export function tree_axes(dimension: number, free_axis: number): Uint32Array;1278    /** The default residue base. */1279    export function BASE(): number;1280}1281export declare namespace shape {1282    /** Tallies the design's cells and filled cells per region of the shape. */1283    export function census(shape: shape.Shape, types: Tensor): shape.ShapeCensus;1284    /** Places one lattice cell relative to the shape, exactly, with no floats. */1285    export function classify(shape: shape.Shape, side: number, index: ArrayLike<number>): shape.Region;1286    /** Zeroes every cell of the design outside the shape, keeping Cut cells on request; anti-crop is Shape::Anti. */1287    export function crop(types: Tensor, shape: shape.Shape, keep_cut: boolean): Tensor;1288    /** Lists the level-`level` boxes the circle of radius `radius` crosses, in the arc's own order. */1289    export function crossing_shell(radius: number | bigint, number: number | bigint, level: number): [bigint, bigint][];1290    /** Builds the whole crossing tree of one radius, pruned by the seats the design keeps. */1291    export function crossing_tree(radius: number | bigint, number: number | bigint, keep: boolean[]): shape.Shell;1292    /** Builds a named shape of the dimension, centered at one half on every axis. */1293    export function named(name: string, dimension: number, radius: shape.Frac): shape.Shape;1294    /** Counts a design's filled cells against every integer radius about one centre, in exact integer arithmetic. */1295    export function radial_census(types: Tensor, centre: ArrayLike<number | bigint>, r_max: number | bigint): shape.RadialCounts[];1296    /** Replicates each design cell base to the extra per axis and keeps a sub-cell only where its own region passes. */1297    export function refine(types: Tensor, shape: shape.Shape, base: number, extra: number, keep_cut: boolean): Tensor;1298    /** Classifies every cell of the grid, packing Out, Cut and In as 0, 1 and 2; the first extent sets the lattice side. */1299    export function regions(shape: shape.Shape, dims: ArrayLike<number>): Tensor;1300    /** Lists the named shapes of a dimension. */1301    export function shapes(dimension: number): string[];1302    /** The refine output ceiling in cells. */1303    export function REFINE_LIMIT(): number;1304    export interface FracData {1305        /** The numerator, carrying the sign. */1306        num: number;1307        /** The denominator, always positive. */1308        den: number;1309    }1310    /** An exact rational number with a positive, reduced denominator. */1311    export class Frac {1312        /** Builds the reduced fraction num over den. */1313        constructor(num: number | bigint, den: number | bigint);1314        free(): void;1315        /** Reads the Frac from its plain data. */1316        static from(data: FracData): Frac;1317        /** Writes the Frac as plain data. */1318        toJSON(): FracData;1319        /** The numerator, carrying the sign. */1320        get num(): bigint;1321        set num(value: number | bigint);1322        /** The denominator, always positive. */1323        get den(): bigint;1324        set den(value: number | bigint);1325        /** Returns the exact difference. */1326        minus(other: shape.Frac): shape.Frac;1327        /** Returns the exact sum. */1328        plus(other: shape.Frac): shape.Frac;1329        /** Returns the exact product. */1330        times(other: shape.Frac): shape.Frac;1331        /** Wraps an integer as a fraction over one. */1332        static whole(num: number | bigint): shape.Frac;1333    }1334    /** A closed half-space: the points x with normal dot x at most offset. */1335    export interface Half {1336        /** The integer outward normal. */1337        normal: number[];1338        /** The rational offset the linear form stays under. */1339        offset: shape.FracData;1340    }1341    /** The tallies of one design against a single integer radius about a centre. */1342    export interface RadialCounts {1343        /** The filled cells whose own centre lies within the radius. */1344        seen: number;1345        /** The filled cells lying wholly within the radius. */1346        inside: number;1347        /** The filled cells the sphere of the radius crosses. */1348        cut: number;1349    }1350    /** Where one lattice cell sits relative to a shape. */1351    export type Region = "Out" | "Cut" | "In";1352    export const Region: {1353        /** Swaps In and Out, keeping Cut. */1354        flip(region: shape.Region): shape.Region;1355    };1356    /** An exact region of the unit box, scaled onto the lattice by the side. */1357    export type Shape = { Ball: { center: shape.FracData[]; radius: shape.FracData } } | { Polytope: { walls: shape.Half[] } } | { Anti: string };1358    /** The per-region tallies of a shape over a design, indexed Out, Cut, In. */1359    export interface ShapeCensus {1360        /** The cell count of each region. */1361        cells: number[];1362        /** The filled-cell count of each region. */1363        filled: number[];1364    }1365    /** The rooted tree of the boxes one circle crosses, level by level. */1366    export interface Shell {1367        /** The radius in cells. */1368        radius: number;1369        /** The side of a box measured in the boxes one level below it. */1370        number: number;1371        /** The boxes of level `j`, the crossed cells at `0` and the single root last, each level in the arc's own order. */1372        levels: shape.ShellBox[][];1373        /** The boxes whose parent is missing from the level above, which the crossing identity forbids. */1374        orphans: number;1375    }1376    /** One box of a crossing shell: where it sits, the seat it takes in its parent and whether the design keeps its path. */1377    export interface ShellBox {1378        /** The box's first coordinate in its own level's grid. */1379        x: number;1380        /** The box's second coordinate in its own level's grid. */1381        y: number;1382        /** The seat the box takes in its parent, row-major over the side, and the side squared at the root. */1383        seat: number;1384        /** The parent's place in the level above, and `usize::MAX` at the root or when the level above holds no such box. */1385        parent: number;1386        /** Whether every seat from the root down to this box is one the design keeps. */1387        live: boolean;1388    }1389}1390export declare namespace six {1391    /** Swaps every fill triangle for a void and back. */1392    export function anti(cell: Cell6d): Cell6d;1393    /** Maps each triangle to one at or above the threshold, zero below. */1394    export function binarize(cell: Cell6d, threshold: number): Cell6d;1395    /** Binarizes the triangles at the threshold Otsu's method picks. */1396    export function binarize_otsu(cell: Cell6d): Cell6d;1397    /** Builds a hexagon of the given radius, fill inside and void outside. */1398    export function blank(radius: number, orient: six.Orientation, fill: number, void_: number): Cell;1399    /** Rounds each triangle to the mean of its masked neighborhood, wrapping on request. */1400    export function blur(cell: Cell6d, mask: Tensor, wrap: boolean): Cell6d;1401    /** Tallies a cell's triangles, corners and edges, counting the backdrop only on request. */1402    export function census(cell: Cell6d, include_grid: boolean): six.Census;1403    /** Counts the connected pieces of the fill, triangles joined across shared edges. */1404    export function components(cell: Cell6d): number;1405    /** Slices a cube through its center across the main diagonal into a hexagon. */1406    export function cut(cell: Cell): Cell6d;1407    /** Builds the coded 3d design and slices its central hexagon. */1408    export function cut_design(code: string | number | bigint, number: number, level: number, base: number): Cell6d;1409    /** The three corners of the east-pointing triangle at the grid column and row. */1410    export function east(x: number | bigint, y: number | bigint): [bigint, bigint][];1411    /** Returns the Euler characteristic of the cell's mesh, counting the backdrop only on request. */1412    export function euler(cell: Cell6d, include_grid: boolean): bigint;1413    /** Counts the filled triangles of the cell. */1414    export function fills(cell: Cell6d): number;1415    /** Tallies only the filled triangles, leaving the voids and the backdrop out of the mesh. */1416    export function fills_only(cell: Cell6d): six.Census;1417    /** Backs a cell onto a backdrop whose longer axis matches its orientation, leaving every triangle where it stood. */1418    export function framed(cell: Cell6d): Cell6d;1419    /** Parses a cell from JSON, defaulting any missing projection metadata. */1420    export function from_json(text: string): Cell6d;1421    /** Returns the triangle count of the fill's largest connected piece. */1422    export function giant(cell: Cell6d): number;1423    /** Returns the largest connected piece of the filled-triangle network as a network of its own. */1424    export function giant_network(cell: Cell6d): graph.Network;1425    /** Returns the grid height in triangles. */1426    export function height(cell: Cell6d): number;1427    /** Counts the holes of the fill, its piece count less the Euler number of the filled sub-mesh. */1428    export function holes(cell: Cell6d): number;1429    /** Returns whether the cell's three sides are equal. */1430    export function is_cube(cell: Cell): boolean;1431    /** Returns whether the cell's width, height and parity frame a hexagon. */1432    export function is_hex(cell: Cell): boolean;1433    /** Projects a cube into the isometric hexagon of top, left and right faces. */1434    export function iso(cell: Cell): Cell6d;1435    /** Builds the coded 3d design and projects it isometrically. */1436    export function iso_design(code: string | number | bigint, number: number, level: number, base: number): Cell6d;1437    /** Builds a cell from its four parts. */1438    export function new_(cell: Cell, projection: six.Projection, orientation: six.Orientation, start: number): Cell6d;1439    /** The three corners of the north-pointing triangle at the grid column and row. */1440    export function north(x: number | bigint, y: number | bigint): [bigint, bigint][];1441    /** Returns the orientation a hexagon's width and height imply. */1442    export function orientation(width: number, height: number): six.Orientation;1443    /** Wraps a hexagonal cell in k rings of the given value, carrying colors and tags along. */1444    export function pad(cell: Cell6d, k: number, value: number): Cell6d;1445    /** Colors each triangle by its type through the custom or default mapping in the given or type mode. */1446    export function paint(cell: Cell6d, custom?: Record<string, Color[]>, mode?: core.Mode, rng?: Rng): Cell6d;1447    /** Writes the value wherever the tiled mask is nonzero. */1448    export function perforate(cell: Cell6d, mask: Tensor, value: number): Cell6d;1449    /** Rasters a cell's triangles to PNG bytes at the given scale, stroked and padded when an outline is given. */1450    export function png(cell: Cell6d, scale: number, outline: Color | undefined, width: number): Uint8Array;1451    /** Projects a cube's three facing sides into a hexagon of fills and voids. */1452    export function pro(cell: Cell): Cell6d;1453    /** Builds the coded 3d design and projects its facing sides. */1454    export function pro_design(code: string | number | bigint, number: number, level: number, base: number): Cell6d;1455    /** Tessellates a hexagonal cell over the disc mask of the given radius. */1456    export function radial(cell: Cell6d, radius: number): Cell;1457    /** Crops the interlocking overhang off a disc tiled at the given radius and tile size. */1458    export function radial_crop(cell: Cell, radius: number, size: [number, number]): Cell;1459    /** Builds the disc mask of cells within hex distance radius of the center. */1460    export function radial_mask(radius: number, orient: six.Orientation): Tensor;1461    /** Rasterizes a hex cell's fills on a square of the side at the true hex aspect, one for a fill triangle and zero elsewhere. */1462    export function raster(cell: Cell6d, size: number): Float32Array;1463    /** Rasters the hexagon tiled three by three and cropped to one interlocking rectangle to PNG bytes. */1464    export function rect_png(cell: Cell6d, scale: number, start?: number): Uint8Array;1465    /** Renders the hexagon tiled three by three and cropped to one interlocking rectangle as an SVG string. */1466    export function rect_svg(cell: Cell6d, scale: number, start?: number): string;1467    /** Counts the void regions the rim never reaches, the second route to the hole count. */1468    export function rim_holes(cell: Cell6d): number;1469    /** Recodes an isometric projection's top, left and right faces as plain fills, so a census reads its visible skin as one figure. */1470    export function skin(cell: Cell6d): Cell6d;1471    /** Builds the network of filled triangles joined by shared edges. */1472    export function slice_core_graph(cell: Cell6d): graph.Network;1473    /** Builds the network of fill and void triangles joined by shared edges. */1474    export function slice_dual_graph(cell: Cell6d): graph.Network;1475    /** Builds the corner-and-edge network of the triangles matching the value, or of every fill and void. */1476    export function slice_edge_graph(cell: Cell6d, value?: number): graph.Network;1477    /** Builds the network of void triangles joined by shared edges, the pore network of the slice. */1478    export function slice_tunnel_graph(cell: Cell6d): graph.Network;1479    /** The three corners of the south-pointing triangle at the grid column and row. */1480    export function south(x: number | bigint, y: number | bigint): [bigint, bigint][];1481    /** Reads the spectral dimension of the giant piece: twice the low-window log-log slope of the normalised Laplacian's integrated density of states. */1482    export function spectral_exponent(cell: Cell6d, window: number): number;1483    /** Renders a cell's triangles to an SVG string at the given scale, stroked and padded when an outline is given. */1484    export function svg(cell: Cell6d, scale: number, outline: Color | undefined, width: number, start?: number): string;1485    /** Stamps a hexagonal cell at every set mask entry into one interlocking sheet, colors and tags included. */1486    export function tessellate(cell: Cell6d, mask: Tensor): Cell;1487    /** Tessellates a hexagonal cell over a full width-by-height mask. */1488    export function tile(cell: Cell6d, width: number, height: number): Cell;1489    /** Tessellates a hexagon over a full width-by-height mask and returns the sheet as a projected cell, cropped to the interlocking rectangle on request. */1490    export function tile_cell(cell: Cell6d, width: number, height: number, crop: boolean): Cell6d;1491    /** Crops one interlocking step off each side of a sheet tiled at the given size. */1492    export function tile_crop(cell: Cell, size: [number, number]): Cell;1493    /** Returns the interlocking step, in triangle columns and rows, that a sheet of hexagons of the given width and height loses off each side when cropped. */1494    export function tile_step(size: [number, number]): [number, number];1495    /** Serializes a cell and its projection metadata to JSON. */1496    export function to_json(cell: Cell6d): string;1497    /** Folds a cell into colored screen triangles, dropping the transparent ones, at the cell's start parity or the given override. */1498    export function triangles(cell: Cell6d, start?: number): [[bigint, bigint][], Uint8Array][];1499    /** The three corners of the west-pointing triangle at the grid column and row. */1500    export function west(x: number | bigint, y: number | bigint): [bigint, bigint][];1501    /** Returns the grid width in triangles. */1502    export function width(cell: Cell6d): number;1503    /** The triangle code for a filled site. */1504    export function FILL(): number;1505    /** The triangle code for the backdrop outside the figure. */1506    export function GRID(): number;1507    /** The triangle code for a cube's left face in the iso view. */1508    export function LEFT(): number;1509    /** The triangle code for a cube's right face in the iso view. */1510    export function RIGHT(): number;1511    /** The triangle code for a cube's top face in the iso view. */1512    export function UP(): number;1513    /** The triangle code for an empty site. */1514    export function VOID(): number;1515    /** The tally of a triangle mesh. */1516    export interface Census {1517        /** The count of tallied triangles. */1518        triangles: number;1519        /** The count of filled triangles. */1520        fills: number;1521        /** The count of void triangles. */1522        voids: number;1523        /** The count of backdrop triangles. */1524        grids: number;1525        /** The count of distinct corners. */1526        vertices: number;1527        /** The count of distinct edges. */1528        edges: number;1529        /** The count of edges touching one triangle. */1530        boundary_edges: number;1531        /** The count of edges shared by two triangles. */1532        interior_edges: number;1533        /** The Euler characteristic of the mesh. */1534        euler: number;1535    }1536    /** The two ways a hexagon can point. */1537    export type Orientation = "Horizontal" | "Vertical";1538    /** The three ways a cube flattens to a hexagon. */1539    export type Projection = "Iso" | "Pro" | "Cut";1540    export namespace star {1541        /** The closed form of the star arm's ink at odd `n`, `1/2 + chi_8(n)/(2n)`, as `n + chi_8(n)` cells of `2n`. */1542        export function arm_law(number: number): six.star.Share;1543        /** The real character mod 8 of `Q(sqrt 2)`: `+1` at `n = 1, 7`, `-1` at `n = 3, 5`, zero at even `n`. */1544        export function chi8(number: number): bigint;1545        /** The constant beside the decay, `ln(1 + sqrt 2)/(2 sqrt 2) - G/8 - gamma/4 - (ln 2)/2`. */1546        export function constant(): number;1547        /** The decay read off the per-layer excesses at a layer count, the slope taken from `L/2` to `L`. */1548        export function decay(excesses: ArrayLike<number>, layers: number): six.star.Decay;1549        /** The cell-frame decay coefficient of a band of half-width `W` cells, `-(K + b)/(4(2K + 1))` for `K = floor(W/2)`. */1550        export function width_law(half: number): number;1551        /** The three classes of layer count the `1/L^2` term of the decay reads. */1552        export type Branch = "Zero" | "Two" | "Odd";1553        export const Branch: {1554            /** The constant the ladder converges on, `C` at even `L` and `C + 1/8` at odd `L`. */1555            constant(branch: six.star.Branch): number;1556            /** The name of the branch. */1557            name(branch: six.star.Branch): string;1558            /** The branch of a layer count. */1559            of(layers: number): six.star.Branch;1560            /** The exact `1/L^2` coefficient at even `L`, absent at odd `L`. */1561            residual(branch: six.star.Branch): number | undefined;1562        };1563        /** The `L`-layer reading of the ghost star's decay in the cell frame. */1564        export interface Decay {1565            /** The layer count `L`. */1566            layers: number;1567            /** The mean excess of the star over the background across the first `L` odd layers. */1568            excess: number;1569            /** That excess times `L`. */1570            scaled: number;1571            /** The scaled excess plus `(ln L)/4`, which settles on the branch constant. */1572            logged: number;1573            /** The miss of the settled value against the branch constant. */1574            miss: number;1575            /** The miss times `L`, the reading odd `L` leaves behind. */1576            linear: number;1577            /** The miss times `L` squared, the reading even `L` leaves behind. */1578            residual: number;1579            /** The slope of the scaled excess against `ln L`, read from `L/2` to `L`, absent unless `L` is divisible by four. */1580            slope?: number;1581        }1582        export interface ShareData {1583            /** The count of inked cells. */1584            inked: number;1585            /** The count of cells read. */1586            cells: number;1587        }1588        /** The exact reading of a cut layer: how many cells were inked out of how many were read. */1589        export class Share {1590            private constructor();1591            free(): void;1592            /** Reads the Share from its plain data. */1593            static from(data: ShareData): Share;1594            /** Writes the Share as plain data. */1595            toJSON(): ShareData;1596            /** The count of inked cells. */1597            get inked(): bigint;1598            set inked(value: number | bigint);1599            /** The count of cells read. */1600            get cells(): bigint;1601            set cells(value: number | bigint);1602            /** The share in lowest terms, numerator then denominator. */1603            reduced(): [bigint, bigint];1604            /** The share as a real number. */1605            value(): number;1606        }1607        export type StarData = Record<string, unknown>;1608        /** The ghost star of a coded cube's hexagonal cut stack, read in the cell frame. */1609        export class Star {1610            /** Reads the star of a base-2 space code, the carpet being `23`. */1611            constructor(code: string | number | bigint);1612            free(): void;1613            /** Reads the Star from its plain data. */1614            static from(data: StarData): Star;1615            /** Writes the Star as plain data. */1616            toJSON(): StarData;1617            /** The exact ink share of the band of half-width `W` cells about the arm `x = y` at odd `n`. */1618            arm(number: number, half: number): six.star.Share;1619            /** The ink of the cut cell at column `x` and even height `z` of the layer at odd `n`. */1620            cell(number: number, x: number | bigint, z: number | bigint): boolean | undefined;1621            /** The per-layer excess of the star band over the hexagon across the first `L` odd layers. */1622            excesses(layers: number, half: number): Float64Array;1623            /** The exact ink share of the whole hexagonal cut at odd `n`, the background the star is read against. */1624            hexagon(number: number): six.star.Share;1625        }1626    }1627}1628export declare namespace spectrum {1629    /** Groups eigenvalues into runs split by consecutive gaps above the tolerance, each run its mean and its size. */1630    export function clusters(eigenvalues: ArrayLike<number>, tolerance: number): [number, number][];1631    /** Builds the Laplacian of a network, the combinatorial `D - A` or the normalised `I - D^-1/2 A D^-1/2`. */1632    export function laplacian(network: graph.Network, normalised: boolean): Float64Array[];1633    /** Returns the ascending Laplacian spectrum of a network, combinatorial or normalised. */1634    export function laplacian_spectrum(network: graph.Network, normalised: boolean): Float64Array;1635    /** Counts the eigenvalues within the tolerance of a value. */1636    export function multiplicity(eigenvalues: ArrayLike<number>, value: number, tolerance: number): number;1637    /** Reads the spectral exponent: twice the log-log slope of the integrated density of states over its low window. */1638    export function spectral_exponent(eigenvalues: ArrayLike<number>, window: number): number | undefined;1639    /** Fits the low window of the integrated density of states in log-log: the intercept, the slope and the fitted count. */1640    export function spectral_fit(eigenvalues: ArrayLike<number>, window: number): [number, number, number] | undefined;1641    /** Builds the integrated density of states as points, each an eigenvalue and its rank fraction. */1642    export function spectral_points(eigenvalues: ArrayLike<number>): [number, number][];1643    /** Returns the eigenvalues of a dense real symmetric matrix in ascending order. */1644    export function symmetric_eigenvalues(matrix: ArrayLike<number>[]): Float64Array;1645}1646export declare namespace spin {1647    /** The arcs of the circle of the radius about the raster's centre: each as its start angle, end angle and the value of the one cell it lies in, zero outside. */1648    export function arcs(data: ArrayLike<number>, size: number, radius: number): [number, number, number][];1649    /** The circular-harmonic power of a raster: for every order `m` up to the last, the energy `sum |c_m(r)|^2 2 pi r dr` of its `m`-th harmonic over rings radii, each ring's coefficient exact from its arcs. */1650    export function harmonics(data: ArrayLike<number>, size: number, rings: number, orders: number): Float64Array;1651    /** The mass a profile carries, the trapezoid integral of `2 pi r F(r)` in cells of the raster it came from. */1652    export function mass(profile: ArrayLike<number>, size: number): number;1653    /** The mass a profile carries inside the radius, the trapezoid integral of `2 pi r F(r)` from the centre out, in cells of the raster it came from. */1654    export function mass_within(profile: ArrayLike<number>, size: number, radius: number): number;1655    /** The petals a full radial stack of the copies shows on a design of the rotation order: their least common multiple. */1656    export function petals(copies: number, order: number): number;1657    /** The ring profile: the circle means at steps radii spaced evenly from the centre to the corner circle. */1658    export function profile(data: ArrayLike<number>, size: number, steps: number): Float32Array;1659    /** Stacks a raster radially: copies turned by multiples of the step, in turns, about the centre and merged by the blend, on an output raster of the side whose inscribed circle is the source's corner circle, every pixel the mean of samples by samples points. */1660    export function radial(data: ArrayLike<number>, size: number, out: number, copies: number, step: number, blend: spin.Blend, samples: number): Float32Array;1661    /** The radius of the corner circle of a square raster of the side, the last radius a profile reads. */1662    export function reach(size: number): number;1663    /** The exact mean of a square raster over the circle of the radius about its centre, each cell read as a constant and the outside as zero. */1664    export function ring(data: ArrayLike<number>, size: number, radius: number): number;1665    /** The rotation order a harmonic power spectrum reveals: the gcd of the orders carrying more than a ten-thousandth of the power, the share pixel aliasing stays under, or zero when none does. */1666    export function turns(power: ArrayLike<number>): number;1667    /** The wheel: a profile spread over a square raster of the side, the corner circle it ends on drawn as the inscribed circle, every pixel reading the profile at its own radius. */1668    export function wheel(profile: ArrayLike<number>, size: number): Float32Array;1669    /** The way radial copies merge: their mean, their sum, their union, their meet, their parity or what the first keeps that no other has. */1670    export type Blend = "Mean" | "Sum" | "Union" | "Meet" | "Parity" | "Difference";1671    export const Blend: {1672        /** Merges one site's copies into the blended value. */1673        fold(blend: spin.Blend, values: ArrayLike<number>): number;1674        /** Reads a blend by name: mean, sum, union, meet, parity or difference. */1675        named(name: string): spin.Blend | undefined;1676    };1677}1678export declare namespace spirograph {1679    /** The side of one cell in wheel radii at a reach, the number the page needs to draw the tile on the wheel. */1680    export function cell(width: number, height: number, reach: number): number;1681    /** The shape between the walls of a circle roulette, on a raster of `side` by `side` pixels over the disc, row zero at the top and the ordinate falling down the rows. Every distinct curve under the coincidence law is drawn once as a polyline of at least `samples` points, and of enough points that consecutive points land in one pixel or in two of the eight that touch, so the polylines make a wall no four-connected flood crosses. One flood starts from every pixel of the raster's edge, the fluid poured from outside; one starts from the centre pixel, the fluid poured at the centre, and is empty when the centre is a wall or the outside already reached it; the shape is the rest of the disc, pockets included. `covered` is the shape's share of the disc's pixels, the wall's own pixels counted in and reported apart as `wall`, and `hole` is the centre flood's share. `winding` is the mean signed winding number of the disc's pixel centres, read off crossings of the same polylines by scanline and never off a flood, and `areas` is the closed form it converges to, the distinct curves' `signed_area` summed over the disc's area: the pair checks the polylines and the raster against Green's theorem and never the floods, which are guarded instead by the sample spacing of at most half a pixel, which makes the wall eight-connected and a four-connected flood unable to cross it. Every share carries a boundary error of the order of the polylines' length times the pixel side over the disc's area. */1682    export function cover(track: spirograph.Track, pencils: spirograph.Pencil[], exact: boolean, samples: number, side: number): spirograph.Cover;1683    /** The disc a circle roulette sits in: the wheel's centre turns on a circle of radius `rho`, and a seat `d` from the wheel's centre puts the pencil at `|z|^2 = rho^2 + d^2 + 2 rho d cos(a t / b -+ arg p)`, whose phase runs over `a` full turns, so that curve lies in the closed annulus from `abs(rho - d)` to `rho + d` and attains both bounds. The whole roulette therefore never leaves the disc of radius `rho + max d` and enters no disc of radius under `min abs(rho - d)`, the least over the seats and not the outermost seat's own, since seats on both sides of `rho` each keep their own inner radius. Refuses a line or a polygon track, whose roulette need not close and has no wall. */1684    export function disc(track: spirograph.Track, pencils: spirograph.Pencil[]): spirograph.Disc;1685    /** How many classes `representatives` finds: the distinct curves on a circle track, the shapes up to a shift along a line track, one class per pencil on a polygon and under jitter. */1686    export function distinct(track: spirograph.Track, pencils: spirograph.Pencil[], exact: boolean): number;1687    /** The box the whole picture sits in: the centre path and the track, padded by the wheel's radius or the farthest seat, whichever reaches further. */1688    export function frame(track: spirograph.Track, pencils: spirograph.Pencil[]): Float64Array;1689    /** The crossings of the whole roulette on a circle track, the generic count, with `R/r = a/b` in lowest terms. Write `|p|` for a seat's distance from the wheel's centre in wheel radii and `A` for the centre path's radius in the same units, `(a - b)/b` inside and `(a + b)/b` outside. Every seat must lie strictly inside the window `0 < |p| < min(1, A)`, which three hypotheses cut: `|p| > 0`, since a seat at the wheel's centre draws the centre circle `b` times over and never crosses; `|p| < 1`, the loop threshold, past which a curve loops; and `|p| < A`, the seat threshold, where the seat reaches the centre path, which comes before the loop threshold on every inside track with `a < 2b` and never bites outside. Inside that window two distinct curves cross exactly `2ab` times, one curve crosses itself `a(b - 1)` times, and `k` distinct curves cross `2ab k(k - 1) / 2 + k a (b - 1)` times, the design entering only through `k`. `exact` reads the coincidence law on the seats, as `distinct` does. `None` on a line or a polygon track, and `None` when any seat leaves the window, where neither count is the law's. At isolated reaches some crossings merge, so the count holds for the generic reach. */1690    export function nodes(track: spirograph.Track, pencils: spirograph.Pencil[], exact: boolean): bigint | undefined;1691    /** Seats one pencil per chosen site of a byte grid: `fill` the filled cells, `void` the empty ones, `both`, or `corners` the corners of the filled cells, each once. The tile is scaled so its circumradius is `reach` wheel radii, and `jitter` moves every seat by up to that fraction of a cell each way, seeded. */1692    export function pencils(types: ArrayLike<number>, width: number, height: number, mode: string, reach: number, jitter: number, seed: number): spirograph.Pencil[];1693    /** Where a pencil is after `s` of path length: the centre plus the seat turned with the wheel. */1694    export function point(track: spirograph.Track, pencil: spirograph.Pencil, s: number): [number, number];1695    /** The wheel's centre after `s` of path length. */1696    export function pose(track: spirograph.Track, s: number): [number, number];1697    /** One pencil per class, the first index of every class in the order the pencils were seated. On a circle track the classes are the distinct curves, by the coincidence law on exact seats: two pencils draw one curve iff a rotation of a full turn over the ratio's denominator carries one seat to the other, which the square lattice allows only by half turns when the denominator is even and by quarter turns when four divides it. On a line track the classes are the seat radii, and those are shapes up to a shift, not curves: turning a seat by `gamma` slides its whole ribbon `gamma` wheel radii along the line while the ribbon's period is a full turn of the wheel, so two seats of one radius draw translates of one shape and share no point unless the seats are equal. On a polygon every pencil is its own class, and so is every pencil under jitter. */1698    export function representatives(track: spirograph.Track, pencils: spirograph.Pencil[], exact: boolean): Uint32Array;1699    /** Counts the pencils by kind. */1700    export function seats(pencils: spirograph.Pencil[]): spirograph.Seats;1701    /** The signed area one pencil's closed trochoid sweeps over the whole track, counterclockwise positive and counted with multiplicity, so it is the winding number integrated over the plane: `pi b rho (rho - d^2/r)` inside and `pi b rho (rho + d^2/r)` outside, with `rho` the centre circle's radius `R -+ r`, `d = r |p|` the seat's distance from the wheel's centre and `R/r = a/b` in lowest terms. Green's theorem on `z(t) = rho e^(i t) + p r e^(-+ i (rho/r) t)` gives it, and the cross terms carry `e^(-+ i a t / b)` over `b` centre turns and integrate to zero. No hypothesis on the seat: loops are counted with their sign. `None` off a circle track, where the roulette need not close. */1702    export function signed_area(track: spirograph.Track, pencil: spirograph.Pencil): number | undefined;1703    /** Traces every pencil along the whole track at `samples` evenly spaced path lengths, first and last included: pencil by pencil, sample by sample, x then y. */1704    export function trace(track: spirograph.Track, pencils: spirograph.Pencil[], samples: number): Float32Array;1705    /** Lays a track: `line` a straight line under the wheel for `laps` turns; `in` and `out` a circle of radius `ring` with the wheel inside or outside, closing after the reduced denominator of `ring` over `wheel` orbits; `polyin` and `polyout` a regular polygon of `sides` sides and circumradius `ring` for `laps` laps. */1706    export function track(kind: string, ring: number, wheel: number, sides: number, laps: number): spirograph.Track;1707    /** The wheel's turn after `s` of path length, in radians: `side` times `s` over the wheel's radius. */1708    export function turn(track: spirograph.Track, s: number): number;1709    /** The most laps of a line or a polygon. */1710    export function LAPS_CAP(): number;1711    /** The most pencils a wheel seats. */1712    export function PENCIL_CAP(): number;1713    /** The most points one trace returns. */1714    export function POINT_CAP(): number;1715    /** The largest radius of a ring or a wheel. */1716    export function RADIUS_CAP(): number;1717    /** The largest raster side a cover rasters. */1718    export function RASTER_CAP(): number;1719    /** The fewest and the most sides of a polygon track. */1720    export function SIDES(): [number, number];1721    /** The shape between the walls on a raster, with its numbers. */1722    export interface Cover {1723        /** The raster row by row, four codes: zero outside the disc, one the flood from the raster's edge, two the flood from the centre, three the shape, the walls and their pockets included. */1724        mask: number[];1725        /** The raster's side in pixels. */1726        side: number;1727        /** The shape's share of the disc's pixels, the walls counted in. */1728        covered: number;1729        /** The centre flood's share of the disc's pixels. */1730        hole: number;1731        /** The share of the disc's pixels the polylines themselves mark, the boundary error `covered` carries and loses as the raster grows. */1732        wall: number;1733        /** The mean signed winding number of the disc's pixel centres, read by scanline off the polylines. */1734        winding: number;1735        /** The closed form `winding` converges to: the distinct curves' signed areas summed and divided by the disc's area. */1736        areas: number;1737    }1738    /** The disc a circle roulette sits in, in the track's units. */1739    export interface Disc {1740        /** The centre's abscissa in the track's units, the centre of the ring. */1741        x: number;1742        /** The centre's ordinate in the track's units. */1743        y: number;1744        /** The radius no curve leaves, in the track's units: `rho + d` with `rho` the centre circle's radius and `d = r abs(p)` the outermost seat, which is `(a - b)/b + abs(p)` wheel radii inside and `(a + b)/b + abs(p)` outside. */1745        radius: number;1746        /** The radius no curve enters, in the track's units: the least of `abs(rho - d)` over the seats, which is not `rho` less the outermost seat when the seats straddle `rho`, and `rho` itself when no pencil is seated. */1747        hole: number;1748    }1749    /** What a pencil sits on: a filled cell, an empty cell, or a corner of a filled cell. */1750    export type Kind = "Fill" | "Void" | "Corner";1751    /** A pencil on the wheel: its seat in units of the wheel's radius with the tile centre at the origin, the exact seat it came from, and its kind. */1752    export interface Pencil {1753        /** The seat's abscissa, in wheel radii. */1754        x: number;1755        /** The seat's ordinate, up the page, in wheel radii. */1756        y: number;1757        /** The exact seat, twice the cell coordinates from the tile centre, before any jitter. */1758        seat: [number, number];1759        /** What the pencil sits on. */1760        kind: spirograph.Kind;1761    }1762    /** One piece of the centre path: a straight run, or a turn about a point. */1763    export type Piece = { Run: { from: [number, number]; to: [number, number] } } | { Turn: { about: [number, number]; radius: number; from: number; to: number } };1764    /** The mass of a byte grid taken as a wheel: how many pencils of each kind it seats. */1765    export interface Seats {1766        /** The pencils on filled cells. */1767        fills: number;1768        /** The pencils on empty cells. */1769        voids: number;1770        /** The pencils on corners. */1771        corners: number;1772    }1773    export const Seats: {1774        /** Returns the default Seats. */1775        default(): spirograph.Seats;1776    };1777    /** A track and the path the wheel's centre takes along it: the wheel of radius `wheel` rolls without slipping, on the left of the track when `side` is minus one and on the right when it is plus one, and turns by `side` times the centre's path length over the wheel's radius. */1778    export interface Track {1779        /** The kind: `line`, `in`, `out`, `polyin` or `polyout`. */1780        kind: string;1781        /** The wheel's radius. */1782        wheel: number;1783        /** The pieces of the centre path, in order. */1784        pieces: spirograph.Piece[];1785        /** The length of the centre path. */1786        total: number;1787        /** Minus one inside the track, plus one outside it. */1788        side: number;1789        /** The track itself as a polyline, closed when `closed` says so. */1790        outline: [number, number][];1791        /** Whether the outline closes on itself. */1792        closed: boolean;1793        /** The ring's radius over the wheel's in lowest terms on a circle, zero over zero elsewhere. */1794        ratio: [number, number];1795        /** How many times the centre goes round: the ratio's denominator on a circle, the laps on a polygon, one on a line. */1796        orbits: number;1797        /** The rotation order of the whole picture: the ratio's numerator on a circle, none elsewhere. */1798        fold: number;1799    }1800}1801export declare namespace three {1802    /** Builds the Menger sponge, filled where at most one coordinate is odd, at the given level. */1803    export function carpet(number: number, level: number): Cell;1804    /** Tallies a cell's sites, its exposed surface and its Euler characteristic in one reading. */1805    export function census(cell: Cell): three.Census;1806    /** Extracts the network of filled sites joined to their axis neighbors. */1807    export function core_graph(cell: Cell): graph.Network;1808    /** Builds the cube the universe code names, deepened to the given fractal level. */1809    export function create(code: string | number | bigint, number: number, level: number, base: number): Cell;1810    /** Lists the filled cells on the diagonal plane `x + y + z = height`, as `x, y, z` triples. */1811    export function diagonal_slice(code: string | number | bigint, number: number, level: number, base: number, height: number): Uint32Array[];1812    /** Draws the given diagonal slices as one circle per cell, coloured by height slot and top-scale corner. */1813    export function diagonal_svg(code: string | number | bigint, number: number, level: number, base: number, heights: ArrayLike<number>, scale: number): string;1814    /** Builds the dust cube, filled where every coordinate is even, at the given level. */1815    export function dust(number: number, level: number): Cell;1816    /** Extracts the network of corners and edges outlining every filled site. */1817    export function edge_graph(cell: Cell): graph.Network;1818    /** Returns the Euler characteristic of the filled complex, vertices less edges plus faces less sites. */1819    export function euler(cell: Cell): bigint;1820    /** Lifts a flat cell into a cube by repeating it depth times along a new axis, colors and tags with it. */1821    export function extrude(cell: Cell, axis: number, depth: number): Cell;1822    /** Repeats every plane of a cube depth times along its leading axis, colors and tags with it. */1823    export function extrude_cube(cell: Cell, depth: number): Cell;1824    /** Returns the count of unit faces the filled sites touch, a face shared by two sites counted once. */1825    export function faces(cell: Cell): number;1826    /** Returns the count of filled sites. */1827    export function fills(cell: Cell): number;1828    /** Builds a cube from its corner patterns, deepened to the given fractal level. */1829    export function from_corners(corners: ArrayLike<number>[], number: number, level: number, base: number): Cell;1830    /** Parses a cell from its JSON, colors and tags included. */1831    export function from_json(text: string): Cell;1832    /** Builds a cube from one string of digits per row, grouped plane by plane. */1833    export function from_strings(data: string[][]): Cell;1834    /** Returns the count of faces buried between two filled sites, six per site less the exposed surface. */1835    export function hidden(cell: Cell): string;1836    /** Builds the cube filled wherever the residue sum lands in the levels, at the given level. */1837    export function level_set(number: number, levels: ArrayLike<number>, level: number, base: number): Cell;1838    /** Folds two or more cells into one by chained Kronecker combination. */1839    export function magic(cells: Cell[]): Cell;1840    /** Tags every site with its Manhattan distance from the cube's center, the diamond shells. */1841    export function manhattan_layers(cell: Cell): Cell;1842    /** Merges the cells into one cube arranged width by height by depth. */1843    export function merge(cells: Cell[], width: number, height: number, depth: number): Cell;1844    /** Builds a cell by placing at each mask site the cell its value indexes. */1845    export function mosaic(mask: Tensor, cells: Cell[]): Cell;1846    /** Builds the cube the name picks, deepened to the given fractal level. */1847    export function named(design: gen.recipe.Design, number: number, level: number): Cell;1848    /** Builds the net cube, filled where at least two coordinates are odd, at the given level. */1849    export function net(number: number, level: number): Cell;1850    /** Builds a cube whose every site turns on with probability density, at the given level. */1851    export function noise(number: number, level: number, density: number, rng: Rng): Cell;1852    /** Builds the solid cube at the given size and level. */1853    export function ones(number: number, level: number): Cell;1854    /** Returns the 24 rotation triples that reach each distinct cube orientation. */1855    export function orientations(): [number, number, number][];1856    /** Builds the point cube, filled where every coordinate is odd, at the given level. */1857    export function point(number: number, level: number): Cell;1858    /** Counts the filled cells on every diagonal plane `x + y + z = s`, for `s` in `0..=3*(side - 1)`. */1859    export function profile(code: string | number | bigint, number: number, level: number, base: number): string[];1860    /** Projects a cell down the `(1,1,1)` axis: `u = (x - y)/sqrt 2`, `v = (x + y - 2z)/sqrt 6`. */1861    export function project(point: ArrayLike<number>): [number, number];1862    /** Returns one outward quad per exposed face, scaled into the unit box. */1863    export function quads(cell: Cell): three.Quad[];1864    /** Returns the integer shadow `(x - y, x + y - 2z)`, the projection with its irrational scales dropped. */1865    export function shadow(point: ArrayLike<number>): [bigint, bigint];1866    /** Takes the flat cell left when one axis of the cube is fixed at an index, colors and tags with it. */1867    export function slice(cell: Cell, axis: number, index: number): Cell;1868    /** Orients a copy of the cell by each mask value and merges them in the mask's shape. */1869    export function special(mask: Tensor, cell: Cell): Cell;1870    /** Builds the star cube, filled where exactly one coordinate is odd, at the given level. */1871    export function star(number: number, level: number): Cell;1872    /** Returns the first and last height a profile fills, or none when the design is empty. */1873    export function support(counts: (string | number | bigint)[]): [number, number] | undefined;1874    /** Returns the count of filled faces exposed to void or the outside. */1875    export function surface(cell: Cell): string;1876    /** Renders the cube as rows of glyphs, plane after plane, or of digits where no glyph is mapped. */1877    export function text(cell: Cell, glyphs?: Record<string, string>): string[];1878    /** Serializes the cell's shape and types to JSON, with colors and tags when present. */1879    export function to_json(cell: Cell): string;1880    /** Writes the cube's exposed quads as a Wavefront OBJ, one shared vertex per corner. */1881    export function to_obj(cell: Cell): string;1882    /** Unrolls the cube into one string of digits per row, grouped plane by plane. */1883    export function to_strings(cell: Cell): string[][];1884    /** Extracts the network of empty sites joined to their axis neighbors. */1885    export function tunnel_graph(cell: Cell): graph.Network;1886    /** Builds the checkerboard cube, filled where all coordinate parities agree, at the given level. */1887    export function void_(number: number, level: number): Cell;1888    /** Returns the count of empty sites. */1889    export function voids(cell: Cell): number;1890    /** Returns the filled-site count, the cube's volume. */1891    export function volume(cell: Cell): number;1892    /** Returns the cell's edge-graph segments, scaled into the unit box. */1893    export function wires(cell: Cell): three.Vec3[][];1894    /** Builds the cube of rods along the x axis at the given size and level. */1895    export function xline(number: number, level: number): Cell;1896    /** Builds the cube of beams along the x axis at the given size and level. */1897    export function xtree(number: number, level: number): Cell;1898    /** Builds the cube of rods along the y axis at the given size and level. */1899    export function yline(number: number, level: number): Cell;1900    /** Builds the cube of beams along the y axis at the given size and level. */1901    export function ytree(number: number, level: number): Cell;1902    /** Builds the all-void cube at the given size and level. */1903    export function zeros(number: number, level: number): Cell;1904    /** Builds the cube of rods along the z axis at the given size and level. */1905    export function zline(number: number, level: number): Cell;1906    /** Builds the cube of beams along the z axis at the given size and level. */1907    export function ztree(number: number, level: number): Cell;1908    /** The tally of a cube's sites. */1909    export interface Census {1910        /** The count of filled sites. */1911        fills: number;1912        /** The count of empty sites. */1913        voids: number;1914        /** The count of exposed faces. */1915        surface: bigint;1916        /** The count of corners the filled sites touch. */1917        vertices: number;1918        /** The count of unit edges the filled sites touch. */1919        edges: number;1920        /** The count of unit faces the filled sites touch, shared ones counted once. */1921        faces: number;1922        /** The Euler characteristic of the filled complex. */1923        euler: number;1924    }1925    /** An outward face of a filled site: its normal and four corners. */1926    export interface Quad {1927        /** The outward unit normal. */1928        normal: three.Vec3Data;1929        /** The four corners in winding order. */1930        verts: three.Vec3Data[];1931    }1932    export interface Vec3Data {1933        /** The x component. */1934        x: number;1935        /** The y component. */1936        y: number;1937        /** The z component. */1938        z: number;1939    }1940    /** A three-component vector of f32. */1941    export class Vec3 {1942        /** Builds a vector from its components. */1943        constructor(x: number, y: number, z: number);1944        free(): void;1945        /** Reads the Vec3 from its plain data. */1946        static from(data: Vec3Data): Vec3;1947        /** Writes the Vec3 as plain data. */1948        toJSON(): Vec3Data;1949        /** The x component. */1950        get x(): number;1951        set x(value: number);1952        /** The y component. */1953        get y(): number;1954        set y(value: number);1955        /** The z component. */1956        get z(): number;1957        set z(value: number);1958        /** Returns the cross product, perpendicular to both vectors. */1959        cross(o: three.Vec3): three.Vec3;1960        /** Returns the dot product of the two vectors. */1961        dot(o: three.Vec3): number;1962        /** Multiplies every component by the scalar. */1963        scale(s: number): three.Vec3;1964    }1965}1966export declare namespace tourbillon {1967    /** The angles a quarter turn shares with itself: ninety a over q for every q up to the cap and every a from zero to four q coprime to it, sorted by angle. */1968    export function eyes(qmax: number): tourbillon.Eye[];1969    /** Spins the odd parity carpets at the scales one, three, five up to the top into one stack on a square of the size, every layer turned about the centre by its own angle and masked to the inscribed disc, so every pixel sees every layer. */1970    export function field(top: number, size: number, schedule: string, increment: number, set: string, weights: string, mode: string, blend: string, seed: number): Float32Array;1971    /** The layers of a stack: every scale one, three, five up to the top the set keeps, each with its weight and its angle. */1972    export function layers(top: number, schedule: string, increment: number, set: string, weights: string, seed: number): tourbillon.Layer[];1973    /** The least whole number of increments that closes a quarter turn, none once the count passes the cap. */1974    export function period(increment: number): number | undefined;1975    /** The angle classes of a stack read a quarter turn apart: how many the layers fall in, and how many layer pairs share one. */1976    export function sharing(list: tourbillon.Layer[]): [number, number];1977    /** Rasters the layers onto a square of the size, every one turned about the centre by its own angle and masked to the inscribed disc, then merged site by site. */1978    export function stack(list: tourbillon.Layer[], size: number, mode: string, blend: spin.Blend): Float32Array;1979    /** Reads a spun stack against the schedule that made it: the layer count, the first eight scales and angles, the mean and RMS contrast over the disc, that contrast times the root of the layer count, the exact centre value, whether the blend carries the weights, the span the raster covers and the brightest three sites. */1980    export function stats(field: ArrayLike<number>, size: number, top: number, schedule: string, increment: number, set: string, weights: string, blend: string, seed: number): tourbillon.Stats;1981    /** One angle of the quarter-turn lattice: the turn in degrees and the ninety a over q that names it. */1982    export interface Eye {1983        /** The turn in degrees. */1984        angle: number;1985        /** The numerator, ninety times a. */1986        numer: number;1987        /** The denominator q. */1988        denom: number;1989    }1990    /** One carpet of a stack: the odd scale it is drawn at, the weight the linear blends carry it at and the turn it takes about the centre, in degrees. */1991    export interface Layer {1992        /** The odd scale, the number of cells across the carpet. */1993        scale: number;1994        /** The weight, scaled so the magnitudes average one. */1995        weight: number;1996        /** The turn about the centre, in degrees. */1997        degrees: number;1998    }1999    /** The readings of a spun stack: its layers, the first eight scales and angles, the mean and RMS contrast over the disc, that contrast times the root of the layer count, the exact centre value, whether the blend carries the weights, the span the raster covers, the sites inside the disc and the brightest three. */2000    export interface Stats {2001        /** The count of layers in the stack. */2002        layers: number;2003        /** The first eight scales. */2004        scales: number[];2005        /** The first eight angles, in degrees. */2006        angles: number[];2007        /** The mean over the disc. */2008        mean: number;2009        /** The RMS contrast over the disc. */2010        rms: number;2011        /** The RMS contrast times the root of the layer count. */2012        faded: number;2013        /** The exact value at the centre, computed and never sampled. */2014        centre: number;2015        /** Whether the blend carries the weights. */2016        weighted: boolean;2017        /** The smallest value over the disc. */2018        low: number;2019        /** The largest value over the disc. */2020        high: number;2021        /** The count of sites inside the disc. */2022        inside: number;2023        /** The brightest three sites, each as its unit coordinates and its value. */2024        peaks: number[][];2025        /** The least whole number of increments that closes a quarter turn, none past the cap. */2026        period?: number;2027        /** The count of distinct angle classes the layers fall in, read a quarter turn apart. */2028        classes: number;2029        /** The count of layer pairs sharing an angle class. */2030        pairs: number;2031    }2032}2033export declare namespace two {2034    /** Returns the payload bytes the cell's filled sites can hold, its length header paid for. */2035    export function capacity(cell: Cell): number;2036    /** Builds the carpet fractal, its seed pierced at every odd-odd site, deepened to the level. */2037    export function carpet(number: number, level: number): Cell;2038    /** Takes the cell's full census in one reading. */2039    export function census(cell: Cell): two.Census;2040    /** Builds the design a universe code names, deepened to the level and rotated by quarter-turns. */2041    export function create(code: string | number | bigint, number: number, level: number, rotation: number, base: number): Cell;2042    /** Builds the dust fractal, its seed on at every even-even site, deepened to the level. */2043    export function dust(number: number, level: number): Cell;2044    /** Writes the payload over the cell's filled sites, repeating it until every site is spoken for. */2045    export function embed(cell: Cell, payload: ArrayLike<number>): Cell;2046    /** Returns the Euler characteristic of the filled sites, vertices less edges plus faces. */2047    export function euler(cell: Cell): bigint;2048    /** Reads the payload back, the plain cell naming the sites the carried one wrote over. */2049    export function extract(carrier: Cell, carried: Cell): Uint8Array;2050    /** Counts the filled sites of the cell. */2051    export function fills(cell: Cell): number;2052    /** Builds the design straight from its filled residue corners, deepened to the level and rotated by quarter-turns. */2053    export function from_corners(corners: ArrayLike<number>[], number: number, level: number, rotation: number, base: number): Cell;2054    /** Restores a cell from its JSON string, colors and tags included. */2055    export function from_json(text: string): Cell;2056    /** Builds a cell from rows of digits, the inverse of the text rendering. */2057    export function from_strings(rows: string[]): Cell;2058    /** Builds the hline fractal, its seed striped along odd rows, deepened to the level. */2059    export function hline(number: number, level: number): Cell;2060    /** Builds the htree fractal, its seed striped along even rows, deepened to the level. */2061    export function htree(number: number, level: number): Cell;2062    /** Builds the level-set design, filling every residue corner whose digits sum to a named level. */2063    export function level_set(number: number, levels: ArrayLike<number>, level: number, rotation: number, base: number): Cell;2064    /** Tiles the mask over the shape and crops it, the perforation pattern itself. */2065    export function mask(mask: Tensor, shape: ArrayLike<number>): Tensor;2066    /** Merges same-shaped cells into one block of the given width and height in cells, colors and tags kept. */2067    export function merge(cells: Cell[], width: number, height: number): Cell;2068    /** Builds the design the name picks, deepened to the level and rotated by quarter-turns. */2069    export function named(design: gen.recipe.Design, number: number, level: number, rotation: number): Cell;2070    /** Builds the net fractal, its seed on wherever a coordinate is odd, deepened to the level. */2071    export function net(number: number, level: number): Cell;2072    /** Builds a random cell, each seed site drawn on with probability density, deepened to the level. */2073    export function noise(number: number, level: number, density: number, rng: Rng): Cell;2074    /** Builds an all-filled cell of the given size and level. */2075    export function ones(number: number, level: number): Cell;2076    /** Counts the faces of filled sites open to emptiness or the border. */2077    export function perimeter(cell: Cell): string;2078    /** Renders the cell to PNG bytes at the given pixel scale, stroked and padded when an outline is given. */2079    export function png(cell: Cell, scale: number, outline: Color | undefined, width: number, shape: two.Shape): Uint8Array;2080    /** Builds the point fractal, its seed on at every odd-odd site, deepened to the level. */2081    export function point(number: number, level: number): Cell;2082    /** Reads the payload back from a framed sheet, the plain fourth cell naming the sites. */2083    export function read(sheet: Cell, carrier: Cell): Uint8Array;2084    /** Builds the framed sheet of four same-sized cells, the fourth carrying the payload. */2085    export function sheet(cells: Cell[], payload: ArrayLike<number>): Cell;2086    /** Tiles quarter-turned copies of the cell as the 2d mask directs. */2087    export function special(mask: Tensor, cell: Cell): Cell;2088    /** Builds the star fractal, its seed on where exactly one coordinate is odd, deepened to the level. */2089    export function star(number: number, level: number): Cell;2090    /** Renders the cell to an SVG string at the given scale, stroked and padded when an outline is given. */2091    export function svg(cell: Cell, scale: number, outline: Color | undefined, width: number, shape: two.Shape): string;2092    /** Renders the cell as rows of glyphs, or of digits where no glyph is mapped. */2093    export function text(cell: Cell, glyphs?: Record<string, string>): string[];2094    /** Lifts the flat cell into a cube one site deep, colors and tags with it. */2095    export function to_3d(cell: Cell): Cell;2096    /** Serializes the cell to a JSON string of its types, with colors and tags when present. */2097    export function to_json(cell: Cell): string;2098    /** Builds the vline fractal, its seed striped along odd columns, deepened to the level. */2099    export function vline(number: number, level: number): Cell;2100    /** Builds the void fractal, its seed a checkerboard on even parity, deepened to the level. */2101    export function void_(number: number, level: number): Cell;2102    /** Counts the empty sites of the cell. */2103    export function voids(cell: Cell): number;2104    /** Builds the vtree fractal, its seed striped along even columns, deepened to the level. */2105    export function vtree(number: number, level: number): Cell;2106    /** Builds an all-empty cell of the given size and level. */2107    export function zeros(number: number, level: number): Cell;2108    /** One reading of a cell: its sites, its outline and its topology. */2109    export interface Census {2110        /** The count of filled sites. */2111        fills: number;2112        /** The count of empty sites. */2113        voids: number;2114        /** The count of filled faces open to emptiness or the border. */2115        perimeter: bigint;2116        /** The count of distinct corners the filled sites touch. */2117        vertices: number;2118        /** The count of distinct unit edges the filled sites carry. */2119        edges: number;2120        /** The Euler characteristic, vertices less edges plus filled sites. */2121        euler: number;2122    }2123    /** The outline a flat cell's sites are drawn with. */2124    export type Shape = "Square" | "Circle" | "Diamond";2125    export namespace payload {2126        /** The five by five mask a carried mosaic lays its four tiles out under. */2127        export function frame(): Tensor;2128    }2129}