@mtkruto/node 0.1.201 → 0.1.299
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYING +674 -0
- package/README.md +77 -1
- package/esm/0_deps.d.ts +20 -1
- package/esm/0_deps.js +21 -1
- package/esm/0_errors.d.ts +19 -0
- package/esm/0_errors.js +19 -0
- package/esm/1_utilities.d.ts +20 -1
- package/esm/1_utilities.js +20 -1
- package/esm/2_connection.d.ts +19 -0
- package/esm/2_connection.js +19 -0
- package/esm/2_tl.d.ts +19 -0
- package/esm/2_tl.js +19 -0
- package/esm/3_errors.d.ts +19 -0
- package/esm/3_errors.js +19 -0
- package/esm/3_storage.d.ts +19 -0
- package/esm/3_storage.js +19 -0
- package/esm/3_transport.d.ts +19 -0
- package/esm/3_transport.js +19 -0
- package/esm/3_types.d.ts +19 -0
- package/esm/3_types.js +19 -0
- package/esm/4_constants.js +19 -0
- package/esm/4_errors.d.ts +19 -0
- package/esm/4_errors.js +22 -3
- package/esm/5_client.d.ts +19 -0
- package/esm/5_client.js +19 -0
- package/esm/client/0_client_abstract.d.ts +19 -0
- package/esm/client/0_client_abstract.js +19 -0
- package/esm/client/0_filters.d.ts +19 -0
- package/esm/client/0_filters.js +19 -0
- package/esm/client/0_html.d.ts +19 -0
- package/esm/client/0_html.js +19 -0
- package/esm/client/0_markdown.js +5 -5
- package/esm/client/0_message.d.ts +19 -0
- package/esm/client/0_message.js +19 -0
- package/esm/client/0_params.d.ts +19 -0
- package/esm/client/0_params.js +19 -0
- package/esm/client/0_password.js +19 -0
- package/esm/client/0_types.d.ts +19 -0
- package/esm/client/0_types.js +19 -0
- package/esm/client/0_utilities.d.ts +7 -0
- package/esm/client/0_utilities.js +66 -4
- package/esm/client/1_account_manager.d.ts +19 -0
- package/esm/client/1_account_manager.js +23 -4
- package/esm/client/1_bot_info_manager.d.ts +19 -0
- package/esm/client/1_bot_info_manager.js +19 -0
- package/esm/client/1_business_connection_manager.d.ts +19 -0
- package/esm/client/1_business_connection_manager.js +19 -0
- package/esm/client/1_client_encrypted.d.ts +19 -0
- package/esm/client/1_client_encrypted.js +23 -4
- package/esm/client/1_client_plain.d.ts +19 -0
- package/esm/client/1_client_plain.js +22 -3
- package/esm/client/1_composer.d.ts +19 -0
- package/esm/client/1_composer.js +19 -0
- package/esm/client/1_file_manager.d.ts +19 -0
- package/esm/client/1_file_manager.js +25 -5
- package/esm/client/1_network_statistics_manager.d.ts +19 -0
- package/esm/client/1_network_statistics_manager.js +19 -0
- package/esm/client/1_reaction_manager.d.ts +19 -0
- package/esm/client/1_reaction_manager.js +21 -2
- package/esm/client/1_update_manager.d.ts +19 -0
- package/esm/client/1_update_manager.js +28 -8
- package/esm/client/2_message_manager.d.ts +19 -0
- package/esm/client/2_message_manager.js +66 -24
- package/esm/client/3_callback_query_manager.d.ts +19 -0
- package/esm/client/3_callback_query_manager.js +21 -0
- package/esm/client/3_chat_list_manager.d.ts +19 -0
- package/esm/client/3_chat_list_manager.js +32 -12
- package/esm/client/3_inline_query_manager.d.ts +19 -0
- package/esm/client/3_inline_query_manager.js +23 -2
- package/esm/client/3_story_manager.d.ts +19 -0
- package/esm/client/3_story_manager.js +26 -5
- package/esm/client/4_client.d.ts +19 -0
- package/esm/client/4_client.js +37 -17
- package/esm/connection/0_connection.d.ts +19 -0
- package/esm/connection/0_connection.js +19 -0
- package/esm/connection/1_connection_web_socket.js +22 -2
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +83 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +203 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +50 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +274 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +47 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +51 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +66 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +191 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +168 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +385 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +159 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +431 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +181 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +1046 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +42 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +52 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +11 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +122 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +1 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +24 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +46 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +121 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +31 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +30 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +2128 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +2127 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +109 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +108 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +8 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +1 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +90 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +95 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +50 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +128 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +46 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +110 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +42 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +120 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +6 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +54 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +110 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +40 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +75 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +58 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +101 -0
- package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
- package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.d.ts +2 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.js +5 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.d.ts +2 -2
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.js +5 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/crc32.js +1 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/deflate.js +8 -8
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inffast.js +2 -2
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inflate.js +19 -21
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/trees.js +3 -3
- package/esm/mod.d.ts +20 -1
- package/esm/mod.js +20 -1
- package/esm/storage/0_storage.d.ts +19 -0
- package/esm/storage/0_storage.js +25 -5
- package/esm/storage/1_utilities.d.ts +19 -1
- package/esm/storage/1_utilities.js +21 -3
- package/esm/storage/2_storage_indexed_db.d.ts +19 -0
- package/esm/storage/2_storage_indexed_db.js +19 -0
- package/esm/storage/2_storage_local_storage.d.ts +19 -0
- package/esm/storage/2_storage_local_storage.js +20 -4
- package/esm/storage/2_storage_memory.d.ts +19 -0
- package/esm/storage/2_storage_memory.js +19 -0
- package/esm/storage/2_storage_session_storage.d.ts +19 -0
- package/esm/storage/2_storage_session_storage.js +20 -4
- package/esm/tl/0_tl_raw_reader.d.ts +19 -0
- package/esm/tl/0_tl_raw_reader.js +19 -0
- package/esm/tl/0_tl_raw_writer.d.ts +19 -0
- package/esm/tl/0_tl_raw_writer.js +19 -0
- package/esm/tl/1_tl_object.d.ts +19 -0
- package/esm/tl/1_tl_object.js +19 -0
- package/esm/tl/2_types.d.ts +19 -0
- package/esm/tl/2_types.js +19 -0
- package/esm/tl/3_deserialize.d.ts +19 -0
- package/esm/tl/3_deserialize.js +19 -0
- package/esm/tl/3_functions.d.ts +19 -0
- package/esm/tl/3_functions.js +19 -0
- package/esm/tl/3_utilities.d.ts +19 -0
- package/esm/tl/3_utilities.js +24 -4
- package/esm/tl/4_tl_reader.d.ts +19 -0
- package/esm/tl/4_tl_reader.js +19 -0
- package/esm/tl/5_tl_writer.d.ts +19 -0
- package/esm/tl/5_tl_writer.js +19 -0
- package/esm/tl/6_rpc_result.d.ts +19 -0
- package/esm/tl/6_rpc_result.js +19 -0
- package/esm/tl/7_message.d.ts +19 -0
- package/esm/tl/7_message.js +19 -0
- package/esm/tl/8_message_container.d.ts +19 -0
- package/esm/tl/8_message_container.js +19 -0
- package/esm/transport/0_obfuscation.js +19 -0
- package/esm/transport/0_transport.d.ts +19 -0
- package/esm/transport/0_transport.js +19 -0
- package/esm/transport/1_transport_abridged.d.ts +19 -0
- package/esm/transport/1_transport_abridged.js +19 -0
- package/esm/transport/1_transport_intermediate.d.ts +19 -0
- package/esm/transport/1_transport_intermediate.js +19 -0
- package/esm/transport/2_transport_provider.d.ts +19 -0
- package/esm/transport/2_transport_provider.js +23 -4
- package/esm/transport/3_transport_provider_web_socket.d.ts +19 -0
- package/esm/transport/3_transport_provider_web_socket.js +19 -0
- package/esm/types/0_authorization_state.d.ts +19 -0
- package/esm/types/0_authorization_state.js +19 -0
- package/esm/types/0_bot_command.d.ts +19 -0
- package/esm/types/0_bot_command.js +19 -0
- package/esm/types/0_chat_action.d.ts +19 -0
- package/esm/types/0_chat_action.js +19 -0
- package/esm/types/0_chat_administrator_rights.d.ts +19 -0
- package/esm/types/0_chat_administrator_rights.js +19 -0
- package/esm/types/0_chat_member_rights.d.ts +19 -0
- package/esm/types/0_chat_member_rights.js +19 -0
- package/esm/types/0_chat_photo.d.ts +19 -1
- package/esm/types/0_chat_photo.js +19 -2
- package/esm/types/0_connection_state.d.ts +19 -0
- package/esm/types/0_connection_state.js +19 -0
- package/esm/types/0_contact.d.ts +19 -0
- package/esm/types/0_contact.js +19 -0
- package/esm/types/0_dice.d.ts +19 -0
- package/esm/types/0_dice.js +19 -0
- package/esm/types/0_file_source.d.ts +19 -0
- package/esm/types/0_file_source.js +19 -0
- package/esm/types/0_giveaway_parameters.d.ts +19 -0
- package/esm/types/0_giveaway_parameters.js +19 -0
- package/esm/types/0_id.d.ts +19 -0
- package/esm/types/0_id.js +19 -0
- package/esm/types/0_keyboard_button_poll_type.d.ts +19 -0
- package/esm/types/0_keyboard_button_poll_type.js +19 -0
- package/esm/types/0_link_preview.d.ts +19 -0
- package/esm/types/0_link_preview.js +19 -0
- package/esm/types/0_location.d.ts +19 -0
- package/esm/types/0_location.js +19 -0
- package/esm/types/0_login_url.d.ts +19 -0
- package/esm/types/0_login_url.js +19 -0
- package/esm/types/0_mask_position.d.ts +19 -0
- package/esm/types/0_mask_position.js +19 -0
- package/esm/types/0_message_entity.d.ts +19 -0
- package/esm/types/0_message_entity.js +22 -3
- package/esm/types/0_message_reference.d.ts +19 -0
- package/esm/types/0_message_reference.js +19 -0
- package/esm/types/0_message_search_filter.d.ts +19 -0
- package/esm/types/0_message_search_filter.js +21 -2
- package/esm/types/0_mini_app_info.d.ts +19 -0
- package/esm/types/0_mini_app_info.js +19 -0
- package/esm/types/0_network_statistics_entry.d.ts +19 -0
- package/esm/types/0_network_statistics_entry.js +19 -0
- package/esm/types/0_parse_mode.d.ts +19 -0
- package/esm/types/0_parse_mode.js +19 -0
- package/esm/types/0_poll_option.d.ts +19 -0
- package/esm/types/0_poll_option.js +19 -0
- package/esm/types/0_price_tag.d.ts +19 -0
- package/esm/types/0_price_tag.js +19 -0
- package/esm/types/0_reaction.d.ts +19 -0
- package/esm/types/0_reaction.js +21 -2
- package/esm/types/0_restriction_reason.d.ts +19 -0
- package/esm/types/0_restriction_reason.js +19 -0
- package/esm/types/0_story_reference.d.ts +19 -0
- package/esm/types/0_story_reference.js +19 -0
- package/esm/types/0_thumbnail.d.ts +19 -0
- package/esm/types/0_thumbnail.js +19 -0
- package/esm/types/0_voice.d.ts +19 -0
- package/esm/types/0_voice.js +19 -0
- package/esm/types/1_animation.d.ts +19 -0
- package/esm/types/1_animation.js +19 -0
- package/esm/types/1_audio.d.ts +19 -0
- package/esm/types/1_audio.js +19 -0
- package/esm/types/1_bot_command_scope.d.ts +19 -0
- package/esm/types/1_bot_command_scope.js +22 -3
- package/esm/types/1_chat_p.d.ts +19 -0
- package/esm/types/1_chat_p.js +22 -2
- package/esm/types/1_document.d.ts +19 -0
- package/esm/types/1_document.js +19 -0
- package/esm/types/1_giveaway.d.ts +19 -0
- package/esm/types/1_giveaway.js +19 -0
- package/esm/types/1_inline_query_result_button.d.ts +19 -0
- package/esm/types/1_inline_query_result_button.js +19 -0
- package/esm/types/1_input_message_content.d.ts +19 -0
- package/esm/types/1_input_message_content.js +19 -0
- package/esm/types/1_input_story_content.d.ts +19 -0
- package/esm/types/1_input_story_content.js +19 -0
- package/esm/types/1_keyboard_button.d.ts +19 -0
- package/esm/types/1_keyboard_button.js +22 -3
- package/esm/types/1_message_reaction.d.ts +19 -0
- package/esm/types/1_message_reaction.js +21 -2
- package/esm/types/1_network_statistics.d.ts +19 -0
- package/esm/types/1_network_statistics.js +19 -0
- package/esm/types/1_photo.d.ts +19 -0
- package/esm/types/1_photo.js +19 -0
- package/esm/types/1_poll.d.ts +19 -0
- package/esm/types/1_poll.js +19 -0
- package/esm/types/1_reaction_count.d.ts +19 -0
- package/esm/types/1_reaction_count.js +19 -0
- package/esm/types/1_reply_quote.d.ts +19 -0
- package/esm/types/1_reply_quote.js +19 -0
- package/esm/types/1_sticker.d.ts +19 -0
- package/esm/types/1_sticker.js +19 -0
- package/esm/types/1_story_privacy.d.ts +19 -0
- package/esm/types/1_story_privacy.js +22 -3
- package/esm/types/1_story_reaction.d.ts +19 -0
- package/esm/types/1_story_reaction.js +19 -0
- package/esm/types/1_user.d.ts +19 -0
- package/esm/types/1_user.js +19 -0
- package/esm/types/1_venue.d.ts +19 -0
- package/esm/types/1_venue.js +19 -0
- package/esm/types/1_video.d.ts +19 -0
- package/esm/types/1_video.js +19 -0
- package/esm/types/1_video_note.d.ts +19 -0
- package/esm/types/1_video_note.js +19 -0
- package/esm/types/2_business_connection.d.ts +19 -0
- package/esm/types/2_business_connection.js +19 -0
- package/esm/types/2_chat_member.d.ts +19 -0
- package/esm/types/2_chat_member.js +25 -5
- package/esm/types/2_chosen_inline_result.d.ts +19 -0
- package/esm/types/2_chosen_inline_result.js +22 -2
- package/esm/types/2_game.d.ts +19 -0
- package/esm/types/2_game.js +19 -0
- package/esm/types/2_inactive_chat.d.ts +19 -0
- package/esm/types/2_inactive_chat.js +22 -2
- package/esm/types/2_inline_keyboard_button.d.ts +19 -0
- package/esm/types/2_inline_keyboard_button.js +22 -3
- package/esm/types/2_inline_query.d.ts +19 -0
- package/esm/types/2_inline_query.js +22 -3
- package/esm/types/2_invite_link.d.ts +19 -0
- package/esm/types/2_invite_link.js +22 -2
- package/esm/types/2_message_interactions.d.ts +19 -0
- package/esm/types/2_message_interactions.js +19 -0
- package/esm/types/2_message_reaction_count.d.ts +19 -0
- package/esm/types/2_message_reaction_count.js +19 -0
- package/esm/types/2_message_reactions.d.ts +19 -0
- package/esm/types/2_message_reactions.js +19 -0
- package/esm/types/2_story_content.d.ts +19 -0
- package/esm/types/2_story_content.js +24 -5
- package/esm/types/2_story_interactions.d.ts +19 -0
- package/esm/types/2_story_interactions.js +19 -0
- package/esm/types/2_story_interactive_area.d.ts +19 -0
- package/esm/types/2_story_interactive_area.js +24 -5
- package/esm/types/3_chat_member_updated.d.ts +19 -0
- package/esm/types/3_chat_member_updated.js +23 -3
- package/esm/types/3_reply_markup.d.ts +19 -0
- package/esm/types/3_reply_markup.js +23 -3
- package/esm/types/3_story.d.ts +19 -0
- package/esm/types/3_story.js +22 -2
- package/esm/types/4_inline_query_result.d.ts +19 -0
- package/esm/types/4_inline_query_result.js +24 -5
- package/esm/types/4_message.d.ts +19 -0
- package/esm/types/4_message.js +36 -16
- package/esm/types/5_callback_query.d.ts +19 -0
- package/esm/types/5_callback_query.js +23 -3
- package/esm/types/5_chat.d.ts +19 -0
- package/esm/types/5_chat.js +27 -7
- package/esm/types/6_update.d.ts +19 -0
- package/esm/types/6_update.js +19 -0
- package/esm/types/_file_id.d.ts +19 -0
- package/esm/types/_file_id.js +28 -8
- package/esm/types/_getters.d.ts +19 -0
- package/esm/types/_getters.js +19 -0
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +44 -0
- package/esm/utilities/0_buffer.d.ts +19 -0
- package/esm/utilities/0_buffer.js +19 -0
- package/esm/utilities/0_cache_map.d.ts +19 -0
- package/esm/utilities/0_cache_map.js +19 -0
- package/esm/utilities/0_color.d.ts +19 -0
- package/esm/utilities/0_color.js +19 -0
- package/esm/utilities/0_crypto.d.ts +19 -0
- package/esm/utilities/0_crypto.js +19 -0
- package/esm/utilities/0_hash.js +19 -0
- package/esm/utilities/0_logger.d.ts +27 -0
- package/esm/utilities/0_logger.js +28 -5
- package/esm/utilities/0_mutex.d.ts +19 -0
- package/esm/utilities/0_mutex.js +19 -0
- package/esm/utilities/0_object.d.ts +19 -0
- package/esm/utilities/0_object.js +19 -0
- package/esm/utilities/0_rle.d.ts +19 -0
- package/esm/utilities/0_rle.js +19 -0
- package/esm/utilities/0_types.d.ts +19 -0
- package/esm/utilities/0_types.js +19 -0
- package/esm/utilities/1_auth.js +19 -0
- package/esm/utilities/1_base64.d.ts +19 -0
- package/esm/utilities/1_base64.js +19 -0
- package/esm/utilities/1_math.d.ts +20 -0
- package/esm/utilities/1_math.js +70 -0
- package/esm/utilities/1_misc.d.ts +19 -0
- package/esm/utilities/1_misc.js +21 -2
- package/esm/utilities/1_queue.d.ts +19 -0
- package/esm/utilities/1_queue.js +19 -0
- package/package.json +1 -1
- package/script/0_deps.d.ts +20 -1
- package/script/0_deps.js +22 -3
- package/script/0_errors.d.ts +19 -0
- package/script/0_errors.js +19 -0
- package/script/1_utilities.d.ts +20 -1
- package/script/1_utilities.js +20 -1
- package/script/2_connection.d.ts +19 -0
- package/script/2_connection.js +19 -0
- package/script/2_tl.d.ts +19 -0
- package/script/2_tl.js +19 -0
- package/script/3_errors.d.ts +19 -0
- package/script/3_errors.js +19 -0
- package/script/3_storage.d.ts +19 -0
- package/script/3_storage.js +19 -0
- package/script/3_transport.d.ts +19 -0
- package/script/3_transport.js +19 -0
- package/script/3_types.d.ts +19 -0
- package/script/3_types.js +19 -0
- package/script/4_constants.js +19 -0
- package/script/4_errors.d.ts +19 -0
- package/script/4_errors.js +22 -3
- package/script/5_client.d.ts +19 -0
- package/script/5_client.js +19 -0
- package/script/client/0_client_abstract.d.ts +19 -0
- package/script/client/0_client_abstract.js +19 -0
- package/script/client/0_filters.d.ts +19 -0
- package/script/client/0_filters.js +19 -0
- package/script/client/0_html.d.ts +19 -0
- package/script/client/0_html.js +19 -0
- package/script/client/0_markdown.js +5 -5
- package/script/client/0_message.d.ts +19 -0
- package/script/client/0_message.js +19 -0
- package/script/client/0_params.d.ts +19 -0
- package/script/client/0_params.js +19 -0
- package/script/client/0_password.js +19 -0
- package/script/client/0_types.d.ts +19 -0
- package/script/client/0_types.js +19 -0
- package/script/client/0_utilities.d.ts +7 -0
- package/script/client/0_utilities.js +73 -4
- package/script/client/1_account_manager.d.ts +19 -0
- package/script/client/1_account_manager.js +23 -4
- package/script/client/1_bot_info_manager.d.ts +19 -0
- package/script/client/1_bot_info_manager.js +19 -0
- package/script/client/1_business_connection_manager.d.ts +19 -0
- package/script/client/1_business_connection_manager.js +19 -0
- package/script/client/1_client_encrypted.d.ts +19 -0
- package/script/client/1_client_encrypted.js +21 -2
- package/script/client/1_client_plain.d.ts +19 -0
- package/script/client/1_client_plain.js +21 -2
- package/script/client/1_composer.d.ts +19 -0
- package/script/client/1_composer.js +19 -0
- package/script/client/1_file_manager.d.ts +19 -0
- package/script/client/1_file_manager.js +24 -4
- package/script/client/1_network_statistics_manager.d.ts +19 -0
- package/script/client/1_network_statistics_manager.js +19 -0
- package/script/client/1_reaction_manager.d.ts +19 -0
- package/script/client/1_reaction_manager.js +21 -2
- package/script/client/1_update_manager.d.ts +19 -0
- package/script/client/1_update_manager.js +27 -7
- package/script/client/2_message_manager.d.ts +19 -0
- package/script/client/2_message_manager.js +70 -28
- package/script/client/3_callback_query_manager.d.ts +19 -0
- package/script/client/3_callback_query_manager.js +21 -0
- package/script/client/3_chat_list_manager.d.ts +19 -0
- package/script/client/3_chat_list_manager.js +31 -11
- package/script/client/3_inline_query_manager.d.ts +19 -0
- package/script/client/3_inline_query_manager.js +23 -2
- package/script/client/3_story_manager.d.ts +19 -0
- package/script/client/3_story_manager.js +23 -2
- package/script/client/4_client.d.ts +19 -0
- package/script/client/4_client.js +35 -15
- package/script/connection/0_connection.d.ts +19 -0
- package/script/connection/0_connection.js +19 -0
- package/script/connection/1_connection_web_socket.js +21 -1
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +83 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +207 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +50 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +301 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +47 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +55 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +66 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +222 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +168 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +404 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +159 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +438 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +181 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +1052 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +42 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +88 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +11 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +128 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +1 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +30 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +46 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +31 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +32 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +2128 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +2129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +109 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +110 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +8 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +3 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +90 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +114 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +50 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +134 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +46 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +118 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +42 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +6 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +22 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +54 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +119 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +40 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +86 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +58 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +112 -0
- package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
- package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.d.ts +2 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.js +7 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.d.ts +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.js +7 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/crc32.js +1 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/deflate.js +8 -8
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inffast.js +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inflate.js +19 -21
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/trees.js +3 -3
- package/script/mod.d.ts +20 -1
- package/script/mod.js +21 -1
- package/script/storage/0_storage.d.ts +19 -0
- package/script/storage/0_storage.js +24 -4
- package/script/storage/1_utilities.d.ts +19 -1
- package/script/storage/1_utilities.js +22 -4
- package/script/storage/2_storage_indexed_db.d.ts +19 -0
- package/script/storage/2_storage_indexed_db.js +19 -0
- package/script/storage/2_storage_local_storage.d.ts +19 -0
- package/script/storage/2_storage_local_storage.js +19 -3
- package/script/storage/2_storage_memory.d.ts +19 -0
- package/script/storage/2_storage_memory.js +19 -0
- package/script/storage/2_storage_session_storage.d.ts +19 -0
- package/script/storage/2_storage_session_storage.js +19 -3
- package/script/tl/0_tl_raw_reader.d.ts +19 -0
- package/script/tl/0_tl_raw_reader.js +19 -0
- package/script/tl/0_tl_raw_writer.d.ts +19 -0
- package/script/tl/0_tl_raw_writer.js +19 -0
- package/script/tl/1_tl_object.d.ts +19 -0
- package/script/tl/1_tl_object.js +19 -0
- package/script/tl/2_types.d.ts +19 -0
- package/script/tl/2_types.js +19 -0
- package/script/tl/3_deserialize.d.ts +19 -0
- package/script/tl/3_deserialize.js +19 -0
- package/script/tl/3_functions.d.ts +19 -0
- package/script/tl/3_functions.js +19 -0
- package/script/tl/3_utilities.d.ts +19 -0
- package/script/tl/3_utilities.js +23 -3
- package/script/tl/4_tl_reader.d.ts +19 -0
- package/script/tl/4_tl_reader.js +19 -0
- package/script/tl/5_tl_writer.d.ts +19 -0
- package/script/tl/5_tl_writer.js +19 -0
- package/script/tl/6_rpc_result.d.ts +19 -0
- package/script/tl/6_rpc_result.js +19 -0
- package/script/tl/7_message.d.ts +19 -0
- package/script/tl/7_message.js +19 -0
- package/script/tl/8_message_container.d.ts +19 -0
- package/script/tl/8_message_container.js +19 -0
- package/script/transport/0_obfuscation.js +19 -0
- package/script/transport/0_transport.d.ts +19 -0
- package/script/transport/0_transport.js +19 -0
- package/script/transport/1_transport_abridged.d.ts +19 -0
- package/script/transport/1_transport_abridged.js +19 -0
- package/script/transport/1_transport_intermediate.d.ts +19 -0
- package/script/transport/1_transport_intermediate.js +19 -0
- package/script/transport/2_transport_provider.d.ts +19 -0
- package/script/transport/2_transport_provider.js +23 -4
- package/script/transport/3_transport_provider_web_socket.d.ts +19 -0
- package/script/transport/3_transport_provider_web_socket.js +19 -0
- package/script/types/0_authorization_state.d.ts +19 -0
- package/script/types/0_authorization_state.js +19 -0
- package/script/types/0_bot_command.d.ts +19 -0
- package/script/types/0_bot_command.js +19 -0
- package/script/types/0_chat_action.d.ts +19 -0
- package/script/types/0_chat_action.js +19 -0
- package/script/types/0_chat_administrator_rights.d.ts +19 -0
- package/script/types/0_chat_administrator_rights.js +19 -0
- package/script/types/0_chat_member_rights.d.ts +19 -0
- package/script/types/0_chat_member_rights.js +19 -0
- package/script/types/0_chat_photo.d.ts +19 -1
- package/script/types/0_chat_photo.js +19 -2
- package/script/types/0_connection_state.d.ts +19 -0
- package/script/types/0_connection_state.js +19 -0
- package/script/types/0_contact.d.ts +19 -0
- package/script/types/0_contact.js +19 -0
- package/script/types/0_dice.d.ts +19 -0
- package/script/types/0_dice.js +19 -0
- package/script/types/0_file_source.d.ts +19 -0
- package/script/types/0_file_source.js +19 -0
- package/script/types/0_giveaway_parameters.d.ts +19 -0
- package/script/types/0_giveaway_parameters.js +19 -0
- package/script/types/0_id.d.ts +19 -0
- package/script/types/0_id.js +19 -0
- package/script/types/0_keyboard_button_poll_type.d.ts +19 -0
- package/script/types/0_keyboard_button_poll_type.js +19 -0
- package/script/types/0_link_preview.d.ts +19 -0
- package/script/types/0_link_preview.js +19 -0
- package/script/types/0_location.d.ts +19 -0
- package/script/types/0_location.js +19 -0
- package/script/types/0_login_url.d.ts +19 -0
- package/script/types/0_login_url.js +19 -0
- package/script/types/0_mask_position.d.ts +19 -0
- package/script/types/0_mask_position.js +19 -0
- package/script/types/0_message_entity.d.ts +19 -0
- package/script/types/0_message_entity.js +22 -3
- package/script/types/0_message_reference.d.ts +19 -0
- package/script/types/0_message_reference.js +19 -0
- package/script/types/0_message_search_filter.d.ts +19 -0
- package/script/types/0_message_search_filter.js +21 -2
- package/script/types/0_mini_app_info.d.ts +19 -0
- package/script/types/0_mini_app_info.js +19 -0
- package/script/types/0_network_statistics_entry.d.ts +19 -0
- package/script/types/0_network_statistics_entry.js +19 -0
- package/script/types/0_parse_mode.d.ts +19 -0
- package/script/types/0_parse_mode.js +19 -0
- package/script/types/0_poll_option.d.ts +19 -0
- package/script/types/0_poll_option.js +19 -0
- package/script/types/0_price_tag.d.ts +19 -0
- package/script/types/0_price_tag.js +19 -0
- package/script/types/0_reaction.d.ts +19 -0
- package/script/types/0_reaction.js +21 -2
- package/script/types/0_restriction_reason.d.ts +19 -0
- package/script/types/0_restriction_reason.js +19 -0
- package/script/types/0_story_reference.d.ts +19 -0
- package/script/types/0_story_reference.js +19 -0
- package/script/types/0_thumbnail.d.ts +19 -0
- package/script/types/0_thumbnail.js +19 -0
- package/script/types/0_voice.d.ts +19 -0
- package/script/types/0_voice.js +19 -0
- package/script/types/1_animation.d.ts +19 -0
- package/script/types/1_animation.js +19 -0
- package/script/types/1_audio.d.ts +19 -0
- package/script/types/1_audio.js +19 -0
- package/script/types/1_bot_command_scope.d.ts +19 -0
- package/script/types/1_bot_command_scope.js +22 -3
- package/script/types/1_chat_p.d.ts +19 -0
- package/script/types/1_chat_p.js +21 -1
- package/script/types/1_document.d.ts +19 -0
- package/script/types/1_document.js +19 -0
- package/script/types/1_giveaway.d.ts +19 -0
- package/script/types/1_giveaway.js +19 -0
- package/script/types/1_inline_query_result_button.d.ts +19 -0
- package/script/types/1_inline_query_result_button.js +19 -0
- package/script/types/1_input_message_content.d.ts +19 -0
- package/script/types/1_input_message_content.js +19 -0
- package/script/types/1_input_story_content.d.ts +19 -0
- package/script/types/1_input_story_content.js +19 -0
- package/script/types/1_keyboard_button.d.ts +19 -0
- package/script/types/1_keyboard_button.js +22 -3
- package/script/types/1_message_reaction.d.ts +19 -0
- package/script/types/1_message_reaction.js +21 -2
- package/script/types/1_network_statistics.d.ts +19 -0
- package/script/types/1_network_statistics.js +19 -0
- package/script/types/1_photo.d.ts +19 -0
- package/script/types/1_photo.js +19 -0
- package/script/types/1_poll.d.ts +19 -0
- package/script/types/1_poll.js +19 -0
- package/script/types/1_reaction_count.d.ts +19 -0
- package/script/types/1_reaction_count.js +19 -0
- package/script/types/1_reply_quote.d.ts +19 -0
- package/script/types/1_reply_quote.js +19 -0
- package/script/types/1_sticker.d.ts +19 -0
- package/script/types/1_sticker.js +19 -0
- package/script/types/1_story_privacy.d.ts +19 -0
- package/script/types/1_story_privacy.js +22 -3
- package/script/types/1_story_reaction.d.ts +19 -0
- package/script/types/1_story_reaction.js +19 -0
- package/script/types/1_user.d.ts +19 -0
- package/script/types/1_user.js +19 -0
- package/script/types/1_venue.d.ts +19 -0
- package/script/types/1_venue.js +19 -0
- package/script/types/1_video.d.ts +19 -0
- package/script/types/1_video.js +19 -0
- package/script/types/1_video_note.d.ts +19 -0
- package/script/types/1_video_note.js +19 -0
- package/script/types/2_business_connection.d.ts +19 -0
- package/script/types/2_business_connection.js +19 -0
- package/script/types/2_chat_member.d.ts +19 -0
- package/script/types/2_chat_member.js +24 -4
- package/script/types/2_chosen_inline_result.d.ts +19 -0
- package/script/types/2_chosen_inline_result.js +21 -1
- package/script/types/2_game.d.ts +19 -0
- package/script/types/2_game.js +19 -0
- package/script/types/2_inactive_chat.d.ts +19 -0
- package/script/types/2_inactive_chat.js +21 -1
- package/script/types/2_inline_keyboard_button.d.ts +19 -0
- package/script/types/2_inline_keyboard_button.js +22 -3
- package/script/types/2_inline_query.d.ts +19 -0
- package/script/types/2_inline_query.js +22 -3
- package/script/types/2_invite_link.d.ts +19 -0
- package/script/types/2_invite_link.js +21 -1
- package/script/types/2_message_interactions.d.ts +19 -0
- package/script/types/2_message_interactions.js +19 -0
- package/script/types/2_message_reaction_count.d.ts +19 -0
- package/script/types/2_message_reaction_count.js +19 -0
- package/script/types/2_message_reactions.d.ts +19 -0
- package/script/types/2_message_reactions.js +19 -0
- package/script/types/2_story_content.d.ts +19 -0
- package/script/types/2_story_content.js +24 -5
- package/script/types/2_story_interactions.d.ts +19 -0
- package/script/types/2_story_interactions.js +19 -0
- package/script/types/2_story_interactive_area.d.ts +19 -0
- package/script/types/2_story_interactive_area.js +24 -5
- package/script/types/3_chat_member_updated.d.ts +19 -0
- package/script/types/3_chat_member_updated.js +22 -2
- package/script/types/3_reply_markup.d.ts +19 -0
- package/script/types/3_reply_markup.js +22 -2
- package/script/types/3_story.d.ts +19 -0
- package/script/types/3_story.js +21 -1
- package/script/types/4_inline_query_result.d.ts +19 -0
- package/script/types/4_inline_query_result.js +24 -5
- package/script/types/4_message.d.ts +19 -0
- package/script/types/4_message.js +35 -15
- package/script/types/5_callback_query.d.ts +19 -0
- package/script/types/5_callback_query.js +22 -2
- package/script/types/5_chat.d.ts +19 -0
- package/script/types/5_chat.js +26 -6
- package/script/types/6_update.d.ts +19 -0
- package/script/types/6_update.js +19 -0
- package/script/types/_file_id.d.ts +19 -0
- package/script/types/_file_id.js +27 -7
- package/script/types/_getters.d.ts +19 -0
- package/script/types/_getters.js +19 -0
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +46 -1
- package/script/utilities/0_buffer.d.ts +19 -0
- package/script/utilities/0_buffer.js +19 -0
- package/script/utilities/0_cache_map.d.ts +19 -0
- package/script/utilities/0_cache_map.js +19 -0
- package/script/utilities/0_color.d.ts +19 -0
- package/script/utilities/0_color.js +19 -0
- package/script/utilities/0_crypto.d.ts +19 -0
- package/script/utilities/0_crypto.js +19 -0
- package/script/utilities/0_hash.js +19 -0
- package/script/utilities/0_logger.d.ts +27 -0
- package/script/utilities/0_logger.js +30 -6
- package/script/utilities/0_mutex.d.ts +19 -0
- package/script/utilities/0_mutex.js +19 -0
- package/script/utilities/0_object.d.ts +19 -0
- package/script/utilities/0_object.js +19 -0
- package/script/utilities/0_rle.d.ts +19 -0
- package/script/utilities/0_rle.js +19 -0
- package/script/utilities/0_types.d.ts +19 -0
- package/script/utilities/0_types.js +19 -0
- package/script/utilities/1_auth.js +19 -0
- package/script/utilities/1_base64.d.ts +19 -0
- package/script/utilities/1_base64.js +19 -0
- package/script/utilities/1_math.d.ts +20 -0
- package/script/utilities/1_math.js +74 -0
- package/script/utilities/1_misc.d.ts +19 -0
- package/script/utilities/1_misc.js +21 -2
- package/script/utilities/1_queue.d.ts +19 -0
- package/script/utilities/1_queue.js +19 -0
- package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
- package/esm/utilities/0_control.d.ts +0 -1
- package/esm/utilities/0_control.js +0 -3
- package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
- package/script/utilities/0_control.d.ts +0 -1
- package/script/utilities/0_control.js +0 -7
- /package/{LICENSE → COPYING.LESSER} +0 -0
- /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import Tokenizer from './Tokenizer.js';
|
|
2
|
+
const formTags = new Set([
|
|
3
|
+
'input',
|
|
4
|
+
'option',
|
|
5
|
+
'optgroup',
|
|
6
|
+
'select',
|
|
7
|
+
'button',
|
|
8
|
+
'datalist',
|
|
9
|
+
'textarea',
|
|
10
|
+
]);
|
|
11
|
+
const pTag = new Set(['p']);
|
|
12
|
+
const openImpliesClose = {
|
|
13
|
+
tr: new Set(['tr', 'th', 'td']),
|
|
14
|
+
th: new Set(['th']),
|
|
15
|
+
td: new Set(['thead', 'th', 'td']),
|
|
16
|
+
body: new Set(['head', 'link', 'script']),
|
|
17
|
+
li: new Set(['li']),
|
|
18
|
+
p: pTag,
|
|
19
|
+
h1: pTag,
|
|
20
|
+
h2: pTag,
|
|
21
|
+
h3: pTag,
|
|
22
|
+
h4: pTag,
|
|
23
|
+
h5: pTag,
|
|
24
|
+
h6: pTag,
|
|
25
|
+
select: formTags,
|
|
26
|
+
input: formTags,
|
|
27
|
+
output: formTags,
|
|
28
|
+
button: formTags,
|
|
29
|
+
datalist: formTags,
|
|
30
|
+
textarea: formTags,
|
|
31
|
+
option: new Set(['option']),
|
|
32
|
+
optgroup: new Set(['optgroup', 'option']),
|
|
33
|
+
dd: new Set(['dt', 'dd']),
|
|
34
|
+
dt: new Set(['dt', 'dd']),
|
|
35
|
+
address: pTag,
|
|
36
|
+
article: pTag,
|
|
37
|
+
aside: pTag,
|
|
38
|
+
blockquote: pTag,
|
|
39
|
+
details: pTag,
|
|
40
|
+
div: pTag,
|
|
41
|
+
dl: pTag,
|
|
42
|
+
fieldset: pTag,
|
|
43
|
+
figcaption: pTag,
|
|
44
|
+
figure: pTag,
|
|
45
|
+
footer: pTag,
|
|
46
|
+
form: pTag,
|
|
47
|
+
header: pTag,
|
|
48
|
+
hr: pTag,
|
|
49
|
+
main: pTag,
|
|
50
|
+
nav: pTag,
|
|
51
|
+
ol: pTag,
|
|
52
|
+
pre: pTag,
|
|
53
|
+
section: pTag,
|
|
54
|
+
table: pTag,
|
|
55
|
+
ul: pTag,
|
|
56
|
+
rt: new Set(['rt', 'rp']),
|
|
57
|
+
rp: new Set(['rt', 'rp']),
|
|
58
|
+
tbody: new Set(['thead', 'tbody']),
|
|
59
|
+
tfoot: new Set(['thead', 'tbody']),
|
|
60
|
+
};
|
|
61
|
+
const voidElements = new Set([
|
|
62
|
+
'area',
|
|
63
|
+
'base',
|
|
64
|
+
'basefont',
|
|
65
|
+
'br',
|
|
66
|
+
'col',
|
|
67
|
+
'command',
|
|
68
|
+
'embed',
|
|
69
|
+
'frame',
|
|
70
|
+
'hr',
|
|
71
|
+
'img',
|
|
72
|
+
'input',
|
|
73
|
+
'isindex',
|
|
74
|
+
'keygen',
|
|
75
|
+
'link',
|
|
76
|
+
'meta',
|
|
77
|
+
'param',
|
|
78
|
+
'source',
|
|
79
|
+
'track',
|
|
80
|
+
'wbr',
|
|
81
|
+
]);
|
|
82
|
+
const foreignContextElements = new Set(['math', 'svg']);
|
|
83
|
+
const htmlIntegrationElements = new Set([
|
|
84
|
+
'mi',
|
|
85
|
+
'mo',
|
|
86
|
+
'mn',
|
|
87
|
+
'ms',
|
|
88
|
+
'mtext',
|
|
89
|
+
'annotation-xml',
|
|
90
|
+
'foreignObject',
|
|
91
|
+
'desc',
|
|
92
|
+
'title',
|
|
93
|
+
]);
|
|
94
|
+
const reNameEnd = /\s|\//;
|
|
95
|
+
export class Parser {
|
|
96
|
+
constructor(cbs, options = {}) {
|
|
97
|
+
/** The start index of the last event. */
|
|
98
|
+
Object.defineProperty(this, "startIndex", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
configurable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
value: 0
|
|
103
|
+
});
|
|
104
|
+
/** The end index of the last event. */
|
|
105
|
+
Object.defineProperty(this, "endIndex", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
configurable: true,
|
|
108
|
+
writable: true,
|
|
109
|
+
value: null
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(this, "tagname", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
configurable: true,
|
|
114
|
+
writable: true,
|
|
115
|
+
value: ''
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(this, "attribname", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
configurable: true,
|
|
120
|
+
writable: true,
|
|
121
|
+
value: ''
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(this, "attribvalue", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
configurable: true,
|
|
126
|
+
writable: true,
|
|
127
|
+
value: ''
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(this, "attribs", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
configurable: true,
|
|
132
|
+
writable: true,
|
|
133
|
+
value: null
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(this, "stack", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
configurable: true,
|
|
138
|
+
writable: true,
|
|
139
|
+
value: []
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(this, "foreignContext", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
configurable: true,
|
|
144
|
+
writable: true,
|
|
145
|
+
value: []
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(this, "cbs", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
configurable: true,
|
|
150
|
+
writable: true,
|
|
151
|
+
value: void 0
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(this, "options", {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
configurable: true,
|
|
156
|
+
writable: true,
|
|
157
|
+
value: void 0
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(this, "lowerCaseTagNames", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
configurable: true,
|
|
162
|
+
writable: true,
|
|
163
|
+
value: void 0
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(this, "lowerCaseAttributeNames", {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
configurable: true,
|
|
168
|
+
writable: true,
|
|
169
|
+
value: void 0
|
|
170
|
+
});
|
|
171
|
+
Object.defineProperty(this, "tokenizer", {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
configurable: true,
|
|
174
|
+
writable: true,
|
|
175
|
+
value: void 0
|
|
176
|
+
});
|
|
177
|
+
this.options = options;
|
|
178
|
+
this.cbs = cbs ?? {};
|
|
179
|
+
this.lowerCaseTagNames = options.lowerCaseTags ?? !options.xmlMode;
|
|
180
|
+
this.lowerCaseAttributeNames =
|
|
181
|
+
options.lowerCaseAttributeNames ?? !options.xmlMode;
|
|
182
|
+
this.tokenizer = new (options.Tokenizer ?? Tokenizer)(this.options, this);
|
|
183
|
+
this.cbs.onparserinit?.(this);
|
|
184
|
+
}
|
|
185
|
+
updatePosition(initialOffset) {
|
|
186
|
+
if (this.endIndex === null) {
|
|
187
|
+
if (this.tokenizer.sectionStart <= initialOffset) {
|
|
188
|
+
this.startIndex = 0;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this.startIndex = this.tokenizer.sectionStart - initialOffset;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.startIndex = this.endIndex + 1;
|
|
196
|
+
}
|
|
197
|
+
this.endIndex = this.tokenizer.getAbsoluteIndex();
|
|
198
|
+
}
|
|
199
|
+
// Tokenizer event handlers
|
|
200
|
+
ontext(data) {
|
|
201
|
+
this.updatePosition(1);
|
|
202
|
+
this.endIndex--;
|
|
203
|
+
this.cbs.ontext?.(data);
|
|
204
|
+
}
|
|
205
|
+
isVoidElement(name) {
|
|
206
|
+
return !this.options.xmlMode && voidElements.has(name);
|
|
207
|
+
}
|
|
208
|
+
onopentagname(name) {
|
|
209
|
+
if (this.lowerCaseTagNames) {
|
|
210
|
+
name = name.toLowerCase();
|
|
211
|
+
}
|
|
212
|
+
this.tagname = name;
|
|
213
|
+
if (!this.options.xmlMode &&
|
|
214
|
+
Object.prototype.hasOwnProperty.call(openImpliesClose, name)) {
|
|
215
|
+
let el;
|
|
216
|
+
while (this.stack.length > 0 &&
|
|
217
|
+
openImpliesClose[name]?.has((el = this.stack[this.stack.length - 1]))) {
|
|
218
|
+
this.onclosetag(el);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (!this.isVoidElement(name)) {
|
|
222
|
+
this.stack.push(name);
|
|
223
|
+
if (foreignContextElements.has(name)) {
|
|
224
|
+
this.foreignContext.push(true);
|
|
225
|
+
}
|
|
226
|
+
else if (htmlIntegrationElements.has(name)) {
|
|
227
|
+
this.foreignContext.push(false);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
this.cbs.onopentagname?.(name);
|
|
231
|
+
if (this.cbs.onopentag)
|
|
232
|
+
this.attribs = {};
|
|
233
|
+
}
|
|
234
|
+
onopentagend() {
|
|
235
|
+
this.updatePosition(1);
|
|
236
|
+
if (this.attribs) {
|
|
237
|
+
this.cbs.onopentag?.(this.tagname, this.attribs);
|
|
238
|
+
this.attribs = null;
|
|
239
|
+
}
|
|
240
|
+
if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {
|
|
241
|
+
this.cbs.onclosetag(this.tagname);
|
|
242
|
+
}
|
|
243
|
+
this.tagname = '';
|
|
244
|
+
}
|
|
245
|
+
onclosetag(name) {
|
|
246
|
+
this.updatePosition(1);
|
|
247
|
+
if (this.lowerCaseTagNames) {
|
|
248
|
+
name = name.toLowerCase();
|
|
249
|
+
}
|
|
250
|
+
if (foreignContextElements.has(name) ||
|
|
251
|
+
htmlIntegrationElements.has(name)) {
|
|
252
|
+
this.foreignContext.pop();
|
|
253
|
+
}
|
|
254
|
+
if (this.stack.length && !this.isVoidElement(name)) {
|
|
255
|
+
let pos = this.stack.lastIndexOf(name);
|
|
256
|
+
if (pos !== -1) {
|
|
257
|
+
if (this.cbs.onclosetag) {
|
|
258
|
+
pos = this.stack.length - pos;
|
|
259
|
+
while (pos--) {
|
|
260
|
+
// We know the stack has sufficient elements.
|
|
261
|
+
this.cbs.onclosetag(this.stack.pop());
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else
|
|
265
|
+
this.stack.length = pos;
|
|
266
|
+
}
|
|
267
|
+
else if (name === 'p' && !this.options.xmlMode) {
|
|
268
|
+
this.onopentagname(name);
|
|
269
|
+
this.closeCurrentTag();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else if (!this.options.xmlMode && (name === 'br' || name === 'p')) {
|
|
273
|
+
this.onopentagname(name);
|
|
274
|
+
this.closeCurrentTag();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
onselfclosingtag() {
|
|
278
|
+
if (this.options.xmlMode ||
|
|
279
|
+
this.options.recognizeSelfClosing ||
|
|
280
|
+
this.foreignContext[this.foreignContext.length - 1]) {
|
|
281
|
+
this.closeCurrentTag();
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.onopentagend();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
closeCurrentTag() {
|
|
288
|
+
const name = this.tagname;
|
|
289
|
+
this.onopentagend();
|
|
290
|
+
/*
|
|
291
|
+
* Self-closing tags will be on the top of the stack
|
|
292
|
+
* (cheaper check than in onclosetag)
|
|
293
|
+
*/
|
|
294
|
+
if (this.stack[this.stack.length - 1] === name) {
|
|
295
|
+
this.cbs.onclosetag?.(name);
|
|
296
|
+
this.stack.pop();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
onattribname(name) {
|
|
300
|
+
if (this.lowerCaseAttributeNames) {
|
|
301
|
+
name = name.toLowerCase();
|
|
302
|
+
}
|
|
303
|
+
this.attribname = name;
|
|
304
|
+
}
|
|
305
|
+
onattribdata(value) {
|
|
306
|
+
this.attribvalue += value;
|
|
307
|
+
}
|
|
308
|
+
onattribend(quote) {
|
|
309
|
+
this.cbs.onattribute?.(this.attribname, this.attribvalue, quote);
|
|
310
|
+
if (this.attribs &&
|
|
311
|
+
!Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {
|
|
312
|
+
this.attribs[this.attribname] = this.attribvalue;
|
|
313
|
+
}
|
|
314
|
+
this.attribname = '';
|
|
315
|
+
this.attribvalue = '';
|
|
316
|
+
}
|
|
317
|
+
getInstructionName(value) {
|
|
318
|
+
const idx = value.search(reNameEnd);
|
|
319
|
+
let name = idx < 0 ? value : value.substr(0, idx);
|
|
320
|
+
if (this.lowerCaseTagNames) {
|
|
321
|
+
name = name.toLowerCase();
|
|
322
|
+
}
|
|
323
|
+
return name;
|
|
324
|
+
}
|
|
325
|
+
ondeclaration(value) {
|
|
326
|
+
if (this.cbs.onprocessinginstruction) {
|
|
327
|
+
const name = this.getInstructionName(value);
|
|
328
|
+
this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
onprocessinginstruction(value) {
|
|
332
|
+
if (this.cbs.onprocessinginstruction) {
|
|
333
|
+
const name = this.getInstructionName(value);
|
|
334
|
+
this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
oncomment(value) {
|
|
338
|
+
this.updatePosition(4);
|
|
339
|
+
this.cbs.oncomment?.(value);
|
|
340
|
+
this.cbs.oncommentend?.();
|
|
341
|
+
}
|
|
342
|
+
oncdata(value) {
|
|
343
|
+
this.updatePosition(1);
|
|
344
|
+
if (this.options.xmlMode || this.options.recognizeCDATA) {
|
|
345
|
+
this.cbs.oncdatastart?.();
|
|
346
|
+
this.cbs.ontext?.(value);
|
|
347
|
+
this.cbs.oncdataend?.();
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
this.oncomment(`[CDATA[${value}]]`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
onerror(err) {
|
|
354
|
+
this.cbs.onerror?.(err);
|
|
355
|
+
}
|
|
356
|
+
onend() {
|
|
357
|
+
if (this.cbs.onclosetag) {
|
|
358
|
+
for (let i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i]))
|
|
359
|
+
;
|
|
360
|
+
}
|
|
361
|
+
this.cbs.onend?.();
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Resets the parser to a blank state, ready to parse a new HTML document
|
|
365
|
+
*/
|
|
366
|
+
reset() {
|
|
367
|
+
this.cbs.onreset?.();
|
|
368
|
+
this.tokenizer.reset();
|
|
369
|
+
this.tagname = '';
|
|
370
|
+
this.attribname = '';
|
|
371
|
+
this.attribs = null;
|
|
372
|
+
this.stack = [];
|
|
373
|
+
this.cbs.onparserinit?.(this);
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Resets the parser, then parses a complete document and
|
|
377
|
+
* pushes it to the handler.
|
|
378
|
+
*
|
|
379
|
+
* @param data Document to parse.
|
|
380
|
+
*/
|
|
381
|
+
parseComplete(data) {
|
|
382
|
+
this.reset();
|
|
383
|
+
this.end(data);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Parses a chunk of data and calls the corresponding callbacks.
|
|
387
|
+
*
|
|
388
|
+
* @param chunk Chunk to parse.
|
|
389
|
+
*/
|
|
390
|
+
write(chunk) {
|
|
391
|
+
this.tokenizer.write(chunk);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Parses the end of the buffer and clears the stack, calls onend.
|
|
395
|
+
*
|
|
396
|
+
* @param chunk Optional final chunk to parse.
|
|
397
|
+
*/
|
|
398
|
+
end(chunk) {
|
|
399
|
+
this.tokenizer.end(chunk);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Pauses parsing. The parser won't emit events until `resume` is called.
|
|
403
|
+
*/
|
|
404
|
+
pause() {
|
|
405
|
+
this.tokenizer.pause();
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Resumes parsing after `pause` was called.
|
|
409
|
+
*/
|
|
410
|
+
resume() {
|
|
411
|
+
this.tokenizer.resume();
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Alias of `write`, for backwards compatibility.
|
|
415
|
+
*
|
|
416
|
+
* @param chunk Chunk to parse.
|
|
417
|
+
* @deprecated
|
|
418
|
+
*/
|
|
419
|
+
parseChunk(chunk) {
|
|
420
|
+
this.write(chunk);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Alias of `end`, for backwards compatibility.
|
|
424
|
+
*
|
|
425
|
+
* @param chunk Optional final chunk to parse.
|
|
426
|
+
* @deprecated
|
|
427
|
+
*/
|
|
428
|
+
done(chunk) {
|
|
429
|
+
this.end(chunk);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/** All the states the tokenizer can be in. */
|
|
2
|
+
declare const enum State {
|
|
3
|
+
Text = 1,
|
|
4
|
+
BeforeTagName = 2,
|
|
5
|
+
InTagName = 3,
|
|
6
|
+
InSelfClosingTag = 4,
|
|
7
|
+
BeforeClosingTagName = 5,
|
|
8
|
+
InClosingTagName = 6,
|
|
9
|
+
AfterClosingTagName = 7,
|
|
10
|
+
BeforeAttributeName = 8,
|
|
11
|
+
InAttributeName = 9,
|
|
12
|
+
AfterAttributeName = 10,
|
|
13
|
+
BeforeAttributeValue = 11,
|
|
14
|
+
InAttributeValueDq = 12,
|
|
15
|
+
InAttributeValueSq = 13,
|
|
16
|
+
InAttributeValueNq = 14,
|
|
17
|
+
BeforeDeclaration = 15,
|
|
18
|
+
InDeclaration = 16,
|
|
19
|
+
InProcessingInstruction = 17,
|
|
20
|
+
BeforeComment = 18,
|
|
21
|
+
InComment = 19,
|
|
22
|
+
InSpecialComment = 20,
|
|
23
|
+
AfterComment1 = 21,
|
|
24
|
+
AfterComment2 = 22,
|
|
25
|
+
BeforeCdata1 = 23,
|
|
26
|
+
BeforeCdata2 = 24,
|
|
27
|
+
BeforeCdata3 = 25,
|
|
28
|
+
BeforeCdata4 = 26,
|
|
29
|
+
BeforeCdata5 = 27,
|
|
30
|
+
BeforeCdata6 = 28,
|
|
31
|
+
InCdata = 29,
|
|
32
|
+
AfterCdata1 = 30,
|
|
33
|
+
AfterCdata2 = 31,
|
|
34
|
+
BeforeSpecialS = 32,
|
|
35
|
+
BeforeSpecialSEnd = 33,
|
|
36
|
+
BeforeScript1 = 34,
|
|
37
|
+
BeforeScript2 = 35,
|
|
38
|
+
BeforeScript3 = 36,
|
|
39
|
+
BeforeScript4 = 37,
|
|
40
|
+
BeforeScript5 = 38,
|
|
41
|
+
AfterScript1 = 39,
|
|
42
|
+
AfterScript2 = 40,
|
|
43
|
+
AfterScript3 = 41,
|
|
44
|
+
AfterScript4 = 42,
|
|
45
|
+
AfterScript5 = 43,
|
|
46
|
+
BeforeStyle1 = 44,
|
|
47
|
+
BeforeStyle2 = 45,
|
|
48
|
+
BeforeStyle3 = 46,
|
|
49
|
+
BeforeStyle4 = 47,
|
|
50
|
+
AfterStyle1 = 48,
|
|
51
|
+
AfterStyle2 = 49,
|
|
52
|
+
AfterStyle3 = 50,
|
|
53
|
+
AfterStyle4 = 51,
|
|
54
|
+
BeforeSpecialT = 52,
|
|
55
|
+
BeforeSpecialTEnd = 53,
|
|
56
|
+
BeforeTitle1 = 54,
|
|
57
|
+
BeforeTitle2 = 55,
|
|
58
|
+
BeforeTitle3 = 56,
|
|
59
|
+
BeforeTitle4 = 57,
|
|
60
|
+
AfterTitle1 = 58,
|
|
61
|
+
AfterTitle2 = 59,
|
|
62
|
+
AfterTitle3 = 60,
|
|
63
|
+
AfterTitle4 = 61,
|
|
64
|
+
BeforeEntity = 62,
|
|
65
|
+
BeforeNumericEntity = 63,
|
|
66
|
+
InNamedEntity = 64,
|
|
67
|
+
InNumericEntity = 65,
|
|
68
|
+
InHexEntity = 66
|
|
69
|
+
}
|
|
70
|
+
export interface Callbacks {
|
|
71
|
+
onattribdata(value: string): void;
|
|
72
|
+
onattribend(quote: string | undefined | null): void;
|
|
73
|
+
onattribname(name: string): void;
|
|
74
|
+
oncdata(data: string): void;
|
|
75
|
+
onclosetag(name: string): void;
|
|
76
|
+
oncomment(data: string): void;
|
|
77
|
+
ondeclaration(content: string): void;
|
|
78
|
+
onend(): void;
|
|
79
|
+
onerror(error: Error, state?: State): void;
|
|
80
|
+
onopentagend(): void;
|
|
81
|
+
onopentagname(name: string): void;
|
|
82
|
+
onprocessinginstruction(instruction: string): void;
|
|
83
|
+
onselfclosingtag(): void;
|
|
84
|
+
ontext(value: string): void;
|
|
85
|
+
}
|
|
86
|
+
export default class Tokenizer {
|
|
87
|
+
/** The current state the tokenizer is in. */
|
|
88
|
+
_state: State;
|
|
89
|
+
/** The read buffer. */
|
|
90
|
+
private buffer;
|
|
91
|
+
/** The beginning of the section that is currently being read. */
|
|
92
|
+
sectionStart: number;
|
|
93
|
+
/** The index within the buffer that we are currently looking at. */
|
|
94
|
+
_index: number;
|
|
95
|
+
/**
|
|
96
|
+
* Data that has already been processed will be removed from the buffer occasionally.
|
|
97
|
+
* `_bufferOffset` keeps track of how many characters have been removed, to make sure position information is accurate.
|
|
98
|
+
*/
|
|
99
|
+
private bufferOffset;
|
|
100
|
+
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
|
|
101
|
+
private baseState;
|
|
102
|
+
/** For special parsing behavior inside of script and style tags. */
|
|
103
|
+
private special;
|
|
104
|
+
/** Indicates whether the tokenizer has been paused. */
|
|
105
|
+
private running;
|
|
106
|
+
/** Indicates whether the tokenizer has finished running / `.end` has been called. */
|
|
107
|
+
private ended;
|
|
108
|
+
private readonly cbs;
|
|
109
|
+
private readonly xmlMode;
|
|
110
|
+
private readonly decodeEntities;
|
|
111
|
+
constructor(options: {
|
|
112
|
+
xmlMode?: boolean;
|
|
113
|
+
decodeEntities?: boolean;
|
|
114
|
+
} | null, cbs: Callbacks);
|
|
115
|
+
reset(): void;
|
|
116
|
+
write(chunk: string): void;
|
|
117
|
+
end(chunk?: string): void;
|
|
118
|
+
pause(): void;
|
|
119
|
+
resume(): void;
|
|
120
|
+
/**
|
|
121
|
+
* The current index within all of the written data.
|
|
122
|
+
*/
|
|
123
|
+
getAbsoluteIndex(): number;
|
|
124
|
+
private stateText;
|
|
125
|
+
/**
|
|
126
|
+
* HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
|
|
127
|
+
*
|
|
128
|
+
* XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
|
|
129
|
+
* We allow anything that wouldn't end the tag.
|
|
130
|
+
*/
|
|
131
|
+
private isTagStartChar;
|
|
132
|
+
private stateBeforeTagName;
|
|
133
|
+
private stateInTagName;
|
|
134
|
+
private stateBeforeClosingTagName;
|
|
135
|
+
private stateInClosingTagName;
|
|
136
|
+
private stateAfterClosingTagName;
|
|
137
|
+
private stateBeforeAttributeName;
|
|
138
|
+
private stateInSelfClosingTag;
|
|
139
|
+
private stateInAttributeName;
|
|
140
|
+
private stateAfterAttributeName;
|
|
141
|
+
private stateBeforeAttributeValue;
|
|
142
|
+
private handleInAttributeValue;
|
|
143
|
+
private stateInAttributeValueDoubleQuotes;
|
|
144
|
+
private stateInAttributeValueSingleQuotes;
|
|
145
|
+
private stateInAttributeValueNoQuotes;
|
|
146
|
+
private stateBeforeDeclaration;
|
|
147
|
+
private stateInDeclaration;
|
|
148
|
+
private stateInProcessingInstruction;
|
|
149
|
+
private stateBeforeComment;
|
|
150
|
+
private stateInComment;
|
|
151
|
+
private stateInSpecialComment;
|
|
152
|
+
private stateAfterComment1;
|
|
153
|
+
private stateAfterComment2;
|
|
154
|
+
private stateBeforeCdata6;
|
|
155
|
+
private stateInCdata;
|
|
156
|
+
private stateAfterCdata1;
|
|
157
|
+
private stateAfterCdata2;
|
|
158
|
+
private stateBeforeSpecialS;
|
|
159
|
+
private stateBeforeSpecialSEnd;
|
|
160
|
+
private stateBeforeSpecialLast;
|
|
161
|
+
private stateAfterSpecialLast;
|
|
162
|
+
private parseFixedEntity;
|
|
163
|
+
private parseLegacyEntity;
|
|
164
|
+
private stateInNamedEntity;
|
|
165
|
+
private decodeNumericEntity;
|
|
166
|
+
private stateInNumericEntity;
|
|
167
|
+
private stateInHexEntity;
|
|
168
|
+
private cleanup;
|
|
169
|
+
/**
|
|
170
|
+
* Iterates through the buffer, calling the function corresponding to the current state.
|
|
171
|
+
*
|
|
172
|
+
* States that are more likely to be hit are higher up, as a performance improvement.
|
|
173
|
+
*/
|
|
174
|
+
private parse;
|
|
175
|
+
private finish;
|
|
176
|
+
private handleTrailingData;
|
|
177
|
+
private getSection;
|
|
178
|
+
private emitToken;
|
|
179
|
+
private emitPartial;
|
|
180
|
+
}
|
|
181
|
+
export {};
|