/**
 * pacem v0.51.10-faraday (https://js.pacem.it)
 * Copyright 2025 Pacem (https://pacem.it)
 * Licensed under Apache-2.0
 */
declare namespace Pacem.Drawing {
    type ViewBoxAlignment = 'min' | 'mid' | 'max';
    type ViewBoxAspectRatio = 'none' | {
        x: ViewBoxAlignment;
        y: ViewBoxAlignment;
        slice?: boolean;
    };
    interface Stage extends EventTarget {
        draw(item?: Drawable): any;
        viewbox: Rect;
        aspectRatio?: ViewBoxAspectRatio;
        readonly transformMatrix: Matrix2D;
        readonly stage: HTMLElement;
    }
    interface Drawable {
        stage?: Stage;
        /** Gets or sets whether the drawable is hit-testable. */
        inert?: boolean;
        hide?: boolean;
        /** @deprecated will be likely removed sooner or later to be handled outside the stage/adapter. */
        draggable?: boolean;
        tag?: any;
    }
    function isDrawable(object: any): object is Drawable;
    interface UiObject extends Drawable {
        opacity?: number;
        readonly transformMatrix?: Matrix2D;
    }
    function isUiObject(object: any): object is UiObject;
    interface GradientStop {
        offset: number;
        color: string;
        opacity?: number;
    }
    interface Gradient {
        stops: GradientStop[];
    }
    interface LinearGradient extends Gradient {
        start: Point;
        end: Point;
    }
    interface RadialGradient extends Gradient {
        center: Point;
        radius: number;
    }
    function isLinearGradient(object: Gradient): object is LinearGradient;
    function isRadialGradient(object: Gradient): object is RadialGradient;
    interface PresentationState {
        stroke?: string;
        lineWidth?: number;
        fill?: string | Gradient;
        dashArray?: number[];
        lineJoin?: CanvasLineJoin;
        lineCap?: CanvasLineCap;
        readonly transformMatrix?: Matrix2D;
        opacity?: number;
    }
    class PresentationState {
        static combine(lhs: PresentationState, rhs: PresentationState, precomputedMatrix?: Matrix2D): PresentationState;
    }
    interface PresentationObject extends UiObject, PresentationState {
    }
    function isPresentationObject(object: any): object is PresentationObject;
    type Marker = {
        pathData: string;
        stroke?: string;
        fill?: string;
        viewbox?: Rect;
        ref?: Point;
        width?: number;
        height?: number;
    };
    type ShapeGeometry = {
        pathData: string;
        vertices: Point[];
        boundingRect: Rect;
    };
    interface Shape extends PresentationObject {
        pathData: string;
        markerStart?: Marker;
        markerEnd?: Marker;
        markerMid?: Marker;
        readonly vertices?: Point[];
        readonly boundingRect?: Rect;
    }
    function isShape(object: any): object is Shape;
    interface Group extends UiObject {
        childDrawables: Drawable[];
    }
    function isGroup(object: any): object is Pacem.Drawing.Group;
    interface Text extends UiObject {
        text: string;
        fontFamily?: string;
        fontWeight?: string;
        fontStyle?: string;
        fontSize?: number;
        color?: string;
        anchor?: Point;
        textAnchor?: 'start' | 'middle' | 'end';
    }
    function isText(object: any): object is Pacem.Drawing.Text;
    interface Image extends UiObject {
        src: string;
        x?: number;
        y?: number;
        width?: number;
        height?: number;
    }
    function isImage(object: any): object is Pacem.Drawing.Image;
    interface DragEventArgs {
        readonly offset: Point;
        readonly item: Drawable;
    }
    abstract class UI2DEvent<T> extends CustomUIEvent<T> {
        #private;
        constructor(type: string, eventInit: CustomEventInit<T>, originalEvent: MouseEvent | TouchEvent | KeyboardEvent, transformMatrix: Matrix2D);
        /** Gets the screen transform matrix. */
        get transformMatrix(): Matrix2D;
        project(pt?: Point): Point;
    }
    class Shape {
        static empty(): ShapeGeometry;
    }
    class DragEvent extends UI2DEvent<DragEventArgs> {
    }
    class DrawableEvent extends UI2DEvent<Drawable> {
        constructor(type: string, args: Drawable, originalEvent: MouseEvent | TouchEvent | KeyboardEvent, m: Matrix2D);
    }
    class StageEvent extends UI2DEvent<Stage> {
        constructor(type: string, args: Stage, originalEvent: MouseEvent | TouchEvent | KeyboardEvent, m?: Matrix2D);
    }
}
declare namespace Pacem.Components.Drawing {
    interface Stage extends Pacem.Drawing.Stage {
        readonly adapter: Pacem2DAdapterElement;
    }
    const TAG_MIDDLE_NAME = "2d";
    const TWO_PI: number;
    abstract class Pacem2DAdapterElement extends PacemEventTarget {
        protected DefaultShapeValues: {
            stroke: string;
            lineWidth: number;
            fill: string;
        };
        /**
         * Returns the transform matrix that projects page coords into stage coords.
         * @param scene {Pacem2DElement} Container for the stage/scene
         */
        abstract getTransformMatrix(scene: Pacem2DElement): Matrix2D;
        /**
         * Updates the stage with the new size.
         * @param scene {Pacem2DElement} Container for the stage/scene
         * @param size {Size} New size
         */
        abstract invalidateSize(scene: Pacem2DElement, size: Size): any;
        /**
         * Initializes the 2d scene and returns its corresponding DOM element.
         * @param scene {Pacem2DElement} Container for the stage/scene
         */
        abstract initialize(scene: Pacem2DElement): HTMLElement | SVGElement;
        /**
         * Disposes the 2d scene resources.
         * @param scene {Pacem2DElement} Container for the stage/scene
         */
        abstract dispose(scene: Pacem2DElement): void;
        /**
         * Returns the foremost drawable element under the pointer.
         * @param scene {Pacem2DElement} Container for the stage/scene
         */
        abstract getHitTarget(scene: Pacem2DElement): Pacem.Drawing.Drawable;
        /**
         * Draws the elements of provided the scene.
         * @param scene {Pacem2DElement} Container for the stage/scene
         * @param item {Drawable} If provided, tries to limit the drawing execution to the drawable itself
         * @param forceGroupRedraw {Boolean} In case the item is a group, it forces the redraw of its content
         */
        abstract draw(scene: Pacem2DElement, item?: Pacem.Drawing.Drawable, forceGroupRedraw?: boolean): any;
        /**
         * Processes the stage content and returns an image accordingly.
         * */
        abstract snapshot(stage: Pacem2DElement, bgColor?: string, type?: string, quality?: number): PromiseLike<Blob>;
        protected snapshotElement(element: HTMLElement | SVGElement, bgColor?: string, type?: string, quality?: number): PromiseLike<Blob>;
    }
    abstract class DrawableElement extends PacemCrossItemsContainerElement<DrawableElement> implements Pacem.Drawing.Drawable {
        validate(_: DrawableElement): boolean;
        protected findContainer(): Pacem2DElement | DrawableElement;
        get stage(): Pacem2DElement;
        get parent(): DrawableElement;
        tag: any;
        inert: boolean;
        disconnectedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
    }
    abstract class UiElement extends DrawableElement implements Pacem.Drawing.UiObject {
        #private;
        rotate: number;
        scaleX: number;
        scaleY: number;
        translateX: number;
        translateY: number;
        opacity: number;
        viewActivatedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        private _updateTransformMatrix;
        /** @internal */
        get transformMatrix(): {
            a: number;
            b: number;
            c: number;
            d: number;
            e: number;
            f: number;
        };
    }
    abstract class PresentationElement extends UiElement implements Pacem.Drawing.PresentationObject {
        stroke: string;
        fill: string | Pacem.Drawing.Gradient;
        dashArray?: number[];
        lineWidth: number;
        lineJoin?: CanvasLineJoin;
        lineCap?: CanvasLineCap;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
    }
    abstract class ShapeElement extends PresentationElement implements Pacem.Drawing.Shape {
        #private;
        protected data: string;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        viewActivatedCallback(): void;
        protected recomputeShape(): void;
        get pathData(): string;
        get boundingRect(): Rect;
        get vertices(): Point[];
        protected abstract getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
    }
    type StageOptions = {
        panControl: boolean;
        zoomControl: boolean;
        panModifiers: EventKeyModifier[];
        zoomModifiers: EventKeyModifier[];
    };
}
declare namespace Pacem.Components.Drawing {
    class PacemEllipseElement extends ShapeElement {
        center: Point;
        rx: number;
        ry: number;
        start: number;
        end: number;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        protected getPathData(): string;
        protected getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
        static getPathData(c?: Point, rx?: number, ry?: number, start?: number, end?: number): string;
    }
    class PacemCircleElement extends ShapeElement {
        center: Point;
        radius: number;
        start: number;
        end: number;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        protected getPathData(): string;
        protected getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
        static getPathData(c?: Point, r?: number, start?: number, end?: number): string;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemGroupElement extends PresentationElement implements Pacem.Drawing.Group {
        #private;
        validate(item: DrawableElement): boolean;
        datasource: Pacem.Drawing.Drawable[];
        get childDrawables(): Pacem.Drawing.Drawable[];
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemImageElement extends UiElement implements Pacem.Drawing.Image {
        src: string;
        x: number;
        y: number;
        width: number;
        height: number;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemLineElement extends ShapeElement {
        from: Point;
        to: Point;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        protected getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
        protected getPathData(): string;
        static getPathData(from?: Point, to?: Point): string;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemPathElement extends ShapeElement {
        d: string;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        protected getPathData: () => string;
        protected getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemPolygonElement extends ShapeElement {
        sides: number;
        /** The circumradius of the polygon. */
        radius: number;
        center: Point;
        starIndent: number;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        protected getPathData(): string;
        protected getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
        static getShapeGeometry(center: Point, radius: number, sides: number, starIndent?: number): Pacem.Drawing.ShapeGeometry;
        static getPathData(center: Point, radius: number, sides: number, starIndent?: number): string;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemPolylineElement extends ShapeElement {
        points: Point[];
        closed: boolean;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        static getShapeGeometry(points: Point[], closed: boolean): Pacem.Drawing.ShapeGeometry;
        protected getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
        protected getPathData(): string;
        static getPathData(points: Point[], closed: boolean): string;
    }
}
declare namespace Pacem.Components.Drawing {
    type CornerRadiusComponent = {
        value: number;
        unit?: 'pct' | 'u';
    };
    type CornerRadius = {
        rx: CornerRadiusComponent;
        ry: CornerRadiusComponent;
        type: CornerType;
    };
    enum CornerType {
        Rounded = "rounded",
        Cut = "cut"
    }
    class PacemRectElement extends ShapeElement {
        x: number;
        y: number;
        w: number;
        h: number;
        r: [CornerRadius, CornerRadius, CornerRadius, CornerRadius];
        cornerType: CornerType;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        protected getPathData(): any;
        protected getShapeGeometry(): Pacem.Drawing.ShapeGeometry;
        static getPathData(x: number, y: number, w: number, h: number, r: CornerRadius): any;
        static getPathData(x: number, y: number, w: number, h: number, r: [CornerRadius, CornerRadius, CornerRadius, CornerRadius]): any;
    }
}
declare namespace Pacem.Components.Drawing {
    class Pacem2DElement extends PacemItemsContainerElement<DrawableElement> implements Stage {
        #private;
        get stage(): HTMLElement;
        snapshot(bgColor?: string, type?: string, quality?: number): Promise<any> | PromiseLike<Blob>;
        get transformMatrix(): Matrix2D;
        private _transformMatrixScale;
        validate(item: DrawableElement): boolean;
        adapter: Pacem2DAdapterElement;
        viewbox: Rect;
        aspectRatio: Pacem.Drawing.ViewBoxAspectRatio;
        datasource: Pacem.Drawing.Drawable[];
        options: StageOptions;
        zoom: number;
        private _stage;
        private _resize;
        draw(item?: Pacem.Drawing.Drawable): any;
        draw(item: Pacem.Drawing.Group, deepRedraw: boolean): any;
        private _drawDebounced;
        /** Debounced draw invocation. */
        requestDraw(item?: Pacem.Drawing.Drawable): any;
        requestDraw(item: Pacem.Drawing.Group, redrawContent: boolean): any;
        private _buildUpDatasourceFromDOM;
        private _options;
        private _size;
        private _resizeHandler;
        private _getActualAspectRatio;
        private _zoomFromValue;
        private _zoom;
        private _zoomHandler;
        private _getPanPoint;
        private _panHandler;
        private _panningStart;
        private _panStartHandler;
        private _panEndHandler;
        private _invalidateSize;
        viewActivatedCallback(): void;
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
        disconnectedCallback(): void;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemTextElement extends UiElement implements Pacem.Drawing.Text {
        text: string;
        color: string;
        fontFamily: string;
        fontSize: number;
        fontWeight: string;
        fontStyle: string;
        anchor: Point;
        textAnchor: 'start' | 'middle' | 'end';
        propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
    }
}
declare namespace Pacem.Components.Drawing {
    class AdapterUtils {
        static stageDispatch(stage: Pacem.Drawing.Stage, type: 'down' | 'up' | 'click' | 'over' | 'out' | 'move', evt: MouseEvent | TouchEvent): void;
        static isValidViewbox(viewbox: any): viewbox is Rect;
        /**
         * Dispatches a UI event related to a `Drawable` and returns a boolean that tells if the event was prevented (true) or not (false).
         * @param target The `Drawable` instance.
         * @param type Short event type name.
         * @param evt The original event.
         */
        static itemDispatch(target: Pacem.Drawing.Drawable, type: 'down' | 'up' | 'click' | 'over' | 'out', evt: MouseEvent | TouchEvent): boolean;
        /**
         * Dispatches a drag event related to a `Drawable` and returns a boolean that tells if the event was prevented (true) or not (false).
         * @param target The `Drawable` instance.
         * @param evt The `DragDropEvent` instance.
         * @param offset The tracked offset.
         */
        static itemDispatch(target: Pacem.Drawing.Drawable, evt: Pacem.UI.DragDropEvent, offset: Point): boolean;
    }
}
declare namespace Pacem.Components.Drawing {
    /** Implementation postponed. Focus on SVG adapter. */
    class PacemCanvasAdapterElement extends Pacem2DAdapterElement {
        #private;
        snapshot(stage: Pacem2DElement, backgroundColor?: string, type?: string, quality?: number): PromiseLike<Blob>;
        getCanvas(stage: Pacem2DElement): HTMLCanvasElement;
        private _getScreenInverseMatrix;
        getTransformMatrix(scene: Pacem2DElement): Matrix2D;
        private _dragger;
        viewActivatedCallback(): void;
        disconnectedCallback(): void;
        invalidateSize(scene: Pacem2DElement, size: Size): void;
        getHitTarget(stage: Pacem2DElement): Pacem.Drawing.Drawable;
        initialize(scene: Pacem2DElement): HTMLElement | SVGElement;
        dispose(scene: Pacem2DElement): void;
        private _requestDraw;
        draw(scene: Pacem2DElement): void;
        private _hitTarget;
        private _pointer;
        private _scopeEvent;
        private _dragging;
        private _dragInitHandler;
        private _draggingHandler;
        private _dragEndHandler;
        private _mousemoveHandler;
        private _mouseDownUpHandler;
        private _draw;
        private _setPresentationState;
        private _drawImage;
        private _drawText;
        private _drawShape;
        private _drawMarker;
        private _scenes;
        private _handles;
    }
}
declare namespace Pacem.Components.Drawing {
    class PacemSvgAdapterElement extends Pacem2DAdapterElement {
        snapshot(stage: Pacem.Drawing.Stage, background?: string, type?: string, quality?: number): PromiseLike<Blob>;
        getTransformMatrix(scene: Pacem2DElement): Matrix2D;
        private _dragger;
        viewActivatedCallback(): void;
        disconnectedCallback(): void;
        invalidateSize(scene: Pacem2DElement, size: Size): void;
        initialize(scene: Pacem2DElement): HTMLElement | SVGElement;
        dispose(scene: Pacem2DElement): void;
        private _hitTarget;
        getHitTarget(scene: Pacem2DElement): Pacem.Drawing.Drawable;
        draw(scene: Pacem2DElement, item?: Pacem.Drawing.Drawable): any;
        draw(scene: Pacem2DElement, item: Pacem.Drawing.Group, deepRedraw: boolean): any;
        private _dragging;
        private _dragInitHandler;
        private _draggingHandler;
        private _dragEndHandler;
        private _mousemoveHandler;
        private _mouseDownUpHandler;
        private _hasItems;
        private _disposeSvg;
        private _draw;
        private _buildSVGElement;
        private _ensureGradient;
        private _ensureMarker;
        private _scenes;
        private _markers;
        private _gradients;
        private _items;
    }
}
