/** * MTKruto - Cross-runtime JavaScript library for building Telegram clients * Copyright (C) 2023-2026 Roj * * This file is part of MTKruto. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import { Api } from "../2_tl.js"; import { type Location } from "./0_location.js"; import { type ChatP } from "./1_chat_p.js"; import { type RichTextComponent } from "./3_rich_text_component.js"; /** * An unsupported type of page block. * @unlisted */ export interface PageBlockUnsupported { type: "unsupported"; } /** * A paragraph page block. * @unlisted */ export interface PageBlockParagraph { type: "paragraph"; text: RichTextComponent; } /** * A pre-formatted page block. * @unlisted */ export interface PageBlockPre { type: "pre"; language?: string; text: RichTextComponent; } /** * A footer page block. * @unlisted */ export interface PageBlockFooter { type: "footer"; text: RichTextComponent; } /** * A divider page block. * @unlisted */ export interface PageBlockDivider { type: "divider"; } /** * An anchor page block. * @unlisted */ export interface PageBlockAnchor { type: "anchor"; name: string; } /** @unlisted */ export interface PageBlockListItemText { type: "text"; isCheckbox: boolean; isChecked: boolean; text: RichTextComponent; } /** @unlisted */ export interface PageBlockListItemBlockList { type: "blockList"; isCheckbox: boolean; isChecked: boolean; blocks: PageBlock[]; } /** @unlisted */ export type PageBlockListItem = PageBlockListItemText | PageBlockListItemBlockList; export declare function constructPageBlockListItem(pli: Api.PageListItem, photos: Api.Photo[], documents: Api.Document[]): PageBlockListItem; export declare function pageBlockListItemToTlObject(pbli: PageBlockListItem): Api.PageListItem; /** * A list page block. * @unlisted */ export interface PageBlockList { type: "list"; items: PageBlockListItem[]; } /** * A block quote page block. * @unlisted */ export interface PageBlockBlockQuote { type: "blockQuote"; text: RichTextComponent; caption: RichTextComponent; } /** * A pull quote page block. * @unlisted */ export interface PageBlockPullQuote { type: "pullQuote"; text: RichTextComponent; caption: RichTextComponent; } /** @unlisted */ export interface PageBlockCaption { text: RichTextComponent; credit: RichTextComponent; } export declare function constructPageBlockCaption(pc: Api.PageCaption, photos: Api.Photo[]): PageBlockCaption; export declare function pageBlockCaptionToTlObject(pbc: PageBlockCaption): Api.PageCaption; /** * A photo page block. * @unlisted */ export interface PageBlockPhoto { type: "photo"; fileId: string; caption: PageBlockCaption; isSpoiler: boolean; url?: string; linkPreviewId?: string; } /** * A video page block. * @unlisted */ export interface PageBlockVideo { type: "video"; fileId: string; caption: PageBlockCaption; isSpoiler: boolean; isLoop: boolean; isAutoplay: boolean; linkPreviewId?: string; } /** * An animation page block. * @unlisted */ export interface PageBlockAnimation { type: "animation"; fileId: string; caption: PageBlockCaption; isSpoiler: boolean; isLoop: boolean; isAutoplay: boolean; linkPreviewId?: string; } /** * A cover page block. * @unlisted */ export interface PageBlockCover { type: "cover"; cover: PageBlock; } /** * An embed page block. * @unlisted */ export interface PageBlockEmbed { type: "embed"; isFullWidth: boolean; isScrollingAllowed: boolean; url?: string; html?: string; posterPhotoId?: string; width?: number; height?: number; caption: PageBlockCaption; } /** * An embed post page block. * @unlisted */ export interface PageBlockEmbedPost { type: "embedPost"; url: string; linkPreviewId: string; authorPhotoId: string; author: string; date: number; blocks: PageBlock[]; caption: PageBlockCaption; } /** * A collage page block. * @unlisted */ export interface PageBlockCollage { type: "collage"; items: PageBlock[]; caption: PageBlockCaption; } /** * A slideshow page block. * @unlisted */ export interface PageBlockSlideshow { type: "slideshow"; items: PageBlock[]; caption: PageBlockCaption; } /** * A channel page block. * @unlisted */ export interface PageBlockChannel { type: "channel"; chat: ChatP; } /** * An audio page block. * @unlisted */ export interface PageBlockAudio { type: "audio"; fileId: string; caption: PageBlockCaption; } /** * A voice page block. * @unlisted */ export interface PageBlockVoice { type: "voice"; fileId: string; caption: PageBlockCaption; } /** * A kicker page block. * @unlisted */ export interface PageBlockKicker { type: "kicker"; text: RichTextComponent; } /** @unlisted */ export interface PageBlockTableCell { isHeader: boolean; isCenterAligned: boolean; isRightAligned: boolean; isMiddleVerticallyAligned: boolean; isBottomVerticallyAligned: boolean; text?: RichTextComponent; colspan?: number; rowspan?: number; } export declare function constructPageBlockTableCell(ptc: Api.PageTableCell, photos: Api.Photo[]): PageBlockTableCell; export declare function pageBlockTableCellToTlObject(pbtc: PageBlockTableCell): Api.PageTableCell; /** @unlisted */ export interface PageBlockTableRow { cells: PageBlockTableCell[]; } export declare function constructPageBlockTableRow(ptr: Api.PageTableRow, photos: Api.Photo[]): PageBlockTableRow; export declare function pageBlockTableRowToTlObject(pbtr: PageBlockTableRow): Api.PageTableRow; /** * A table page block. * @unlisted */ export interface PageBlockTable { type: "table"; isBordered: boolean; isStriped: boolean; title: RichTextComponent; rows: PageBlockTableRow[]; } /** @unlisted */ export interface PageBlockOrderedListItemText { type: "text"; isCheckbox: boolean; isChecked: boolean; number?: string; value?: number; itemType?: string; text: RichTextComponent; } /** @unlisted */ export interface PageBlockOrderedListItemTextBlockList { type: "blockList"; isCheckbox: boolean; isChecked: boolean; number?: string; value?: number; itemType?: string; blocks: PageBlock[]; } /** @unlisted */ export type PageBlockOrderedListItem = PageBlockOrderedListItemText | PageBlockOrderedListItemTextBlockList; export declare function constructPageBlockOrderedListItem(ploi: Api.PageListOrderedItem, photos: Api.Photo[], documents: Api.Document[]): PageBlockOrderedListItem; export declare function pageBlockOrderedListItemToTlObject(pboli: PageBlockOrderedListItem): Api.PageListOrderedItem; /** * An order list page block. * @unlisted */ export interface PageBlockOrderedList { type: "orderedList"; isReversed: boolean; items: PageBlockOrderedListItem[]; start?: number; itemsType?: string; } /** * A details page block. * @unlisted */ export interface PageBlockDetails { type: "details"; isOpen: boolean; blocks: PageBlock[]; title: RichTextComponent; } /** * A map page block. * @unlisted */ export interface PageBlockMap { type: "map"; location: Location; zoom: number; width: number; height: number; caption: PageBlockCaption; } /** * A heading 1 page block. * @unlisted */ export interface PageBlockHeading1 { type: "heading1"; text: RichTextComponent; } /** * A heading 2 page block. * @unlisted */ export interface PageBlockHeading2 { type: "heading2"; text: RichTextComponent; } /** * A heading 3 page block. * @unlisted */ export interface PageBlockHeading3 { type: "heading3"; text: RichTextComponent; } /** * A heading 4 page block. * @unlisted */ export interface PageBlockHeading4 { type: "heading4"; text: RichTextComponent; } /** * A heading 5 page block. * @unlisted */ export interface PageBlockHeading5 { type: "heading5"; text: RichTextComponent; } /** * A heading 6 page block. * @unlisted */ export interface PageBlockHeading6 { type: "heading6"; text: RichTextComponent; } /** * A math page block. * @unlisted */ export interface PageBlockMath { type: "math"; code: string; } /** * A thinking block. * @unlisted */ export interface PageBlockThinking { type: "thinking"; text: RichTextComponent; } /** * A block quote blocks block. * @unlisted */ export interface PageBlockBlockQuoteBlocks { type: "blockQuoteBlocks"; blocks: PageBlock[]; caption: RichTextComponent; } /** Any type of page block. */ export type PageBlock = PageBlockUnsupported | PageBlockParagraph | PageBlockPre | PageBlockFooter | PageBlockDivider | PageBlockAnchor | PageBlockList | PageBlockBlockQuote | PageBlockPullQuote | PageBlockPhoto | PageBlockVideo | PageBlockAnimation | PageBlockCover | PageBlockEmbed | PageBlockEmbedPost | PageBlockCollage | PageBlockSlideshow | PageBlockChannel | PageBlockAudio | PageBlockVoice | PageBlockKicker | PageBlockTable | PageBlockOrderedList | PageBlockDetails | PageBlockMap | PageBlockHeading1 | PageBlockHeading2 | PageBlockHeading3 | PageBlockHeading4 | PageBlockHeading5 | PageBlockHeading6 | PageBlockMath | PageBlockThinking | PageBlockBlockQuoteBlocks; export declare function constructPageBlock(pb: Api.PageBlock, photos: Api.Photo[], documents: Api.Document[]): PageBlock; export declare function pageBlockToTlObject(pb: PageBlock): Api.PageBlock; export declare function collectMediaFileIds(pageBlocks: PageBlock[]): { fileId: string; type: "photo" | "audio" | "video" | "voice" | "animation"; }[]; //# sourceMappingURL=4_page_block.d.ts.map