commit ef806f8fbb42bd9b9f34687d02a5c2ecbdcfee47 Author: giles Date: Wed Feb 11 12:45:56 2026 +0000 feat: extract shared infrastructure from shared_lib Phase 1-3 of decoupling plan: - Shared DB, models, infrastructure, browser, config, utils - Event infrastructure (domain_events outbox, bus, processor) - Structured logging - Generic container concept (container_type/container_id) - Alembic migrations for all schema changes Co-Authored-By: Claude Opus 4.6 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a60b85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +*.pyc diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..ef8b7de --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +# shared package — extracted from blog/shared_lib/ diff --git a/alembic/env.py b/alembic/env.py new file mode 100644 index 0000000..52d169b --- /dev/null +++ b/alembic/env.py @@ -0,0 +1,68 @@ +from __future__ import annotations +import os, sys +from logging.config import fileConfig +from alembic import context +from sqlalchemy import engine_from_config, pool + +config = context.config + +if config.config_file_name is not None: + try: + fileConfig(config.config_file_name) + except Exception: + pass + +# Add project root so all app model packages are importable +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) + +from shared.db.base import Base + +# Import ALL models so Base.metadata sees every table +import shared.models # noqa: F401 User, KV, MagicLink, MenuItem, Ghost* +import blog.models # noqa: F401 Post, Author, Tag, Snippet, TagGroup +import market.models # noqa: F401 Product, CartItem, MarketPlace, etc. +import cart.models # noqa: F401 Order, OrderItem, PageConfig +import events.models # noqa: F401 Calendar, CalendarEntry, Ticket, etc. + +target_metadata = Base.metadata + +def _get_url() -> str: + url = os.getenv( + "ALEMBIC_DATABASE_URL", + os.getenv("DATABASE_URL", config.get_main_option("sqlalchemy.url") or "") + ) + print(url) + return url + +def run_migrations_offline() -> None: + url = _get_url() + context.configure( + url=url, + target_metadata=target_metadata, + literal_binds=True, + dialect_opts={"paramstyle": "named"}, + compare_type=True, + ) + with context.begin_transaction(): + context.run_migrations() + +def run_migrations_online() -> None: + url = _get_url() + if url: + config.set_main_option("sqlalchemy.url", url) + + connectable = engine_from_config( + config.get_section(config.config_ini_section, {}), + prefix="sqlalchemy.", + poolclass=pool.NullPool, + ) + + with connectable.connect() as connection: + context.configure(connection=connection, target_metadata=target_metadata, compare_type=True) + with context.begin_transaction(): + context.run_migrations() + +if context.is_offline_mode(): + run_migrations_offline() +else: + run_migrations_online() diff --git a/alembic/script.py.mako b/alembic/script.py.mako new file mode 100644 index 0000000..31bee0b --- /dev/null +++ b/alembic/script.py.mako @@ -0,0 +1,24 @@ +<%text> +# Alembic migration script template + +"""empty message + +Revision ID: ${up_revision} +Revises: ${down_revision | comma,n} +Create Date: ${create_date} + +""" +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = ${repr(up_revision)} +down_revision = ${repr(down_revision)} +branch_labels = ${repr(branch_labels)} +depends_on = ${repr(depends_on)} + +def upgrade() -> None: + ${upgrades if upgrades else "pass"} + +def downgrade() -> None: + ${downgrades if downgrades else "pass"} diff --git a/alembic/versions/0001_initial_schem.py b/alembic/versions/0001_initial_schem.py new file mode 100644 index 0000000..b131310 --- /dev/null +++ b/alembic/versions/0001_initial_schem.py @@ -0,0 +1,33 @@ +"""Initial database schema from schema.sql""" + +from alembic import op +import sqlalchemy as sa +import pathlib + +# revision identifiers, used by Alembic +revision = '0001_initial_schema' +down_revision = None +branch_labels = None +depends_on = None + +def upgrade(): + return + schema_path = pathlib.Path(__file__).parent.parent.parent / "schema.sql" + with open(schema_path, encoding="utf-8") as f: + sql = f.read() + conn = op.get_bind() + conn.execute(sa.text(sql)) + +def downgrade(): + return + # Drop all user-defined tables in the 'public' schema + conn = op.get_bind() + conn.execute(sa.text(""" + DO $$ DECLARE + r RECORD; + BEGIN + FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = 'public') LOOP + EXECUTE 'DROP TABLE IF EXISTS public.' || quote_ident(r.tablename) || ' CASCADE'; + END LOOP; + END $$; + """)) \ No newline at end of file diff --git a/alembic/versions/0002_add_cart_items.py b/alembic/versions/0002_add_cart_items.py new file mode 100644 index 0000000..ecae098 --- /dev/null +++ b/alembic/versions/0002_add_cart_items.py @@ -0,0 +1,78 @@ +"""Add cart_items table for shopping cart""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = "0002_add_cart_items" +down_revision = "0001_initial_schema" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + "cart_items", + sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True), + + # Either a logged-in user *or* an anonymous session_id + sa.Column( + "user_id", + sa.Integer(), + sa.ForeignKey("users.id", ondelete="CASCADE"), + nullable=True, + ), + sa.Column("session_id", sa.String(length=128), nullable=True), + + # IMPORTANT: reference products.id (PK), not slug + sa.Column( + "product_id", + sa.Integer(), + sa.ForeignKey("products.id", ondelete="CASCADE"), + nullable=False, + ), + + sa.Column( + "quantity", + sa.Integer(), + nullable=False, + server_default="1", + ), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + nullable=False, + server_default=sa.text("now()"), + ), + sa.Column( + "updated_at", + sa.DateTime(timezone=True), + nullable=False, + server_default=sa.text("now()"), + ), + sa.Column( + "deleted_at", + sa.DateTime(timezone=True), + nullable=True, + ), + ) + + # Indexes to speed up cart lookups + op.create_index( + "ix_cart_items_user_product", + "cart_items", + ["user_id", "product_id"], + unique=False, + ) + op.create_index( + "ix_cart_items_session_product", + "cart_items", + ["session_id", "product_id"], + unique=False, + ) + + +def downgrade() -> None: + op.drop_index("ix_cart_items_session_product", table_name="cart_items") + op.drop_index("ix_cart_items_user_product", table_name="cart_items") + op.drop_table("cart_items") diff --git a/alembic/versions/0003_add_orders.py b/alembic/versions/0003_add_orders.py new file mode 100644 index 0000000..4387219 --- /dev/null +++ b/alembic/versions/0003_add_orders.py @@ -0,0 +1,118 @@ +"""Add orders and order_items tables for checkout""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = "0003_add_orders" +down_revision = "0002_add_cart_items" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + "orders", + sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True), + sa.Column("user_id", sa.Integer(), sa.ForeignKey("users.id"), nullable=True), + sa.Column("session_id", sa.String(length=64), nullable=True), + + sa.Column( + "status", + sa.String(length=32), + nullable=False, + server_default="pending", + ), + sa.Column( + "currency", + sa.String(length=16), + nullable=False, + server_default="GBP", + ), + sa.Column( + "total_amount", + sa.Numeric(12, 2), + nullable=False, + ), + + # SumUp integration fields + sa.Column("sumup_checkout_id", sa.String(length=128), nullable=True), + sa.Column("sumup_status", sa.String(length=32), nullable=True), + sa.Column("sumup_hosted_url", sa.Text(), nullable=True), + + sa.Column( + "created_at", + sa.DateTime(timezone=True), + nullable=False, + server_default=sa.func.now(), + ), + sa.Column( + "updated_at", + sa.DateTime(timezone=True), + nullable=False, + server_default=sa.func.now(), + ), + ) + + # Indexes to match model hints (session_id + sumup_checkout_id index=True) + op.create_index( + "ix_orders_session_id", + "orders", + ["session_id"], + unique=False, + ) + op.create_index( + "ix_orders_sumup_checkout_id", + "orders", + ["sumup_checkout_id"], + unique=False, + ) + + op.create_table( + "order_items", + sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True), + sa.Column( + "order_id", + sa.Integer(), + sa.ForeignKey("orders.id", ondelete="CASCADE"), + nullable=False, + ), + sa.Column( + "product_id", + sa.Integer(), + sa.ForeignKey("products.id"), + nullable=False, + ), + sa.Column("product_title", sa.String(length=512), nullable=True), + + sa.Column( + "quantity", + sa.Integer(), + nullable=False, + server_default="1", + ), + sa.Column( + "unit_price", + sa.Numeric(12, 2), + nullable=False, + ), + sa.Column( + "currency", + sa.String(length=16), + nullable=False, + server_default="GBP", + ), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + nullable=False, + server_default=sa.func.now(), + ), + ) + + +def downgrade() -> None: + op.drop_table("order_items") + op.drop_index("ix_orders_sumup_checkout_id", table_name="orders") + op.drop_index("ix_orders_session_id", table_name="orders") + op.drop_table("orders") diff --git a/alembic/versions/0004_add_sumup_reference.py b/alembic/versions/0004_add_sumup_reference.py new file mode 100644 index 0000000..2738cd2 --- /dev/null +++ b/alembic/versions/0004_add_sumup_reference.py @@ -0,0 +1,27 @@ +"""Add sumup_reference to orders""" + +from alembic import op +import sqlalchemy as sa + +revision = "0004_add_sumup_reference" +down_revision = "0003_add_orders" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.add_column( + "orders", + sa.Column("sumup_reference", sa.String(length=255), nullable=True), + ) + op.create_index( + "ix_orders_sumup_reference", + "orders", + ["sumup_reference"], + unique=False, + ) + + +def downgrade() -> None: + op.drop_index("ix_orders_sumup_reference", table_name="orders") + op.drop_column("orders", "sumup_reference") diff --git a/alembic/versions/0005_add_description.py b/alembic/versions/0005_add_description.py new file mode 100644 index 0000000..37e84ed --- /dev/null +++ b/alembic/versions/0005_add_description.py @@ -0,0 +1,27 @@ +"""Add description field to orders""" + +from alembic import op +import sqlalchemy as sa + +revision = "0005_add_description" +down_revision = "0004_add_sumup_reference" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.add_column( + "orders", + sa.Column("description", sa.Text(), nullable=True), + ) + op.create_index( + "ix_orders_description", + "orders", + ["description"], + unique=False, + ) + + +def downgrade() -> None: + op.drop_index("ix_orders_description", table_name="orders") + op.drop_column("orders", "description") diff --git a/alembic/versions/0006_update_calendar_entries.py b/alembic/versions/0006_update_calendar_entries.py new file mode 100644 index 0000000..cd6f9bd --- /dev/null +++ b/alembic/versions/0006_update_calendar_entries.py @@ -0,0 +1,28 @@ +from alembic import op +import sqlalchemy as sa + +revision = '0006_update_calendar_entries' +down_revision = '0005_add_description' # use the appropriate previous revision ID +branch_labels = None +depends_on = None + +def upgrade(): + # Add user_id and session_id columns + op.add_column('calendar_entries', sa.Column('user_id', sa.Integer(), nullable=True)) + op.create_foreign_key('fk_calendar_entries_user_id', 'calendar_entries', 'users', ['user_id'], ['id']) + op.add_column('calendar_entries', sa.Column('session_id', sa.String(length=128), nullable=True)) + # Add state and cost columns + op.add_column('calendar_entries', sa.Column('state', sa.String(length=20), nullable=False, server_default='pending')) + op.add_column('calendar_entries', sa.Column('cost', sa.Numeric(10,2), nullable=False, server_default='10')) + # (Optional) Create indexes on the new columns + op.create_index('ix_calendar_entries_user_id', 'calendar_entries', ['user_id']) + op.create_index('ix_calendar_entries_session_id', 'calendar_entries', ['session_id']) + +def downgrade(): + op.drop_index('ix_calendar_entries_session_id', table_name='calendar_entries') + op.drop_index('ix_calendar_entries_user_id', table_name='calendar_entries') + op.drop_column('calendar_entries', 'cost') + op.drop_column('calendar_entries', 'state') + op.drop_column('calendar_entries', 'session_id') + op.drop_constraint('fk_calendar_entries_user_id', 'calendar_entries', type_='foreignkey') + op.drop_column('calendar_entries', 'user_id') diff --git a/alembic/versions/0007_add_oid_entries.py b/alembic/versions/0007_add_oid_entries.py new file mode 100644 index 0000000..be05343 --- /dev/null +++ b/alembic/versions/0007_add_oid_entries.py @@ -0,0 +1,50 @@ +from alembic import op +import sqlalchemy as sa + +revision = "0007_add_oid_entries" +down_revision = "0006_update_calendar_entries" +branch_labels = None +depends_on = None + + +def upgrade(): + # Add order_id column + op.add_column( + "calendar_entries", + sa.Column("order_id", sa.Integer(), nullable=True), + ) + op.create_foreign_key( + "fk_calendar_entries_order_id", + "calendar_entries", + "orders", + ["order_id"], + ["id"], + ondelete="SET NULL", + ) + op.create_index( + "ix_calendar_entries_order_id", + "calendar_entries", + ["order_id"], + unique=False, + ) + + # Optional: add an index on state if you want faster queries by state + op.create_index( + "ix_calendar_entries_state", + "calendar_entries", + ["state"], + unique=False, + ) + + +def downgrade(): + # Drop indexes and FK in reverse order + op.drop_index("ix_calendar_entries_state", table_name="calendar_entries") + + op.drop_index("ix_calendar_entries_order_id", table_name="calendar_entries") + op.drop_constraint( + "fk_calendar_entries_order_id", + "calendar_entries", + type_="foreignkey", + ) + op.drop_column("calendar_entries", "order_id") diff --git a/alembic/versions/0008_add_flexible_to_slots.py b/alembic/versions/0008_add_flexible_to_slots.py new file mode 100644 index 0000000..0af0cfe --- /dev/null +++ b/alembic/versions/0008_add_flexible_to_slots.py @@ -0,0 +1,33 @@ +"""add flexible flag to calendar_slots + +Revision ID: 0008_add_flexible_to_calendar_slots +Revises: 0007_add_order_id_to_calendar_entries +Create Date: 2025-12-06 12:34:56.000000 +""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = "0008_add_flexible_to_slots" +down_revision = "0007_add_oid_entries" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.add_column( + "calendar_slots", + sa.Column( + "flexible", + sa.Boolean(), + nullable=False, + server_default=sa.false(), # set existing rows to False + ), + ) + # Optional: drop server_default so future inserts must supply a value + op.alter_column("calendar_slots", "flexible", server_default=None) + + +def downgrade() -> None: + op.drop_column("calendar_slots", "flexible") diff --git a/alembic/versions/0009_add_slot_id_to_entries.py b/alembic/versions/0009_add_slot_id_to_entries.py new file mode 100644 index 0000000..32c0de4 --- /dev/null +++ b/alembic/versions/0009_add_slot_id_to_entries.py @@ -0,0 +1,54 @@ +"""add slot_id to calendar_entries + +Revision ID: 0009_add_slot_id_to_entries +Revises: 0008_add_flexible_to_slots +Create Date: 2025-12-06 13:00:00.000000 +""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = "0009_add_slot_id_to_entries" +down_revision = "0008_add_flexible_to_slots" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # Add slot_id column as nullable initially + op.add_column( + "calendar_entries", + sa.Column( + "slot_id", + sa.Integer(), + nullable=True, + ), + ) + + # Add foreign key constraint + op.create_foreign_key( + "fk_calendar_entries_slot_id_calendar_slots", + "calendar_entries", + "calendar_slots", + ["slot_id"], + ["id"], + ondelete="SET NULL", + ) + + # Add index for better query performance + op.create_index( + "ix_calendar_entries_slot_id", + "calendar_entries", + ["slot_id"], + ) + + +def downgrade() -> None: + op.drop_index("ix_calendar_entries_slot_id", table_name="calendar_entries") + op.drop_constraint( + "fk_calendar_entries_slot_id_calendar_slots", + "calendar_entries", + type_="foreignkey", + ) + op.drop_column("calendar_entries", "slot_id") \ No newline at end of file diff --git a/alembic/versions/0010_add_post_likes.py b/alembic/versions/0010_add_post_likes.py new file mode 100644 index 0000000..17bc15b --- /dev/null +++ b/alembic/versions/0010_add_post_likes.py @@ -0,0 +1,64 @@ +"""Add post_likes table for liking blog posts + +Revision ID: 0010_add_post_likes +Revises: 0009_add_slot_id_to_entries +Create Date: 2025-12-07 13:00:00.000000 +""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = "0010_add_post_likes" +down_revision = "0009_add_slot_id_to_entries" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + "post_likes", + sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True), + sa.Column( + "user_id", + sa.Integer(), + sa.ForeignKey("users.id", ondelete="CASCADE"), + nullable=False, + ), + sa.Column( + "post_id", + sa.Integer(), + sa.ForeignKey("posts.id", ondelete="CASCADE"), + nullable=False, + ), + sa.Column( + "created_at", + sa.DateTime(timezone=True), + nullable=False, + server_default=sa.text("now()"), + ), + sa.Column( + "updated_at", + sa.DateTime(timezone=True), + nullable=False, + server_default=sa.text("now()"), + ), + sa.Column( + "deleted_at", + sa.DateTime(timezone=True), + nullable=True, + ), + ) + + # Index for fast user+post lookups + op.create_index( + "ix_post_likes_user_post", + "post_likes", + ["user_id", "post_id"], + unique=False, + ) + + +def downgrade() -> None: + op.drop_index("ix_post_likes_user_post", table_name="post_likes") + op.drop_table("post_likes") diff --git a/alembic/versions/0011_add_entry_tickets.py b/alembic/versions/0011_add_entry_tickets.py new file mode 100644 index 0000000..4b5936f --- /dev/null +++ b/alembic/versions/0011_add_entry_tickets.py @@ -0,0 +1,43 @@ +"""Add ticket_price and ticket_count to calendar_entries + +Revision ID: 0011_add_entry_tickets +Revises: 0010_add_post_likes +Create Date: 2025-12-07 14:00:00.000000 +""" + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.postgresql import NUMERIC + +# revision identifiers, used by Alembic. +revision = "0011_add_entry_tickets" +down_revision = "0010_add_post_likes" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # Add ticket_price column (nullable - NULL means no tickets) + op.add_column( + "calendar_entries", + sa.Column( + "ticket_price", + NUMERIC(10, 2), + nullable=True, + ), + ) + + # Add ticket_count column (nullable - NULL means unlimited) + op.add_column( + "calendar_entries", + sa.Column( + "ticket_count", + sa.Integer(), + nullable=True, + ), + ) + + +def downgrade() -> None: + op.drop_column("calendar_entries", "ticket_count") + op.drop_column("calendar_entries", "ticket_price") diff --git a/alembic/versions/47fc53fc0d2b_add_ticket_types_table.py b/alembic/versions/47fc53fc0d2b_add_ticket_types_table.py new file mode 100644 index 0000000..4c3cd5a --- /dev/null +++ b/alembic/versions/47fc53fc0d2b_add_ticket_types_table.py @@ -0,0 +1,41 @@ + +# Alembic migration script template + +"""add ticket_types table + +Revision ID: 47fc53fc0d2b +Revises: a9f54e4eaf02 +Create Date: 2025-12-08 07:29:11.422435 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '47fc53fc0d2b' +down_revision = 'a9f54e4eaf02' +branch_labels = None +depends_on = None + +def upgrade() -> None: + op.create_table( + 'ticket_types', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('entry_id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=255), nullable=False), + sa.Column('cost', sa.Numeric(precision=10, scale=2), nullable=False), + sa.Column('count', sa.Integer(), nullable=False), + sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), + sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), + sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True), + sa.ForeignKeyConstraint(['entry_id'], ['calendar_entries.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id') + ) + op.create_index('ix_ticket_types_entry_id', 'ticket_types', ['entry_id'], unique=False) + op.create_index('ix_ticket_types_name', 'ticket_types', ['name'], unique=False) + +def downgrade() -> None: + op.drop_index('ix_ticket_types_name', table_name='ticket_types') + op.drop_index('ix_ticket_types_entry_id', table_name='ticket_types') + op.drop_table('ticket_types') diff --git a/alembic/versions/6cb124491c9d_entry_posts.py b/alembic/versions/6cb124491c9d_entry_posts.py new file mode 100644 index 0000000..6062096 --- /dev/null +++ b/alembic/versions/6cb124491c9d_entry_posts.py @@ -0,0 +1,36 @@ + +# Alembic migration script template + +"""Add calendar_entry_posts association table + +Revision ID: 6cb124491c9d +Revises: 0011_add_entry_tickets +Create Date: 2025-12-07 03:40:49.194068 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.postgresql import TIMESTAMP + +# revision identifiers, used by Alembic. +revision = '6cb124491c9d' +down_revision = '0011_add_entry_tickets' +branch_labels = None +depends_on = None + +def upgrade() -> None: + op.create_table( + 'calendar_entry_posts', + sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True), + sa.Column('entry_id', sa.Integer(), sa.ForeignKey('calendar_entries.id', ondelete='CASCADE'), nullable=False), + sa.Column('post_id', sa.Integer(), sa.ForeignKey('posts.id', ondelete='CASCADE'), nullable=False), + sa.Column('created_at', TIMESTAMP(timezone=True), nullable=False, server_default=sa.func.now()), + sa.Column('deleted_at', TIMESTAMP(timezone=True), nullable=True), + ) + op.create_index('ix_entry_posts_entry_id', 'calendar_entry_posts', ['entry_id']) + op.create_index('ix_entry_posts_post_id', 'calendar_entry_posts', ['post_id']) + +def downgrade() -> None: + op.drop_index('ix_entry_posts_post_id', 'calendar_entry_posts') + op.drop_index('ix_entry_posts_entry_id', 'calendar_entry_posts') + op.drop_table('calendar_entry_posts') diff --git a/alembic/versions/a1b2c3d4e5f6_add_page_configs_table.py b/alembic/versions/a1b2c3d4e5f6_add_page_configs_table.py new file mode 100644 index 0000000..9cb858c --- /dev/null +++ b/alembic/versions/a1b2c3d4e5f6_add_page_configs_table.py @@ -0,0 +1,74 @@ +"""add page_configs table + +Revision ID: a1b2c3d4e5f6 +Revises: f6d4a1b2c3e7 +Create Date: 2026-02-10 +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy import text + +revision = 'a1b2c3d4e5f6' +down_revision = 'f6d4a1b2c3e7' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + 'page_configs', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('post_id', sa.Integer(), nullable=False), + sa.Column('features', sa.JSON(), server_default='{}', nullable=False), + sa.Column('sumup_merchant_code', sa.String(64), nullable=True), + sa.Column('sumup_api_key', sa.Text(), nullable=True), + sa.Column('sumup_checkout_prefix', sa.String(64), nullable=True), + sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False), + sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False), + sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True), + sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('post_id'), + ) + + # Backfill: create PageConfig for every existing page + conn = op.get_bind() + + # 1. Pages with calendars -> features={"calendar": true} + conn.execute(text(""" + INSERT INTO page_configs (post_id, features, created_at, updated_at) + SELECT p.id, '{"calendar": true}'::jsonb, now(), now() + FROM posts p + WHERE p.is_page = true + AND p.deleted_at IS NULL + AND EXISTS ( + SELECT 1 FROM calendars c + WHERE c.post_id = p.id AND c.deleted_at IS NULL + ) + """)) + + # 2. Market page (slug='market', is_page=true) -> features={"market": true} + # Only if not already inserted above + conn.execute(text(""" + INSERT INTO page_configs (post_id, features, created_at, updated_at) + SELECT p.id, '{"market": true}'::jsonb, now(), now() + FROM posts p + WHERE p.slug = 'market' + AND p.is_page = true + AND p.deleted_at IS NULL + AND p.id NOT IN (SELECT post_id FROM page_configs) + """)) + + # 3. All other pages -> features={} + conn.execute(text(""" + INSERT INTO page_configs (post_id, features, created_at, updated_at) + SELECT p.id, '{}'::jsonb, now(), now() + FROM posts p + WHERE p.is_page = true + AND p.deleted_at IS NULL + AND p.id NOT IN (SELECT post_id FROM page_configs) + """)) + + +def downgrade() -> None: + op.drop_table('page_configs') diff --git a/alembic/versions/a9f54e4eaf02_add_menu_items_table.py b/alembic/versions/a9f54e4eaf02_add_menu_items_table.py new file mode 100644 index 0000000..960c10c --- /dev/null +++ b/alembic/versions/a9f54e4eaf02_add_menu_items_table.py @@ -0,0 +1,37 @@ + +# Alembic migration script template + +"""add menu_items table + +Revision ID: a9f54e4eaf02 +Revises: 6cb124491c9d +Create Date: 2025-12-07 17:38:54.839296 + +""" +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = 'a9f54e4eaf02' +down_revision = '6cb124491c9d' +branch_labels = None +depends_on = None + +def upgrade() -> None: + op.create_table('menu_items', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('post_id', sa.Integer(), nullable=False), + sa.Column('sort_order', sa.Integer(), nullable=False), + sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True), + sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_menu_items_post_id'), 'menu_items', ['post_id'], unique=False) + op.create_index(op.f('ix_menu_items_sort_order'), 'menu_items', ['sort_order'], unique=False) + +def downgrade() -> None: + op.drop_index(op.f('ix_menu_items_sort_order'), table_name='menu_items') + op.drop_index(op.f('ix_menu_items_post_id'), table_name='menu_items') + op.drop_table('menu_items') diff --git a/alembic/versions/b2c3d4e5f6a7_add_market_places_table.py b/alembic/versions/b2c3d4e5f6a7_add_market_places_table.py new file mode 100644 index 0000000..4dbb124 --- /dev/null +++ b/alembic/versions/b2c3d4e5f6a7_add_market_places_table.py @@ -0,0 +1,97 @@ +"""add market_places table and nav_tops.market_id + +Revision ID: b2c3d4e5f6a7 +Revises: a1b2c3d4e5f6 +Create Date: 2026-02-10 +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy import text + +revision = 'b2c3d4e5f6a7' +down_revision = 'a1b2c3d4e5f6' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # 1. Create market_places table + op.create_table( + 'market_places', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('post_id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(255), nullable=False), + sa.Column('slug', sa.String(255), nullable=False), + sa.Column('description', sa.Text(), nullable=True), + sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False), + sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False), + sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True), + sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id'), + ) + op.create_index('ix_market_places_post_id', 'market_places', ['post_id']) + op.create_index( + 'ux_market_places_slug_active', + 'market_places', + [sa.text('lower(slug)')], + unique=True, + postgresql_where=sa.text('deleted_at IS NULL'), + ) + + # 2. Add market_id column to nav_tops + op.add_column( + 'nav_tops', + sa.Column('market_id', sa.Integer(), nullable=True), + ) + op.create_foreign_key( + 'fk_nav_tops_market_id', + 'nav_tops', + 'market_places', + ['market_id'], + ['id'], + ondelete='SET NULL', + ) + op.create_index('ix_nav_tops_market_id', 'nav_tops', ['market_id']) + + # 3. Backfill: create default MarketPlace for the 'market' page + conn = op.get_bind() + + # Find the market page + result = conn.execute(text(""" + SELECT id FROM posts + WHERE slug = 'market' AND is_page = true AND deleted_at IS NULL + LIMIT 1 + """)) + row = result.fetchone() + if row: + post_id = row[0] + + # Insert the default market + conn.execute(text(""" + INSERT INTO market_places (post_id, name, slug, created_at, updated_at) + VALUES (:post_id, 'Suma Market', 'suma-market', now(), now()) + """), {"post_id": post_id}) + + # Get the new market_places id + market_row = conn.execute(text(""" + SELECT id FROM market_places + WHERE slug = 'suma-market' AND deleted_at IS NULL + LIMIT 1 + """)).fetchone() + + if market_row: + market_id = market_row[0] + # Assign all active nav_tops to this market + conn.execute(text(""" + UPDATE nav_tops SET market_id = :market_id + WHERE deleted_at IS NULL + """), {"market_id": market_id}) + + +def downgrade() -> None: + op.drop_index('ix_nav_tops_market_id', table_name='nav_tops') + op.drop_constraint('fk_nav_tops_market_id', 'nav_tops', type_='foreignkey') + op.drop_column('nav_tops', 'market_id') + op.drop_index('ux_market_places_slug_active', table_name='market_places') + op.drop_index('ix_market_places_post_id', table_name='market_places') + op.drop_table('market_places') diff --git a/alembic/versions/c3a1f7b9d4e5_add_snippets_table.py b/alembic/versions/c3a1f7b9d4e5_add_snippets_table.py new file mode 100644 index 0000000..c17c08c --- /dev/null +++ b/alembic/versions/c3a1f7b9d4e5_add_snippets_table.py @@ -0,0 +1,35 @@ +"""add snippets table + +Revision ID: c3a1f7b9d4e5 +Revises: 47fc53fc0d2b +Create Date: 2026-02-07 +""" +from alembic import op +import sqlalchemy as sa + +revision = 'c3a1f7b9d4e5' +down_revision = '47fc53fc0d2b' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + 'snippets', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('user_id', sa.Integer(), nullable=False), + sa.Column('name', sa.String(length=255), nullable=False), + sa.Column('value', sa.Text(), nullable=False), + sa.Column('visibility', sa.String(length=20), server_default='private', nullable=False), + sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('user_id', 'name', name='uq_snippets_user_name'), + ) + op.create_index('ix_snippets_visibility', 'snippets', ['visibility']) + + +def downgrade() -> None: + op.drop_index('ix_snippets_visibility', table_name='snippets') + op.drop_table('snippets') diff --git a/alembic/versions/c3d4e5f6a7b8_add_page_tracking_to_orders.py b/alembic/versions/c3d4e5f6a7b8_add_page_tracking_to_orders.py new file mode 100644 index 0000000..9547d38 --- /dev/null +++ b/alembic/versions/c3d4e5f6a7b8_add_page_tracking_to_orders.py @@ -0,0 +1,55 @@ +"""add page_config_id to orders, market_place_id to cart_items + +Revision ID: c3d4e5f6a7b8 +Revises: b2c3d4e5f6a7 +Create Date: 2026-02-10 +""" +from alembic import op +import sqlalchemy as sa + +revision = 'c3d4e5f6a7b8' +down_revision = 'b2c3d4e5f6a7' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # 1. Add market_place_id to cart_items + op.add_column( + 'cart_items', + sa.Column('market_place_id', sa.Integer(), nullable=True), + ) + op.create_foreign_key( + 'fk_cart_items_market_place_id', + 'cart_items', + 'market_places', + ['market_place_id'], + ['id'], + ondelete='SET NULL', + ) + op.create_index('ix_cart_items_market_place_id', 'cart_items', ['market_place_id']) + + # 2. Add page_config_id to orders + op.add_column( + 'orders', + sa.Column('page_config_id', sa.Integer(), nullable=True), + ) + op.create_foreign_key( + 'fk_orders_page_config_id', + 'orders', + 'page_configs', + ['page_config_id'], + ['id'], + ondelete='SET NULL', + ) + op.create_index('ix_orders_page_config_id', 'orders', ['page_config_id']) + + +def downgrade() -> None: + op.drop_index('ix_orders_page_config_id', table_name='orders') + op.drop_constraint('fk_orders_page_config_id', 'orders', type_='foreignkey') + op.drop_column('orders', 'page_config_id') + + op.drop_index('ix_cart_items_market_place_id', table_name='cart_items') + op.drop_constraint('fk_cart_items_market_place_id', 'cart_items', type_='foreignkey') + op.drop_column('cart_items', 'market_place_id') diff --git a/alembic/versions/d4b2e8f1a3c7_add_post_user_id_and_author_email.py b/alembic/versions/d4b2e8f1a3c7_add_post_user_id_and_author_email.py new file mode 100644 index 0000000..8d6f122 --- /dev/null +++ b/alembic/versions/d4b2e8f1a3c7_add_post_user_id_and_author_email.py @@ -0,0 +1,45 @@ +"""add post user_id, author email, publish_requested + +Revision ID: d4b2e8f1a3c7 +Revises: c3a1f7b9d4e5 +Create Date: 2026-02-08 +""" +from alembic import op +import sqlalchemy as sa + +revision = 'd4b2e8f1a3c7' +down_revision = 'c3a1f7b9d4e5' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # Add author.email + op.add_column('authors', sa.Column('email', sa.String(255), nullable=True)) + + # Add post.user_id FK + op.add_column('posts', sa.Column('user_id', sa.Integer(), nullable=True)) + op.create_foreign_key('fk_posts_user_id', 'posts', 'users', ['user_id'], ['id'], ondelete='SET NULL') + op.create_index('ix_posts_user_id', 'posts', ['user_id']) + + # Add post.publish_requested + op.add_column('posts', sa.Column('publish_requested', sa.Boolean(), server_default='false', nullable=False)) + + # Backfill: match posts to users via primary_author email + op.execute(""" + UPDATE posts + SET user_id = u.id + FROM authors a + JOIN users u ON lower(a.email) = lower(u.email) + WHERE posts.primary_author_id = a.id + AND posts.user_id IS NULL + AND a.email IS NOT NULL + """) + + +def downgrade() -> None: + op.drop_column('posts', 'publish_requested') + op.drop_index('ix_posts_user_id', table_name='posts') + op.drop_constraint('fk_posts_user_id', 'posts', type_='foreignkey') + op.drop_column('posts', 'user_id') + op.drop_column('authors', 'email') diff --git a/alembic/versions/e5c3f9a2b1d6_add_tag_groups_and_tag_group_tags.py b/alembic/versions/e5c3f9a2b1d6_add_tag_groups_and_tag_group_tags.py new file mode 100644 index 0000000..5e21e22 --- /dev/null +++ b/alembic/versions/e5c3f9a2b1d6_add_tag_groups_and_tag_group_tags.py @@ -0,0 +1,45 @@ +"""add tag_groups and tag_group_tags + +Revision ID: e5c3f9a2b1d6 +Revises: d4b2e8f1a3c7 +Create Date: 2026-02-08 +""" +from alembic import op +import sqlalchemy as sa + +revision = 'e5c3f9a2b1d6' +down_revision = 'd4b2e8f1a3c7' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + 'tag_groups', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('name', sa.String(length=255), nullable=False), + sa.Column('slug', sa.String(length=191), nullable=False), + sa.Column('feature_image', sa.Text(), nullable=True), + sa.Column('colour', sa.String(length=32), nullable=True), + sa.Column('sort_order', sa.Integer(), nullable=False, server_default='0'), + sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('slug'), + ) + + op.create_table( + 'tag_group_tags', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('tag_group_id', sa.Integer(), nullable=False), + sa.Column('tag_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['tag_group_id'], ['tag_groups.id'], ondelete='CASCADE'), + sa.ForeignKeyConstraint(['tag_id'], ['tags.id'], ondelete='CASCADE'), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('tag_group_id', 'tag_id', name='uq_tag_group_tag'), + ) + + +def downgrade() -> None: + op.drop_table('tag_group_tags') + op.drop_table('tag_groups') diff --git a/alembic/versions/f6d4a0b2c3e7_add_domain_events_table.py b/alembic/versions/f6d4a0b2c3e7_add_domain_events_table.py new file mode 100644 index 0000000..edd0ffb --- /dev/null +++ b/alembic/versions/f6d4a0b2c3e7_add_domain_events_table.py @@ -0,0 +1,40 @@ +"""add domain_events table + +Revision ID: f6d4a0b2c3e7 +Revises: e5c3f9a2b1d6 +Create Date: 2026-02-11 +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +revision = 'f6d4a0b2c3e7' +down_revision = 'e5c3f9a2b1d6' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + 'domain_events', + sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('event_type', sa.String(128), nullable=False), + sa.Column('aggregate_type', sa.String(64), nullable=False), + sa.Column('aggregate_id', sa.Integer(), nullable=False), + sa.Column('payload', postgresql.JSONB(astext_type=sa.Text()), nullable=True), + sa.Column('state', sa.String(20), server_default='pending', nullable=False), + sa.Column('attempts', sa.Integer(), server_default='0', nullable=False), + sa.Column('max_attempts', sa.Integer(), server_default='5', nullable=False), + sa.Column('last_error', sa.Text(), nullable=True), + sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), + sa.Column('processed_at', sa.DateTime(timezone=True), nullable=True), + sa.PrimaryKeyConstraint('id'), + ) + op.create_index('ix_domain_events_event_type', 'domain_events', ['event_type']) + op.create_index('ix_domain_events_state', 'domain_events', ['state']) + + +def downgrade() -> None: + op.drop_index('ix_domain_events_state', table_name='domain_events') + op.drop_index('ix_domain_events_event_type', table_name='domain_events') + op.drop_table('domain_events') diff --git a/alembic/versions/f6d4a1b2c3e7_add_tickets_table.py b/alembic/versions/f6d4a1b2c3e7_add_tickets_table.py new file mode 100644 index 0000000..06a0f76 --- /dev/null +++ b/alembic/versions/f6d4a1b2c3e7_add_tickets_table.py @@ -0,0 +1,47 @@ +"""add tickets table + +Revision ID: f6d4a1b2c3e7 +Revises: e5c3f9a2b1d6 +Create Date: 2026-02-09 +""" +from alembic import op +import sqlalchemy as sa + +revision = 'f6d4a1b2c3e7' +down_revision = 'e5c3f9a2b1d6' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.create_table( + 'tickets', + sa.Column('id', sa.Integer(), primary_key=True), + sa.Column('entry_id', sa.Integer(), sa.ForeignKey('calendar_entries.id', ondelete='CASCADE'), nullable=False), + sa.Column('ticket_type_id', sa.Integer(), sa.ForeignKey('ticket_types.id', ondelete='SET NULL'), nullable=True), + sa.Column('user_id', sa.Integer(), sa.ForeignKey('users.id'), nullable=True), + sa.Column('session_id', sa.String(64), nullable=True), + sa.Column('order_id', sa.Integer(), sa.ForeignKey('orders.id', ondelete='SET NULL'), nullable=True), + sa.Column('code', sa.String(64), unique=True, nullable=False), + sa.Column('state', sa.String(20), nullable=False, server_default=sa.text("'reserved'")), + sa.Column('created_at', sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()), + sa.Column('checked_in_at', sa.DateTime(timezone=True), nullable=True), + ) + op.create_index('ix_tickets_entry_id', 'tickets', ['entry_id']) + op.create_index('ix_tickets_ticket_type_id', 'tickets', ['ticket_type_id']) + op.create_index('ix_tickets_user_id', 'tickets', ['user_id']) + op.create_index('ix_tickets_session_id', 'tickets', ['session_id']) + op.create_index('ix_tickets_order_id', 'tickets', ['order_id']) + op.create_index('ix_tickets_code', 'tickets', ['code'], unique=True) + op.create_index('ix_tickets_state', 'tickets', ['state']) + + +def downgrade() -> None: + op.drop_index('ix_tickets_state', 'tickets') + op.drop_index('ix_tickets_code', 'tickets') + op.drop_index('ix_tickets_order_id', 'tickets') + op.drop_index('ix_tickets_session_id', 'tickets') + op.drop_index('ix_tickets_user_id', 'tickets') + op.drop_index('ix_tickets_ticket_type_id', 'tickets') + op.drop_index('ix_tickets_entry_id', 'tickets') + op.drop_table('tickets') diff --git a/alembic/versions/g7e5b1c3d4f8_generic_containers.py b/alembic/versions/g7e5b1c3d4f8_generic_containers.py new file mode 100644 index 0000000..7756957 --- /dev/null +++ b/alembic/versions/g7e5b1c3d4f8_generic_containers.py @@ -0,0 +1,115 @@ +"""replace post_id FKs with container_type + container_id + +Revision ID: g7e5b1c3d4f8 +Revises: f6d4a0b2c3e7 +Create Date: 2026-02-11 +""" +from alembic import op +import sqlalchemy as sa + +revision = 'g7e5b1c3d4f8' +down_revision = 'f6d4a0b2c3e7' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # --- calendars: post_id → container_type + container_id --- + op.add_column('calendars', sa.Column('container_type', sa.String(32), nullable=True)) + op.add_column('calendars', sa.Column('container_id', sa.Integer(), nullable=True)) + op.execute("UPDATE calendars SET container_type = 'page', container_id = post_id") + op.alter_column('calendars', 'container_type', nullable=False, server_default=sa.text("'page'")) + op.alter_column('calendars', 'container_id', nullable=False) + op.drop_index('ix_calendars_post_id', table_name='calendars') + op.drop_index('ux_calendars_post_slug_active', table_name='calendars') + op.drop_constraint('calendars_post_id_fkey', 'calendars', type_='foreignkey') + op.drop_column('calendars', 'post_id') + op.create_index('ix_calendars_container', 'calendars', ['container_type', 'container_id']) + op.create_index( + 'ux_calendars_container_slug_active', + 'calendars', + ['container_type', 'container_id', sa.text('lower(slug)')], + unique=True, + postgresql_where=sa.text('deleted_at IS NULL'), + ) + + # --- market_places: post_id → container_type + container_id --- + op.add_column('market_places', sa.Column('container_type', sa.String(32), nullable=True)) + op.add_column('market_places', sa.Column('container_id', sa.Integer(), nullable=True)) + op.execute("UPDATE market_places SET container_type = 'page', container_id = post_id") + op.alter_column('market_places', 'container_type', nullable=False, server_default=sa.text("'page'")) + op.alter_column('market_places', 'container_id', nullable=False) + op.drop_index('ix_market_places_post_id', table_name='market_places') + op.drop_constraint('market_places_post_id_fkey', 'market_places', type_='foreignkey') + op.drop_column('market_places', 'post_id') + op.create_index('ix_market_places_container', 'market_places', ['container_type', 'container_id']) + + # --- page_configs: post_id → container_type + container_id --- + op.add_column('page_configs', sa.Column('container_type', sa.String(32), nullable=True)) + op.add_column('page_configs', sa.Column('container_id', sa.Integer(), nullable=True)) + op.execute("UPDATE page_configs SET container_type = 'page', container_id = post_id") + op.alter_column('page_configs', 'container_type', nullable=False, server_default=sa.text("'page'")) + op.alter_column('page_configs', 'container_id', nullable=False) + op.drop_constraint('page_configs_post_id_fkey', 'page_configs', type_='foreignkey') + op.drop_column('page_configs', 'post_id') + op.create_index('ix_page_configs_container', 'page_configs', ['container_type', 'container_id']) + + # --- calendar_entry_posts: post_id → content_type + content_id --- + op.add_column('calendar_entry_posts', sa.Column('content_type', sa.String(32), nullable=True)) + op.add_column('calendar_entry_posts', sa.Column('content_id', sa.Integer(), nullable=True)) + op.execute("UPDATE calendar_entry_posts SET content_type = 'post', content_id = post_id") + op.alter_column('calendar_entry_posts', 'content_type', nullable=False, server_default=sa.text("'post'")) + op.alter_column('calendar_entry_posts', 'content_id', nullable=False) + op.drop_index('ix_entry_posts_post_id', table_name='calendar_entry_posts') + op.drop_constraint('calendar_entry_posts_post_id_fkey', 'calendar_entry_posts', type_='foreignkey') + op.drop_column('calendar_entry_posts', 'post_id') + op.create_index('ix_entry_posts_content', 'calendar_entry_posts', ['content_type', 'content_id']) + + +def downgrade() -> None: + # --- calendar_entry_posts: restore post_id --- + op.add_column('calendar_entry_posts', sa.Column('post_id', sa.Integer(), nullable=True)) + op.execute("UPDATE calendar_entry_posts SET post_id = content_id WHERE content_type = 'post'") + op.alter_column('calendar_entry_posts', 'post_id', nullable=False) + op.create_foreign_key('calendar_entry_posts_post_id_fkey', 'calendar_entry_posts', 'posts', ['post_id'], ['id'], ondelete='CASCADE') + op.create_index('ix_entry_posts_post_id', 'calendar_entry_posts', ['post_id']) + op.drop_index('ix_entry_posts_content', table_name='calendar_entry_posts') + op.drop_column('calendar_entry_posts', 'content_id') + op.drop_column('calendar_entry_posts', 'content_type') + + # --- page_configs: restore post_id --- + op.add_column('page_configs', sa.Column('post_id', sa.Integer(), nullable=True)) + op.execute("UPDATE page_configs SET post_id = container_id WHERE container_type = 'page'") + op.alter_column('page_configs', 'post_id', nullable=False) + op.create_foreign_key('page_configs_post_id_fkey', 'page_configs', 'posts', ['post_id'], ['id'], ondelete='CASCADE') + op.drop_index('ix_page_configs_container', table_name='page_configs') + op.drop_column('page_configs', 'container_id') + op.drop_column('page_configs', 'container_type') + + # --- market_places: restore post_id --- + op.add_column('market_places', sa.Column('post_id', sa.Integer(), nullable=True)) + op.execute("UPDATE market_places SET post_id = container_id WHERE container_type = 'page'") + op.alter_column('market_places', 'post_id', nullable=False) + op.create_foreign_key('market_places_post_id_fkey', 'market_places', 'posts', ['post_id'], ['id'], ondelete='CASCADE') + op.create_index('ix_market_places_post_id', 'market_places', ['post_id']) + op.drop_index('ix_market_places_container', table_name='market_places') + op.drop_column('market_places', 'container_id') + op.drop_column('market_places', 'container_type') + + # --- calendars: restore post_id --- + op.add_column('calendars', sa.Column('post_id', sa.Integer(), nullable=True)) + op.execute("UPDATE calendars SET post_id = container_id WHERE container_type = 'page'") + op.alter_column('calendars', 'post_id', nullable=False) + op.create_foreign_key('calendars_post_id_fkey', 'calendars', 'posts', ['post_id'], ['id'], ondelete='CASCADE') + op.create_index('ix_calendars_post_id', 'calendars', ['post_id']) + op.create_index( + 'ux_calendars_post_slug_active', + 'calendars', + ['post_id', sa.text('lower(slug)')], + unique=True, + postgresql_where=sa.text('deleted_at IS NULL'), + ) + op.drop_index('ux_calendars_container_slug_active', table_name='calendars') + op.drop_index('ix_calendars_container', table_name='calendars') + op.drop_column('calendars', 'container_id') + op.drop_column('calendars', 'container_type') diff --git a/browser/__init__.py b/browser/__init__.py new file mode 100644 index 0000000..6ded1e5 --- /dev/null +++ b/browser/__init__.py @@ -0,0 +1 @@ +# suma_browser package diff --git a/browser/app/__init__.py b/browser/app/__init__.py new file mode 100644 index 0000000..ef1392a --- /dev/null +++ b/browser/app/__init__.py @@ -0,0 +1,12 @@ +# The monolith has been split into three apps (apps/coop, apps/market, apps/cart). +# This package remains for shared infrastructure modules (middleware, redis_cacher, +# csrf, errors, authz, filters, utils, bp/*). +# +# To run individual apps: +# hypercorn apps.coop.app:app --bind 0.0.0.0:8000 +# hypercorn apps.market.app:app --bind 0.0.0.0:8001 +# hypercorn apps.cart.app:app --bind 0.0.0.0:8002 +# +# Legacy single-process: +# hypercorn suma_browser.app.app:app --bind 0.0.0.0:8000 +# (runs the old monolith from app.py, which still works) diff --git a/browser/app/authz.py b/browser/app/authz.py new file mode 100644 index 0000000..864e4ff --- /dev/null +++ b/browser/app/authz.py @@ -0,0 +1,152 @@ +from __future__ import annotations + +from functools import wraps +from typing import Any, Dict, Iterable, Optional +import inspect + +from quart import g, abort, redirect, request, current_app +from shared.infrastructure.urls import login_url + + +def require_rights(*rights: str, any_of: bool = True): + """ + Decorator for routes that require certain user rights. + """ + + if not rights: + raise ValueError("require_rights needs at least one right name") + + required_set = frozenset(rights) + + def decorator(view_func): + @wraps(view_func) + async def wrapper(*args: Any, **kwargs: Any): + # Not logged in → go to login, with ?next= + user = g.get("user") + if not user: + return redirect(login_url(request.url)) + + rights_dict = g.get("rights") or {} + + if any_of: + allowed = any(rights_dict.get(name) for name in required_set) + else: + allowed = all(rights_dict.get(name) for name in required_set) + + if not allowed: + abort(403) + + result = view_func(*args, **kwargs) + if inspect.isawaitable(result): + return await result + return result + + # ---- expose access requirements on the wrapper ---- + wrapper.__access_requires__ = { + "rights": required_set, + "any_of": any_of, + } + + return wrapper + + return decorator + + +def require_login(view_func): + """ + Decorator for routes that require any logged-in user. + """ + @wraps(view_func) + async def wrapper(*args: Any, **kwargs: Any): + user = g.get("user") + if not user: + return redirect(login_url(request.url)) + result = view_func(*args, **kwargs) + if inspect.isawaitable(result): + return await result + return result + return wrapper + + +def require_admin(view_func=None): + """ + Shortcut for routes that require the 'admin' right. + """ + if view_func is None: + return require_rights("admin") + + return require_rights("admin")(view_func) + +def require_post_author(view_func): + """Allow admin or post owner.""" + @wraps(view_func) + async def wrapper(*args, **kwargs): + user = g.get("user") + if not user: + return redirect(login_url(request.url)) + is_admin = bool((g.get("rights") or {}).get("admin")) + if is_admin: + result = view_func(*args, **kwargs) + if inspect.isawaitable(result): + return await result + return result + post = getattr(g, "post_data", {}).get("original_post") + if post and post.user_id == user.id: + result = view_func(*args, **kwargs) + if inspect.isawaitable(result): + return await result + return result + abort(403) + return wrapper + + +def _get_access_meta(view_func) -> Optional[Dict[str, Any]]: + """ + Walk the wrapper chain looking for __access_requires__ metadata. + """ + func = view_func + seen: set[int] = set() + + while func is not None and id(func) not in seen: + seen.add(id(func)) + meta = getattr(func, "__access_requires__", None) + if meta is not None: + return meta + func = getattr(func, "__wrapped__", None) + + return None + + +def has_access(endpoint: str) -> bool: + """ + Return True if the current user has access to the given endpoint. + + Example: + has_access("settings.home") + has_access("settings.clear_cache_view") + """ + view = current_app.view_functions.get(endpoint) + if view is None: + # Unknown endpoint: be conservative + return False + + meta = _get_access_meta(view) + + # If the route has no rights metadata, treat it as public: + if meta is None: + return True + + required: Iterable[str] = meta["rights"] + any_of: bool = meta["any_of"] + + # Must be in a request context; if no user, they don't have access + user = g.get("user") + if not user: + return False + + rights_dict = g.get("rights") or {} + + if any_of: + return any(rights_dict.get(name) for name in required) + else: + return all(rights_dict.get(name) for name in required) diff --git a/browser/app/csrf.py b/browser/app/csrf.py new file mode 100644 index 0000000..bfd898d --- /dev/null +++ b/browser/app/csrf.py @@ -0,0 +1,99 @@ +from __future__ import annotations + +import secrets +from typing import Callable, Awaitable, Optional + +from quart import ( + abort, + current_app, + request, + session as qsession, +) + +SAFE_METHODS = {"GET", "HEAD", "OPTIONS", "TRACE"} + + +def generate_csrf_token() -> str: + """ + Per-session CSRF token. + + In Jinja: + + """ + token = qsession.get("csrf_token") + if not token: + token = secrets.token_urlsafe(32) + qsession["csrf_token"] = token + return token + + +def _is_exempt_endpoint() -> bool: + endpoint = request.endpoint + if not endpoint: + return False + view = current_app.view_functions.get(endpoint) + + # Walk decorator stack (__wrapped__) to find csrf_exempt + while view is not None: + if getattr(view, "_csrf_exempt", False): + return True + view = getattr(view, "__wrapped__", None) + + return False + + +async def protect() -> None: + """ + Enforce CSRF on unsafe methods. + + Supports: + * Forms: hidden input "csrf_token" + * JSON: "csrf_token" or "csrfToken" field + * HTMX/AJAX: "X-CSRFToken" or "X-CSRF-Token" header + """ + if request.method in SAFE_METHODS: + return + + if _is_exempt_endpoint(): + return + + session_token = qsession.get("csrf_token") + if not session_token: + abort(400, "Missing CSRF session token") + + supplied_token: Optional[str] = None + + # JSON body + if request.mimetype == "application/json": + data = await request.get_json(silent=True) or {} + supplied_token = data.get("csrf_token") or data.get("csrfToken") + + # Form body + if not supplied_token and request.mimetype != "application/json": + form = await request.form + supplied_token = form.get("csrf_token") + + # Headers (HTMX / fetch) + if not supplied_token: + supplied_token = ( + request.headers.get("X-CSRFToken") + or request.headers.get("X-CSRF-Token") + ) + + if not supplied_token or supplied_token != session_token: + abort(400, "Invalid CSRF token") + + +def csrf_exempt(view: Callable[..., Awaitable]) -> Callable[..., Awaitable]: + """ + Mark a view as CSRF-exempt. + + from suma_browser.app.csrf import csrf_exempt + + @csrf_exempt + @blueprint.post("/hook") + async def webhook(): + ... + """ + setattr(view, "_csrf_exempt", True) + return view diff --git a/browser/app/errors.py b/browser/app/errors.py new file mode 100644 index 0000000..bb8cdf2 --- /dev/null +++ b/browser/app/errors.py @@ -0,0 +1,126 @@ +from werkzeug.exceptions import HTTPException +from shared.utils import hx_fragment_request + +from quart import ( + request, + render_template, + make_response, + current_app +) + +from markupsafe import escape + +class AppError(ValueError): + """ + Base class for app-level, client-safe errors. + Behaves like ValueError so existing except ValueError: still works. + """ + status_code: int = 400 + + def __init__(self, message, *, status_code: int | None = None): + # Support a single message or a list/tuple of messages + if isinstance(message, (list, tuple, set)): + self.messages = [str(m) for m in message] + msg = self.messages[0] if self.messages else "" + else: + self.messages = [str(message)] + msg = str(message) + + super().__init__(msg) + + if status_code is not None: + self.status_code = status_code + + +def errors(app): + def _info(e): + return { + "exception": e, + "method": request.method, + "url": str(request.url), + "base_url": str(request.base_url), + "root_path": request.root_path, + "path": request.path, + "full_path": request.full_path, + "endpoint": request.endpoint, + "url_rule": str(request.url_rule) if request.url_rule else None, + "headers": {k: v for k, v in request.headers.items() + if k.lower().startswith("x-forwarded") or k in ("Host",)}, + } + + @app.errorhandler(404) + async def not_found(e): + current_app.logger.warning("404 %s", _info(e)) + if hx_fragment_request(): + html = await render_template( + "_types/root/exceptions/hx/_.html", + errnum='404' + ) + else: + html = await render_template( + "_types/root/exceptions/_.html", + errnum='404', + ) + + return await make_response(html, 404) + + @app.errorhandler(403) + async def not_allowed(e): + current_app.logger.warning("403 %s", _info(e)) + if hx_fragment_request(): + html = await render_template( + "_types/root/exceptions/hx/_.html", + errnum='403' + ) + else: + html = await render_template( + "_types/root/exceptions/_.html", + errnum='403', + ) + + return await make_response(html, 403) + + @app.errorhandler(AppError) + async def app_error(e: AppError): + # App-level, client-safe errors + current_app.logger.info("AppError %s", _info(e)) + status = getattr(e, "status_code", 400) + messages = getattr(e, "messages", [str(e)]) + + if request.headers.get("HX-Request") == "true": + # Build a little styled
  • ...
snippet + lis = "".join( + f"
  • {escape(m)}
  • " + for m in messages if m + ) + html = ( + "
      " + f"{lis}" + "
    " + ) + return await make_response(html, status) + + # Non-HTMX: show a nicer page with error messages + html = await render_template( + "_types/root/exceptions/app_error.html", + messages=messages, + ) + return await make_response(html, status) + + @app.errorhandler(Exception) + async def error(e): + current_app.logger.exception("Exception %s", _info(e)) + + status = 500 + if isinstance(e, HTTPException): + status = e.code or 500 + + if request.headers.get("HX-Request") == "true": + # Generic message for unexpected/untrusted errors + return await make_response( + "Something went wrong. Please try again.", + status, + ) + + html = await render_template("_types/root/exceptions/error.html") + return await make_response(html, status) diff --git a/browser/app/filters/__init__.py b/browser/app/filters/__init__.py new file mode 100644 index 0000000..4e34162 --- /dev/null +++ b/browser/app/filters/__init__.py @@ -0,0 +1,17 @@ +def register(app): + from .highlight import highlight + app.jinja_env.filters["highlight"] = highlight + + from .qs import register as qs + from .url_join import register as url_join + from .combine import register as combine + from .currency import register as currency + from .truncate import register as truncate + from .getattr import register as getattr + + qs(app) + url_join(app) + combine(app) + currency(app) + getattr(app) + # truncate(app) \ No newline at end of file diff --git a/browser/app/filters/combine.py b/browser/app/filters/combine.py new file mode 100644 index 0000000..9edf07b --- /dev/null +++ b/browser/app/filters/combine.py @@ -0,0 +1,25 @@ +from __future__ import annotations +from typing import Any, Mapping + +def _deep_merge(dst: dict, src: Mapping) -> dict: + out = dict(dst) + for k, v in src.items(): + if isinstance(v, Mapping) and isinstance(out.get(k), Mapping): + out[k] = _deep_merge(out[k], v) # type: ignore[arg-type] + else: + out[k] = v + return out +def register(app): + @app.template_filter("combine") + def combine_filter(a: Any, b: Any, deep: bool = False, drop_none: bool = False) -> Any: + """ + Jinja filter: merge two dict-like objects. + + - Non-dict inputs: returns `a` unchanged. + - If drop_none=True, keys in `b` with value None are ignored. + - If deep=True, nested dicts are merged recursively. + """ + if not isinstance(a, Mapping) or not isinstance(b, Mapping): + return a + b2 = {k: v for k, v in b.items() if not (drop_none and v is None)} + return _deep_merge(a, b2) if deep else {**a, **b2} \ No newline at end of file diff --git a/browser/app/filters/currency.py b/browser/app/filters/currency.py new file mode 100644 index 0000000..0309b9b --- /dev/null +++ b/browser/app/filters/currency.py @@ -0,0 +1,12 @@ +from decimal import Decimal + +def register(app): + @app.template_filter("currency") + def currency_filter(value, code="GBP"): + if value is None: + return "" + # ensure decimal-ish + if isinstance(value, float): + value = Decimal(str(value)) + symbol = "£" if code == "GBP" else code + return f"{symbol}{value:.2f}" diff --git a/browser/app/filters/getattr.py b/browser/app/filters/getattr.py new file mode 100644 index 0000000..7d98684 --- /dev/null +++ b/browser/app/filters/getattr.py @@ -0,0 +1,6 @@ + +def register(app): + @app.template_filter("getattr") + def jinja_getattr(obj, name, default=None): + # Safe getattr: returns default if the attribute is missing + return getattr(obj, name, default) diff --git a/browser/app/filters/highlight.py b/browser/app/filters/highlight.py new file mode 100644 index 0000000..876a10b --- /dev/null +++ b/browser/app/filters/highlight.py @@ -0,0 +1,21 @@ +# ---------- misc helpers / filters ---------- +from markupsafe import Markup, escape + +def highlight(text: str, needle: str, cls: str = "bg-yellow-200 rounded") -> Markup: + """ + Wraps case-insensitive matches of `needle` inside . + Escapes everything safely. + """ + import re + if not text or not needle: + return Markup(escape(text or "")) + + pattern = re.compile(re.escape(needle), re.IGNORECASE) + + def repl(m: re.Match) -> str: + return f'{escape(m.group(0))}' + + esc = escape(text) + result = pattern.sub(lambda m: Markup(repl(m)), esc) + return Markup(result) + diff --git a/browser/app/filters/qs.py b/browser/app/filters/qs.py new file mode 100644 index 0000000..49d3b5d --- /dev/null +++ b/browser/app/filters/qs.py @@ -0,0 +1,13 @@ +from typing import Dict +from quart import g + +def register(app): + @app.template_filter("qs") + def qs_filter(dict: Dict): + if getattr(g, "makeqs_factory", False): + q= g.makeqs_factory()( + **dict, + ) + return q + else: + return "" diff --git a/browser/app/filters/qs_base.py b/browser/app/filters/qs_base.py new file mode 100644 index 0000000..6a8a8b5 --- /dev/null +++ b/browser/app/filters/qs_base.py @@ -0,0 +1,78 @@ +""" +Shared query-string primitives used by blog, market, and order qs modules. +""" +from __future__ import annotations + +from urllib.parse import urlencode + +# Sentinel meaning "leave value as-is" (used as default arg in makeqs) +KEEP = object() + + +def _iterify(x): + """Normalize *x* to a list: None → [], scalar → [scalar], iterable → as-is.""" + if x is None: + return [] + if isinstance(x, (list, tuple, set)): + return x + return [x] + + +def _norm(s: str) -> str: + """Strip + lowercase — used for case-insensitive filter dedup.""" + return s.strip().lower() + + +def make_filter_set( + base: list[str], + add, + remove, + clear_filters: bool, + *, + single_select: bool = False, +) -> list[str]: + """ + Build a deduplicated, sorted filter list. + + Parameters + ---------- + base : list[str] + Current filter values. + add : str | list | None + Value(s) to add. + remove : str | list | None + Value(s) to remove. + clear_filters : bool + If True, start from empty instead of *base*. + single_select : bool + If True, *add* **replaces** the list (blog tags/authors). + If False, *add* is **appended** (market brands/stickers/labels). + """ + add_list = [s for s in _iterify(add) if s is not None] + + if single_select: + # Blog-style: adding replaces the entire set + if add_list: + table = {_norm(s): s for s in add_list} + else: + table = {_norm(s): s for s in base if not clear_filters} + else: + # Market-style: adding appends to the existing set + table = {_norm(s): s for s in base if not clear_filters} + for s in add_list: + k = _norm(s) + if k not in table: + table[k] = s + + for s in _iterify(remove): + if s is None: + continue + table.pop(_norm(s), None) + + return [table[k] for k in sorted(table)] + + +def build_qs(params: list[tuple[str, str]], *, leading_q: bool = True) -> str: + """URL-encode *params* and optionally prepend ``?``.""" + qs = urlencode(params, doseq=True) + return ("?" + qs) if (qs and leading_q) else qs diff --git a/browser/app/filters/query_types.py b/browser/app/filters/query_types.py new file mode 100644 index 0000000..3a7482c --- /dev/null +++ b/browser/app/filters/query_types.py @@ -0,0 +1,33 @@ +""" +NamedTuple types returned by each blueprint's ``decode()`` function. +""" +from __future__ import annotations + +from typing import NamedTuple + + +class BlogQuery(NamedTuple): + page: int + search: str | None + sort: str | None + selected_tags: tuple[str, ...] + selected_authors: tuple[str, ...] + liked: str | None + view: str | None + drafts: str | None + selected_groups: tuple[str, ...] + + +class MarketQuery(NamedTuple): + page: int + search: str | None + sort: str | None + selected_brands: tuple[str, ...] + selected_stickers: tuple[str, ...] + selected_labels: tuple[str, ...] + liked: str | None + + +class OrderQuery(NamedTuple): + page: int + search: str | None diff --git a/browser/app/filters/truncate.py b/browser/app/filters/truncate.py new file mode 100644 index 0000000..754851a --- /dev/null +++ b/browser/app/filters/truncate.py @@ -0,0 +1,22 @@ +from __future__ import annotations + +def register(app): + @app.template_filter("truncate") + def truncate(text, max_length=100): + """ + Truncate text to max_length characters and add an ellipsis character (…) + if it was longer. + """ + if text is None: + return "" + + text = str(text) + + if len(text) <= max_length: + return text + + # Leave space for the ellipsis itself + if max_length <= 1: + return "…" + + return text[:max_length - 1] + "…" \ No newline at end of file diff --git a/browser/app/filters/url_join.py b/browser/app/filters/url_join.py new file mode 100644 index 0000000..120d7fe --- /dev/null +++ b/browser/app/filters/url_join.py @@ -0,0 +1,19 @@ +from typing import Iterable, Union + +from shared.utils import join_url, host_url, _join_url_parts, route_prefix + + +# --- Register as a Jinja filter (Quart / Flask) --- +def register(app): + @app.template_filter("urljoin") + def urljoin_filter(value: Union[str, Iterable[str]]): + return join_url(value) + @app.template_filter("urlhost") + def urlhost_filter(value: Union[str, Iterable[str]]): + return host_url(value) + @app.template_filter("urlhost_no_slash") + def urlhost_no_slash_filter(value: Union[str, Iterable[str]]): + return host_url(value, True) + @app.template_filter("host") + def host_filter(value: str): + return _join_url_parts([route_prefix(), value]) diff --git a/browser/app/middleware.py b/browser/app/middleware.py new file mode 100644 index 0000000..bb156d4 --- /dev/null +++ b/browser/app/middleware.py @@ -0,0 +1,58 @@ + +def register(app): + import json + from typing import Any + + def _decode_headers(scope) -> dict[str, str]: + out = {} + for k, v in scope.get("headers", []): + try: + out[k.decode("latin1")] = v.decode("latin1") + except Exception: + out[repr(k)] = repr(v) + return out + + def _safe(obj: Any): + # make scope json-serialisable; fall back to repr() + try: + json.dumps(obj) + return obj + except Exception: + return repr(obj) + + class ScopeDumpMiddleware: + def __init__(self, app, *, log_bodies: bool = False): + self.app = app + self.log_bodies = log_bodies # keep False; bodies aren't needed for routing + + async def __call__(self, scope, receive, send): + if scope["type"] in ("http", "websocket"): + # Build a compact view of keys relevant to routing + scope_view = { + "type": scope.get("type"), + "asgi": scope.get("asgi"), + "http_version": scope.get("http_version"), + "scheme": scope.get("scheme"), + "method": scope.get("method"), + "server": scope.get("server"), + "client": scope.get("client"), + "root_path": scope.get("root_path"), + "path": scope.get("path"), + "raw_path": scope.get("raw_path").decode("latin1") if scope.get("raw_path") else None, + "query_string": scope.get("query_string", b"").decode("latin1"), + "headers": _decode_headers(scope), + } + + print("\n=== ASGI SCOPE (routing) ===") + print(json.dumps({_safe(k): _safe(v) for k, v in scope_view.items()}, indent=2)) + print("=== END SCOPE ===\n", flush=True) + + return await self.app(scope, receive, send) + + # wrap LAST so you see what hits Quart + #app.asgi_app = ScopeDumpMiddleware(app.asgi_app) + + + from hypercorn.middleware import ProxyFixMiddleware + # trust a single proxy hop; use legacy X-Forwarded-* headers + app.asgi_app = ProxyFixMiddleware(app.asgi_app, mode="legacy", trusted_hops=1) diff --git a/browser/app/payments/__init__.py b/browser/app/payments/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/browser/app/payments/__init__.py @@ -0,0 +1 @@ + diff --git a/browser/app/payments/sumup.py b/browser/app/payments/sumup.py new file mode 100644 index 0000000..21c3e0b --- /dev/null +++ b/browser/app/payments/sumup.py @@ -0,0 +1,121 @@ +from __future__ import annotations + +import os +from typing import Any, Dict, TYPE_CHECKING + +import httpx +from quart import current_app + +from shared.config import config + +if TYPE_CHECKING: + from cart.models.order import Order + +SUMUP_BASE_URL = "https://api.sumup.com/v0.1" + + +def _sumup_settings() -> Dict[str, str]: + cfg = config() + sumup_cfg = cfg.get("sumup", {}) or {} + api_key_env = sumup_cfg.get("api_key_env", "SUMUP_API_KEY") + api_key = os.getenv(api_key_env) + if not api_key: + raise RuntimeError(f"Missing SumUp API key in environment variable {api_key_env}") + + merchant_code = sumup_cfg.get("merchant_code") + prefix = sumup_cfg.get("checkout_prefix", "") + if not merchant_code: + raise RuntimeError("Missing 'sumup.merchant_code' in app-config.yaml") + + currency = sumup_cfg.get("currency", "GBP") + + return { + "api_key": api_key, + "merchant_code": merchant_code, + "currency": currency, + "checkout_reference_prefix": prefix, + } + + +async def create_checkout( + order: Order, + redirect_url: str, + webhook_url: str | None = None, + description: str | None = None, +) -> Dict[str, Any]: + settings = _sumup_settings() + # Use stored reference if present, otherwise build it + checkout_reference = order.sumup_reference or f"{settings['checkout_reference_prefix']}{order.id}" + + payload: Dict[str, Any] = { + "checkout_reference": checkout_reference, + "amount": float(order.total_amount), + "currency": settings["currency"], + "merchant_code": settings["merchant_code"], + "description": description or f"Order {order.id} at {current_app.config.get('APP_TITLE', 'Rose Ash')}", + "return_url": webhook_url or redirect_url, + "redirect_url": redirect_url, + "hosted_checkout": {"enabled": True}, + } + headers = { + "Authorization": f"Bearer {settings['api_key']}", + "Content-Type": "application/json", + } + + # Optional: log for debugging + current_app.logger.info( + "Creating SumUp checkout %s for Order %s amount %.2f", + checkout_reference, + order.id, + float(order.total_amount), + ) + + async with httpx.AsyncClient(timeout=15.0) as client: + resp = await client.post(f"{SUMUP_BASE_URL}/checkouts", json=payload, headers=headers) + + if resp.status_code == 409: + # Duplicate checkout — retrieve the existing one by reference + current_app.logger.warning( + "SumUp duplicate checkout for ref %s order %s, fetching existing", + checkout_reference, + order.id, + ) + list_resp = await client.get( + f"{SUMUP_BASE_URL}/checkouts", + params={"checkout_reference": checkout_reference}, + headers=headers, + ) + list_resp.raise_for_status() + items = list_resp.json() + if isinstance(items, list) and items: + return items[0] + if isinstance(items, dict) and items.get("items"): + return items["items"][0] + # Fallback: re-raise original error + resp.raise_for_status() + + if resp.status_code >= 400: + current_app.logger.error( + "SumUp checkout error for ref %s order %s: %s", + checkout_reference, + order.id, + resp.text, + ) + resp.raise_for_status() + data = resp.json() + + return data + + +async def get_checkout(checkout_id: str) -> Dict[str, Any]: + """Fetch checkout status/details from SumUp.""" + settings = _sumup_settings() + headers = { + "Authorization": f"Bearer {settings['api_key']}", + "Content-Type": "application/json", + } + + async with httpx.AsyncClient(timeout=10.0) as client: + resp = await client.get(f"{SUMUP_BASE_URL}/checkouts/{checkout_id}", headers=headers) + resp.raise_for_status() + return resp.json() diff --git a/browser/app/redis_cacher.py b/browser/app/redis_cacher.py new file mode 100644 index 0000000..154d410 --- /dev/null +++ b/browser/app/redis_cacher.py @@ -0,0 +1,346 @@ +from __future__ import annotations + +from functools import wraps +from typing import Optional, Literal + +import asyncio + +from quart import ( + Quart, + request, + Response, + g, + current_app, +) +from redis import asyncio as aioredis + +Scope = Literal["user", "global", "anon"] +TagScope = Literal["all", "user"] # for clear_cache + + +# --------------------------------------------------------------------------- +# Redis setup +# --------------------------------------------------------------------------- + +def register(app: Quart) -> None: + @app.before_serving + async def setup_redis() -> None: + if app.config["REDIS_URL"] and app.config["REDIS_URL"] != 'no': + app.redis = aioredis.Redis.from_url( + app.config["REDIS_URL"], + encoding="utf-8", + decode_responses=False, # store bytes + ) + else: + app.redis = False + + @app.after_serving + async def close_redis() -> None: + if app.redis: + await app.redis.close() + # optional: await app.redis.connection_pool.disconnect() + + +def get_redis(): + return current_app.redis + + +# --------------------------------------------------------------------------- +# Key helpers +# --------------------------------------------------------------------------- + +def get_user_id() -> str: + """ + Returns a string id or 'anon'. + Adjust based on your auth system. + """ + user = getattr(g, "user", None) + if user: + return str(user.id) + return "anon" + + +def make_cache_key(cache_user_id: str) -> str: + """ + Build a cache key for this (user/global/anon) + path + query + HTMX status. + + HTMX requests and normal requests get different cache keys because they + return different content (partials vs full pages). + + Keys are namespaced by app name (from CACHE_APP_PREFIX) to avoid + collisions between apps that may share the same paths. + """ + app_prefix = current_app.config.get("CACHE_APP_PREFIX", "app") + path = request.path + qs = request.query_string.decode() if request.query_string else "" + + # Check if this is an HTMX request + is_htmx = request.headers.get("HX-Request", "").lower() == "true" + htmx_suffix = ":htmx" if is_htmx else "" + + if qs: + return f"cache:{app_prefix}:page:{cache_user_id}:{path}?{qs}{htmx_suffix}" + else: + return f"cache:{app_prefix}:page:{cache_user_id}:{path}{htmx_suffix}" + + +def user_set_key(user_id: str) -> str: + """ + Redis set that tracks all cache keys for a given user id. + Only used when scope='user'. + """ + return f"cache:user:{user_id}" + + +def tag_set_key(tag: str) -> str: + """ + Redis set that tracks all cache keys associated with a tag + (across all scopes/users). + """ + return f"cache:tag:{tag}" + + +# --------------------------------------------------------------------------- +# Invalidation helpers +# --------------------------------------------------------------------------- + +async def invalidate_user_cache(user_id: str) -> None: + """ + Delete all cached pages for a specific user (scope='user' caches). + """ + r = get_redis() + if r: + s_key = user_set_key(user_id) + keys = await r.smembers(s_key) # set of bytes + if keys: + await r.delete(*keys) + await r.delete(s_key) + + +async def invalidate_tag_cache(tag: str) -> None: + """ + Delete all cached pages associated with this tag, for all users/scopes. + """ + r = get_redis() + if r: + t_key = tag_set_key(tag) + keys = await r.smembers(t_key) # set of bytes + if keys: + await r.delete(*keys) + await r.delete(t_key) + + +async def invalidate_tag_cache_for_user(tag: str, cache_uid: str) -> None: + r = get_redis() + if not r: + return + + t_key = tag_set_key(tag) + keys = await r.smembers(t_key) # set of bytes + if not keys: + return + + prefix = f"cache:page:{cache_uid}:".encode("utf-8") + + # Filter keys belonging to this cache_uid only + to_delete = [k for k in keys if k.startswith(prefix)] + if not to_delete: + return + + # Delete those page entries + await r.delete(*to_delete) + # Remove them from the tag set (leave other users' keys intact) + await r.srem(t_key, *to_delete) + +async def invalidate_tag_cache_for_current_user(tag: str) -> None: + """ + Convenience helper: delete tag cache for the current user_id (scope='user'). + """ + uid = get_user_id() + await invalidate_tag_cache_for_user(tag, uid) + + +# --------------------------------------------------------------------------- +# Cache decorator for GET +# --------------------------------------------------------------------------- + +def cache_page( + ttl: int = 0, + tag: Optional[str] = None, + scope: Scope = "user", +): + """ + Cache GET responses in Redis. + + ttl: + Seconds to keep the cache. 0 = no expiry. + tag: + Optional tag name used for bulk invalidation via invalidate_tag_cache(). + scope: + "user" → cache per-user (includes 'anon'), tracked in cache:user:{id} + "global" → single cache shared by everyone (no per-user tracking) + "anon" → cache only for anonymous users; logged-in users bypass cache + """ + + def decorator(view): + @wraps(view) + async def wrapper(*args, **kwargs): + r = get_redis() + + if not r or request.method != "GET": + return await view(*args, **kwargs) + uid = get_user_id() + + # Decide who the cache key is keyed on + if scope == "global": + cache_uid = "global" + elif scope == "anon": + # Only cache for anonymous users + if uid != "anon": + return await view(*args, **kwargs) + cache_uid = "anon" + else: # scope == "user" + cache_uid = uid + + key = make_cache_key(cache_uid) + + cached = await r.hgetall(key) + if cached: + body = cached[b"body"] + status = int(cached[b"status"].decode()) + content_type = cached.get(b"content_type", b"text/html").decode() + return Response(body, status=status, content_type=content_type) + + # Not cached, call the view + resp = await view(*args, **kwargs) + + # Normalise: if the view returned a string/bytes, wrap it + if not isinstance(resp, Response): + resp = Response(resp, content_type="text/html") + + # Only cache successful responses + if resp.status_code == 200: + body = await resp.get_data() # bytes + + pipe = r.pipeline() + pipe.hset( + key, + mapping={ + "body": body, + "status": str(resp.status_code), + "content_type": resp.content_type or "text/html", + }, + ) + if ttl: + pipe.expire(key, ttl) + + # Track per-user keys only when scope='user' + if scope == "user": + pipe.sadd(user_set_key(cache_uid), key) + + # Track per-tag keys (all scopes) + if tag: + pipe.sadd(tag_set_key(tag), key) + + await pipe.execute() + + resp.set_data(body) + + return resp + + return wrapper + + return decorator + + +# --------------------------------------------------------------------------- +# Clear cache decorator for POST (or any method) +# --------------------------------------------------------------------------- + +def clear_cache( + *, + tag: Optional[str] = None, + tag_scope: TagScope = "all", + clear_user: bool = False, +): + """ + Decorator for routes that should clear cache after they run. + + Use on POST/PUT/PATCH/DELETE handlers. + + Params: + tag: + If set, will clear caches for this tag. + tag_scope: + "all" → invalidate_tag_cache(tag) (all users/scopes) + "user" → invalidate_tag_cache_for_current_user(tag) + clear_user: + If True, also run invalidate_user_cache(current_user_id). + + Typical usage: + + @bp.post("/posts//edit") + @clear_cache(tag="post.post_detail", tag_scope="all") + async def edit_post(slug): + ... + + @bp.post("/prefs") + @clear_cache(tag="dashboard", tag_scope="user", clear_user=True) + async def update_prefs(): + ... + """ + + def decorator(view): + @wraps(view) + async def wrapper(*args, **kwargs): + # Run the view first + resp = await view(*args, **kwargs) + if get_redis(): + + # Only clear cache if the view succeeded (2xx) + status = getattr(resp, "status_code", None) + if status is None: + # Non-Response return (string, dict) -> treat as success + success = True + else: + success = 200 <= status < 300 + + if not success: + return resp + + # Perform invalidations + tasks = [] + + if clear_user: + uid = get_user_id() + tasks.append(invalidate_user_cache(uid)) + + if tag: + if tag_scope == "all": + tasks.append(invalidate_tag_cache(tag)) + else: # tag_scope == "user" + tasks.append(invalidate_tag_cache_for_current_user(tag)) + + if tasks: + # Run them concurrently + await asyncio.gather(*tasks) + + return resp + + return wrapper + + return decorator + +async def clear_all_cache(prefix: str = "cache:") -> None: + r = get_redis() + if not r: + return + + cursor = 0 + pattern = f"{prefix}*" + while True: + cursor, keys = await r.scan(cursor=cursor, match=pattern, count=500) + if keys: + await r.delete(*keys) + if cursor == 0: + break diff --git a/browser/app/utils/__init__.py b/browser/app/utils/__init__.py new file mode 100644 index 0000000..75b8279 --- /dev/null +++ b/browser/app/utils/__init__.py @@ -0,0 +1,12 @@ +from .parse import ( + parse_time, + parse_cost, + parse_dt +) +from .utils import ( + current_route_relative_path, + current_url_without_page, + vary, +) + +from .utc import utcnow \ No newline at end of file diff --git a/browser/app/utils/htmx.py b/browser/app/utils/htmx.py new file mode 100644 index 0000000..17f80e6 --- /dev/null +++ b/browser/app/utils/htmx.py @@ -0,0 +1,46 @@ +"""HTMX utilities for detecting and handling HTMX requests.""" + +from quart import request + + +def is_htmx_request() -> bool: + """ + Check if the current request is an HTMX request. + + Returns: + bool: True if HX-Request header is present and true + """ + return request.headers.get("HX-Request", "").lower() == "true" + + +def get_htmx_target() -> str | None: + """ + Get the target element ID from HTMX request headers. + + Returns: + str | None: Target element ID or None + """ + return request.headers.get("HX-Target") + + +def get_htmx_trigger() -> str | None: + """ + Get the trigger element ID from HTMX request headers. + + Returns: + str | None: Trigger element ID or None + """ + return request.headers.get("HX-Trigger") + + +def should_return_fragment() -> bool: + """ + Determine if we should return a fragment vs full page. + + For HTMX requests, return fragment. + For normal requests, return full page. + + Returns: + bool: True if fragment should be returned + """ + return is_htmx_request() diff --git a/browser/app/utils/parse.py b/browser/app/utils/parse.py new file mode 100644 index 0000000..ee6d8de --- /dev/null +++ b/browser/app/utils/parse.py @@ -0,0 +1,36 @@ +from datetime import datetime, timezone + +def parse_time(val: str | None): + if not val: + return None + try: + h,m = val.split(':', 1) + from datetime import time + return time(int(h), int(m)) + except Exception: + return None + +def parse_cost(val: str | None): + if not val: + return None + try: + return float(val) + except Exception: + return None + + if not val: + return None + dt = datetime.fromisoformat(val) + # make TZ-aware (assume local if naive; convert to UTC) + if dt.tzinfo is None: + dt = dt.replace(tzinfo=timezone.utc) + return dt + +def parse_dt(val: str | None) -> datetime | None: + if not val: + return None + dt = datetime.fromisoformat(val) + if dt.tzinfo is None: + dt = dt.replace(tzinfo=timezone.utc) + return dt + diff --git a/browser/app/utils/utc.py b/browser/app/utils/utc.py new file mode 100644 index 0000000..084886c --- /dev/null +++ b/browser/app/utils/utc.py @@ -0,0 +1,6 @@ +from datetime import datetime, timezone + + +def utcnow() -> datetime: + return datetime.now(timezone.utc) + diff --git a/browser/app/utils/utils.py b/browser/app/utils/utils.py new file mode 100644 index 0000000..71cd993 --- /dev/null +++ b/browser/app/utils/utils.py @@ -0,0 +1,51 @@ +from quart import ( + Response, + request, + g, +) +from shared.utils import host_url +from urllib.parse import urlencode + +def current_route_relative_path() -> str: + """ + Returns the current request path relative to the app's mount point (script_root). + """ + + (request.script_root or "").rstrip("/") + path = request.path # excludes query string + + + + if g.root and path.startswith(f"/{g.root}"): + rel = path[len(g.root+1):] + return rel if rel.startswith("/") else "/" + rel + return path # app at / + + +def current_url_without_page() -> str: + """ + Build current URL (host+path+qs) but with ?page= removed. + Used for Hx-Push-Url. + """ + base = host_url(current_route_relative_path()) + + params = request.args.to_dict(flat=False) # keep multivals + params.pop("page", None) + qs = urlencode(params, doseq=True) + + return f"{base}?{qs}" if qs else base + +def vary(resp: Response) -> Response: + """ + Ensure caches/CDNs vary on HX headers so htmx/non-htmx versions don't get mixed. + """ + v = resp.headers.get("Vary", "") + parts = [p.strip() for p in v.split(",") if p.strip()] + for h in ("HX-Request", "X-Origin"): + if h not in parts: + parts.append(h) + if parts: + resp.headers["Vary"] = ", ".join(parts) + return resp + + diff --git a/browser/templates/_oob_elements.html b/browser/templates/_oob_elements.html new file mode 100644 index 0000000..da748da --- /dev/null +++ b/browser/templates/_oob_elements.html @@ -0,0 +1,33 @@ +{% extends oob.oob_extends %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header( + oob.parent_id, + oob.child_id, + oob.header, + )}} + + {% from oob.parent_header import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{# Mobile menu - from market/index.html _main_mobile_menu block #} +{% set mobile_nav %} + {% include oob.nav %} +{% endset %} +{{ mobile_menu(mobile_nav) }} + + +{% block content %} + {% include oob.main %} +{% endblock %} + + diff --git a/browser/templates/_types/auth/_main_panel.html b/browser/templates/_types/auth/_main_panel.html new file mode 100644 index 0000000..d394dd0 --- /dev/null +++ b/browser/templates/_types/auth/_main_panel.html @@ -0,0 +1,49 @@ +
    +
    + + {% if error %} +
    + {{ error }} +
    + {% endif %} + + {# Account header #} +
    +
    +

    Account

    + {% if g.user %} +

    {{ g.user.email }}

    + {% if g.user.name %} +

    {{ g.user.name }}

    + {% endif %} + {% endif %} +
    +
    + + +
    +
    + + {# Labels #} + {% set labels = g.user.labels if g.user is defined and g.user.labels is defined else [] %} + {% if labels %} +
    +

    Labels

    +
    + {% for label in labels %} + + {{ label.name }} + + {% endfor %} +
    +
    + {% endif %} + +
    +
    diff --git a/browser/templates/_types/auth/_nav.html b/browser/templates/_types/auth/_nav.html new file mode 100644 index 0000000..3d404b8 --- /dev/null +++ b/browser/templates/_types/auth/_nav.html @@ -0,0 +1,9 @@ +{% import 'macros/links.html' as links %} +{% call links.link(url_for('auth.newsletters'), hx_select_search, select_colours, True, aclass=styles.nav_button) %} + newsletters +{% endcall %} + diff --git a/browser/templates/_types/auth/_newsletter_toggle.html b/browser/templates/_types/auth/_newsletter_toggle.html new file mode 100644 index 0000000..4320f58 --- /dev/null +++ b/browser/templates/_types/auth/_newsletter_toggle.html @@ -0,0 +1,17 @@ +
    + +
    diff --git a/browser/templates/_types/auth/_newsletters_panel.html b/browser/templates/_types/auth/_newsletters_panel.html new file mode 100644 index 0000000..2c2c548 --- /dev/null +++ b/browser/templates/_types/auth/_newsletters_panel.html @@ -0,0 +1,46 @@ +
    +
    + +

    Newsletters

    + + {% if newsletter_list %} +
    + {% for item in newsletter_list %} +
    +
    +

    {{ item.newsletter.name }}

    + {% if item.newsletter.description %} +

    {{ item.newsletter.description }}

    + {% endif %} +
    +
    + {% if item.un %} + {% with un=item.un %} + {% include "_types/auth/_newsletter_toggle.html" %} + {% endwith %} + {% else %} + {# No subscription row yet — show an off toggle that will create one #} +
    + +
    + {% endif %} +
    +
    + {% endfor %} +
    + {% else %} +

    No newsletters available.

    + {% endif %} + +
    +
    diff --git a/browser/templates/_types/auth/_oob_elements.html b/browser/templates/_types/auth/_oob_elements.html new file mode 100644 index 0000000..cafb113 --- /dev/null +++ b/browser/templates/_types/auth/_oob_elements.html @@ -0,0 +1,29 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-header-child', 'auth-header-child', '_types/auth/header/_header.html')}} + + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/auth/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include oob.main %} +{% endblock %} + + diff --git a/browser/templates/_types/auth/check_email.html b/browser/templates/_types/auth/check_email.html new file mode 100644 index 0000000..822b58e --- /dev/null +++ b/browser/templates/_types/auth/check_email.html @@ -0,0 +1,33 @@ +{% extends "_types/root/index.html" %} +{% block content %} +
    +
    +

    Check your email

    + +

    + If an account exists for + {{ email }}, + you’ll receive a link to sign in. It expires in 15 minutes. +

    + + {% if email_error %} + + {% endif %} + +

    + + ← Back + +

    +
    +
    +{% endblock %} diff --git a/browser/templates/_types/auth/header/_header.html b/browser/templates/_types/auth/header/_header.html new file mode 100644 index 0000000..9f9e451 --- /dev/null +++ b/browser/templates/_types/auth/header/_header.html @@ -0,0 +1,12 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='auth-row', oob=oob) %} + {% call links.link(url_for('auth.account'), hx_select_search ) %} + +
    account
    + {% endcall %} + {% call links.desktop_nav() %} + {% include "_types/auth/_nav.html" %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/auth/index copy.html b/browser/templates/_types/auth/index copy.html new file mode 100644 index 0000000..cd4d6d3 --- /dev/null +++ b/browser/templates/_types/auth/index copy.html @@ -0,0 +1,18 @@ +{% extends "_types/root/_index.html" %} + + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('auth-header-child', '_types/auth/header/_header.html') %} + {% block auth_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include "_types/auth/_nav.html" %} +{% endblock %} + +{% block content %} + {% include '_types/auth/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/auth/index.html b/browser/templates/_types/auth/index.html new file mode 100644 index 0000000..3c66bf1 --- /dev/null +++ b/browser/templates/_types/auth/index.html @@ -0,0 +1,18 @@ +{% extends oob.extends %} + + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row(oob.child_id, oob.header) %} + {% block auth_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include oob.nav %} +{% endblock %} + +{% block content %} + {% include oob.main %} +{% endblock %} diff --git a/browser/templates/_types/auth/login.html b/browser/templates/_types/auth/login.html new file mode 100644 index 0000000..dc5ef8a --- /dev/null +++ b/browser/templates/_types/auth/login.html @@ -0,0 +1,46 @@ +{% extends "_types/root/index.html" %} +{% block content %} +
    +
    +

    Sign in

    +

    + Enter your email and we’ll email you a one-time sign-in link. +

    + + {% if error %} +
    + {{ error }} +
    + {% endif %} + +
    + +
    + + +
    + + +
    +
    +
    +{% endblock %} diff --git a/browser/templates/_types/blog/_action_buttons.html b/browser/templates/_types/blog/_action_buttons.html new file mode 100644 index 0000000..0ea7fa2 --- /dev/null +++ b/browser/templates/_types/blog/_action_buttons.html @@ -0,0 +1,51 @@ +{# New Post + Drafts toggle — shown in aside (desktop + mobile) #} +
    + {% if has_access('blog.new_post') %} + {% set new_href = url_for('blog.new_post')|host %} + + New Post + + {% endif %} + {% if g.user and (draft_count or drafts) %} + {% if drafts %} + {% set drafts_off_href = (current_local_href ~ {'drafts': None}|qs)|host %} + + Drafts + {{ draft_count }} + + {% else %} + {% set drafts_on_href = (current_local_href ~ {'drafts': '1'}|qs)|host %} + + Drafts + {{ draft_count }} + + {% endif %} + {% endif %} +
    diff --git a/browser/templates/_types/blog/_card.html b/browser/templates/_types/blog/_card.html new file mode 100644 index 0000000..d5b1347 --- /dev/null +++ b/browser/templates/_types/blog/_card.html @@ -0,0 +1,110 @@ +{% import 'macros/stickers.html' as stick %} +
    + {# ❤️ like button - OUTSIDE the link, aligned with image top #} + {% if g.user %} +
    + {% set slug = post.slug %} + {% set liked = post.is_liked or False %} + {% set like_url = url_for('blog.post.like_toggle', slug=slug)|host %} + {% set item_type = 'post' %} + {% include "_types/browse/like/button.html" %} +
    + {% endif %} + + {% set _href=url_for('blog.post.post_detail', slug=post.slug)|host %} + +
    +

    + {{ post.title }} +

    + + {% if post.status == "draft" %} +
    + Draft + {% if post.publish_requested %} + Publish requested + {% endif %} +
    + {% if post.updated_at %} +

    + Updated: {{ post.updated_at.strftime("%-d %b %Y at %H:%M") }} +

    + {% endif %} + {% elif post.published_at %} +

    + Published: {{ post.published_at.strftime("%-d %b %Y at %H:%M") }} +

    + {% endif %} + +
    + + {% if post.feature_image %} +
    + +
    + {% endif %} + {% if post.custom_excerpt %} +

    + {{ post.custom_excerpt }} +

    + {% else %} + {% if post.excerpt %} +

    + {{ post.excerpt }} +

    + {% endif %} + {% endif %} +
    + + {# Associated Entries - Scrollable list #} + {% if post.associated_entries %} +
    +

    Events:

    +
    +
    + {% for entry in post.associated_entries %} + {% set _entry_path = '/' + post.slug + '/calendars/' + entry.calendar.slug + '/' + entry.start_at.year|string + '/' + entry.start_at.month|string + '/' + entry.start_at.day|string + '/entries/' + entry.id|string + '/' %} + +
    {{ entry.name }}
    +
    + {{ entry.start_at.strftime('%a, %b %d') }} +
    +
    + {{ entry.start_at.strftime('%H:%M') }} + {% if entry.end_at %} – {{ entry.end_at.strftime('%H:%M') }}{% endif %} +
    +
    + {% endfor %} +
    +
    +
    + + + {% endif %} + + {% include '_types/blog/_card/at_bar.html' %} + +
    diff --git a/browser/templates/_types/blog/_card/at_bar.html b/browser/templates/_types/blog/_card/at_bar.html new file mode 100644 index 0000000..f226d92 --- /dev/null +++ b/browser/templates/_types/blog/_card/at_bar.html @@ -0,0 +1,19 @@ +
    + {% if post.tags %} +
    +
    in
    +
      + {% include '_types/blog/_card/tags.html' %} +
    +
    + {% endif %} +
    + {% if post.authors %} +
    +
    by
    +
      + {% include '_types/blog/_card/authors.html' %} +
    +
    + {% endif %} +
    diff --git a/browser/templates/_types/blog/_card/author.html b/browser/templates/_types/blog/_card/author.html new file mode 100644 index 0000000..7ddddf7 --- /dev/null +++ b/browser/templates/_types/blog/_card/author.html @@ -0,0 +1,21 @@ +{% macro author(author) %} + {% if author %} + {% if author.profile_image %} + {{ author.name }} + {% else %} +
    + {# optional fallback circle with first letter +
    + {{ author.name[:1] }} +
    #} + {% endif %} + + + {{ author.name }} + + {% endif %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/blog/_card/authors.html b/browser/templates/_types/blog/_card/authors.html new file mode 100644 index 0000000..5b8911d --- /dev/null +++ b/browser/templates/_types/blog/_card/authors.html @@ -0,0 +1,32 @@ +{# --- AUTHORS LIST STARTS HERE --- #} + {% if post.authors and post.authors|length %} + {% for a in post.authors %} + {% for author in authors if author.slug==a.slug %} +
  • + + {% if author.profile_image %} + {{ author.name }} + {% else %} + {# optional fallback circle with first letter #} +
    + {{ author.name[:1] }} +
    + {% endif %} + + + {{ author.name }} + +
    +
  • + {% endfor %} + {% endfor %} + {% endif %} + + {# --- AUTHOR LIST ENDS HERE --- #} \ No newline at end of file diff --git a/browser/templates/_types/blog/_card/tag.html b/browser/templates/_types/blog/_card/tag.html new file mode 100644 index 0000000..137cb0c --- /dev/null +++ b/browser/templates/_types/blog/_card/tag.html @@ -0,0 +1,19 @@ +{% macro tag(tag) %} + {% if tag %} + {% if tag.feature_image %} + {{ tag.name }} + {% else %} +
    + {{ tag.name[:1] }} +
    + {% endif %} + + + {{ tag.name }} + + {% endif %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/blog/_card/tag_group.html b/browser/templates/_types/blog/_card/tag_group.html new file mode 100644 index 0000000..21c9974 --- /dev/null +++ b/browser/templates/_types/blog/_card/tag_group.html @@ -0,0 +1,22 @@ +{% macro tag_group(group) %} + {% if group %} + {% if group.feature_image %} + {{ group.name }} + {% else %} +
    + {{ group.name[:1] }} +
    + {% endif %} + + + {{ group.name }} + + {% endif %} +{% endmacro %} diff --git a/browser/templates/_types/blog/_card/tags.html b/browser/templates/_types/blog/_card/tags.html new file mode 100644 index 0000000..2ea7ad1 --- /dev/null +++ b/browser/templates/_types/blog/_card/tags.html @@ -0,0 +1,17 @@ +{% import '_types/blog/_card/tag.html' as dotag %} +{# --- TAG LIST STARTS HERE --- #} + {% if post.tags and post.tags|length %} + {% for t in post.tags %} + {% for tag in tags if tag.slug==t.slug %} +
  • + + {{dotag.tag(tag)}} + +
  • + {% endfor %} + {% endfor %} + {% endif %} + {# --- TAG LIST ENDS HERE --- #} \ No newline at end of file diff --git a/browser/templates/_types/blog/_card_tile.html b/browser/templates/_types/blog/_card_tile.html new file mode 100644 index 0000000..f03ca16 --- /dev/null +++ b/browser/templates/_types/blog/_card_tile.html @@ -0,0 +1,59 @@ +
    + {% set _href=url_for('blog.post.post_detail', slug=post.slug)|host %} + + {% if post.feature_image %} +
    + +
    + {% endif %} + +
    +

    + {{ post.title }} +

    + + {% if post.status == "draft" %} +
    + Draft + {% if post.publish_requested %} + Publish requested + {% endif %} +
    + {% if post.updated_at %} +

    + Updated: {{ post.updated_at.strftime("%-d %b %Y at %H:%M") }} +

    + {% endif %} + {% elif post.published_at %} +

    + Published: {{ post.published_at.strftime("%-d %b %Y at %H:%M") }} +

    + {% endif %} + + {% if post.custom_excerpt %} +

    + {{ post.custom_excerpt }} +

    + {% elif post.excerpt %} +

    + {{ post.excerpt }} +

    + {% endif %} +
    +
    + + {% include '_types/blog/_card/at_bar.html' %} +
    diff --git a/browser/templates/_types/blog/_cards.html b/browser/templates/_types/blog/_cards.html new file mode 100644 index 0000000..82eee98 --- /dev/null +++ b/browser/templates/_types/blog/_cards.html @@ -0,0 +1,111 @@ +{% for post in posts %} + {% if view == 'tile' %} + {% include "_types/blog/_card_tile.html" %} + {% else %} + {% include "_types/blog/_card.html" %} + {% endif %} +{% endfor %} +{% if page < total_pages|int %} + + + + + +{% else %} +
    End of results
    +{% endif %} + diff --git a/browser/templates/_types/blog/_main_panel.html b/browser/templates/_types/blog/_main_panel.html new file mode 100644 index 0000000..350999d --- /dev/null +++ b/browser/templates/_types/blog/_main_panel.html @@ -0,0 +1,48 @@ + + {# View toggle bar - desktop only #} + + + {# Cards container - list or grid based on view #} + {% if view == 'tile' %} +
    + {% include "_types/blog/_cards.html" %} +
    + {% else %} +
    + {% include "_types/blog/_cards.html" %} +
    + {% endif %} +
    diff --git a/browser/templates/_types/blog/_oob_elements.html b/browser/templates/_types/blog/_oob_elements.html new file mode 100644 index 0000000..2aa02cb --- /dev/null +++ b/browser/templates/_types/blog/_oob_elements.html @@ -0,0 +1,40 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob_.html' import root_header with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-header-child', 'blog-header-child', '_types/blog/header/_header.html')}} + + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + + +{# Filter container - blog doesn't have child_summary but still needs this element #} +{% block filter %} + {% include "_types/blog/mobile/_filter/summary.html" %} +{% endblock %} + +{# Aside with filters #} +{% block aside %} + {% include "_types/blog/desktop/menu.html" %} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/root/_nav.html' %} + {% include '_types/root/_nav_panel.html' %} +{% endblock %} + + +{% block content %} + {% include '_types/blog/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog/admin/tag_groups/_edit_header.html b/browser/templates/_types/blog/admin/tag_groups/_edit_header.html new file mode 100644 index 0000000..ade4ee9 --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/_edit_header.html @@ -0,0 +1,9 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='tag-groups-edit-row', oob=oob) %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{ admin_nav_item(url_for('blog.tag_groups_admin.edit', id=group.id), 'pencil', group.name, select_colours, aclass='') }} + {% call links.desktop_nav() %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/blog/admin/tag_groups/_edit_main_panel.html b/browser/templates/_types/blog/admin/tag_groups/_edit_main_panel.html new file mode 100644 index 0000000..7d1fa96 --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/_edit_main_panel.html @@ -0,0 +1,79 @@ +
    + + {# --- Edit group form --- #} +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + +
    +
    +
    + + +
    +
    + + {# --- Tag checkboxes --- #} +
    + +
    + {% for tag in all_tags %} + + {% endfor %} +
    +
    + +
    + +
    +
    + + {# --- Delete form --- #} +
    + + +
    + +
    diff --git a/browser/templates/_types/blog/admin/tag_groups/_edit_oob.html b/browser/templates/_types/blog/admin/tag_groups/_edit_oob.html new file mode 100644 index 0000000..116bc7b --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/_edit_oob.html @@ -0,0 +1,17 @@ +{% extends 'oob_elements.html' %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('tag-groups-header-child', 'tag-groups-edit-child', '_types/blog/admin/tag_groups/_edit_header.html')}} + {{oob_header('root-settings-header-child', 'tag-groups-header-child', '_types/blog/admin/tag_groups/_header.html')}} + + {% from '_types/root/settings/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} +{% endblock %} + +{% block mobile_menu %} +{% endblock %} + +{% block content %} + {% include '_types/blog/admin/tag_groups/_edit_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog/admin/tag_groups/_header.html b/browser/templates/_types/blog/admin/tag_groups/_header.html new file mode 100644 index 0000000..d9c3095 --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/_header.html @@ -0,0 +1,9 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='tag-groups-row', oob=oob) %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{ admin_nav_item(url_for('blog.tag_groups_admin.index'), 'tags', 'Tag Groups', select_colours, aclass='') }} + {% call links.desktop_nav() %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/blog/admin/tag_groups/_main_panel.html b/browser/templates/_types/blog/admin/tag_groups/_main_panel.html new file mode 100644 index 0000000..1c8b8f4 --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/_main_panel.html @@ -0,0 +1,73 @@ +
    + + {# --- Create new group form --- #} +
    + +

    New Group

    +
    + + + +
    + + +
    + + {# --- Existing groups list --- #} + {% if groups %} +
      + {% for group in groups %} +
    • + {% if group.feature_image %} + {{ group.name }} + {% else %} +
      + {{ group.name[:1] }} +
      + {% endif %} +
      + + {{ group.name }} + + {{ group.slug }} +
      + order: {{ group.sort_order }} +
    • + {% endfor %} +
    + {% else %} +

    No tag groups yet.

    + {% endif %} + + {# --- Unassigned tags --- #} + {% if unassigned_tags %} +
    +

    Unassigned Tags ({{ unassigned_tags|length }})

    +
    + {% for tag in unassigned_tags %} + + {{ tag.name }} + + {% endfor %} +
    +
    + {% endif %} + +
    diff --git a/browser/templates/_types/blog/admin/tag_groups/_oob_elements.html b/browser/templates/_types/blog/admin/tag_groups/_oob_elements.html new file mode 100644 index 0000000..cb00363 --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/_oob_elements.html @@ -0,0 +1,16 @@ +{% extends 'oob_elements.html' %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-settings-header-child', 'tag-groups-header-child', '_types/blog/admin/tag_groups/_header.html')}} + + {% from '_types/root/settings/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} +{% endblock %} + +{% block mobile_menu %} +{% endblock %} + +{% block content %} + {% include '_types/blog/admin/tag_groups/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog/admin/tag_groups/edit.html b/browser/templates/_types/blog/admin/tag_groups/edit.html new file mode 100644 index 0000000..5fefbc6 --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/edit.html @@ -0,0 +1,13 @@ +{% extends '_types/blog/admin/tag_groups/index.html' %} + +{% block tag_groups_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/blog/admin/tag_groups/_edit_header.html' import header_row with context %} + {{ header_row() }} + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/blog/admin/tag_groups/_edit_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog/admin/tag_groups/index.html b/browser/templates/_types/blog/admin/tag_groups/index.html new file mode 100644 index 0000000..680b051 --- /dev/null +++ b/browser/templates/_types/blog/admin/tag_groups/index.html @@ -0,0 +1,20 @@ +{% extends '_types/root/settings/index.html' %} + +{% block root_settings_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/blog/admin/tag_groups/_header.html' import header_row with context %} + {{ header_row() }} +
    + {% block tag_groups_header_child %} + {% endblock %} +
    + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/blog/admin/tag_groups/_main_panel.html' %} +{% endblock %} + +{% block _main_mobile_menu %} +{% endblock %} diff --git a/browser/templates/_types/blog/desktop/menu.html b/browser/templates/_types/blog/desktop/menu.html new file mode 100644 index 0000000..57dba58 --- /dev/null +++ b/browser/templates/_types/blog/desktop/menu.html @@ -0,0 +1,19 @@ +{% import '_types/browse/desktop/_filter/search.html' as s %} +{{ s.search(current_local_href, search, search_count, hx_select) }} +{% include '_types/blog/_action_buttons.html' %} +
    + {% include '_types/blog/desktop/menu/tag_groups.html' %} + {% include '_types/blog/desktop/menu/authors.html' %} +
    + +
    + +
    + + \ No newline at end of file diff --git a/browser/templates/_types/blog/desktop/menu/authors.html b/browser/templates/_types/blog/desktop/menu/authors.html new file mode 100644 index 0000000..de939e0 --- /dev/null +++ b/browser/templates/_types/blog/desktop/menu/authors.html @@ -0,0 +1,62 @@ + {% import '_types/blog/_card/author.html' as doauthor %} + + {# Author filter bar #} + + diff --git a/browser/templates/_types/blog/desktop/menu/tag_groups.html b/browser/templates/_types/blog/desktop/menu/tag_groups.html new file mode 100644 index 0000000..e23a879 --- /dev/null +++ b/browser/templates/_types/blog/desktop/menu/tag_groups.html @@ -0,0 +1,70 @@ + {# Tag group filter bar #} + diff --git a/browser/templates/_types/blog/desktop/menu/tags.html b/browser/templates/_types/blog/desktop/menu/tags.html new file mode 100644 index 0000000..c20b5bc --- /dev/null +++ b/browser/templates/_types/blog/desktop/menu/tags.html @@ -0,0 +1,59 @@ + {% import '_types/blog/_card/tag.html' as dotag %} + + {# Tag filter bar #} + + diff --git a/browser/templates/_types/blog/header/_header.html b/browser/templates/_types/blog/header/_header.html new file mode 100644 index 0000000..67325b9 --- /dev/null +++ b/browser/templates/_types/blog/header/_header.html @@ -0,0 +1,7 @@ + +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='blog-row', oob=oob) %} +
    + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/blog/index.html b/browser/templates/_types/blog/index.html new file mode 100644 index 0000000..5978020 --- /dev/null +++ b/browser/templates/_types/blog/index.html @@ -0,0 +1,37 @@ +{% extends '_types/root/_index.html' %} + +{% block meta %} + {{ super() }} + +{% endblock %} + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('root-blog-header', '_types/blog/header/_header.html') %} + {% block root_blog_header %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block aside %} + {% include "_types/blog/desktop/menu.html" %} +{% endblock %} + +{% block filter %} + {% include "_types/blog/mobile/_filter/summary.html" %} +{% endblock %} + +{% block content %} + {% include '_types/blog/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog/mobile/_filter/_hamburger.html b/browser/templates/_types/blog/mobile/_filter/_hamburger.html new file mode 100644 index 0000000..10e0b9c --- /dev/null +++ b/browser/templates/_types/blog/mobile/_filter/_hamburger.html @@ -0,0 +1,13 @@ +
    + + + + + + + + +
    diff --git a/browser/templates/_types/blog/mobile/_filter/summary.html b/browser/templates/_types/blog/mobile/_filter/summary.html new file mode 100644 index 0000000..4ed013b --- /dev/null +++ b/browser/templates/_types/blog/mobile/_filter/summary.html @@ -0,0 +1,14 @@ +{% import 'macros/layout.html' as layout %} + +{% call layout.details('/filter', 'md:hidden') %} + {% call layout.filter_summary("filter-summary-mobile", current_local_href, search, search_count, hx_select) %} + {% include '_types/blog/mobile/_filter/summary/tag_groups.html' %} + {% include '_types/blog/mobile/_filter/summary/authors.html' %} + {% endcall %} + {% include '_types/blog/_action_buttons.html' %} +
    + {% include '_types/blog/desktop/menu/tag_groups.html' %} + {% include '_types/blog/desktop/menu/authors.html' %} +
    +{% endcall %} + \ No newline at end of file diff --git a/browser/templates/_types/blog/mobile/_filter/summary/authors.html b/browser/templates/_types/blog/mobile/_filter/summary/authors.html new file mode 100644 index 0000000..32796d9 --- /dev/null +++ b/browser/templates/_types/blog/mobile/_filter/summary/authors.html @@ -0,0 +1,31 @@ +{% if selected_authors and selected_authors|length %} +
      + {% for st in selected_authors %} + {% for author in authors %} + {% if st == author.slug %} +
    • + {% if author.profile_image %} + {{ author.name }} + {% else %} + {# optional fallback circle with first letter #} +
      + {{ author.name[:1] }} +
      + {% endif %} + + + {{ author.name }} + + + {{author.published_post_count}} + +
    • + {% endif %} + {% endfor %} + {% endfor %} +
    +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/blog/mobile/_filter/summary/tag_groups.html b/browser/templates/_types/blog/mobile/_filter/summary/tag_groups.html new file mode 100644 index 0000000..7bf142e --- /dev/null +++ b/browser/templates/_types/blog/mobile/_filter/summary/tag_groups.html @@ -0,0 +1,33 @@ +{% if selected_groups and selected_groups|length %} +
      + {% for sg in selected_groups %} + {% for group in tag_groups %} + {% if sg == group.slug %} +
    • + {% if group.feature_image %} + {{ group.name }} + {% else %} +
      + {{ group.name[:1] }} +
      + {% endif %} + + + {{ group.name }} + + + {{group.post_count}} + +
    • + {% endif %} + {% endfor %} + {% endfor %} +
    +{% endif %} diff --git a/browser/templates/_types/blog/mobile/_filter/summary/tags.html b/browser/templates/_types/blog/mobile/_filter/summary/tags.html new file mode 100644 index 0000000..df6169d --- /dev/null +++ b/browser/templates/_types/blog/mobile/_filter/summary/tags.html @@ -0,0 +1,31 @@ +{% if selected_tags and selected_tags|length %} +
      + {% for st in selected_tags %} + {% for tag in tags %} + {% if st == tag.slug %} +
    • + {% if tag.feature_image %} + {{ tag.name }} + {% else %} + {# optional fallback circle with first letter #} +
      + {{ tag.name[:1] }} +
      + {% endif %} + + + {{ tag.name }} + + + {{tag.published_post_count}} + +
    • + {% endif %} + {% endfor %} + {% endfor %} +
    +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/blog/not_found.html b/browser/templates/_types/blog/not_found.html new file mode 100644 index 0000000..525c188 --- /dev/null +++ b/browser/templates/_types/blog/not_found.html @@ -0,0 +1,22 @@ +{% extends '_types/root/_index.html' %} + +{% block content %} +
    +
    📝
    +

    Post Not Found

    +

    + The post "{{ slug }}" could not be found. +

    + + ← Back to Blog + +
    +{% endblock %} diff --git a/browser/templates/_types/blog_drafts/_main_panel.html b/browser/templates/_types/blog_drafts/_main_panel.html new file mode 100644 index 0000000..8cb0b7a --- /dev/null +++ b/browser/templates/_types/blog_drafts/_main_panel.html @@ -0,0 +1,55 @@ +
    + +
    +

    Drafts

    + {% set new_href = url_for('blog.new_post')|host %} + + New Post + +
    + + {% if drafts %} + + {% else %} +

    No drafts yet.

    + {% endif %} + +
    diff --git a/browser/templates/_types/blog_drafts/_oob_elements.html b/browser/templates/_types/blog_drafts/_oob_elements.html new file mode 100644 index 0000000..8d9790b --- /dev/null +++ b/browser/templates/_types/blog_drafts/_oob_elements.html @@ -0,0 +1,12 @@ +{% extends 'oob_elements.html' %} + +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{% block oobs %} + {% from '_types/blog/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + +{% block content %} + {% include '_types/blog_drafts/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog_drafts/index.html b/browser/templates/_types/blog_drafts/index.html new file mode 100644 index 0000000..6ce38f1 --- /dev/null +++ b/browser/templates/_types/blog_drafts/index.html @@ -0,0 +1,11 @@ +{% extends '_types/root/_index.html' %} + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('root-blog-header', '_types/blog/header/_header.html') %} + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/blog_drafts/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog_new/_main_panel.html b/browser/templates/_types/blog_new/_main_panel.html new file mode 100644 index 0000000..5523068 --- /dev/null +++ b/browser/templates/_types/blog_new/_main_panel.html @@ -0,0 +1,259 @@ +{# ── Error banner ── #} +{% if save_error %} +
    + Save failed: {{ save_error }} +
    +{% endif %} + +
    + + + + + + {# ── Feature image ── #} +
    + {# Empty state: add link #} +
    + +
    + + {# Filled state: image preview + controls #} + + + {# Upload spinner overlay #} + + + {# Hidden file input #} + +
    + + {# ── Title ── #} + + + {# ── Excerpt ── #} + + + {# ── Editor mount point ── #} +
    + + {# ── Status + Save footer ── #} +
    + + + +
    +
    + +{# ── Koenig editor assets ── #} + + + + diff --git a/browser/templates/_types/blog_new/_oob_elements.html b/browser/templates/_types/blog_new/_oob_elements.html new file mode 100644 index 0000000..61e78f5 --- /dev/null +++ b/browser/templates/_types/blog_new/_oob_elements.html @@ -0,0 +1,12 @@ +{% extends 'oob_elements.html' %} + +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{% block oobs %} + {% from '_types/blog/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + +{% block content %} + {% include '_types/blog_new/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/blog_new/index.html b/browser/templates/_types/blog_new/index.html new file mode 100644 index 0000000..3c802d4 --- /dev/null +++ b/browser/templates/_types/blog_new/index.html @@ -0,0 +1,11 @@ +{% extends '_types/root/_index.html' %} + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('root-blog-header', '_types/blog/header/_header.html') %} + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/blog_new/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/browse/_admin.html b/browser/templates/_types/browse/_admin.html new file mode 100644 index 0000000..053691d --- /dev/null +++ b/browser/templates/_types/browse/_admin.html @@ -0,0 +1,7 @@ +{% import "macros/links.html" as links %} +{% if g.rights.admin %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{admin_nav_item( + url_for('market.browse.product.admin', slug=slug) + )}} +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/browse/_main_panel.html b/browser/templates/_types/browse/_main_panel.html new file mode 100644 index 0000000..8640ce8 --- /dev/null +++ b/browser/templates/_types/browse/_main_panel.html @@ -0,0 +1,5 @@ + +
    + {% include "_types/browse/_product_cards.html" %} +
    +
    diff --git a/browser/templates/_types/browse/_oob_elements.html b/browser/templates/_types/browse/_oob_elements.html new file mode 100644 index 0000000..d32fd78 --- /dev/null +++ b/browser/templates/_types/browse/_oob_elements.html @@ -0,0 +1,37 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-header-child', 'market-header-child', '_types/market/header/_header.html')}} + + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/market/mobile/_nav_panel.html' %} +{% endblock %} + +{# Filter container with child summary - from browse/index.html child_summary block #} +{% block filter %} + {% include "_types/browse/mobile/_filter/summary.html" %} +{% endblock %} + +{% block aside %} + {% include "_types/browse/desktop/menu.html" %} +{% endblock %} + + +{% block content %} + {% include "_types/browse/_main_panel.html" %} +{% endblock %} diff --git a/browser/templates/_types/browse/_product_card.html b/browser/templates/_types/browse/_product_card.html new file mode 100644 index 0000000..f9bc980 --- /dev/null +++ b/browser/templates/_types/browse/_product_card.html @@ -0,0 +1,104 @@ +{% import 'macros/stickers.html' as stick %} +{% import '_types/product/prices.html' as prices %} +{% set prices_ns = namespace() %} +{{ prices.set_prices(p, prices_ns) }} +{% set item_href = url_for('market.browse.product.product_detail', slug=p.slug)|host %} + \ No newline at end of file diff --git a/browser/templates/_types/browse/_product_cards.html b/browser/templates/_types/browse/_product_cards.html new file mode 100644 index 0000000..cc8edb3 --- /dev/null +++ b/browser/templates/_types/browse/_product_cards.html @@ -0,0 +1,107 @@ +{% for p in products %} + {% include "_types/browse/_product_card.html" %} +{% endfor %} +{% if page < total_pages|int %} + + + + + +{% else %} +
    End of results
    +{% endif %} + diff --git a/browser/templates/_types/browse/desktop/_category_selector.html b/browser/templates/_types/browse/desktop/_category_selector.html new file mode 100644 index 0000000..ba642b7 --- /dev/null +++ b/browser/templates/_types/browse/desktop/_category_selector.html @@ -0,0 +1,40 @@ +{# Categories #} + diff --git a/browser/templates/_types/browse/desktop/_filter/brand.html b/browser/templates/_types/browse/desktop/_filter/brand.html new file mode 100644 index 0000000..616e36e --- /dev/null +++ b/browser/templates/_types/browse/desktop/_filter/brand.html @@ -0,0 +1,40 @@ +{# Brand filter (desktop, single-select) #} + +{# Brands #} + diff --git a/browser/templates/_types/browse/desktop/_filter/labels.html b/browser/templates/_types/browse/desktop/_filter/labels.html new file mode 100644 index 0000000..7a4a41e --- /dev/null +++ b/browser/templates/_types/browse/desktop/_filter/labels.html @@ -0,0 +1,44 @@ + + + +{% import 'macros/stickers.html' as stick %} + + diff --git a/browser/templates/_types/browse/desktop/_filter/like.html b/browser/templates/_types/browse/desktop/_filter/like.html new file mode 100644 index 0000000..c830f98 --- /dev/null +++ b/browser/templates/_types/browse/desktop/_filter/like.html @@ -0,0 +1,38 @@ +{% import 'macros/stickers.html' as stick %} + {% set qs = {"liked": None if liked else True, "page": None}|qs %} + {% set href = (current_local_href ~ qs)|host %} + + {% if liked %} + + {% else %} + + {% endif %} + + {{ liked_count }} + + diff --git a/browser/templates/_types/browse/desktop/_filter/search.html b/browser/templates/_types/browse/desktop/_filter/search.html new file mode 100644 index 0000000..2e0ea8e --- /dev/null +++ b/browser/templates/_types/browse/desktop/_filter/search.html @@ -0,0 +1,44 @@ + +{% macro search(current_local_href,search, search_count, hx_select) -%} + + +
    + + +
    + {% if search %} + {{search_count}} + {% endif %} + {{zap_filter}} +
    +
    +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/browse/desktop/_filter/sort.html b/browser/templates/_types/browse/desktop/_filter/sort.html new file mode 100644 index 0000000..a4b5404 --- /dev/null +++ b/browser/templates/_types/browse/desktop/_filter/sort.html @@ -0,0 +1,34 @@ + + + + +{% import 'macros/stickers.html' as stick %} +{% set sort_val = sort|default('az', true) %} + +
      + {% for key,label,icon in sort_options %} + {% set is_on = (sort_val == key) %} + {% set qs = {"sort": None, "page": None}|qs if is_on + else {"sort": key, "page": None}|qs %} + {% set href = (current_local_href ~ qs)|host %} + +
    • + + {{ stick.sticker(asset_url(icon), label, is_on) }} + +
    • + {% endfor %} +
    diff --git a/browser/templates/_types/browse/desktop/_filter/stickers.html b/browser/templates/_types/browse/desktop/_filter/stickers.html new file mode 100644 index 0000000..46fd22b --- /dev/null +++ b/browser/templates/_types/browse/desktop/_filter/stickers.html @@ -0,0 +1,46 @@ + + + + +{% import 'macros/stickers.html' as stick %} + + diff --git a/browser/templates/_types/browse/desktop/menu.html b/browser/templates/_types/browse/desktop/menu.html new file mode 100644 index 0000000..893cf2d --- /dev/null +++ b/browser/templates/_types/browse/desktop/menu.html @@ -0,0 +1,37 @@ + {% import '_types/browse/desktop/_filter/search.html' as s %} + {{ s.search(current_local_href, search, search_count, hx_select) }} + +
    +
    +
    {{ category_label }}
    +
    + {% include "_types/browse/desktop/_filter/sort.html" %} + + + {% if stickers %} + {% include "_types/browse/desktop/_filter/stickers.html" %} + {% endif %} + + + {% if subs_local and top_local_href %} + {% include "_types/browse/desktop/_category_selector.html" %} + {% endif %} + +
    + +
    + + {% include "_types/browse/desktop/_filter/brand.html" %} + +
    diff --git a/browser/templates/_types/browse/index.html b/browser/templates/_types/browse/index.html new file mode 100644 index 0000000..015e6b3 --- /dev/null +++ b/browser/templates/_types/browse/index.html @@ -0,0 +1,13 @@ +{% extends '_types/market/index.html' %} + +{% block filter %} + {% include "_types/browse/mobile/_filter/summary.html" %} +{% endblock %} + +{% block aside %} + {% include "_types/browse/desktop/menu.html" %} +{% endblock %} + +{% block content %} + {% include "_types/browse/_main_panel.html" %} +{% endblock %} diff --git a/browser/templates/_types/browse/like/button.html b/browser/templates/_types/browse/like/button.html new file mode 100644 index 0000000..de147a4 --- /dev/null +++ b/browser/templates/_types/browse/like/button.html @@ -0,0 +1,20 @@ + diff --git a/browser/templates/_types/browse/mobile/_filter/brand_ul.html b/browser/templates/_types/browse/mobile/_filter/brand_ul.html new file mode 100644 index 0000000..ac15400 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/brand_ul.html @@ -0,0 +1,40 @@ + \ No newline at end of file diff --git a/browser/templates/_types/browse/mobile/_filter/index.html b/browser/templates/_types/browse/mobile/_filter/index.html new file mode 100644 index 0000000..7c2a615 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/index.html @@ -0,0 +1,30 @@ + + {% include "_types/browse/mobile/_filter/sort_ul.html" %} + {% if search or selected_labels|length or selected_stickers|length or selected_brands|length %} + {% set href = (current_local_href ~ {"clear_filters": True}|qs)|host %} + + {% endif %} +
    + {% include "_types/browse/mobile/_filter/like.html" %} + {% include "_types/browse/mobile/_filter/labels.html" %} +
    + {% include "_types/browse/mobile/_filter/stickers.html" %} + {% include "_types/browse/mobile/_filter/brand_ul.html" %} + diff --git a/browser/templates/_types/browse/mobile/_filter/labels.html b/browser/templates/_types/browse/mobile/_filter/labels.html new file mode 100644 index 0000000..3868d42 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/labels.html @@ -0,0 +1,47 @@ +{% import 'macros/stickers.html' as stick %} + + +{# Optional: hide horizontal scrollbar on mobile while keeping scrollable #} + diff --git a/browser/templates/_types/browse/mobile/_filter/like.html b/browser/templates/_types/browse/mobile/_filter/like.html new file mode 100644 index 0000000..509ea92 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/like.html @@ -0,0 +1,40 @@ +{% import 'macros/stickers.html' as stick %} + \ No newline at end of file diff --git a/browser/templates/_types/browse/mobile/_filter/search.html b/browser/templates/_types/browse/mobile/_filter/search.html new file mode 100644 index 0000000..0f39178 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/search.html @@ -0,0 +1,40 @@ +{% macro search(current_local_href, search, search_count, hx_select) -%} + +
    + + +
    + {% if search %} + {{search_count}} + {% endif %} +
    +
    +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/browse/mobile/_filter/sort_ul.html b/browser/templates/_types/browse/mobile/_filter/sort_ul.html new file mode 100644 index 0000000..c02de19 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/sort_ul.html @@ -0,0 +1,33 @@ + + + +{% import 'macros/stickers.html' as stick %} + + + \ No newline at end of file diff --git a/browser/templates/_types/browse/mobile/_filter/stickers.html b/browser/templates/_types/browse/mobile/_filter/stickers.html new file mode 100644 index 0000000..fed0927 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/stickers.html @@ -0,0 +1,50 @@ +{% import 'macros/stickers.html' as stick %} + + + +{# Optional: hide horizontal scrollbar on mobile while keeping scrollable #} + diff --git a/browser/templates/_types/browse/mobile/_filter/summary.html b/browser/templates/_types/browse/mobile/_filter/summary.html new file mode 100644 index 0000000..07a86a1 --- /dev/null +++ b/browser/templates/_types/browse/mobile/_filter/summary.html @@ -0,0 +1,120 @@ +{% import 'macros/stickers.html' as stick %} +{% import 'macros/layout.html' as layout %} + + + + +{% call layout.details('/filter', 'md:hidden') %} + {% call layout.filter_summary("filter-summary-mobile", current_local_href, search, search_count, hx_select) %} +
    + + +
    + {% if sort %} +
      + + {% for k,l,i in sort_options %} + {% if k == sort %} + {% set key = k %} + {% set label = l %} + {% set icon = i %} +
    • + {{ stick.sticker(asset_url(icon), label, True)}} +
    • + {% endif %} + {% endfor %} +
    + {% endif %} + {% if liked %} +
    + + {% if liked_count is not none %} +
    + {{ liked_count }} +
    + {% endif %} +
    + {% endif %} + {% if selected_labels and selected_labels|length %} +
      + {% for st in selected_labels %} + {% for s in labels %} + {% if st == s.name %} +
    • + {{ stick.sticker(asset_url('nav-labels/' + s.name + '.svg'), s.name, True)}} + {% if s.count is not none %} +
      + {{ s.count }} +
      + {% endif %} +
    • + {% endif %} + {% endfor %} + {% endfor %} +
    + {% endif %} + {% if selected_stickers and selected_stickers|length %} +
      + {% for st in selected_stickers %} + {% for s in stickers %} + {% if st == s.name %} +
    • + + {{ stick.sticker(asset_url('stickers/' + s.name + '.svg'), s.name, True)}} + {% if s.count is not none %} + + {{ s.count }} + + {% endif %} +
    • + {% endif %} + {% endfor %} + {% endfor %} +
    + {% endif %} +
    + + {% if selected_brands and selected_brands|length %} +
      + {% for b in selected_brands %} +
    • + {% set ns = namespace(count=0) %} + {% for brand in brands %} + {% if brand.name == b %} + {% set ns.count = brand.count %} + {% endif %} + {% endfor %} + {% if ns.count %} +
      {{ b }}
      +
      {{ ns.count }}
      + {% else %} +
      {{ b }}
      +
      0
      + {% endif %} +
    • + {% endfor %} + + +
    + {% endif %} +
    + {% endcall %} +
    + {% include "_types/browse/mobile/_filter/index.html" %} +
    +{% endcall %} diff --git a/browser/templates/_types/calendar/_description.html b/browser/templates/_types/calendar/_description.html new file mode 100644 index 0000000..0f04f3a --- /dev/null +++ b/browser/templates/_types/calendar/_description.html @@ -0,0 +1,12 @@ +{% macro description(calendar, oob=False) %} +
    + {{ calendar.description or ''}} +
    + +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/calendar/_main_panel.html b/browser/templates/_types/calendar/_main_panel.html new file mode 100644 index 0000000..48ae736 --- /dev/null +++ b/browser/templates/_types/calendar/_main_panel.html @@ -0,0 +1,180 @@ +
    +
    + + {# Month / year navigation #} + +
    + + {# Calendar grid #} +
    + {# Weekday header: only show on sm+ (desktop/tablet) #} + + + {# On mobile: 1 column; on sm+: 7 columns #} +
    + {% for week in weeks %} + {% for day in week %} +
    +
    +
    + + {{ day.date.strftime('%a') }} + + + {# Clickable day number: goes to day detail view #} + + {{ day.date.day }} + +
    +
    + {# Entries for this day: merged, chronological #} +
    + {# Build a list of entries for this specific day. + month_entries is already sorted by start_at in Python. #} + {% for e in month_entries %} + {% if e.start_at.date() == day.date %} + {# Decide colour: highlight "mine" differently if you want #} + {% set is_mine = (g.user and e.user_id == g.user.id) + or (not g.user and e.session_id == qsession.get('calendar_sid')) %} +
    + + {{ e.name }} + + + {{ (e.state or 'pending')|replace('_', ' ') }} + +
    + {% endif %} + {% endfor %} + +
    +
    + {% endfor %} + {% endfor %} +
    +
    diff --git a/browser/templates/_types/calendar/_nav.html b/browser/templates/_types/calendar/_nav.html new file mode 100644 index 0000000..cd972d2 --- /dev/null +++ b/browser/templates/_types/calendar/_nav.html @@ -0,0 +1,12 @@ + +{% import 'macros/links.html' as links %} + + +
    Slots
    +
    +{% if g.rights.admin %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + + + +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/calendar/_oob_elements.html b/browser/templates/_types/calendar/_oob_elements.html new file mode 100644 index 0000000..1447e24 --- /dev/null +++ b/browser/templates/_types/calendar/_oob_elements.html @@ -0,0 +1,22 @@ +{% extends "oob_elements.html" %} +{# OOB elements for post admin page #} + + + + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('post-header-child', 'calendar-header-child', '_types/calendar/header/_header.html')}} + + {% from '_types/post/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} +{% include '_types/calendar/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/calendar/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/calendar/admin/_description.html b/browser/templates/_types/calendar/admin/_description.html new file mode 100644 index 0000000..7fc96f0 --- /dev/null +++ b/browser/templates/_types/calendar/admin/_description.html @@ -0,0 +1,33 @@ +
    + {% if calendar.description %} +

    + {{ calendar.description }} +

    + {% else %} +

    + No description yet. +

    + {% endif %} + + +
    + +{% if oob %} + + {% from '_types/calendar/_description.html' import description %} + {{description(calendar, oob=True)}} +{% endif %} + + diff --git a/browser/templates/_types/calendar/admin/_description_edit.html b/browser/templates/_types/calendar/admin/_description_edit.html new file mode 100644 index 0000000..61c5ff0 --- /dev/null +++ b/browser/templates/_types/calendar/admin/_description_edit.html @@ -0,0 +1,43 @@ +
    +
    + + + + +
    + + + +
    +
    +
    diff --git a/browser/templates/_types/calendar/admin/_main_panel.html b/browser/templates/_types/calendar/admin/_main_panel.html new file mode 100644 index 0000000..9696f47 --- /dev/null +++ b/browser/templates/_types/calendar/admin/_main_panel.html @@ -0,0 +1,46 @@ + +
    + +
    +

    Calendar configuration

    +
    +
    + + {% include '_types/calendar/admin/_description.html' %} +
    + + +
    + +
    + +
    diff --git a/browser/templates/_types/calendar/admin/_nav.html b/browser/templates/_types/calendar/admin/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/calendar/admin/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/calendar/admin/_oob_elements.html b/browser/templates/_types/calendar/admin/_oob_elements.html new file mode 100644 index 0000000..ec6244c --- /dev/null +++ b/browser/templates/_types/calendar/admin/_oob_elements.html @@ -0,0 +1,25 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for calendar admin page #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('calendar-header-child', 'calendar-admin-header-child', '_types/calendar/admin/header/_header.html')}} + + {% from '_types/calendar/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/calendar/admin/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/calendar/admin/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/calendar/admin/header/_header.html b/browser/templates/_types/calendar/admin/header/_header.html new file mode 100644 index 0000000..d383373 --- /dev/null +++ b/browser/templates/_types/calendar/admin/header/_header.html @@ -0,0 +1,14 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='calendar-admin-row', oob=oob) %} + {% call links.link( + url_for('calendars.calendar.admin.admin', slug=post.slug, calendar_slug=calendar.slug), + hx_select_search + ) %} + {{ links.admin() }} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/calendar/admin/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/calendar/admin/index.html b/browser/templates/_types/calendar/admin/index.html new file mode 100644 index 0000000..c27d6d2 --- /dev/null +++ b/browser/templates/_types/calendar/admin/index.html @@ -0,0 +1,24 @@ +{% extends '_types/calendar/index.html' %} +{% import 'macros/layout.html' as layout %} + +{% block calendar_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/calendar/admin/header/_header.html' import header_row with context %} + {{ header_row() }} +
    + {% block calendar_admin_header_child %} + {% endblock %} +
    + {% endcall %} +{% endblock %} + + + +{% block _main_mobile_menu %} + {% include '_types/calendar/admin/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/calendar/admin/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/calendar/header/_header.html b/browser/templates/_types/calendar/header/_header.html new file mode 100644 index 0000000..73fe115 --- /dev/null +++ b/browser/templates/_types/calendar/header/_header.html @@ -0,0 +1,23 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='calendar-row', oob=oob) %} + +
    +
    + +
    + {{ calendar.name }} +
    +
    + {% from '_types/calendar/_description.html' import description %} + {{description(calendar)}} +
    +
    + {% call links.desktop_nav() %} + {% include '_types/calendar/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/calendar/index.html b/browser/templates/_types/calendar/index.html new file mode 100644 index 0000000..802c45c --- /dev/null +++ b/browser/templates/_types/calendar/index.html @@ -0,0 +1,20 @@ +{% extends '_types/post/index.html' %} + +{% block post_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('calendar-header-child', '_types/calendar/header/_header.html') %} + {% block calendar_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {% include '_types/calendar/_nav.html' %} +{% endblock %} + + + +{% block content %} + {% include '_types/calendar/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/calendars/_calendars_list.html b/browser/templates/_types/calendars/_calendars_list.html new file mode 100644 index 0000000..ace0545 --- /dev/null +++ b/browser/templates/_types/calendars/_calendars_list.html @@ -0,0 +1,44 @@ + {% for row in calendars %} + {% set cal = row %} +
    +
    + + {% set calendar_href = url_for('calendars.calendar.get', slug=post.slug, calendar_slug=cal.slug)|host%} + +

    {{ cal.name }}

    +

    /{{ cal.slug }}/

    +
    + + + + +
    +
    + {% else %} +

    No calendars yet. Create one above.

    + {% endfor %} diff --git a/browser/templates/_types/calendars/_main_panel.html b/browser/templates/_types/calendars/_main_panel.html new file mode 100644 index 0000000..9314576 --- /dev/null +++ b/browser/templates/_types/calendars/_main_panel.html @@ -0,0 +1,27 @@ +
    + {% if has_access('calendars.create_calendar') %} + +
    + +
    + +
    + + +
    + +
    + {% endif %} + +
    + {% include "_types/calendars/_calendars_list.html" %} +
    +
    \ No newline at end of file diff --git a/browser/templates/_types/calendars/_nav.html b/browser/templates/_types/calendars/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/calendars/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/calendars/_oob_elements.html b/browser/templates/_types/calendars/_oob_elements.html new file mode 100644 index 0000000..6de3bea --- /dev/null +++ b/browser/templates/_types/calendars/_oob_elements.html @@ -0,0 +1,28 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('post-admin-header-child', 'calendars-header-child', '_types/calendars/header/_header.html')}} + + {% from '_types/post/admin/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/calendars/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/calendars/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/calendars/header/_header.html b/browser/templates/_types/calendars/header/_header.html new file mode 100644 index 0000000..3dca4ea --- /dev/null +++ b/browser/templates/_types/calendars/header/_header.html @@ -0,0 +1,12 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='calendars-row', oob=oob) %} + + +
    Calendars
    +
    + {% call links.desktop_nav() %} + {% include '_types/calendars/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/calendars/index.html b/browser/templates/_types/calendars/index.html new file mode 100644 index 0000000..a4e909a --- /dev/null +++ b/browser/templates/_types/calendars/index.html @@ -0,0 +1,22 @@ +{% extends '_types/post/admin/index.html' %} + + + +{% block post_admin_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('calendars-header-child', '_types/calendars/header/_header.html') %} + {% block calendars_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {% include '_types/calendars/_nav.html' %} +{% endblock %} + + + +{% block content %} + {% include '_types/calendars/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/cart/_cart.html b/browser/templates/_types/cart/_cart.html new file mode 100644 index 0000000..37ec396 --- /dev/null +++ b/browser/templates/_types/cart/_cart.html @@ -0,0 +1,169 @@ +{% macro show_cart(oob=False) %} +
    + {# Empty cart #} + {% if not cart and not calendar_cart_entries %} +
    +
    + +
    +

    + Your cart is empty +

    + {# +

    + Add some items from the shop to see them here. +

    + #} +
    + + {% else %} + +
    + {# Items list #} +
    + {% for item in cart %} + {% from '_types/product/_cart.html' import cart_item with context %} + {{ cart_item()}} + {% endfor %} + {% if calendar_cart_entries %} +
    +

    + Calendar bookings +

    + +
      + {% for entry in calendar_cart_entries %} +
    • +
      +
      + {{ entry.name or entry.calendar.name }} +
      +
      + {{ entry.start_at }} + {% if entry.end_at %} + – {{ entry.end_at }} + {% endif %} +
      +
      +
      + £{{ "%.2f"|format(entry.cost or 0) }} +
      +
    • + {% endfor %} +
    +
    + {% endif %} +
    + {{summary(cart, total, calendar_total, calendar_cart_entries,)}} + +
    + + {% endif %} +
    +{% endmacro %} + + +{% macro summary(cart, total, calendar_total, calendar_cart_entries, oob=False) %} + +{% endmacro %} + +{% macro cart_total(cart, total) %} + {% set cart_total = total(cart) %} + {% if cart_total %} + {% set symbol = "£" if cart[0].product.regular_price_currency == "GBP" else cart[0].product.regular_price_currency %} + {{ symbol }}{{ "%.2f"|format(cart_total) }} + {% else %} + – + {% endif %} +{% endmacro %} + + +{% macro cart_grand_total(cart, total, calendar_total, calendar_cart_entries) %} + {% set product_total = total(cart) or 0 %} + {% set cal_total = calendar_total(calendar_cart_entries) or 0 %} + {% set grand = product_total + cal_total %} + + {% if cart and cart[0].product.regular_price_currency %} + {% set symbol = "£" if cart[0].product.regular_price_currency == "GBP" else cart[0].product.regular_price_currency %} + {% else %} + {% set symbol = "£" %} + {% endif %} + + {{ symbol }}{{ "%.2f"|format(grand) }} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/cart/_main_panel.html b/browser/templates/_types/cart/_main_panel.html new file mode 100644 index 0000000..3872387 --- /dev/null +++ b/browser/templates/_types/cart/_main_panel.html @@ -0,0 +1,4 @@ +
    + {% from '_types/cart/_cart.html' import show_cart with context %} + {{ show_cart() }} +
    \ No newline at end of file diff --git a/browser/templates/_types/cart/_mini.html b/browser/templates/_types/cart/_mini.html new file mode 100644 index 0000000..aa64d36 --- /dev/null +++ b/browser/templates/_types/cart/_mini.html @@ -0,0 +1,42 @@ +{% macro mini(oob=False) %} +
    + {# cart_count is set by the context processor in all apps. + Cart app computes it from g.cart + calendar_cart_entries; + other apps get it from the cart internal API. #} + {% if cart_count is defined and cart_count is not none %} + {% set _count = cart_count %} + {% elif cart is defined and cart is not none %} + {% set _count = (cart | sum(attribute="quantity")) + ((calendar_cart_entries | length) if calendar_cart_entries else 0) %} + {% else %} + {% set _count = 0 %} + {% endif %} + + {% if _count == 0 %} +
    + + + +
    + {% else %} + + + + + + {{ _count }} + + + {% endif %} +
    +{% endmacro %} diff --git a/browser/templates/_types/cart/_nav.html b/browser/templates/_types/cart/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/cart/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/cart/_oob_elements.html b/browser/templates/_types/cart/_oob_elements.html new file mode 100644 index 0000000..6e54a8b --- /dev/null +++ b/browser/templates/_types/cart/_oob_elements.html @@ -0,0 +1,28 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-header-child', 'cart-header-child', '_types/cart/header/_header.html')}} + + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/cart/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/cart/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/cart/checkout_error.html b/browser/templates/_types/cart/checkout_error.html new file mode 100644 index 0000000..a15b1e9 --- /dev/null +++ b/browser/templates/_types/cart/checkout_error.html @@ -0,0 +1,38 @@ +{% extends '_types/root/index.html' %} + +{% block filter %} +
    +

    + Checkout error +

    +

    + We tried to start your payment with SumUp but hit a problem. +

    +
    +{% endblock %} + +{% block content %} +
    +
    +

    Something went wrong.

    +

    + {{ error or "Unexpected error while creating the hosted checkout session." }} +

    + {% if order %} +

    + Order ID: #{{ order.id }} +

    + {% endif %} +
    + + +
    +{% endblock %} diff --git a/browser/templates/_types/cart/checkout_return.html b/browser/templates/_types/cart/checkout_return.html new file mode 100644 index 0000000..326a469 --- /dev/null +++ b/browser/templates/_types/cart/checkout_return.html @@ -0,0 +1,68 @@ +{% extends '_types/root/index.html' %} + +{% block filter %} +
    +
    +

    + {% if order.status == 'paid' %} + Payment received + {% elif order.status == 'failed' %} + Payment failed + {% elif order.status == 'missing' %} + Order not found + {% else %} + Payment status: {{ order.status|default('pending')|capitalize }} + {% endif %} +

    +

    + {% if order.status == 'paid' %} + Thanks for your order. + {% elif order.status == 'failed' %} + Something went wrong while processing your payment. You can try again below. + {% elif order.status == 'missing' %} + We couldn't find that order – it may have expired or never been created. + {% else %} + We’re still waiting for a final confirmation from SumUp. + {% endif %} +

    +
    + +
    +{% endblock %} + +{% block aside %} + {# no aside content for now #} +{% endblock %} + +{% block content %} +
    + {% if order %} +
    + {% include '_types/order/_summary.html' %} +
    + {% else %} +
    + We couldn’t find that order. If you reached this page from an old link, please start a new order. +
    + {% endif %} + {% include '_types/order/_items.html' %} + {% include '_types/order/_calendar_items.html' %} + + + {% if order.status == 'failed' and order %} +
    +

    Your payment was not completed.

    +

    + You can go back to your cart and try checkout again. If the problem persists, + please contact us and mention order #{{ order.id }}. +

    +
    + {% elif order.status == 'paid' %} +
    +

    All done!

    +

    We’ll start processing your order shortly.

    +
    + {% endif %} + +
    +{% endblock %} diff --git a/browser/templates/_types/cart/header/_header.html b/browser/templates/_types/cart/header/_header.html new file mode 100644 index 0000000..b5d913d --- /dev/null +++ b/browser/templates/_types/cart/header/_header.html @@ -0,0 +1,12 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='cart-row', oob=oob) %} + {% call links.link(cart_url('/'), hx_select_search ) %} + +

    cart

    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/cart/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/cart/index.html b/browser/templates/_types/cart/index.html new file mode 100644 index 0000000..78570d9 --- /dev/null +++ b/browser/templates/_types/cart/index.html @@ -0,0 +1,22 @@ +{% extends '_types/root/_index.html' %} + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('cart-header-child', '_types/cart/header/_header.html') %} + {% block cart_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} +{% include '_types/cart/_nav.html' %} +{% endblock %} + + +{% block aside %} +{% endblock %} + +{% block content %} + {% include '_types/cart/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/day/_add.html b/browser/templates/_types/day/_add.html new file mode 100644 index 0000000..df02331 --- /dev/null +++ b/browser/templates/_types/day/_add.html @@ -0,0 +1,301 @@ +
    + +
    + + + {# 1) Entry name #} + + + {# 2) Slot picker for this weekday (required) #} + {% if day_slots %} + + {% else %} +
    + No slots defined for this day. +
    + {% endif %} + + {# 3) Time entry + cost display #} +
    + {# Time inputs — hidden until a flexible slot is selected #} + + + {# Cost display — shown when a slot is selected #} + + + {# Summary of fixed times — shown for non-flexible slots #} + +
    + + {# Ticket Configuration #} +
    +

    Ticket Configuration (Optional)

    +
    +
    + + +
    +
    + + +
    +
    +
    + +
    + + + +
    +
    + +{# --- Behaviour: lock / unlock times based on slot.flexible --- #} + \ No newline at end of file diff --git a/browser/templates/_types/day/_add_button.html b/browser/templates/_types/day/_add_button.html new file mode 100644 index 0000000..46726e5 --- /dev/null +++ b/browser/templates/_types/day/_add_button.html @@ -0,0 +1,17 @@ + + diff --git a/browser/templates/_types/day/_main_panel.html b/browser/templates/_types/day/_main_panel.html new file mode 100644 index 0000000..0eea6f0 --- /dev/null +++ b/browser/templates/_types/day/_main_panel.html @@ -0,0 +1,28 @@ +
    + + + + + + + + + + + + + {% for entry in day_entries %} + {% include '_types/day/_row.html' %} + {% else %} + + {% endfor %} + + + +
    NameSlot/TimeStateCostTicketsActions
    No entries yet.
    + +
    + {% include '_types/day/_add_button.html' %} +
    + +
    diff --git a/browser/templates/_types/day/_nav.html b/browser/templates/_types/day/_nav.html new file mode 100644 index 0000000..3e4e5ed --- /dev/null +++ b/browser/templates/_types/day/_nav.html @@ -0,0 +1,41 @@ +{% import 'macros/links.html' as links %} + +{# Confirmed Entries - vertical on mobile, horizontal with arrows on desktop #} +
    + {% from 'macros/scrolling_menu.html' import scrolling_menu with context %} + {% call(entry) scrolling_menu('day-entries-container', confirmed_entries) %} + +
    +
    {{ entry.name }}
    +
    + {{ entry.start_at.strftime('%H:%M') }} + {% if entry.end_at %} – {{ entry.end_at.strftime('%H:%M') }}{% endif %} +
    +
    +
    + {% endcall %} +
    + +{# Admin link #} +{% if g.rights.admin %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{admin_nav_item( + url_for( + 'calendars.calendar.day.admin.admin', + slug=post.slug, + calendar_slug=calendar.slug, + year=day_date.year, + month=day_date.month, + day=day_date.day + ) + )}} +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/day/_oob_elements.html b/browser/templates/_types/day/_oob_elements.html new file mode 100644 index 0000000..812e6b0 --- /dev/null +++ b/browser/templates/_types/day/_oob_elements.html @@ -0,0 +1,18 @@ +{% extends "oob_elements.html" %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('calendar-header-child', 'day-header-child', '_types/day/header/_header.html')}} + + {% from '_types/calendar/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/day/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/day/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/day/_row.html b/browser/templates/_types/day/_row.html new file mode 100644 index 0000000..87aead7 --- /dev/null +++ b/browser/templates/_types/day/_row.html @@ -0,0 +1,76 @@ +{% import 'macros/links.html' as links %} + + +
    + {% call links.link( + url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.get', + slug=post.slug, + calendar_slug=calendar.slug, + day=day, + month=month, + year=year, + entry_id=entry.id + ), + hx_select_search, + aclass=styles.pill + ) %} + {{ entry.name }} + {% endcall %} +
    + + + {% if entry.slot %} +
    + {% call links.link( + url_for( + 'calendars.calendar.slots.slot.get', + slug=post.slug, + calendar_slug=calendar.slug, + slot_id=entry.slot.id + ), + hx_select_search, + aclass=styles.pill + ) %} + {{ entry.slot.name }} + {% endcall %} + + ({{ entry.slot.time_start.strftime('%H:%M') }}{% if entry.slot.time_end %} → {{ entry.slot.time_end.strftime('%H:%M') }}{% endif %}) + +
    + {% else %} +
    + {% include '_types/entry/_times.html' %} +
    + {% endif %} + + +
    + {% include '_types/entry/_state.html' %} +
    + + + + £{{ ('%.2f'|format(entry.cost)) if entry.cost is not none else '0.00' }} + + + + {% if entry.ticket_price is not none %} +
    +
    £{{ ('%.2f'|format(entry.ticket_price)) }}
    +
    + {% if entry.ticket_count is not none %} + {{ entry.ticket_count }} tickets + {% else %} + Unlimited + {% endif %} +
    +
    + {% else %} + No tickets + {% endif %} + + + {% include '_types/entry/_options.html' %} + + \ No newline at end of file diff --git a/browser/templates/_types/day/admin/_main_panel.html b/browser/templates/_types/day/admin/_main_panel.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/day/admin/_main_panel.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/day/admin/_nav.html b/browser/templates/_types/day/admin/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/day/admin/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/day/admin/_nav_entries_oob.html b/browser/templates/_types/day/admin/_nav_entries_oob.html new file mode 100644 index 0000000..d72fc90 --- /dev/null +++ b/browser/templates/_types/day/admin/_nav_entries_oob.html @@ -0,0 +1,34 @@ +{# OOB swap for day confirmed entries nav when entries are edited #} +{% import 'macros/links.html' as links %} + +{# Confirmed Entries - vertical on mobile, horizontal with arrows on desktop #} +{% if confirmed_entries %} +
    + {% from 'macros/scrolling_menu.html' import scrolling_menu with context %} + {% call(entry) scrolling_menu('day-entries-container', confirmed_entries) %} + +
    +
    {{ entry.name }}
    +
    + {{ entry.start_at.strftime('%H:%M') }} + {% if entry.end_at %} – {{ entry.end_at.strftime('%H:%M') }}{% endif %} +
    +
    +
    + {% endcall %} +
    +{% else %} + {# Empty placeholder to remove nav entries when none are confirmed #} +
    +{% endif %} diff --git a/browser/templates/_types/day/admin/_oob_elements.html b/browser/templates/_types/day/admin/_oob_elements.html new file mode 100644 index 0000000..20986bf --- /dev/null +++ b/browser/templates/_types/day/admin/_oob_elements.html @@ -0,0 +1,25 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for calendar admin page #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('day-header-child', 'day-admin-header-child', '_types/day/admin/header/_header.html')}} + + {% from '_types/calendar/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/day/admin/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/day/admin/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/day/admin/header/_header.html b/browser/templates/_types/day/admin/header/_header.html new file mode 100644 index 0000000..b5f583c --- /dev/null +++ b/browser/templates/_types/day/admin/header/_header.html @@ -0,0 +1,21 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='day-admin-row', oob=oob) %} + {% call links.link( + url_for( + 'calendars.calendar.day.admin.admin', + slug=post.slug, + calendar_slug=calendar.slug, + year=day_date.year, + month=day_date.month, + day=day_date.day + ), + hx_select_search + ) %} + {{ links.admin() }} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/day/admin/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/day/admin/index.html b/browser/templates/_types/day/admin/index.html new file mode 100644 index 0000000..f4f37b5 --- /dev/null +++ b/browser/templates/_types/day/admin/index.html @@ -0,0 +1,24 @@ +{% extends '_types/day/index.html' %} +{% import 'macros/layout.html' as layout %} +{% import 'macros/links.html' as links %} + + +{% block day_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/day/admin/header/_header.html' import header_row with context %} + {{ header_row() }} +
    + {% block day_admin_header_child %} + {% endblock %} +
    + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/day/admin/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/day/admin/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/day/header/_header.html b/browser/templates/_types/day/header/_header.html new file mode 100644 index 0000000..e53a815 --- /dev/null +++ b/browser/templates/_types/day/header/_header.html @@ -0,0 +1,27 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='day-row', oob=oob) %} + {% call links.link( + url_for( + 'calendars.calendar.day.show_day', + slug=post.slug, + calendar_slug=calendar.slug, + year=day_date.year, + month=day_date.month, + day=day_date.day + ), + hx_select_search, + ) %} +
    + + {{ day_date.strftime('%A %d %B %Y') }} +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/day/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/day/index.html b/browser/templates/_types/day/index.html new file mode 100644 index 0000000..655ee55 --- /dev/null +++ b/browser/templates/_types/day/index.html @@ -0,0 +1,18 @@ +{% extends '_types/calendar/index.html' %} + +{% block calendar_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('day-header-child', '_types/day/header/_header.html') %} + {% block day_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/day/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include '_types/day/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/entry/_edit.html b/browser/templates/_types/entry/_edit.html new file mode 100644 index 0000000..628f239 --- /dev/null +++ b/browser/templates/_types/entry/_edit.html @@ -0,0 +1,334 @@ +
    + + +
    + +
    + + + + +
    + + +
    + + +
    + + {% if day_slots %} + + {% else %} +
    + No slots defined for this day. +
    + {% endif %} +
    + + + + + + + + + + + +
    +

    Ticket Configuration

    + +
    +
    + + +

    Leave empty if no tickets needed

    +
    + +
    + + +

    Leave empty for unlimited

    +
    +
    +
    + +
    + + + + + + + +
    + +
    +
    + +{# --- Behaviour: lock / unlock times based on slot.flexible --- #} + \ No newline at end of file diff --git a/browser/templates/_types/entry/_main_panel.html b/browser/templates/_types/entry/_main_panel.html new file mode 100644 index 0000000..403605b --- /dev/null +++ b/browser/templates/_types/entry/_main_panel.html @@ -0,0 +1,126 @@ +
    + + +
    +
    + Name +
    +
    + {{ entry.name }} +
    +
    + + +
    +
    + Slot +
    +
    + {% if entry.slot %} + + {{ entry.slot.name }} + + {% if entry.slot.flexible %} + (flexible) + {% else %} + (fixed) + {% endif %} + {% else %} + No slot assigned + {% endif %} +
    +
    + + +
    +
    + Time Period +
    +
    + {{ entry.start_at.strftime('%H:%M') }} + {% if entry.end_at %} + – {{ entry.end_at.strftime('%H:%M') }} + {% else %} + – open-ended + {% endif %} +
    +
    + + +
    +
    + State +
    +
    +
    + {% include '_types/entry/_state.html' %} +
    +
    +
    + + +
    +
    + Cost +
    +
    + + £{{ ('%.2f'|format(entry.cost)) if entry.cost is not none else '0.00' }} + +
    +
    + + +
    +
    + Tickets +
    +
    + {% include '_types/entry/_tickets.html' %} +
    +
    + + +
    +
    + Date +
    +
    + {{ entry.start_at.strftime('%A, %B %d, %Y') }} +
    +
    + + +
    +
    + Associated Posts +
    +
    + {% include '_types/entry/_posts.html' %} +
    +
    + + +
    + {% include '_types/entry/_options.html' %} + + +
    + +
    \ No newline at end of file diff --git a/browser/templates/_types/entry/_nav.html b/browser/templates/_types/entry/_nav.html new file mode 100644 index 0000000..513f517 --- /dev/null +++ b/browser/templates/_types/entry/_nav.html @@ -0,0 +1,40 @@ +{% import 'macros/links.html' as links %} + +{# Associated Posts - vertical on mobile, horizontal with arrows on desktop #} +
    + {% from 'macros/scrolling_menu.html' import scrolling_menu with context %} + {% call(entry_post) scrolling_menu('entry-posts-container', entry_posts) %} + + {% if entry_post.feature_image %} + {{ entry_post.title }} + {% else %} +
    + {% endif %} +
    +
    {{ entry_post.title }}
    +
    +
    + {% endcall %} +
    + +{# Admin link #} +{% if g.rights.admin %} + + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{admin_nav_item( + url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.admin.admin', + slug=post.slug, + calendar_slug=calendar.slug, + day=day, + month=month, + year=year, + entry_id=entry.id + ) + )}} +{% endif %} diff --git a/browser/templates/_types/entry/_oob_elements.html b/browser/templates/_types/entry/_oob_elements.html new file mode 100644 index 0000000..8981fa1 --- /dev/null +++ b/browser/templates/_types/entry/_oob_elements.html @@ -0,0 +1,18 @@ +{% extends "oob_elements.html" %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('day-header-child', 'entry-header-child', '_types/entry/header/_header.html')}} + + {% from '_types/day/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/entry/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/entry/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/entry/_optioned.html b/browser/templates/_types/entry/_optioned.html new file mode 100644 index 0000000..ba23391 --- /dev/null +++ b/browser/templates/_types/entry/_optioned.html @@ -0,0 +1,9 @@ + +{% include '_types/entry/_options.html' %} +
    + {% include '_types/entry/_title.html' %} +
    + +
    + {% include '_types/entry/_state.html' %} +
    \ No newline at end of file diff --git a/browser/templates/_types/entry/_options.html b/browser/templates/_types/entry/_options.html new file mode 100644 index 0000000..6c42952 --- /dev/null +++ b/browser/templates/_types/entry/_options.html @@ -0,0 +1,98 @@ +
    + {% if entry.state == 'provisional' %} +
    + + +
    +
    + + +
    + {% endif %} + {% if entry.state == 'confirmed' %} +
    + + + +
    + {% endif %} +
    \ No newline at end of file diff --git a/browser/templates/_types/entry/_post_search_results.html b/browser/templates/_types/entry/_post_search_results.html new file mode 100644 index 0000000..2b19821 --- /dev/null +++ b/browser/templates/_types/entry/_post_search_results.html @@ -0,0 +1,107 @@ +{% for search_post in search_posts %} +
    + + + +
    +{% endfor %} + +{# Infinite scroll sentinel #} +{% if page < total_pages|int %} + +{% elif search_posts %} +
    + End of results +
    +{% endif %} diff --git a/browser/templates/_types/entry/_posts.html b/browser/templates/_types/entry/_posts.html new file mode 100644 index 0000000..9a88936 --- /dev/null +++ b/browser/templates/_types/entry/_posts.html @@ -0,0 +1,74 @@ + +
    + {% if entry_posts %} +
    + {% for entry_post in entry_posts %} +
    + {% if entry_post.feature_image %} + {{ entry_post.title }} + {% else %} +
    + {% endif %} + {{ entry_post.title }} + +
    + {% endfor %} +
    + {% else %} +

    No posts associated

    + {% endif %} + + +
    + + +
    +
    +
    diff --git a/browser/templates/_types/entry/_state.html b/browser/templates/_types/entry/_state.html new file mode 100644 index 0000000..b67254a --- /dev/null +++ b/browser/templates/_types/entry/_state.html @@ -0,0 +1,15 @@ +{% if entry.state %} + + {{ entry.state|capitalize }} + + {% endif %} \ No newline at end of file diff --git a/browser/templates/_types/entry/_tickets.html b/browser/templates/_types/entry/_tickets.html new file mode 100644 index 0000000..ee5dc38 --- /dev/null +++ b/browser/templates/_types/entry/_tickets.html @@ -0,0 +1,105 @@ +{% if entry.ticket_price is not none %} + {# Tickets are configured #} +
    +
    + Price: + + £{{ ('%.2f'|format(entry.ticket_price)) }} + +
    +
    + Available: + + {% if entry.ticket_count is not none %} + {{ entry.ticket_count }} tickets + {% else %} + Unlimited + {% endif %} + +
    + +
    +{% else %} + {# No tickets configured #} +
    + No tickets configured + +
    +{% endif %} + +{# Ticket configuration form (hidden by default) #} +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    +
    diff --git a/browser/templates/_types/entry/_times.html b/browser/templates/_types/entry/_times.html new file mode 100644 index 0000000..3543fe4 --- /dev/null +++ b/browser/templates/_types/entry/_times.html @@ -0,0 +1,5 @@ +{% from 'macros/date.html' import t %} +
    + {{ t(entry.start_at) }} + {% if entry.end_at %} → {{ t(entry.end_at) }}{% endif %} +
    \ No newline at end of file diff --git a/browser/templates/_types/entry/_title.html b/browser/templates/_types/entry/_title.html new file mode 100644 index 0000000..3c1dc63 --- /dev/null +++ b/browser/templates/_types/entry/_title.html @@ -0,0 +1,3 @@ + + {{ entry.name }} + {% include '_types/entry/_state.html' %} diff --git a/browser/templates/_types/entry/admin/_main_panel.html b/browser/templates/_types/entry/admin/_main_panel.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/entry/admin/_main_panel.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/entry/admin/_nav.html b/browser/templates/_types/entry/admin/_nav.html new file mode 100644 index 0000000..ff658d3 --- /dev/null +++ b/browser/templates/_types/entry/admin/_nav.html @@ -0,0 +1,18 @@ +{% import 'macros/links.html' as links %} +{% call links.link( + url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.ticket_types.get', + slug=post.slug, + calendar_slug=calendar.slug, + entry_id=entry.id, + year=year, + month=month, + day=day + ), + hx_select_search, + select_colours, + True, + aclass=styles.nav_button, +)%} + ticket_types +{% endcall %} diff --git a/browser/templates/_types/entry/admin/_nav_posts_oob.html b/browser/templates/_types/entry/admin/_nav_posts_oob.html new file mode 100644 index 0000000..e4d62cb --- /dev/null +++ b/browser/templates/_types/entry/admin/_nav_posts_oob.html @@ -0,0 +1,31 @@ +{# OOB swap for entry posts nav when posts are associated/disassociated #} +{% import 'macros/links.html' as links %} + +{# Associated Posts - vertical on mobile, horizontal with arrows on desktop #} +{% if entry_posts %} +
    + {% from 'macros/scrolling_menu.html' import scrolling_menu with context %} + {% call(entry_post) scrolling_menu('entry-posts-container', entry_posts) %} + + {% if entry_post.feature_image %} + {{ entry_post.title }} + {% else %} +
    + {% endif %} +
    +
    {{ entry_post.title }}
    +
    +
    + {% endcall %} +
    +{% else %} + {# Empty placeholder to remove nav posts when all are disassociated #} +
    +{% endif %} diff --git a/browser/templates/_types/entry/admin/_oob_elements.html b/browser/templates/_types/entry/admin/_oob_elements.html new file mode 100644 index 0000000..bcf2255 --- /dev/null +++ b/browser/templates/_types/entry/admin/_oob_elements.html @@ -0,0 +1,25 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for calendar admin page #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('entry-header-child', 'entry-admin-header-child', '_types/entry/admin/header/_header.html')}} + + {% from '_types/entry/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/entry/admin/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/entry/admin/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/entry/admin/header/_header.html b/browser/templates/_types/entry/admin/header/_header.html new file mode 100644 index 0000000..ea06833 --- /dev/null +++ b/browser/templates/_types/entry/admin/header/_header.html @@ -0,0 +1,22 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='entry-admin-row', oob=oob) %} + {% call links.link( + url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.admin.admin', + slug=post.slug, + calendar_slug=calendar.slug, + day=day, + month=month, + year=year, + entry_id=entry.id + ), + hx_select_search + ) %} + {{ links.admin() }} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/entry/admin/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/entry/admin/index.html b/browser/templates/_types/entry/admin/index.html new file mode 100644 index 0000000..caa100c --- /dev/null +++ b/browser/templates/_types/entry/admin/index.html @@ -0,0 +1,24 @@ +{% extends '_types/entry/index.html' %} +{% import 'macros/layout.html' as layout %} +{% import 'macros/links.html' as links %} + + +{% block entry_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/entry/admin/header/_header.html' import header_row with context %} + {{ header_row() }} +
    + {% block entry_admin_header_child %} + {% endblock %} +
    + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/entry/admin/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/entry/admin/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/entry/header/_header.html b/browser/templates/_types/entry/header/_header.html new file mode 100644 index 0000000..6d0680c --- /dev/null +++ b/browser/templates/_types/entry/header/_header.html @@ -0,0 +1,28 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='entry-row', oob=oob) %} + {% call links.link( + url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.get', + slug=post.slug, + calendar_slug=calendar.slug, + day=day, + month=month, + year=year, + entry_id=entry.id + ), + hx_select_search, + ) %} +
    + {% include '_types/entry/_title.html' %} + {% include '_types/entry/_times.html' %} +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/entry/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/entry/index.html b/browser/templates/_types/entry/index.html new file mode 100644 index 0000000..a980f46 --- /dev/null +++ b/browser/templates/_types/entry/index.html @@ -0,0 +1,20 @@ +{% extends '_types/day/index.html' %} + +{% block day_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('entry-header-child', '_types/entry/header/_header.html') %} + {% block entry_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {% include '_types/entry/_nav.html' %} +{% endblock %} + + + +{% block content %} +{% include '_types/entry/_main_panel.html' %} +{% endblock %} \ No newline at end of file diff --git a/browser/templates/_types/market/_admin.html b/browser/templates/_types/market/_admin.html new file mode 100644 index 0000000..0b09927 --- /dev/null +++ b/browser/templates/_types/market/_admin.html @@ -0,0 +1,7 @@ +{% import "macros/links.html" as links %} +{% if g.rights.admin %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{admin_nav_item( + url_for('market.admin.admin') + )}} +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/market/_main_panel.html b/browser/templates/_types/market/_main_panel.html new file mode 100644 index 0000000..87bb965 --- /dev/null +++ b/browser/templates/_types/market/_main_panel.html @@ -0,0 +1,23 @@ +{# Main panel fragment for HTMX navigation - market landing page #} +
    + {% if post.custom_excerpt %} +
    + {{post.custom_excerpt|safe}} +
    + {% endif %} + {% if post.feature_image %} +
    + +
    + {% endif %} +
    + {% if post.html %} + {{post.html|safe}} + {% endif %} +
    +
    +
    diff --git a/browser/templates/_types/market/_oob_elements.html b/browser/templates/_types/market/_oob_elements.html new file mode 100644 index 0000000..b37eea0 --- /dev/null +++ b/browser/templates/_types/market/_oob_elements.html @@ -0,0 +1,30 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-header-child', 'market-header-child', '_types/market/header/_header.html')}} + + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/market/mobile/_nav_panel.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/market/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/market/_title.html b/browser/templates/_types/market/_title.html new file mode 100644 index 0000000..33e6c67 --- /dev/null +++ b/browser/templates/_types/market/_title.html @@ -0,0 +1,17 @@ +
    +
    + + {{ coop_title }} +
    +
    +
    + {{top_slug or ''}} +
    + {% if sub_slug %} +
    + {{sub_slug}} +
    + {% endif %} +
    +
    \ No newline at end of file diff --git a/browser/templates/_types/market/admin/_main_panel.html b/browser/templates/_types/market/admin/_main_panel.html new file mode 100644 index 0000000..a354325 --- /dev/null +++ b/browser/templates/_types/market/admin/_main_panel.html @@ -0,0 +1 @@ +market admin \ No newline at end of file diff --git a/browser/templates/_types/market/admin/_nav.html b/browser/templates/_types/market/admin/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/market/admin/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/market/admin/_oob_elements.html b/browser/templates/_types/market/admin/_oob_elements.html new file mode 100644 index 0000000..9b306fd --- /dev/null +++ b/browser/templates/_types/market/admin/_oob_elements.html @@ -0,0 +1,29 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('market-header-child', 'market-admin-header-child', '_types/market/admin/header/_header.html')}} + + {% from '_types/market/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/market/admin/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/market/admin/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/market/admin/header/_header.html b/browser/templates/_types/market/admin/header/_header.html new file mode 100644 index 0000000..950eefc --- /dev/null +++ b/browser/templates/_types/market/admin/header/_header.html @@ -0,0 +1,11 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='market-admin-row', oob=oob) %} + {% call links.link(url_for('market.admin.admin'), hx_select_search) %} + {{ links.admin() }} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/market/admin/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/market/admin/index.html b/browser/templates/_types/market/admin/index.html new file mode 100644 index 0000000..4798c46 --- /dev/null +++ b/browser/templates/_types/market/admin/index.html @@ -0,0 +1,19 @@ +{% extends '_types/market/index.html' %} + + +{% block market_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('market-admin-header-child', '_types/market/admin/header/_header.html') %} + {% block market_admin_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/market/admin/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include '_types/market/admin/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/market/desktop/_nav.html b/browser/templates/_types/market/desktop/_nav.html new file mode 100644 index 0000000..d4de6e6 --- /dev/null +++ b/browser/templates/_types/market/desktop/_nav.html @@ -0,0 +1,38 @@ + + diff --git a/browser/templates/_types/market/header/_header.html b/browser/templates/_types/market/header/_header.html new file mode 100644 index 0000000..2d92286 --- /dev/null +++ b/browser/templates/_types/market/header/_header.html @@ -0,0 +1,11 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='market-row', oob=oob) %} + {% call links.link(url_for('market.browse.home'), hx_select_search ) %} + {% include '_types/market/_title.html' %} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/market/desktop/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/market/index.html b/browser/templates/_types/market/index.html new file mode 100644 index 0000000..df1ec4c --- /dev/null +++ b/browser/templates/_types/market/index.html @@ -0,0 +1,25 @@ +{% extends '_types/root/_index.html' %} + + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('market-header-child', '_types/market/header/_header.html') %} + {% block market_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {% include '_types/market/mobile/_nav_panel.html' %} +{% endblock %} + + + +{% block aside %} +{# No aside on landing page #} +{% endblock %} + +{% block content %} + {% include "_types/market/_main_panel.html" %} +{% endblock %} diff --git a/browser/templates/_types/market/mobile/_nav_panel.html b/browser/templates/_types/market/mobile/_nav_panel.html new file mode 100644 index 0000000..65a9685 --- /dev/null +++ b/browser/templates/_types/market/mobile/_nav_panel.html @@ -0,0 +1,110 @@ +{% from 'macros/glyphs.html' import opener %} +
    +
    + {% set all_href = (url_for('market.browse.browse_all') ~ qs)|host %} + {% set all_active = (category_label == 'All Products') %} + +
    + All +
    +
    + {% for cat, data in categories.items() %} +
    + + + {% set href = (url_for('market.browse.browse_top', top_slug=data.slug) ~ qs)|host %} + + +
    {{ cat }}
    +
    {{ data.count }}
    +
    + {{ opener('cat')}} + +
    + +
    + {% if data.subs %} + +
    + +
    + {% for sub in data.subs %} + {% set href = (url_for('market.browse.browse_sub', top_slug=data.slug, sub_slug=sub.slug) ~qs)|host%} + {% if top_slug==(data.slug | lower) and sub_slug == sub.slug %} + +
    {{ sub.html_label or sub.name }}
    +
    {{ sub.count }}
    +
    + {% endif %} + {% endfor %} + {% for sub in data.subs %} + {% if not (top_slug==(data.slug | lower) and sub_slug == sub.slug) %} + {% set href = (url_for('market.browse.browse_sub', top_slug=data.slug, sub_slug=sub.slug) ~ qs)|host%} + +
    {{ sub.name }}
    +
    {{ sub.count }}
    +
    + {% endif %} + {% endfor %} +
    +
    + {% else %} + {% set href = (url_for('market.browse.browse_top', top_slug=data.slug) ~ qs)|host%} + View all + {% endif %} +
    +
    + {% endfor %} + {% include '_types/market/_admin.html' %} +
    +
    diff --git a/browser/templates/_types/market/mobile/menu.html b/browser/templates/_types/market/mobile/menu.html new file mode 100644 index 0000000..145b551 --- /dev/null +++ b/browser/templates/_types/market/mobile/menu.html @@ -0,0 +1,6 @@ +{% extends 'mobile/menu.html' %} +{% block menu %} + {% block mobile_menu %} + {% endblock %} + {% include '_types/market/mobile/_nav_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/menu_items/_form.html b/browser/templates/_types/menu_items/_form.html new file mode 100644 index 0000000..15bb404 --- /dev/null +++ b/browser/templates/_types/menu_items/_form.html @@ -0,0 +1,125 @@ + + + diff --git a/browser/templates/_types/menu_items/_list.html b/browser/templates/_types/menu_items/_list.html new file mode 100644 index 0000000..70f676c --- /dev/null +++ b/browser/templates/_types/menu_items/_list.html @@ -0,0 +1,68 @@ +
    + {% if menu_items %} +
    + {% for item in menu_items %} +
    + {# Drag handle #} +
    + +
    + + {# Page image #} + {% if item.post.feature_image %} + {{ item.post.title }} + {% else %} +
    + {% endif %} + + {# Page title #} +
    +
    {{ item.post.title }}
    +
    {{ item.post.slug }}
    +
    + + {# Sort order #} +
    + Order: {{ item.sort_order }} +
    + + {# Actions #} +
    + + +
    +
    + {% endfor %} +
    + {% else %} +
    + +

    No menu items yet. Add one to get started!

    +
    + {% endif %} +
    diff --git a/browser/templates/_types/menu_items/_main_panel.html b/browser/templates/_types/menu_items/_main_panel.html new file mode 100644 index 0000000..bc502dd --- /dev/null +++ b/browser/templates/_types/menu_items/_main_panel.html @@ -0,0 +1,20 @@ +
    +
    + +
    + + {# Form container #} + + + {# Menu items list #} + +
    diff --git a/browser/templates/_types/menu_items/_nav_oob.html b/browser/templates/_types/menu_items/_nav_oob.html new file mode 100644 index 0000000..f8bdd5c --- /dev/null +++ b/browser/templates/_types/menu_items/_nav_oob.html @@ -0,0 +1,29 @@ +{% set _app_slugs = {'market': market_url('/'), 'cart': cart_url('/')} %} + diff --git a/browser/templates/_types/menu_items/_oob_elements.html b/browser/templates/_types/menu_items/_oob_elements.html new file mode 100644 index 0000000..c242593 --- /dev/null +++ b/browser/templates/_types/menu_items/_oob_elements.html @@ -0,0 +1,23 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-settings-header-child', 'menu_items-header-child', '_types/menu_items/header/_header.html')}} + + {% from '_types/root/settings/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} + +{% endblock %} + +{% block mobile_menu %} +{#% include '_types/root/settings/_nav.html' %#} +{% endblock %} + +{% block content %} + {% include '_types/menu_items/_main_panel.html' %} +{% endblock %} + diff --git a/browser/templates/_types/menu_items/_page_search_results.html b/browser/templates/_types/menu_items/_page_search_results.html new file mode 100644 index 0000000..df36d0d --- /dev/null +++ b/browser/templates/_types/menu_items/_page_search_results.html @@ -0,0 +1,44 @@ +{% if pages %} +
    + {% for post in pages %} +
    + + {# Page image #} + {% if post.feature_image %} + {{ post.title }} + {% else %} +
    + {% endif %} + + {# Page info #} +
    +
    {{ post.title }}
    +
    {{ post.slug }}
    +
    +
    + {% endfor %} + + {# Infinite scroll sentinel #} + {% if has_more %} +
    + Loading more... +
    + {% endif %} +
    +{% elif query %} +
    + No pages found matching "{{ query }}" +
    +{% endif %} diff --git a/browser/templates/_types/menu_items/header/_header.html b/browser/templates/_types/menu_items/header/_header.html new file mode 100644 index 0000000..55a18d6 --- /dev/null +++ b/browser/templates/_types/menu_items/header/_header.html @@ -0,0 +1,9 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='menu_items-row', oob=oob) %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{ admin_nav_item(url_for('menu_items.list_menu_items'), 'bars', 'Menu Items', select_colours, aclass='') }} + {% call links.desktop_nav() %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/menu_items/index.html b/browser/templates/_types/menu_items/index.html new file mode 100644 index 0000000..5bcf7da --- /dev/null +++ b/browser/templates/_types/menu_items/index.html @@ -0,0 +1,20 @@ +{% extends '_types/root/settings/index.html' %} + +{% block root_settings_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/menu_items/header/_header.html' import header_row with context %} + {{ header_row() }} + + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/menu_items/_main_panel.html' %} +{% endblock %} + +{% block _main_mobile_menu %} +{% endblock %} diff --git a/browser/templates/_types/order/_calendar_items.html b/browser/templates/_types/order/_calendar_items.html new file mode 100644 index 0000000..019f048 --- /dev/null +++ b/browser/templates/_types/order/_calendar_items.html @@ -0,0 +1,43 @@ +{# --- NEW: calendar bookings in this order --- #} + {% if order and calendar_entries %} +
    +

    + Calendar bookings in this order +

    + +
      + {% for entry in calendar_entries %} +
    • +
      +
      + {{ entry.name }} + {# Small status pill #} + + {{ entry.state|capitalize }} + +
      +
      + {{ entry.start_at.strftime('%-d %b %Y, %H:%M') }} + {% if entry.end_at %} + – {{ entry.end_at.strftime('%-d %b %Y, %H:%M') }} + {% endif %} +
      +
      +
      + £{{ "%.2f"|format(entry.cost or 0) }} +
      +
    • + {% endfor %} +
    +
    + {% endif %} \ No newline at end of file diff --git a/browser/templates/_types/order/_items.html b/browser/templates/_types/order/_items.html new file mode 100644 index 0000000..fdf0a0c --- /dev/null +++ b/browser/templates/_types/order/_items.html @@ -0,0 +1,51 @@ +{# Items list #} +{% if order and order.items %} + +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/order/_main_panel.html b/browser/templates/_types/order/_main_panel.html new file mode 100644 index 0000000..679b846 --- /dev/null +++ b/browser/templates/_types/order/_main_panel.html @@ -0,0 +1,7 @@ +
    + {# Order summary card #} + {% include '_types/order/_summary.html' %} + {% include '_types/order/_items.html' %} + {% include '_types/order/_calendar_items.html' %} + +
    \ No newline at end of file diff --git a/browser/templates/_types/order/_nav.html b/browser/templates/_types/order/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/order/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/order/_oob_elements.html b/browser/templates/_types/order/_oob_elements.html new file mode 100644 index 0000000..31d1e17 --- /dev/null +++ b/browser/templates/_types/order/_oob_elements.html @@ -0,0 +1,30 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('orders-header-child', 'order-header-child', '_types/order/header/_header.html')}} + + {% from '_types/order/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/order/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/order/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/order/_summary.html b/browser/templates/_types/order/_summary.html new file mode 100644 index 0000000..ffe560b --- /dev/null +++ b/browser/templates/_types/order/_summary.html @@ -0,0 +1,52 @@ +
    +

    + Order ID: + #{{ order.id }} +

    + +

    + Created: + {% if order.created_at %} + {{ order.created_at.strftime('%-d %b %Y, %H:%M') }} + {% else %} + — + {% endif %} +

    + +

    + Description: + {{ order.description or '–' }} +

    + +

    + Status: + + {{ order.status or 'pending' }} + +

    + +

    + Currency: + {{ order.currency or 'GBP' }} +

    + +

    + Total: + {% if order.total_amount %} + {{ order.currency or 'GBP' }} {{ '%.2f'|format(order.total_amount) }} + {% else %} + – + {% endif %} +

    + +
    + + \ No newline at end of file diff --git a/browser/templates/_types/order/header/_header.html b/browser/templates/_types/order/header/_header.html new file mode 100644 index 0000000..4d7f74b --- /dev/null +++ b/browser/templates/_types/order/header/_header.html @@ -0,0 +1,17 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='order-row', oob=oob) %} + {% call links.link(url_for('orders.order.order_detail', order_id=order.id), hx_select_search ) %} + +
    + Order +
    +
    + {{ order.id }} +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/order/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/order/index.html b/browser/templates/_types/order/index.html new file mode 100644 index 0000000..c3d301e --- /dev/null +++ b/browser/templates/_types/order/index.html @@ -0,0 +1,68 @@ +{% extends '_types/orders/index.html' %} + + +{% block orders_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('order-header-child', '_types/order/header/_header.html') %} + {% block order_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/order/_nav.html' %} +{% endblock %} + + + +{% block filter %} +
    +
    +

    + Placed {% if order.created_at %}{{ order.created_at.strftime('%-d %b %Y, %H:%M') }}{% else %}—{% endif %} · Status: {{ order.status or 'pending' }} +

    +
    +
    + + + All orders + + + {# Re-check status button #} +
    + + +
    + + {% if order.status != 'paid' %} + + + Open payment page + + {% endif %} +
    +
    +{% endblock %} + +{% block content %} + {% include '_types/order/_main_panel.html' %} +{% endblock %} + +{% block aside %} +{% endblock %} diff --git a/browser/templates/_types/orders/_main_panel.html b/browser/templates/_types/orders/_main_panel.html new file mode 100644 index 0000000..01ad410 --- /dev/null +++ b/browser/templates/_types/orders/_main_panel.html @@ -0,0 +1,26 @@ +
    + {% if not orders %} +
    + No orders yet. +
    + {% else %} +
    + + + + + + + + + + + + + {# rows + infinite-scroll sentinel #} + {% include "_types/orders/_rows.html" %} + +
    OrderCreatedDescriptionTotalStatus
    +
    + {% endif %} +
    diff --git a/browser/templates/_types/orders/_nav.html b/browser/templates/_types/orders/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/orders/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/orders/_oob_elements.html b/browser/templates/_types/orders/_oob_elements.html new file mode 100644 index 0000000..ab50cb1 --- /dev/null +++ b/browser/templates/_types/orders/_oob_elements.html @@ -0,0 +1,38 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{# Header with app title - includes cart-mini, navigation, and market-specific header #} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('auth-header-child', 'orders-header-child', '_types/orders/header/_header.html')}} + + {% from '_types/auth/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + +{% block aside %} + {% import '_types/browse/desktop/_filter/search.html' as s %} + {{ s.search(current_local_href, search, search_count, hx_select) }} +{% endblock %} + +{% block filter %} +{% include '_types/orders/_summary.html' %} +{% endblock %} + +{% block mobile_menu %} + {% include '_types/orders/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/orders/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/orders/_rows.html b/browser/templates/_types/orders/_rows.html new file mode 100644 index 0000000..33a459c --- /dev/null +++ b/browser/templates/_types/orders/_rows.html @@ -0,0 +1,164 @@ +{# suma_browser/templates/_types/order/_orders_rows.html #} + +{# --- existing rows, but split into desktop/tablet vs mobile --- #} +{% for order in orders %} + {# Desktop / tablet table row #} + + + #{{ order.id }} + + + {% if order.created_at %} + {{ order.created_at.strftime('%-d %b %Y, %H:%M') }} + {% else %} + — + {% endif %} + + + {{ order.description or '' }} + + + + {{ order.currency or 'GBP' }} + {{ '%.2f'|format(order.total_amount or 0) }} + + + {# status pill, roughly matching existing styling #} + + {{ order.status or 'pending' }} + + + + + View + + + + + {# Mobile card row #} + + +
    +
    + + #{{ order.id }} + + + + {{ order.status or 'pending' }} + +
    + +
    + {{ order.created_at or '' }} +
    + +
    +
    + {{ order.currency or 'GBP' }} + {{ '%.2f'|format(order.total_amount or 0) }} +
    + + + View + +
    +
    + + +{% endfor %} + +{# --- sentinel / end-of-results --- #} +{% if page < total_pages|int %} + + + {# Mobile sentinel content #} +
    + {% include "sentinel/mobile_content.html" %} +
    + + {# Desktop sentinel content #} + + + +{% else %} + + + End of results + + +{% endif %} diff --git a/browser/templates/_types/orders/_summary.html b/browser/templates/_types/orders/_summary.html new file mode 100644 index 0000000..824a235 --- /dev/null +++ b/browser/templates/_types/orders/_summary.html @@ -0,0 +1,11 @@ +
    +
    +

    + Recent orders placed via the checkout. +

    +
    +
    + {% import '_types/browse/mobile/_filter/search.html' as s %} + {{ s.search(current_local_href, search, search_count, hx_select) }} +
    +
    \ No newline at end of file diff --git a/browser/templates/_types/orders/header/_header.html b/browser/templates/_types/orders/header/_header.html new file mode 100644 index 0000000..32c1659 --- /dev/null +++ b/browser/templates/_types/orders/header/_header.html @@ -0,0 +1,14 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='orders-row', oob=oob) %} + {% call links.link(url_for('orders.list_orders'), hx_select_search, ) %} + +
    + Orders +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/orders/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/orders/index.html b/browser/templates/_types/orders/index.html new file mode 100644 index 0000000..8744c13 --- /dev/null +++ b/browser/templates/_types/orders/index.html @@ -0,0 +1,29 @@ +{% extends '_types/auth/index.html' %} + + +{% block auth_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('orders-header-child', '_types/orders/header/_header.html') %} + {% block orders_header_child %} + {% endblock %} + {% endcall %} + +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/orders/_nav.html' %} +{% endblock %} + +{% block aside %} + {% import '_types/browse/desktop/_filter/search.html' as s %} + {{ s.search(current_local_href, search, search_count, hx_select) }} +{% endblock %} + + +{% block filter %} + {% include '_types/orders/_summary.html' %} +{% endblock %} + +{% block content %} +{% include '_types/orders/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post/_entry_container.html b/browser/templates/_types/post/_entry_container.html new file mode 100644 index 0000000..3c3965a --- /dev/null +++ b/browser/templates/_types/post/_entry_container.html @@ -0,0 +1,24 @@ +
    +
    + {% include '_types/post/_entry_items.html' with context %} +
    +
    + + diff --git a/browser/templates/_types/post/_entry_items.html b/browser/templates/_types/post/_entry_items.html new file mode 100644 index 0000000..3a7b04f --- /dev/null +++ b/browser/templates/_types/post/_entry_items.html @@ -0,0 +1,38 @@ +{# Get entries from either direct variable or associated_entries dict #} +{% set entry_list = entries if entries is defined else (associated_entries.entries if associated_entries is defined else []) %} +{% set current_page = page if page is defined else (associated_entries.page if associated_entries is defined else 1) %} +{% set has_more_entries = has_more if has_more is defined else (associated_entries.has_more if associated_entries is defined else False) %} + +{% for entry in entry_list %} + {% set _entry_path = '/' + post.slug + '/calendars/' + entry.calendar.slug + '/' + entry.start_at.year|string + '/' + entry.start_at.month|string + '/' + entry.start_at.day|string + '/entries/' + entry.id|string + '/' %} + + {% if entry.calendar.post.feature_image %} + {{ entry.calendar.post.title }} + {% else %} +
    + {% endif %} +
    +
    {{ entry.name }}
    +
    + {{ entry.start_at.strftime('%b %d, %Y at %H:%M') }} + {% if entry.end_at %} – {{ entry.end_at.strftime('%H:%M') }}{% endif %} +
    +
    +
    +{% endfor %} + +{# Load more entries one at a time until container is full #} +{% if has_more_entries %} +
    +
    +{% endif %} diff --git a/browser/templates/_types/post/_main_panel.html b/browser/templates/_types/post/_main_panel.html new file mode 100644 index 0000000..318d234 --- /dev/null +++ b/browser/templates/_types/post/_main_panel.html @@ -0,0 +1,62 @@ +{# Main panel fragment for HTMX navigation - post article content #} +
    + {# ❤️ like button - always visible in top right of article #} + {% if g.user %} +
    + {% set slug = post.slug %} + {% set liked = post.is_liked or False %} + {% set like_url = url_for('blog.post.like_toggle', slug=slug)|host %} + {% set item_type = 'post' %} + {% include "_types/browse/like/button.html" %} +
    + {% endif %} + + {# Draft indicator + edit link #} + {% if post.status == "draft" %} +
    + Draft + {% if post.publish_requested %} + Publish requested + {% endif %} + {% set is_admin = (g.get("rights") or {}).get("admin") %} + {% if is_admin or (g.user and post.user_id == g.user.id) %} + {% set edit_href = url_for('blog.post.admin.edit', slug=post.slug)|host %} + + Edit + + {% endif %} +
    + {% endif %} + + {% if post.custom_excerpt %} +
    + {{post.custom_excerpt|safe}} +
    + {% endif %} + + {% if post.feature_image %} +
    + +
    + {% endif %} +
    + {% if post.html %} + {{post.html|safe}} + {% endif %} +
    +
    +
    diff --git a/browser/templates/_types/post/_meta.html b/browser/templates/_types/post/_meta.html new file mode 100644 index 0000000..fc752d4 --- /dev/null +++ b/browser/templates/_types/post/_meta.html @@ -0,0 +1,128 @@ +{# --- social/meta_post.html --- #} +{# Context expected: + site, post, request +#} +{% if post is not defined %} + {% include 'social/meta_base.html' %} +{% else %} + +{# Visibility → robots #} +{% set is_public = (post.visibility == 'public') %} +{% set is_published = (post.status == 'published') %} +{% set robots_here = 'index,follow' if (is_public and is_published and not post.email_only) else 'noindex,nofollow' %} + +{# Compute canonical early so both this file and base can use it #} +{% set _site_url = site().url.rstrip('/') if site and site().url else '' %} +{% set _post_path = request.path if request else ('/posts/' ~ (post.slug or post.uuid)) %} +{% set canonical = post.canonical_url or (_site_url ~ _post_path if _site_url else (request.url if request else None)) %} + +{# Include common base (charset, viewport, robots default, RSS, Org/WebSite JSON-LD) #} +{% set robots_override = robots_here %} +{% include 'social/meta_base.html' %} + +{# ---- Titles / descriptions ---- #} +{% set og_title = post.og_title or base_title %} +{% set tw_title = post.twitter_title or base_title %} + +{# Description best-effort, trimmed #} +{% set desc_source = post.meta_description + or post.og_description + or post.twitter_description + or post.custom_excerpt + or post.excerpt + or (post.plaintext if post.plaintext else (post.html|striptags if post.html else '')) %} +{% set description = (desc_source|trim|replace('\n',' ')|replace('\r',' ')|striptags)|truncate(160, True, '…') %} + +{# Image priority #} +{% set image_url = post.og_image + or post.twitter_image + or post.feature_image + or (site().default_image if site and site().default_image else None) %} + +{# Dates #} +{% set published_iso = post.published_at.isoformat() if post.published_at else None %} +{% set updated_iso = post.updated_at.isoformat() if post.updated_at + else (post.created_at.isoformat() if post.created_at else None) %} + +{# Authors / tags #} +{% set primary_author = post.primary_author %} +{% set authors = post.authors or ([primary_author] if primary_author else []) %} +{% set tag_names = (post.tags or []) | map(attribute='name') | list %} +{% set is_article = not post.is_page %} + +{{ base_title }} + +{% if canonical %}{% endif %} + +{# ---- Open Graph ---- #} + + + + +{% if canonical %}{% endif %} +{% if image_url %}{% endif %} +{% if is_article and published_iso %}{% endif %} +{% if is_article and updated_iso %} + + +{% endif %} +{% if is_article and post.primary_tag and post.primary_tag.name %} + +{% endif %} +{% if is_article %} + {% for t in tag_names %} + + {% endfor %} +{% endif %} + +{# ---- Twitter ---- #} + +{% if site and site().twitter_site %}{% endif %} +{% if primary_author and primary_author.twitter %} + +{% endif %} + + +{% if image_url %}{% endif %} + +{# ---- JSON-LD author value (no list comprehensions) ---- #} +{% if authors and authors|length == 1 %} + {% set author_value = {"@type": "Person", "name": authors[0].name} %} +{% elif authors %} + {% set ns = namespace(arr=[]) %} + {% for a in authors %} + {% set _ = ns.arr.append({"@type": "Person", "name": a.name}) %} + {% endfor %} + {% set author_value = ns.arr %} +{% else %} + {% set author_value = none %} +{% endif %} + +{# ---- JSON-LD using combine for optionals ---- #} +{% set jsonld = { + "@context": "https://schema.org", + "@type": "BlogPosting" if is_article else "WebPage", + "mainEntityOfPage": canonical, + "headline": base_title, + "description": description, + "image": image_url, + "datePublished": published_iso, + "author": author_value, + "publisher": { + "@type": "Organization", + "name": site().title if site and site().title else "", + "logo": {"@type": "ImageObject", "url": site().logo if site and site().logo else image_url} + } +} %} + +{% if updated_iso %} + {% set jsonld = jsonld | combine({"dateModified": updated_iso}) %} +{% endif %} +{% if tag_names %} + {% set jsonld = jsonld | combine({"keywords": tag_names | join(", ")}) %} +{% endif %} + + +{% endif %} diff --git a/browser/templates/_types/post/_nav.html b/browser/templates/_types/post/_nav.html new file mode 100644 index 0000000..a124ae2 --- /dev/null +++ b/browser/templates/_types/post/_nav.html @@ -0,0 +1,8 @@ +{% import 'macros/links.html' as links %} + {# Associated Entries and Calendars - vertical on mobile, horizontal with arrows on desktop #} + {% if (associated_entries and associated_entries.entries) or calendars %} +
    + {% include '_types/post/admin/_nav_entries.html' %} +
    + {% endif %} diff --git a/browser/templates/_types/post/_oob_elements.html b/browser/templates/_types/post/_oob_elements.html new file mode 100644 index 0000000..d8bda2c --- /dev/null +++ b/browser/templates/_types/post/_oob_elements.html @@ -0,0 +1,36 @@ +{% extends 'oob_elements.html' %} + + +{# OOB elements for HTMX navigation - all elements that need updating #} +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + + +{% block oobs %} + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + +{% from '_types/root/_n/macros.html' import header with context %} +{% call header(id='root-header-child', oob=True) %} + {% call header() %} + {% from '_types/post/header/_header.html' import header_row with context %} + {{header_row()}} +
    + +
    + {% endcall %} +{% endcall %} + + +{# Mobile menu #} + +{% block mobile_menu %} + {% include '_types/post/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/post/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post/admin/_associated_entries.html b/browser/templates/_types/post/admin/_associated_entries.html new file mode 100644 index 0000000..d9fe853 --- /dev/null +++ b/browser/templates/_types/post/admin/_associated_entries.html @@ -0,0 +1,50 @@ +
    +

    Associated Entries

    + {% if associated_entry_ids %} +
    + {% for calendar in all_calendars %} + {% for entry in calendar.entries %} + {% if entry.id in associated_entry_ids and entry.deleted_at is none %} + + {% endif %} + {% endfor %} + {% endfor %} +
    + {% else %} +
    No entries associated yet. Browse calendars below to add entries.
    + {% endif %} +
    diff --git a/browser/templates/_types/post/admin/_calendar_view.html b/browser/templates/_types/post/admin/_calendar_view.html new file mode 100644 index 0000000..1aa5734 --- /dev/null +++ b/browser/templates/_types/post/admin/_calendar_view.html @@ -0,0 +1,88 @@ +
    + {# Month/year navigation #} +
    + +
    + + {# Calendar grid #} +
    + + +
    + {% for week in weeks %} + {% for day in week %} +
    +
    {{ day.date.day }}
    + + {# Entries for this day #} +
    + {% for e in month_entries %} + {% if e.start_at.date() == day.date and e.deleted_at is none %} + {% if e.id in associated_entry_ids %} + {# Associated entry - show with delete button #} +
    + {{ e.name }} + +
    + {% else %} + {# Non-associated entry - clickable to add #} + + {% endif %} + {% endif %} + {% endfor %} +
    +
    + {% endfor %} + {% endfor %} +
    +
    +
    diff --git a/browser/templates/_types/post/admin/_main_panel.html b/browser/templates/_types/post/admin/_main_panel.html new file mode 100644 index 0000000..58d5238 --- /dev/null +++ b/browser/templates/_types/post/admin/_main_panel.html @@ -0,0 +1,7 @@ +{# Main panel fragment for HTMX navigation - post admin #} +
    +
    +
    diff --git a/browser/templates/_types/post/admin/_nav.html b/browser/templates/_types/post/admin/_nav.html new file mode 100644 index 0000000..7296d15 --- /dev/null +++ b/browser/templates/_types/post/admin/_nav.html @@ -0,0 +1,18 @@ +{% import 'macros/links.html' as links %} + +{% call links.link(url_for('blog.post.admin.entries', slug=post.slug), hx_select_search, select_colours, True, aclass=styles.nav_button) %} + entries +{% endcall %} +{% call links.link(url_for('blog.post.admin.data', slug=post.slug), hx_select_search, select_colours, True, aclass=styles.nav_button) %} + data +{% endcall %} +{% call links.link(url_for('blog.post.admin.edit', slug=post.slug), hx_select_search, select_colours, True, aclass=styles.nav_button) %} + edit +{% endcall %} +{% call links.link(url_for('blog.post.admin.settings', slug=post.slug), hx_select_search, select_colours, True, aclass=styles.nav_button) %} + settings +{% endcall %} \ No newline at end of file diff --git a/browser/templates/_types/post/admin/_nav_entries.html b/browser/templates/_types/post/admin/_nav_entries.html new file mode 100644 index 0000000..2268243 --- /dev/null +++ b/browser/templates/_types/post/admin/_nav_entries.html @@ -0,0 +1,70 @@ + + {# Left scroll arrow - desktop only #} + + + {# Entries and Calendars container #} +
    +
    + {# Associated Entries #} + {% if associated_entries and associated_entries.entries %} + {% include '_types/post/_entry_items.html' with context %} + {% endif %} + + {# Calendars #} + {% for calendar in calendars %} + {% set local_href=events_url('/' + post.slug + '/calendars/' + calendar.slug + '/') %} + + +
    {{calendar.name}}
    +
    + {% endfor %} + + {# Markets #} + {% for m in markets %} + + +
    {{m.name}}
    +
    + {% endfor %} +
    +
    + + + + {# Right scroll arrow - desktop only #} + diff --git a/browser/templates/_types/post/admin/_nav_entries_oob.html b/browser/templates/_types/post/admin/_nav_entries_oob.html new file mode 100644 index 0000000..cc6d3b8 --- /dev/null +++ b/browser/templates/_types/post/admin/_nav_entries_oob.html @@ -0,0 +1,14 @@ +{# OOB swap for nav entries and calendars when toggling associations or editing calendars #} +{% import 'macros/links.html' as links %} + +{# Associated Entries and Calendars - vertical on mobile, horizontal with arrows on desktop #} +{% if (associated_entries and associated_entries.entries) or calendars %} +
    + {% include '_types/post/admin/_nav_entries.html' %} +
    +{% else %} + {# Empty placeholder to remove nav items when all are disassociated/deleted #} +
    +{% endif %} diff --git a/browser/templates/_types/post/admin/_oob_elements.html b/browser/templates/_types/post/admin/_oob_elements.html new file mode 100644 index 0000000..4bd3b74 --- /dev/null +++ b/browser/templates/_types/post/admin/_oob_elements.html @@ -0,0 +1,22 @@ +{% extends "oob_elements.html" %} +{# OOB elements for post admin page #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('post-header-child', 'post-admin-header-child', '_types/post/admin/header/_header.html')}} + + {% from '_types/post/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + +{% block mobile_menu %} + {% include '_types/post/admin/_nav.html' %} +{% endblock %} + +{% block content %} +nowt +{% endblock %} \ No newline at end of file diff --git a/browser/templates/_types/post/admin/header/_header.html b/browser/templates/_types/post/admin/header/_header.html new file mode 100644 index 0000000..2708e4f --- /dev/null +++ b/browser/templates/_types/post/admin/header/_header.html @@ -0,0 +1,13 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='post-admin-row', oob=oob) %} + {% call links.link( + url_for('blog.post.admin.admin', slug=post.slug), + hx_select_search) %} + {{ links.admin() }} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/post/admin/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/post/admin/index.html b/browser/templates/_types/post/admin/index.html new file mode 100644 index 0000000..fb1de5f --- /dev/null +++ b/browser/templates/_types/post/admin/index.html @@ -0,0 +1,18 @@ +{% extends '_types/post/index.html' %} +{% import 'macros/layout.html' as layout %} + +{% block post_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('post-admin-header-child', '_types/post/admin/header/_header.html') %} + {% block post_admin_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/post/admin/_nav.html' %} +{% endblock %} + +{% block content %} +nowt +{% endblock %} diff --git a/browser/templates/_types/post/header/_header.html b/browser/templates/_types/post/header/_header.html new file mode 100644 index 0000000..a75eda3 --- /dev/null +++ b/browser/templates/_types/post/header/_header.html @@ -0,0 +1,19 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='post-row', oob=oob) %} + + {% if post.feature_image %} + + {% endif %} + + {{ post.title | truncate(160, True, '…') }} + + + {% call links.desktop_nav() %} + {% include '_types/post/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/post/index.html b/browser/templates/_types/post/index.html new file mode 100644 index 0000000..56ed99c --- /dev/null +++ b/browser/templates/_types/post/index.html @@ -0,0 +1,25 @@ +{% extends '_types/root/_index.html' %} +{% import 'macros/layout.html' as layout %} +{% block meta %} + {% include '_types/post/_meta.html' %} +{% endblock %} + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('post-header-child', '_types/post/header/_header.html') %} + {% block post_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/post/_nav.html' %} +{% endblock %} + + +{% block aside %} +{% endblock %} + +{% block content %} + {% include '_types/post/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post_data/_main_panel.html b/browser/templates/_types/post_data/_main_panel.html new file mode 100644 index 0000000..83dcc32 --- /dev/null +++ b/browser/templates/_types/post_data/_main_panel.html @@ -0,0 +1,137 @@ +{% macro render_scalar_table(obj) -%} +
    + + + + + + + + + {% for col in obj.__mapper__.columns %} + {% set key = col.key %} + {% set val = obj|attr(key) %} + {% if key != "_sa_instance_state" %} + + + + + {% endif %} + {% endfor %} + +
    FieldValue
    {{ key }} + {% if val is none %} + + {% elif val.__class__.__name__ in ["datetime", "date"] and val.isoformat is defined %} +
    {{ val.isoformat() }}
    + {% elif val is string %} +
    {{ val }}
    + {% else %} +
    {{ val }}
    + {% endif %} +
    +
    +{%- endmacro %} + +{% macro render_model(obj, depth=0, max_depth=2) -%} + {% if obj is none %} + + {% else %} +
    + {{ render_scalar_table(obj) }} + +
    + {% for rel in obj.__mapper__.relationships %} + {% set rel_name = rel.key %} + {% set loaded = rel.key in obj.__dict__ %} + {% if loaded %} + {% set value = obj|attr(rel_name) %} + {% else %} + {% set value = none %} + {% endif %} + +
    +
    + Relationship: {{ rel_name }} + + {{ 'many' if rel.uselist else 'one' }} → {{ rel.mapper.class_.__name__ }} + {% if not loaded %} • not loaded{% endif %} + +
    + +
    + {% if value is none %} + + + {% elif rel.uselist %} + {% set items = value or [] %} +
    {{ items|length }} item{{ '' if items|length == 1 else 's' }}
    + + {% if items %} +
    + + + + + + + + + {% for it in items %} + + + + + {% endfor %} + +
    #Summary
    {{ loop.index }} + {% set ident = [] %} + {% for k in ['id','ghost_id','uuid','slug','name','title'] if k in it.__mapper__.c %} + {% set v = (it|attr(k))|default('', true) %} + {% do ident.append(k ~ '=' ~ v) %} + {% endfor %} +
    {{ (ident|join(' • ')) or it|string }}
    + + {% if depth < max_depth %} +
    + {{ render_model(it, depth+1, max_depth) }} +
    + {% else %} +
    …max depth reached…
    + {% endif %} +
    +
    + {% endif %} + + {% else %} + {% set child = value %} + {% set ident = [] %} + {% for k in ['id','ghost_id','uuid','slug','name','title'] if k in child.__mapper__.c %} + {% set v = (child|attr(k))|default('', true) %} + {% do ident.append(k ~ '=' ~ v) %} + {% endfor %} +
    {{ (ident|join(' • ')) or child|string }}
    + + {% if depth < max_depth %} +
    + {{ render_model(child, depth+1, max_depth) }} +
    + {% else %} +
    …max depth reached…
    + {% endif %} + {% endif %} +
    +
    + {% endfor %} +
    +
    + {% endif %} +{%- endmacro %} + +
    +
    + Model: Post • Table: {{ original_post.__tablename__ }} +
    + {{ render_model(original_post, 0, 2) }} +
    + diff --git a/browser/templates/_types/post_data/_nav.html b/browser/templates/_types/post_data/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/post_data/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/post_data/_oob_elements.html b/browser/templates/_types/post_data/_oob_elements.html new file mode 100644 index 0000000..32fd0c7 --- /dev/null +++ b/browser/templates/_types/post_data/_oob_elements.html @@ -0,0 +1,28 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('post-admin-header-child', 'post_data-header-child', '_types/post_data/header/_header.html')}} + + {% from '_types/post/admin/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/post_data/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/post_data/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/post_data/header/_header.html b/browser/templates/_types/post_data/header/_header.html new file mode 100644 index 0000000..27eaf6f --- /dev/null +++ b/browser/templates/_types/post_data/header/_header.html @@ -0,0 +1,15 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='post_data-row', oob=oob) %} + + +
    data
    +
    + {% call links.desktop_nav() %} + {#% include '_types/post_data/_nav.html' %#} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/post_data/index.html b/browser/templates/_types/post_data/index.html new file mode 100644 index 0000000..1df67b8 --- /dev/null +++ b/browser/templates/_types/post_data/index.html @@ -0,0 +1,24 @@ +{% extends '_types/post/admin/index.html' %} + +{% block ___app_title %} + {% import 'macros/links.html' as links %} + {% call links.menu_row() %} + {% call links.link(url_for('blog.post.admin.data', slug=post.slug), hx_select_search) %} + +
    + data +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/post_data/_nav.html' %} + {% endcall %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/post_data/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/post_data/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post_edit/_main_panel.html b/browser/templates/_types/post_edit/_main_panel.html new file mode 100644 index 0000000..5148b61 --- /dev/null +++ b/browser/templates/_types/post_edit/_main_panel.html @@ -0,0 +1,352 @@ +{# ── Error banner ── #} +{% if save_error %} +
    + Save failed: {{ save_error }} +
    +{% endif %} + +
    + + + + + + + {# ── Feature image ── #} +
    + {# Empty state: add link #} +
    + +
    + + {# Filled state: image preview + controls #} +
    + + {# Delete button (top-right, visible on hover) #} + + + {# Caption input #} + +
    + + {# Upload spinner overlay #} + + + {# Hidden file input #} + +
    + + {# ── Title ── #} + + + {# ── Excerpt ── #} + + + {# ── Editor mount point ── #} +
    + + {# ── Initial Lexical JSON from Ghost ── #} + + + {# ── Status + Publish mode + Save footer ── #} + {% set already_emailed = ghost_post and ghost_post.email and ghost_post.email.status %} +
    + + + {# Publish mode — only relevant when publishing #} + + + {# Newsletter picker — only when email is involved #} + + + + + {% if save_success %} + Saved. + {% endif %} + {% if request.args.get('publish_requested') %} + Publish requested — an admin will review. + {% endif %} + {% if post and post.publish_requested %} + Publish requested + {% endif %} + {% if already_emailed %} + + Emailed{% if ghost_post.newsletter %} to {{ ghost_post.newsletter.name }}{% endif %} + + {% endif %} +
    + + {# ── Publish-mode show/hide logic ── #} + +
    + +{# ── Koenig editor assets ── #} + + + + diff --git a/browser/templates/_types/post_edit/_nav.html b/browser/templates/_types/post_edit/_nav.html new file mode 100644 index 0000000..0b1d08a --- /dev/null +++ b/browser/templates/_types/post_edit/_nav.html @@ -0,0 +1,5 @@ +{% import 'macros/links.html' as links %} +{% call links.link(url_for('blog.post.admin.settings', slug=post.slug), hx_select_search, select_colours, True, aclass=styles.nav_button) %} + + settings +{% endcall %} diff --git a/browser/templates/_types/post_edit/_oob_elements.html b/browser/templates/_types/post_edit/_oob_elements.html new file mode 100644 index 0000000..694096c --- /dev/null +++ b/browser/templates/_types/post_edit/_oob_elements.html @@ -0,0 +1,19 @@ +{% extends 'oob_elements.html' %} + +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('post-admin-header-child', 'post_edit-header-child', '_types/post_edit/header/_header.html')}} + + {% from '_types/post/admin/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + +{% block mobile_menu %} + {% include '_types/post_edit/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/post_edit/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post_edit/header/_header.html b/browser/templates/_types/post_edit/header/_header.html new file mode 100644 index 0000000..60e07e7 --- /dev/null +++ b/browser/templates/_types/post_edit/header/_header.html @@ -0,0 +1,14 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='post_edit-row', oob=oob) %} + {% call links.link(url_for('blog.post.admin.edit', slug=post.slug), hx_select_search) %} + +
    + edit +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/post_edit/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/post_edit/index.html b/browser/templates/_types/post_edit/index.html new file mode 100644 index 0000000..b5c7212 --- /dev/null +++ b/browser/templates/_types/post_edit/index.html @@ -0,0 +1,17 @@ +{% extends '_types/post/admin/index.html' %} + +{% block post_admin_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('post-admin-header-child', '_types/post_edit/header/_header.html') %} + {% block post_edit_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/post_edit/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/post_edit/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post_entries/_main_panel.html b/browser/templates/_types/post_entries/_main_panel.html new file mode 100644 index 0000000..342041e --- /dev/null +++ b/browser/templates/_types/post_entries/_main_panel.html @@ -0,0 +1,48 @@ +
    + + {# Associated Entries List #} + {% include '_types/post/admin/_associated_entries.html' %} + + {# Calendars Browser #} +
    +

    Browse Calendars

    + {% for calendar in all_calendars %} +
    + + {% if calendar.post.feature_image %} + {{ calendar.post.title }} + {% else %} +
    + {% endif %} +
    +
    + + {{ calendar.name }} +
    +
    + {{ calendar.post.title }} +
    +
    +
    +
    +
    Loading calendar...
    +
    +
    + {% else %} +
    No calendars found.
    + {% endfor %} +
    +
    \ No newline at end of file diff --git a/browser/templates/_types/post_entries/_nav.html b/browser/templates/_types/post_entries/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/post_entries/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/post_entries/_oob_elements.html b/browser/templates/_types/post_entries/_oob_elements.html new file mode 100644 index 0000000..3ef5559 --- /dev/null +++ b/browser/templates/_types/post_entries/_oob_elements.html @@ -0,0 +1,28 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('post-admin-header-child', 'post_entries-header-child', '_types/post_entries/header/_header.html')}} + + {% from '_types/post/admin/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/post_entries/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include "_types/post_entries/_main_panel.html" %} +{% endblock %} + + diff --git a/browser/templates/_types/post_entries/header/_header.html b/browser/templates/_types/post_entries/header/_header.html new file mode 100644 index 0000000..019c000 --- /dev/null +++ b/browser/templates/_types/post_entries/header/_header.html @@ -0,0 +1,17 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='post_entries-row', oob=oob) %} + {% call links.link(url_for('blog.post.admin.entries', slug=post.slug), hx_select_search) %} + +
    + entries +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/post_entries/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/post_entries/index.html b/browser/templates/_types/post_entries/index.html new file mode 100644 index 0000000..382d297 --- /dev/null +++ b/browser/templates/_types/post_entries/index.html @@ -0,0 +1,19 @@ +{% extends '_types/post/admin/index.html' %} + + + +{% block post_admin_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('post-admin-header-child', '_types/post_entries/header/_header.html') %} + {% block post_entries_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/post_entries/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/post_entries/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post_settings/_main_panel.html b/browser/templates/_types/post_settings/_main_panel.html new file mode 100644 index 0000000..dd372b2 --- /dev/null +++ b/browser/templates/_types/post_settings/_main_panel.html @@ -0,0 +1,197 @@ +{# ── Post Settings Form ── #} +{% set gp = ghost_post or {} %} + +{% macro field_label(text, field_for=None) %} + +{% endmacro %} + +{% macro text_input(name, value='', placeholder='', type='text', maxlength=None) %} + +{% endmacro %} + +{% macro textarea_input(name, value='', placeholder='', rows=3, maxlength=None) %} + +{% endmacro %} + +{% macro checkbox_input(name, checked=False, label='') %} + +{% endmacro %} + +{% macro section(title, open=False) %} +
    + + {{ title }} + +
    + {{ caller() }} +
    +
    +{% endmacro %} + +
    + + + +
    + + {# ── General ── #} + {% call section('General', open=True) %} +
    + {{ field_label('Slug', 'settings-slug') }} + {{ text_input('slug', gp.slug or '', 'post-slug') }} +
    +
    + {{ field_label('Published at', 'settings-published_at') }} + +
    +
    + {{ checkbox_input('featured', gp.featured, 'Featured post') }} +
    +
    + {{ field_label('Visibility', 'settings-visibility') }} + +
    +
    + {{ checkbox_input('email_only', gp.email_only, 'Email only') }} +
    + {% endcall %} + + {# ── Tags ── #} + {% call section('Tags') %} +
    + {{ field_label('Tags (comma-separated)', 'settings-tags') }} + {% set tag_names = gp.tags|map(attribute='name')|list|join(', ') if gp.tags else '' %} + {{ text_input('tags', tag_names, 'news, updates, featured') }} +

    Unknown tags will be created automatically.

    +
    + {% endcall %} + + {# ── Feature Image ── #} + {% call section('Feature Image') %} +
    + {{ field_label('Alt text', 'settings-feature_image_alt') }} + {{ text_input('feature_image_alt', gp.feature_image_alt or '', 'Describe the feature image') }} +
    + {% endcall %} + + {# ── SEO / Meta ── #} + {% call section('SEO / Meta') %} +
    + {{ field_label('Meta title', 'settings-meta_title') }} + {{ text_input('meta_title', gp.meta_title or '', 'SEO title', maxlength=300) }} +

    Recommended: 70 characters. Max: 300.

    +
    +
    + {{ field_label('Meta description', 'settings-meta_description') }} + {{ textarea_input('meta_description', gp.meta_description or '', 'SEO description', rows=2, maxlength=500) }} +

    Recommended: 156 characters.

    +
    +
    + {{ field_label('Canonical URL', 'settings-canonical_url') }} + {{ text_input('canonical_url', gp.canonical_url or '', 'https://example.com/original-post', type='url') }} +
    + {% endcall %} + + {# ── Facebook / OpenGraph ── #} + {% call section('Facebook / OpenGraph') %} +
    + {{ field_label('OG title', 'settings-og_title') }} + {{ text_input('og_title', gp.og_title or '') }} +
    +
    + {{ field_label('OG description', 'settings-og_description') }} + {{ textarea_input('og_description', gp.og_description or '', rows=2) }} +
    +
    + {{ field_label('OG image URL', 'settings-og_image') }} + {{ text_input('og_image', gp.og_image or '', 'https://...', type='url') }} +
    + {% endcall %} + + {# ── X / Twitter ── #} + {% call section('X / Twitter') %} +
    + {{ field_label('Twitter title', 'settings-twitter_title') }} + {{ text_input('twitter_title', gp.twitter_title or '') }} +
    +
    + {{ field_label('Twitter description', 'settings-twitter_description') }} + {{ textarea_input('twitter_description', gp.twitter_description or '', rows=2) }} +
    +
    + {{ field_label('Twitter image URL', 'settings-twitter_image') }} + {{ text_input('twitter_image', gp.twitter_image or '', 'https://...', type='url') }} +
    + {% endcall %} + + {# ── Advanced ── #} + {% call section('Advanced') %} +
    + {{ field_label('Custom template', 'settings-custom_template') }} + {{ text_input('custom_template', gp.custom_template or '', 'custom-post.hbs') }} +
    + {% endcall %} + +
    + + {# ── Save footer ── #} +
    + + + {% if save_success %} + Saved. + {% endif %} +
    +
    diff --git a/browser/templates/_types/post_settings/_nav.html b/browser/templates/_types/post_settings/_nav.html new file mode 100644 index 0000000..a08d80a --- /dev/null +++ b/browser/templates/_types/post_settings/_nav.html @@ -0,0 +1,5 @@ +{% import 'macros/links.html' as links %} +{% call links.link(url_for('blog.post.admin.edit', slug=post.slug), hx_select_search, select_colours, True, aclass=styles.nav_button) %} + + edit +{% endcall %} diff --git a/browser/templates/_types/post_settings/_oob_elements.html b/browser/templates/_types/post_settings/_oob_elements.html new file mode 100644 index 0000000..d2d6beb --- /dev/null +++ b/browser/templates/_types/post_settings/_oob_elements.html @@ -0,0 +1,19 @@ +{% extends 'oob_elements.html' %} + +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('post-admin-header-child', 'post_settings-header-child', '_types/post_settings/header/_header.html')}} + + {% from '_types/post/admin/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + +{% block mobile_menu %} + {% include '_types/post_settings/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/post_settings/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/post_settings/header/_header.html b/browser/templates/_types/post_settings/header/_header.html new file mode 100644 index 0000000..ba187fe --- /dev/null +++ b/browser/templates/_types/post_settings/header/_header.html @@ -0,0 +1,14 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='post_settings-row', oob=oob) %} + {% call links.link(url_for('blog.post.admin.settings', slug=post.slug), hx_select_search) %} + +
    + settings +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/post_settings/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/post_settings/index.html b/browser/templates/_types/post_settings/index.html new file mode 100644 index 0000000..59835f4 --- /dev/null +++ b/browser/templates/_types/post_settings/index.html @@ -0,0 +1,17 @@ +{% extends '_types/post/admin/index.html' %} + +{% block post_admin_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('post-admin-header-child', '_types/post_settings/header/_header.html') %} + {% block post_settings_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/post_settings/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/post_settings/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/product/_added.html b/browser/templates/_types/product/_added.html new file mode 100644 index 0000000..9ee4fed --- /dev/null +++ b/browser/templates/_types/product/_added.html @@ -0,0 +1,25 @@ +{% set oob='true' %} +{% import '_types/product/_cart.html' as _cart %} +{% from '_types/cart/_mini.html' import mini with context %} +{{mini()}} + +{{ _cart.add(d.slug, cart, oob='true')}} + +{% from '_types/product/_cart.html' import cart_item with context %} + +{% if cart | sum(attribute="quantity") > 0 %} + {% if item.quantity > 0 %} + {{ cart_item(oob='true')}} + {% else %} + {{ cart_item(oob='delete')}} + {% endif %} + {% from '_types/cart/_cart.html' import summary %} + + {{ summary(cart, total,calendar_total, calendar_cart_entries, oob='true')}} + +{% else %} + {% set cart=[] %} + {% from '_types/cart/_cart.html' import show_cart with context %} + {{ show_cart( oob='true') }} + +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/product/_cart.html b/browser/templates/_types/product/_cart.html new file mode 100644 index 0000000..dfdb6c1 --- /dev/null +++ b/browser/templates/_types/product/_cart.html @@ -0,0 +1,250 @@ +{% macro add(slug, cart, oob='false') %} +{% set quantity = cart + | selectattr('product.slug', 'equalto', slug) + | sum(attribute='quantity') %} + +
    + + {% if not quantity %} +
    + + + + +
    + + {% else %} +
    + +
    + + + +
    + + + + + + + + + {{ quantity }} + + + + + + +
    + + + +
    +
    + {% endif %} +
    +{% endmacro %} + + + +{% macro cart_item(oob=False) %} + +{% set p = item.product %} +{% set unit_price = p.special_price or p.regular_price %} +
    +
    + {% if p.image %} + {{ p.title }} + {% else %} +
    + No image +
    'market', 'product', p.slug + {% endif %} +
    + + {# Details #} +
    +
    +
    +

    + {% set href=market_url('/product/' + p.slug + '/') %} + + {{ p.title }} + +

    + + {% if p.brand %} +

    + {{ p.brand }} +

    + {% endif %} + + {% if item.is_deleted %} +

    + + This item is no longer available or price has changed +

    + {% endif %} +
    + + {# Unit price #} +
    + {% if unit_price %} + {% set symbol = "£" if p.regular_price_currency == "GBP" else p.regular_price_currency %} +

    + {{ symbol }}{{ "%.2f"|format(unit_price) }} +

    + {% if p.special_price and p.special_price != p.regular_price %} +

    + {{ symbol }}{{ "%.2f"|format(p.regular_price) }} +

    + {% endif %} + {% else %} +

    No price

    + {% endif %} +
    +
    + +
    +
    + Quantity +
    + + + +
    + + {{ item.quantity }} + +
    + + + +
    +
    + +
    + {% if unit_price %} + {% set line_total = unit_price * item.quantity %} + {% set symbol = "£" if p.regular_price_currency == "GBP" else p.regular_price_currency %} +

    + Line total: + {{ symbol }}{{ "%.2f"|format(line_total) }} +

    + {% endif %} +
    +
    +
    +
    + +{% endmacro %} diff --git a/browser/templates/_types/product/_main_panel.html b/browser/templates/_types/product/_main_panel.html new file mode 100644 index 0000000..cf8df31 --- /dev/null +++ b/browser/templates/_types/product/_main_panel.html @@ -0,0 +1,131 @@ +{# Main panel fragment for HTMX navigation - product detail content #} +{% import 'macros/stickers.html' as stick %} +{% import '_types/product/prices.html' as prices %} +{% set prices_ns = namespace() %} +{{ prices.set_prices(d, prices_ns)}} + + {# Product detail grid from content block #} +
    +
    + {% if d.images and d.images|length > 0 %} +
    + {# --- like button overlay in top-right --- #} + {% if g.user %} +
    + {% set slug = d.slug %} + {% set liked = liked_by_current_user %} + {% include "_types/browse/like/button.html" %} +
    + {% endif %} + +
    +
    + {{ d.title }} + + {% for l in d.labels %} + + {% endfor %} +
    +
    + {{ d.brand }} +
    +
    + + {% if d.images|length > 1 %} + + + {% endif %} +
    + +
    +
    + {% for u in d.images %} + + + {% endfor %} +
    +
    + {% else %} +
    + {# Even if no image, still render the like button in the corner for consistency #} + {% if g.user %} +
    + {% set slug = d.slug %} + {% set liked = liked_by_current_user %} + {% include "_types/browse/like/button.html" %} +
    + {% endif %} + + No image +
    + {% endif %} + +
    + {% for s in d.stickers %} + {{ stick.sticker(asset_url('stickers/' + s + '.svg'), s, True, size=40) }} + {% endfor %} +
    +
    + +
    + {# Optional extras shown quietly #} +
    + {% if d.price_per_unit or d.price_per_unit_raw %} +
    Unit price: {{ prices.price_str(d.price_per_unit, d.price_per_unit_raw, d.price_per_unit_currency) }}
    + {% endif %} + {% if d.case_size_raw %} +
    Case size: {{ d.case_size_raw }}
    + {% endif %} + +
    + + {% if d.description_short or d.description_html %} +
    + {% if d.description_short %} +

    {{ d.description_short }}

    + {% endif %} + {% if d.description_html %} +
    + {{ d.description_html | safe }} +
    + {% endif %} +
    + {% endif %} + + {% if d.sections and d.sections|length %} +
    + {% for sec in d.sections %} +
    + + {{ sec.title }} + + +
    + {{ sec.html | safe }} +
    +
    + {% endfor %} +
    + {% endif %} +
    + +
    +
    diff --git a/browser/templates/_types/product/_meta.html b/browser/templates/_types/product/_meta.html new file mode 100644 index 0000000..aebb684 --- /dev/null +++ b/browser/templates/_types/product/_meta.html @@ -0,0 +1,106 @@ +{# --- social/meta_product.html --- #} +{# Context expected: + site, d (Product), request +#} + +{# Visibility → robots: index unless soft-deleted #} +{% set robots_here = 'noindex,nofollow' if d.deleted_at else 'index,follow' %} + +{# Compute canonical #} +{% set _site_url = site().url.rstrip('/') if site and site().url else '' %} +{% set _product_path = request.path if request else ('/products/' ~ (d.slug or '')) %} +{% set canonical = _site_url ~ _product_path if _site_url else (request.url if request else None) %} + +{# Include common base (charset, viewport, robots default, RSS, Org/WebSite JSON-LD) #} +{% set robots_override = robots_here %} +{% include 'social/meta_base.html' %} + +{# ---- Titles / descriptions ---- #} +{% set base_product_title = d.title or base_title %} +{% set og_title = base_product_title %} +{% set tw_title = base_product_title %} + +{# Description: prefer short, then HTML stripped #} +{% set desc_source = d.description_short + or (d.description_html|striptags if d.description_html else '') %} +{% set description = (desc_source|trim|replace('\n',' ')|replace('\r',' ')|striptags)|truncate(160, True, '…') %} + +{# ---- Image priority: product image, then first gallery image, then site default ---- #} +{% set image_url = d.image + or ((d.images|first).url if d.images and (d.images|first).url else None) + or (site().default_image if site and site().default_image else None) %} + +{# ---- Price / offer helpers ---- #} +{% set price = d.special_price or d.regular_price or d.rrp %} +{% set price_currency = d.special_price_currency or d.regular_price_currency or d.rrp_currency %} + +{# ---- Basic meta ---- #} +{{ base_product_title }} + +{% if canonical %}{% endif %} + +{# ---- Open Graph ---- #} + + + + +{% if canonical %}{% endif %} +{% if image_url %}{% endif %} + +{# Optional product OG price tags #} +{% if price and price_currency %} + + +{% endif %} +{% if d.brand %} + +{% endif %} +{% if d.sku %} + +{% endif %} + +{# ---- Twitter ---- #} + +{% if site and site().twitter_site %}{% endif %} + + +{% if image_url %}{% endif %} + +{# ---- JSON-LD Product ---- #} +{% set jsonld = { + "@context": "https://schema.org", + "@type": "Product", + "name": d.title, + "image": image_url, + "description": description, + "sku": d.sku, + "brand": d.brand, + "url": canonical +} %} + +{# Brand as proper object if present #} +{% if d.brand %} + {% set jsonld = jsonld | combine({ + "brand": { + "@type": "Brand", + "name": d.brand + } + }) %} +{% endif %} + +{# Offers if price available #} +{% if price and price_currency %} + {% set jsonld = jsonld | combine({ + "offers": { + "@type": "Offer", + "price": price, + "priceCurrency": price_currency, + "url": canonical, + "availability": "https://schema.org/InStock" + } + }) %} +{% endif %} + + diff --git a/browser/templates/_types/product/_oob_elements.html b/browser/templates/_types/product/_oob_elements.html new file mode 100644 index 0000000..a651387 --- /dev/null +++ b/browser/templates/_types/product/_oob_elements.html @@ -0,0 +1,49 @@ +{% extends 'oob_elements.html' %} +{# OOB elements for HTMX navigation - product extends browse so use similar structure #} +{% import 'macros/layout.html' as layout %} +{% import 'macros/stickers.html' as stick %} +{% import '_types/product/prices.html' as prices %} +{% set prices_ns = namespace() %} +{{ prices.set_prices(d, prices_ns)}} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + + +{% block oobs %} + {% from '_types/market/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('market-header-child', 'product-header-child', '_types/product/header/_header.html')}} + +{% endblock %} + + + +{% block mobile_menu %} + {% include '_types/market/mobile/_nav_panel.html' %} + {% include '_types/browse/_admin.html' %} +{% endblock %} + +{% block filter %} + {% call layout.details() %} + {% call layout.summary('coop-child-header') %} + {% endcall %} + {% call layout.menu('blog-child-menu') %} + {% endcall %} + {% endcall %} + + {% call layout.details() %} + {% call layout.summary('product-child-header') %} + {% endcall %} + {% call layout.menu('item-child-menu') %} + {% endcall %} + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/product/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/product/_prices.html b/browser/templates/_types/product/_prices.html new file mode 100644 index 0000000..e56339f --- /dev/null +++ b/browser/templates/_types/product/_prices.html @@ -0,0 +1,33 @@ +{% import '_types/product/_cart.html' as _cart %} + {# ---- Price block ---- #} + {% import '_types/product/prices.html' as prices %} + {% set prices_ns = namespace() %} + {{ prices.set_prices(d, prices_ns)}} + +
    + {{ _cart.add(d.slug, cart)}} + + {% if prices_ns.sp_val %} +
    + Special price +
    +
    + {{ prices.price_str(prices_ns.sp_val, prices_ns.sp_raw, prices_ns.sp_cur) }} +
    + {% if prices_ns.sp_val and prices_ns.rp_val %} +
    + {{ prices.price_str(prices_ns.rp_val, prices_ns.rp_raw, prices_ns.rp_cur) }} +
    + {% endif %} + {% elif prices_ns.rp_val %} + +
    + {{ prices.price_str(prices_ns.rp_val, prices_ns.rp_raw, prices_ns.rp_cur) }} +
    + {% endif %} + {{ prices.rrp(prices_ns) }} + +
    + diff --git a/browser/templates/_types/product/_title.html b/browser/templates/_types/product/_title.html new file mode 100644 index 0000000..0b3be43 --- /dev/null +++ b/browser/templates/_types/product/_title.html @@ -0,0 +1,2 @@ + +
    {{ d.title }}
    diff --git a/browser/templates/_types/product/admin/_nav.html b/browser/templates/_types/product/admin/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/product/admin/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/product/admin/_oob_elements.html b/browser/templates/_types/product/admin/_oob_elements.html new file mode 100644 index 0000000..84acac6 --- /dev/null +++ b/browser/templates/_types/product/admin/_oob_elements.html @@ -0,0 +1,40 @@ +{% extends 'oob_elements.html' %} + + +{# OOB elements for HTMX navigation - all elements that need updating #} +{# Import shared OOB macros #} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('product-header-child', 'product-admin-header-child', '_types/product/admin/header/_header.html')}} + + {% from '_types/product/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% from '_types/root/_n/macros.html' import header with context %} +{% call header(id='product-header-child', oob=True) %} + {% call header() %} + {% from '_types/product/admin/header/_header.html' import header_row with context %} + {{header_row()}} +
    + +
    + {% endcall %} +{% endcall %} + + +{% block mobile_menu %} + {% include '_types/product/admin/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include '_types/product/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/product/admin/header/_header.html b/browser/templates/_types/product/admin/header/_header.html new file mode 100644 index 0000000..2a6993a --- /dev/null +++ b/browser/templates/_types/product/admin/header/_header.html @@ -0,0 +1,11 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='product-admin-row', oob=oob) %} + {% call links.link(url_for('market.browse.product.admin', slug=d.slug), hx_select_search ) %} + admin!! + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/product/admin/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/product/admin/index.html b/browser/templates/_types/product/admin/index.html new file mode 100644 index 0000000..3afe352 --- /dev/null +++ b/browser/templates/_types/product/admin/index.html @@ -0,0 +1,39 @@ +{% extends '_types/product/index.html' %} + +{% import 'macros/layout.html' as layout %} + +{% block product_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('market-header-child', '_types/product/admin/header/_header.html') %} + {% block product_admin_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + + +{% block ___app_title %} + {% import 'macros/links.html' as links %} + {% call links.menu_row() %} + {% call links.link(url_for('market.browse.product.admin', slug=slug), hx_select_search) %} + {{ links.admin() }} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/product/admin/_nav.html' %} + {% endcall %} + {% endcall %} +{% endblock %} + + + +{% block _main_mobile_menu %} + {% include '_types/product/admin/_nav.html' %} +{% endblock %} + +{% block aside %} +{% endblock %} + + +{% block content %} +{% include '_types/product/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/product/header/_header.html b/browser/templates/_types/product/header/_header.html new file mode 100644 index 0000000..3a8daa6 --- /dev/null +++ b/browser/templates/_types/product/header/_header.html @@ -0,0 +1,15 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='product-row', oob=oob) %} + {% call links.link(url_for('market.browse.product.product_detail', slug=d.slug), hx_select_search ) %} + {% include '_types/product/_title.html' %} + {% endcall %} + {% include '_types/product/_prices.html' %} + {% call links.desktop_nav() %} + {% include '_types/browse/_admin.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/product/index.html b/browser/templates/_types/product/index.html new file mode 100644 index 0000000..bdbe8cc --- /dev/null +++ b/browser/templates/_types/product/index.html @@ -0,0 +1,61 @@ +{% extends '_types/browse/index.html' %} + +{% block meta %} + {% include '_types/product/_meta.html' %} +{% endblock %} + + +{% import 'macros/stickers.html' as stick %} +{% import '_types/product/prices.html' as prices %} +{% set prices_ns = namespace() %} +{{ prices.set_prices(d, prices_ns)}} + + + +{% block market_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('market-header-child', '_types/product/header/_header.html') %} + {% block product_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {% include '_types/browse/_admin.html' %} +{% endblock %} + + + +{% block filter %} + +{% call layout.details() %} + {% call layout.summary('coop-child-header') %} + {% block coop_child_summary %} + {% endblock %} + {% endcall %} + {% call layout.menu('blog-child-menu') %} + {% block post_child_menu %} + {% endblock %} + {% endcall %} + {% endcall %} + + {% call layout.details() %} + {% call layout.summary('product-child-header') %} + {% block item_child_summary %} + {% endblock %} + {% endcall %} + {% call layout.menu('item-child-menu') %} + {% block item_child_menu %} + {% endblock %} + {% endcall %} + {% endcall %} + +{% endblock %} + +{% block aside %} +{% endblock %} + +{% block content %} + {% include '_types/product/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/product/prices.html b/browser/templates/_types/product/prices.html new file mode 100644 index 0000000..be9cc4c --- /dev/null +++ b/browser/templates/_types/product/prices.html @@ -0,0 +1,66 @@ +{# ---- Price formatting helpers ---- #} +{% set _sym = {'GBP':'£','EUR':'€','USD':'$'} %} +{% macro price_str(val, raw, cur) -%} + {%- if raw -%} + {{ raw }} + {%- elif val is number -%} + {{ (_sym.get(cur) or '') ~ ('%.2f'|format(val)) }} + {%- else -%} + {{ val or '' }} + {%- endif -%} +{%- endmacro %} + + +{% macro set_prices(item, ns) -%} + +{% set ns.sp_val = item.special_price or (item.oe_list_price and item.oe_list_price.special) %} +{% set ns.sp_raw = item.special_price_raw or (item.oe_list_price and item.oe_list_price.special_raw) %} +{% set ns.sp_cur = item.special_price_currency or (item.oe_list_price and item.oe_list_price.special_currency) %} + +{% set ns.rp_val = item.regular_price or item.rrp or (item.oe_list_price and item.oe_list_price.rrp) %} +{% set ns.rp_raw = item.regular_price_raw or item.rrp_raw or (item.oe_list_price and item.oe_list_price.rrp_raw) %} +{% set ns.rp_cur = item.regular_price_currency or item.rrp_currency or (item.oe_list_price and item.oe_list_price.rrp_currency) %} + +{% set ns.case_size_count = (item.case_size_count or 1) %} +{% set ns.rrp = item.rrp_raw[0] ~ "%.2f"|format(item.rrp * (ns.case_size_count)) %} +{% set ns.rrp_raw = item.rrp_raw %} + +{%- endmacro %} + + +{% macro rrp(ns) -%} + {% if ns.rrp %} +
    + rrp: + + {{ ns.rrp }} + +
    + {% endif %} +{%- endmacro %} + + +{% macro card_price(item) %} + + +{# price block unchanged #} + {% set _sym = {'GBP':'£','EUR':'€','USD':'$'} %} + {% set sp_val = item.special_price or (item.oe_list_price and item.oe_list_price.special) %} + {% set sp_raw = item.special_price_raw or (item.oe_list_price and item.oe_list_price.special_raw) %} + {% set sp_cur = item.special_price_currency or (item.oe_list_price and item.oe_list_price.special_currency) %} + {% set rp_val = item.regular_price or item.rrp or (item.oe_list_price and item.oe_list_price.rrp) %} + {% set rp_raw = item.regular_price_raw or item.rrp_raw or (item.oe_list_price and item.oe_list_price.rrp_raw) %} + {% set rp_cur = item.regular_price_currency or item.rrp_currency or (item.oe_list_price and item.oe_list_price.rrp_currency) %} + {% set sp_str = sp_raw if sp_raw else ( (_sym.get(sp_cur, '') ~ ('%.2f'|format(sp_val))) if sp_val is number else (sp_val or '')) %} + {% set rp_str = rp_raw if rp_raw else ( (_sym.get(rp_cur, '') ~ ('%.2f'|format(rp_val))) if rp_val is number else (rp_val or '')) %} +
    + {% if sp_val %} +
    {{ sp_str }}
    + {% if rp_val %} +
    {{ rp_str }}
    + {% endif %} + {% elif rp_val %} +
    {{ rp_str }}
    + {% endif %} +
    +{% endmacro %} diff --git a/browser/templates/_types/root/_full_user.html b/browser/templates/_types/root/_full_user.html new file mode 100644 index 0000000..eb36d86 --- /dev/null +++ b/browser/templates/_types/root/_full_user.html @@ -0,0 +1,11 @@ + +{% set href=coop_url('/auth/account/') %} + + + {{g.user.email}} + + \ No newline at end of file diff --git a/browser/templates/_types/root/_hamburger.html b/browser/templates/_types/root/_hamburger.html new file mode 100644 index 0000000..9a30a19 --- /dev/null +++ b/browser/templates/_types/root/_hamburger.html @@ -0,0 +1,13 @@ + +
    + + + + +
    + + diff --git a/browser/templates/_types/root/_head.html b/browser/templates/_types/root/_head.html new file mode 100644 index 0000000..26a487b --- /dev/null +++ b/browser/templates/_types/root/_head.html @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/browser/templates/_types/root/_index.html b/browser/templates/_types/root/_index.html new file mode 100644 index 0000000..5d3e313 --- /dev/null +++ b/browser/templates/_types/root/_index.html @@ -0,0 +1,13 @@ +{% extends '_types/root/index.html' %} +{% from 'macros/glyphs.html' import opener %} + {% from 'macros/title.html' import title with context %} +{% block main_mobile_menu %} +
    + {% block _main_mobile_menu %} + {% include '_types/root/_nav.html' %} + {% include '_types/root/_nav_panel.html' %} + {% endblock %} +
    +{% endblock %} + + diff --git a/browser/templates/_types/root/_n/macros.html b/browser/templates/_types/root/_n/macros.html new file mode 100644 index 0000000..26e6128 --- /dev/null +++ b/browser/templates/_types/root/_n/macros.html @@ -0,0 +1,35 @@ +{% macro header(id=False, oob=False) %} +
    + {{ caller() }} +
    +{% endmacro %} + + +{% macro oob_header(id, child_id, row_macro) %} + {% call header(id=id, oob=True) %} + {% call header() %} + {% from row_macro import header_row with context %} + {{header_row()}} +
    +
    + {% endcall %} + {% endcall %} +{% endmacro %} + + +{% macro index_row(id, row_macro) %} + {% from '_types/root/_n/macros.html' import header with context %} + {% set _caller = caller %} + {% call header() %} + {% from row_macro import header_row with context %} + {{ header_row() }} +
    + {{_caller()}} +
    + {% endcall %} + +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/root/_nav.html b/browser/templates/_types/root/_nav.html new file mode 100644 index 0000000..5e61e58 --- /dev/null +++ b/browser/templates/_types/root/_nav.html @@ -0,0 +1,21 @@ +{% set _app_slugs = {'cart': cart_url('/')} %} + diff --git a/browser/templates/_types/root/_nav_panel.html b/browser/templates/_types/root/_nav_panel.html new file mode 100644 index 0000000..a1a0528 --- /dev/null +++ b/browser/templates/_types/root/_nav_panel.html @@ -0,0 +1,7 @@ + {% import 'macros/links.html' as links %} + {% if g.rights.admin %} + + + + {% endif %} + \ No newline at end of file diff --git a/browser/templates/_types/root/_oob_menu.html b/browser/templates/_types/root/_oob_menu.html new file mode 100644 index 0000000..b20c124 --- /dev/null +++ b/browser/templates/_types/root/_oob_menu.html @@ -0,0 +1,46 @@ +{# + Shared mobile menu for both base templates and OOB updates + + This macro can be used in two modes: + - oob=true: Outputs full wrapper with hx-swap-oob attribute (for OOB updates) + - oob=false: Outputs just content, assumes wrapper exists (for base templates) + + The caller can pass section-specific nav items via section_nav parameter. +#} + +{% macro mobile_menu(section_nav='', oob=true) %} +{% if oob %} +
    +{% endif %} + +{% if oob %} +
    +{% endif %} +{% endmacro %} + + + + + +{% macro oob_mobile_menu() %} +
    + +
    +{% endmacro %} + + + diff --git a/browser/templates/_types/root/_sign_in.html b/browser/templates/_types/root/_sign_in.html new file mode 100644 index 0000000..3495518 --- /dev/null +++ b/browser/templates/_types/root/_sign_in.html @@ -0,0 +1,10 @@ + + + + sign in or register + diff --git a/browser/templates/_types/root/exceptions/403/img.html b/browser/templates/_types/root/exceptions/403/img.html new file mode 100644 index 0000000..c171b80 --- /dev/null +++ b/browser/templates/_types/root/exceptions/403/img.html @@ -0,0 +1 @@ +{{asset_url('errors/403.gif')}} \ No newline at end of file diff --git a/browser/templates/_types/root/exceptions/403/message.html b/browser/templates/_types/root/exceptions/403/message.html new file mode 100644 index 0000000..d8d39d5 --- /dev/null +++ b/browser/templates/_types/root/exceptions/403/message.html @@ -0,0 +1 @@ +YOU CAN'T DO THAT \ No newline at end of file diff --git a/browser/templates/_types/root/exceptions/404/img.html b/browser/templates/_types/root/exceptions/404/img.html new file mode 100644 index 0000000..fbfefa5 --- /dev/null +++ b/browser/templates/_types/root/exceptions/404/img.html @@ -0,0 +1 @@ +{{asset_url('errors/404.gif')}} \ No newline at end of file diff --git a/browser/templates/_types/root/exceptions/404/message.html b/browser/templates/_types/root/exceptions/404/message.html new file mode 100644 index 0000000..6647958 --- /dev/null +++ b/browser/templates/_types/root/exceptions/404/message.html @@ -0,0 +1 @@ +NOT FOUND \ No newline at end of file diff --git a/browser/templates/_types/root/exceptions/_.html b/browser/templates/_types/root/exceptions/_.html new file mode 100644 index 0000000..3e54b0d --- /dev/null +++ b/browser/templates/_types/root/exceptions/_.html @@ -0,0 +1,12 @@ +{% extends '_types/root/exceptions/base.html' %} + +{% block error_summary %} +
    + {% include '_types/root/exceptions/' + errnum + '/message.html' %} +
    +{% endblock %} + +{% block error_content %} + +{% endblock %} + diff --git a/browser/templates/_types/root/exceptions/app_error.html b/browser/templates/_types/root/exceptions/app_error.html new file mode 100644 index 0000000..85c981a --- /dev/null +++ b/browser/templates/_types/root/exceptions/app_error.html @@ -0,0 +1,42 @@ +{% extends '_types/root/_index.html' %} + +{% block content %} +
    +
    +
    + + + +
    + +

    + Something went wrong +

    + + {% if messages %} +
    + {% for message in messages %} +
    + {{ message }} +
    + {% endfor %} +
    + {% endif %} + +
    + + + Home + +
    +
    +
    +{% endblock %} diff --git a/browser/templates/_types/root/exceptions/base.html b/browser/templates/_types/root/exceptions/base.html new file mode 100644 index 0000000..7d20283 --- /dev/null +++ b/browser/templates/_types/root/exceptions/base.html @@ -0,0 +1,17 @@ +{% extends '_types/root/index.html' %} + +{% block content %} +
    + {% block error_summary %} + {% endblock %} +
    +
    + {% block error_content %} + {% endblock %} +
    +{% endblock %} + diff --git a/browser/templates/_types/root/exceptions/error.html b/browser/templates/_types/root/exceptions/error.html new file mode 100644 index 0000000..70a8164 --- /dev/null +++ b/browser/templates/_types/root/exceptions/error.html @@ -0,0 +1,12 @@ +{% extends '_types/root/exceptions/base.html' %} + +{% block error_summary %} +
    + WELL THIS IS EMBARASSING... +
    +{% endblock %} + +{% block error_content %} + +{% endblock %} + diff --git a/browser/templates/_types/root/exceptions/hx/_.html b/browser/templates/_types/root/exceptions/hx/_.html new file mode 100644 index 0000000..6a916f1 --- /dev/null +++ b/browser/templates/_types/root/exceptions/hx/_.html @@ -0,0 +1,8 @@ +
    +
    + {% include '_types/root/exceptions/' + errnum + '/message.html' %} +
    + + + +
    \ No newline at end of file diff --git a/browser/templates/_types/root/header/_header.html b/browser/templates/_types/root/header/_header.html new file mode 100644 index 0000000..fc4591b --- /dev/null +++ b/browser/templates/_types/root/header/_header.html @@ -0,0 +1,42 @@ +{% set select_colours = " + [.hover-capable_&]:hover:bg-yellow-300 + aria-selected:bg-stone-500 aria-selected:text-white + [.hover-capable_&[aria-selected=true]:hover]:bg-orange-500 +"%} +{% import 'macros/links.html' as links %} + +{% macro header_row(oob=False) %} + {% call links.menu_row(id='root-row', oob=oob) %} +
    + {# Cart mini #} + {% from '_types/cart/_mini.html' import mini with context %} + {{mini()}} + + {# Site title #} +
    + {% from 'macros/title.html' import title with context %} + {{ title('flex justify-center md:justify-start')}} +
    + + {# Desktop nav #} + + {% include '_types/root/_hamburger.html' %} +
    + {% endcall %} + {# Mobile user info #} +
    + {% if g.user %} + {% include '_types/root/mobile/_full_user.html' %} + {% else %} + {% include '_types/root/mobile/_sign_in.html' %} + {% endif %} +
    +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/root/header/_oob.html b/browser/templates/_types/root/header/_oob.html new file mode 100644 index 0000000..d0e50b2 --- /dev/null +++ b/browser/templates/_types/root/header/_oob.html @@ -0,0 +1,66 @@ +{# + Shared root header for both base templates and OOB updates + + This macro can be used in two modes: + - oob=true: Outputs full div with hx-swap-oob attribute (for OOB updates) + - oob=false: Outputs just content, assumes wrapper div exists (for base templates) + + Usage: + 1. Call root_header_start(oob=true/false) + 2. Add any section-specific headers + 3. Call root_header_end(oob=true/false) +#} + +{% macro root_header_start(oob=true) %} +{% set select_colours = " + [.hover-capable_&]:hover:bg-yellow-300 + aria-selected:bg-stone-500 aria-selected:text-white + [.hover-capable_&[aria-selected=true]:hover]:bg-orange-500 +"%} + +{% if oob %} + +{% endif %} +{% endmacro %} diff --git a/browser/templates/_types/root/header/_oob_.html b/browser/templates/_types/root/header/_oob_.html new file mode 100644 index 0000000..772f2ab --- /dev/null +++ b/browser/templates/_types/root/header/_oob_.html @@ -0,0 +1,38 @@ +{# + Shared root header for both base templates and OOB updates + + This macro can be used in two modes: + - oob=true: Outputs full div with hx-swap-oob attribute (for OOB updates) + - oob=false: Outputs just content, assumes wrapper div exists (for base templates) + + Usage: + 1. Call root_header_start(oob=true/false) + 2. Add any section-specific headers + 3. Call root_header_end(oob=true/false) +#} + +{% macro root_header(oob=true) %} +{% set select_colours = " + [.hover-capable_&]:hover:bg-yellow-300 + aria-selected:bg-stone-500 aria-selected:text-white + [.hover-capable_&[aria-selected=true]:hover]:bg-orange-500 +"%} + +{% if oob %} + +{% endif %} + +{% endmacro %} + diff --git a/browser/templates/_types/root/index.html b/browser/templates/_types/root/index.html new file mode 100644 index 0000000..06094f3 --- /dev/null +++ b/browser/templates/_types/root/index.html @@ -0,0 +1,84 @@ +{% import 'macros/layout.html' as layout %} +{% from '_types/root/header/_oob.html' import root_header_start, root_header_end with context %} +{% from '_types/root/_oob_menu.html' import mobile_menu with context %} + + + + + + {% block meta %} + {% include 'social/meta_site.html' %} + {% endblock %} + + {% include '_types/root/_head.html' %} + + +
    + {% block header %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% call layout.details('/root-header') %} + {% call layout.summary( + 'root-header-summary', + _class='flex items-start gap-2 p-1 + bg-' + menu_colour + '-' + (500-(level()*100))|string, + ) + %} +
    + + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row() }} +
    + {% block root_header_child %} + {% endblock %} +
    +
    + + {% endcall %} + {% call layout.menu('root-menu', 'md:hidden bg-yellow-100') %} + {% block main_mobile_menu %} + {% endblock %} + {% endcall %} + {% endcall %} + + + + {% endcall %} + {% endblock %} + + +
    + {% block filter %} + {% endblock %} +
    +
    +
    +
    + + +
    + {% block content %} + {% endblock %} +
    +
    + +
    +
    +
    + +
    + + + diff --git a/browser/templates/_types/root/mobile/_full_user.html b/browser/templates/_types/root/mobile/_full_user.html new file mode 100644 index 0000000..cdecae0 --- /dev/null +++ b/browser/templates/_types/root/mobile/_full_user.html @@ -0,0 +1,10 @@ + +{% set href=coop_url('/auth/account/') %} + + + {{g.user.email}} + + \ No newline at end of file diff --git a/browser/templates/_types/root/mobile/_sign_in.html b/browser/templates/_types/root/mobile/_sign_in.html new file mode 100644 index 0000000..86e06eb --- /dev/null +++ b/browser/templates/_types/root/mobile/_sign_in.html @@ -0,0 +1,8 @@ + + + + sign in or register + diff --git a/browser/templates/_types/root/settings/_main_panel.html b/browser/templates/_types/root/settings/_main_panel.html new file mode 100644 index 0000000..9f4c9a8 --- /dev/null +++ b/browser/templates/_types/root/settings/_main_panel.html @@ -0,0 +1,2 @@ +
    +
    diff --git a/browser/templates/_types/root/settings/_nav.html b/browser/templates/_types/root/settings/_nav.html new file mode 100644 index 0000000..f9d4420 --- /dev/null +++ b/browser/templates/_types/root/settings/_nav.html @@ -0,0 +1,5 @@ +{% from 'macros/admin_nav.html' import admin_nav_item %} +{{ admin_nav_item(url_for('menu_items.list_menu_items'), 'bars', 'Menu Items', select_colours) }} +{{ admin_nav_item(url_for('snippets.list_snippets'), 'puzzle-piece', 'Snippets', select_colours) }} +{{ admin_nav_item(url_for('blog.tag_groups_admin.index'), 'tags', 'Tag Groups', select_colours) }} +{{ admin_nav_item(url_for('settings.cache'), 'refresh', 'Cache', select_colours) }} diff --git a/browser/templates/_types/root/settings/_oob_elements.html b/browser/templates/_types/root/settings/_oob_elements.html new file mode 100644 index 0000000..fbe1bf3 --- /dev/null +++ b/browser/templates/_types/root/settings/_oob_elements.html @@ -0,0 +1,26 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{# Import shared OOB macros #} +{% from '_types/root/header/_oob_.html' import root_header with context %} + +{% block oobs %} + + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-header-child', 'root-settings-header-child', '_types/root/settings/header/_header.html')}} + + {% from '_types/root/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} +{% include '_types/root/settings/_nav.html' %} +{% endblock %} + + +{% block content %} + {% include '_types/root/settings/_main_panel.html' %} +{% endblock %} + diff --git a/browser/templates/_types/root/settings/cache/_header.html b/browser/templates/_types/root/settings/cache/_header.html new file mode 100644 index 0000000..64f8535 --- /dev/null +++ b/browser/templates/_types/root/settings/cache/_header.html @@ -0,0 +1,9 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='cache-row', oob=oob) %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{ admin_nav_item(url_for('settings.cache'), 'refresh', 'Cache', select_colours, aclass='') }} + {% call links.desktop_nav() %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/root/settings/cache/_main_panel.html b/browser/templates/_types/root/settings/cache/_main_panel.html new file mode 100644 index 0000000..854012d --- /dev/null +++ b/browser/templates/_types/root/settings/cache/_main_panel.html @@ -0,0 +1,14 @@ +
    +
    +
    + + +
    +
    +
    +
    diff --git a/browser/templates/_types/root/settings/cache/_oob_elements.html b/browser/templates/_types/root/settings/cache/_oob_elements.html new file mode 100644 index 0000000..5989bf7 --- /dev/null +++ b/browser/templates/_types/root/settings/cache/_oob_elements.html @@ -0,0 +1,16 @@ +{% extends 'oob_elements.html' %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-settings-header-child', 'cache-header-child', '_types/root/settings/cache/_header.html')}} + + {% from '_types/root/settings/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} +{% endblock %} + +{% block mobile_menu %} +{% endblock %} + +{% block content %} + {% include '_types/root/settings/cache/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/root/settings/cache/index.html b/browser/templates/_types/root/settings/cache/index.html new file mode 100644 index 0000000..05706f8 --- /dev/null +++ b/browser/templates/_types/root/settings/cache/index.html @@ -0,0 +1,20 @@ +{% extends '_types/root/settings/index.html' %} + +{% block root_settings_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/root/settings/cache/_header.html' import header_row with context %} + {{ header_row() }} +
    + {% block cache_header_child %} + {% endblock %} +
    + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/root/settings/cache/_main_panel.html' %} +{% endblock %} + +{% block _main_mobile_menu %} +{% endblock %} diff --git a/browser/templates/_types/root/settings/header/_header.html b/browser/templates/_types/root/settings/header/_header.html new file mode 100644 index 0000000..69e7c72 --- /dev/null +++ b/browser/templates/_types/root/settings/header/_header.html @@ -0,0 +1,11 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='root-settings-row', oob=oob) %} + {% call links.link(url_for('settings.home'), hx_select_search) %} + {{ links.admin() }} + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/root/settings/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/_types/root/settings/index.html b/browser/templates/_types/root/settings/index.html new file mode 100644 index 0000000..1773f3d --- /dev/null +++ b/browser/templates/_types/root/settings/index.html @@ -0,0 +1,18 @@ +{% extends '_types/root/_index.html' %} +{% import 'macros/layout.html' as layout %} + +{% block root_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('root-settings-header-child', '_types/root/settings/header/_header.html') %} + {% block root_settings_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {% include '_types/root/settings/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/root/settings/_main_panel.html' %} +{% endblock %} \ No newline at end of file diff --git a/browser/templates/_types/slot/__description.html b/browser/templates/_types/slot/__description.html new file mode 100644 index 0000000..7897fd2 --- /dev/null +++ b/browser/templates/_types/slot/__description.html @@ -0,0 +1,13 @@ +{% macro description(slot, oob=False) %} +
    + {{ slot.description or ''}} +
    + +{% endmacro %} diff --git a/browser/templates/_types/slot/_description.html b/browser/templates/_types/slot/_description.html new file mode 100644 index 0000000..32e28e6 --- /dev/null +++ b/browser/templates/_types/slot/_description.html @@ -0,0 +1,5 @@ +

    + {% if slot.description %} + {{ slot.description }} + {% endif %} +

    diff --git a/browser/templates/_types/slot/_edit.html b/browser/templates/_types/slot/_edit.html new file mode 100644 index 0000000..deebc4f --- /dev/null +++ b/browser/templates/_types/slot/_edit.html @@ -0,0 +1,182 @@ +
    + +
    +
    + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + + Days + + + {# pre-check "All" if every day is true on this slot #} + {% set all_days_checked = + slot|getattr('mon') + and slot|getattr('tue') + and slot|getattr('wed') + and slot|getattr('thu') + and slot|getattr('fri') + and slot|getattr('sat') + and slot|getattr('sun') %} + +
    + {# "All" toggle – no name so it’s not submitted #} + + + {# Individual days, with data-day like the add form #} + {% for key, label in [ + ('mon','Mon'),('tue','Tue'),('wed','Wed'),('thu','Thu'), + ('fri','Fri'),('sat','Sat'),('sun','Sun') + ] %} + {% set is_checked = slot|getattr(key) %} + + {% endfor %} +
    +
    + + +
    + + +
    + +
    + + + +
    +
    +
    diff --git a/browser/templates/_types/slot/_main_panel.html b/browser/templates/_types/slot/_main_panel.html new file mode 100644 index 0000000..80f94ba --- /dev/null +++ b/browser/templates/_types/slot/_main_panel.html @@ -0,0 +1,73 @@ +
    + +
    +
    + Days +
    +
    + {% set days = slot.days_display.split(', ') %} + {% if days and days[0] != "—" %} +
    + {% for day in days %} + + {{ day }} + + {% endfor %} +
    + {% else %} + No days + {% endif %} +
    +
    + + +
    +
    + Flexible +
    +
    + {{ 'yes' if slot.flexible else 'no' }} +
    +
    + + +
    +
    +
    + Time +
    +
    + {{ slot.time_start.strftime('%H:%M') }} — {{ slot.time_end.strftime('%H:%M') }} +
    +
    + +
    +
    + Cost +
    +
    + {{ ('%.2f'|format(slot.cost)) if slot.cost is not none else '' }} +
    +
    +
    + +
    + +{% if oob %} + {% from '_types/slot/__description.html' import description %} + {{description(slot, oob=True)}} + +{% endif %} \ No newline at end of file diff --git a/browser/templates/_types/slot/_oob_elements.html b/browser/templates/_types/slot/_oob_elements.html new file mode 100644 index 0000000..3b82170 --- /dev/null +++ b/browser/templates/_types/slot/_oob_elements.html @@ -0,0 +1,15 @@ +{% extends "oob_elements.html" %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('slots-header-child', 'slot-header-child', '_types/slot/header/_header.html')}} + + {% from '_types/slots/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + + +{% block content %} + {% include '_types/slot/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/slot/header/_header.html b/browser/templates/_types/slot/header/_header.html new file mode 100644 index 0000000..1176b4b --- /dev/null +++ b/browser/templates/_types/slot/header/_header.html @@ -0,0 +1,26 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='slot-row', oob=oob) %} + {% call links.link( + url_for('calendars.calendar.slots.slot.get', slug=post.slug, calendar_slug=calendar.slug, slot_id=slot.id), + hx_select_search, + ) %} +
    +
    + +
    + {{ slot.name }} +
    +
    + {% from '_types/slot/__description.html' import description %} + {{description(slot)}} +
    + {% endcall %} + {% call links.desktop_nav() %} + {#% include '_types/slot/_nav.html' %#} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/slot/index.html b/browser/templates/_types/slot/index.html new file mode 100644 index 0000000..265be24 --- /dev/null +++ b/browser/templates/_types/slot/index.html @@ -0,0 +1,20 @@ +{% extends '_types/slots/index.html' %} +{% import 'macros/layout.html' as layout %} + + +{% block slots_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('slot-header-child', '_types/slot/header/_header.html') %} + {% block slot_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {#% include '_types/slot/_nav.html' %#} +{% endblock %} + +{% block content %} + {% include '_types/slot/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/slots/_add.html b/browser/templates/_types/slots/_add.html new file mode 100644 index 0000000..83e8cbd --- /dev/null +++ b/browser/templates/_types/slots/_add.html @@ -0,0 +1,125 @@ +
    +
    +
    + + +
    + +
    + + +
    + +
    + +
    + {# "All" toggle – no name so it’s not submitted #} + + + {# Individual days #} + {% for key, label in [ + ('mon','Mon'),('tue','Tue'),('wed','Wed'),('thu','Thu'), + ('fri','Fri'),('sat','Sat'),('sun','Sun') + ] %} + + {% endfor %} +
    +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + + {# NEW: flexible flag #} +
    + + +
    +
    + +
    + + + +
    +
    diff --git a/browser/templates/_types/slots/_add_button.html b/browser/templates/_types/slots/_add_button.html new file mode 100644 index 0000000..dec2aee --- /dev/null +++ b/browser/templates/_types/slots/_add_button.html @@ -0,0 +1,12 @@ + + diff --git a/browser/templates/_types/slots/_main_panel.html b/browser/templates/_types/slots/_main_panel.html new file mode 100644 index 0000000..a2ac263 --- /dev/null +++ b/browser/templates/_types/slots/_main_panel.html @@ -0,0 +1,26 @@ +
    + + + + + + + + + + + + + {% for s in slots %} + {% include '_types/slots/_row.html' %} + {% else %} + + {% endfor %} + +
    NameFlexibleDaysTimeCostActions
    No slots yet.
    + + +
    + {% include '_types/slots/_add_button.html' %} +
    +
    diff --git a/browser/templates/_types/slots/_oob_elements.html b/browser/templates/_types/slots/_oob_elements.html new file mode 100644 index 0000000..acf0d05 --- /dev/null +++ b/browser/templates/_types/slots/_oob_elements.html @@ -0,0 +1,15 @@ +{% extends "oob_elements.html" %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('calendar-header-child', 'slots-header-child', '_types/slots/header/_header.html')}} + + {% from '_types/calendar/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + + +{% block content %} + {% include '_types/slots/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/slots/_row.html b/browser/templates/_types/slots/_row.html new file mode 100644 index 0000000..a54d2ae --- /dev/null +++ b/browser/templates/_types/slots/_row.html @@ -0,0 +1,63 @@ +{% import 'macros/links.html' as links %} + + +
    + {% call links.link( + url_for('calendars.calendar.slots.slot.get', slug=post.slug, calendar_slug=calendar.slug, slot_id=s.id), + hx_select_search, + aclass=styles.pill + ) %} + {{ s.name }} + {% endcall %} +
    + {% set slot = s %} + {% include '_types/slot/_description.html' %} + + + {{ 'yes' if s.flexible else 'no' }} + + + {% set days = s.days_display.split(', ') %} + {% if days and days[0] != "—" %} +
    + {% for day in days %} + + {{ day }} + + {% endfor %} +
    + {% else %} + No days + {% endif %} + + + {{ s.time_start.strftime('%H:%M') }} - {{ s.time_end.strftime('%H:%M') }} + + + {{ ('%.2f'|format(s.cost)) if s.cost is not none else '' }} + + + + + diff --git a/browser/templates/_types/slots/header/_header.html b/browser/templates/_types/slots/header/_header.html new file mode 100644 index 0000000..110fb29 --- /dev/null +++ b/browser/templates/_types/slots/header/_header.html @@ -0,0 +1,19 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='slots-row', oob=oob) %} + {% call links.link( + url_for('calendars.calendar.slots.get', slug=post.slug, calendar_slug= calendar.slug), + hx_select_search, + ) %} + +
    + slots +
    + {% endcall %} + {% call links.desktop_nav() %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/slots/index.html b/browser/templates/_types/slots/index.html new file mode 100644 index 0000000..453ba5f --- /dev/null +++ b/browser/templates/_types/slots/index.html @@ -0,0 +1,19 @@ +{% extends '_types/calendar/index.html' %} + +{% block calendar_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('slots-header-child', '_types/slots/header/_header.html') %} + {% block slots_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + +{% block _main_mobile_menu %} + {#% include '_types/calendar/_nav.html' %#} +{% endblock %} + + + +{% block content %} + {% include '_types/slots/_main_panel.html' %} +{% endblock %} \ No newline at end of file diff --git a/browser/templates/_types/snippets/_list.html b/browser/templates/_types/snippets/_list.html new file mode 100644 index 0000000..2b982ca --- /dev/null +++ b/browser/templates/_types/snippets/_list.html @@ -0,0 +1,73 @@ +
    + {% if snippets %} +
    + {% for s in snippets %} +
    + {# Name #} +
    +
    {{ s.name }}
    +
    + {% if s.user_id == g.user.id %} + You + {% else %} + User #{{ s.user_id }} + {% endif %} +
    +
    + + {# Visibility badge #} + {% set badge_colours = { + 'private': 'bg-stone-200 text-stone-700', + 'shared': 'bg-blue-100 text-blue-700', + 'admin': 'bg-amber-100 text-amber-700', + } %} + + {{ s.visibility }} + + + {# Admin: inline visibility select #} + {% if is_admin %} + + {% endif %} + + {# Delete button #} + {% if s.user_id == g.user.id or is_admin %} + + {% endif %} +
    + {% endfor %} +
    + {% else %} +
    + +

    No snippets yet. Create one from the blog editor.

    +
    + {% endif %} +
    diff --git a/browser/templates/_types/snippets/_main_panel.html b/browser/templates/_types/snippets/_main_panel.html new file mode 100644 index 0000000..73b50b7 --- /dev/null +++ b/browser/templates/_types/snippets/_main_panel.html @@ -0,0 +1,9 @@ +
    +
    +

    Snippets

    +
    + +
    + {% include '_types/snippets/_list.html' %} +
    +
    diff --git a/browser/templates/_types/snippets/_oob_elements.html b/browser/templates/_types/snippets/_oob_elements.html new file mode 100644 index 0000000..a1377cf --- /dev/null +++ b/browser/templates/_types/snippets/_oob_elements.html @@ -0,0 +1,18 @@ +{% extends 'oob_elements.html' %} + +{# OOB elements for HTMX navigation - all elements that need updating #} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('root-settings-header-child', 'snippets-header-child', '_types/snippets/header/_header.html')}} + + {% from '_types/root/settings/header/_header.html' import header_row with context %} + {{header_row(oob=True)}} +{% endblock %} + +{% block mobile_menu %} +{% endblock %} + +{% block content %} + {% include '_types/snippets/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/snippets/header/_header.html b/browser/templates/_types/snippets/header/_header.html new file mode 100644 index 0000000..0882518 --- /dev/null +++ b/browser/templates/_types/snippets/header/_header.html @@ -0,0 +1,9 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='snippets-row', oob=oob) %} + {% from 'macros/admin_nav.html' import admin_nav_item %} + {{ admin_nav_item(url_for('snippets.list_snippets'), 'puzzle-piece', 'Snippets', select_colours, aclass='') }} + {% call links.desktop_nav() %} + {% endcall %} + {% endcall %} +{% endmacro %} diff --git a/browser/templates/_types/snippets/index.html b/browser/templates/_types/snippets/index.html new file mode 100644 index 0000000..90f0106 --- /dev/null +++ b/browser/templates/_types/snippets/index.html @@ -0,0 +1,20 @@ +{% extends '_types/root/settings/index.html' %} + +{% block root_settings_header_child %} + {% from '_types/root/_n/macros.html' import header with context %} + {% call header() %} + {% from '_types/snippets/header/_header.html' import header_row with context %} + {{ header_row() }} +
    + {% block snippets_header_child %} + {% endblock %} +
    + {% endcall %} +{% endblock %} + +{% block content %} + {% include '_types/snippets/_main_panel.html' %} +{% endblock %} + +{% block _main_mobile_menu %} +{% endblock %} diff --git a/browser/templates/_types/ticket_type/_edit.html b/browser/templates/_types/ticket_type/_edit.html new file mode 100644 index 0000000..b8326c6 --- /dev/null +++ b/browser/templates/_types/ticket_type/_edit.html @@ -0,0 +1,103 @@ +
    + +
    +
    + + + +
    + + +
    + + +
    + + +
    + + +
    + + +
    + +
    + + + +
    +
    +
    diff --git a/browser/templates/_types/ticket_type/_main_panel.html b/browser/templates/_types/ticket_type/_main_panel.html new file mode 100644 index 0000000..4bb7dac --- /dev/null +++ b/browser/templates/_types/ticket_type/_main_panel.html @@ -0,0 +1,50 @@ +
    + +
    +
    +
    + Name +
    +
    + {{ ticket_type.name }} +
    +
    + +
    +
    + Cost +
    +
    + £{{ ('%.2f'|format(ticket_type.cost)) if ticket_type.cost is not none else '0.00' }} +
    +
    + +
    +
    + Count +
    +
    + {{ ticket_type.count }} +
    +
    +
    + + +
    diff --git a/browser/templates/_types/ticket_type/_nav.html b/browser/templates/_types/ticket_type/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/ticket_type/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/ticket_type/_oob_elements.html b/browser/templates/_types/ticket_type/_oob_elements.html new file mode 100644 index 0000000..824e62a --- /dev/null +++ b/browser/templates/_types/ticket_type/_oob_elements.html @@ -0,0 +1,18 @@ +{% extends "oob_elements.html" %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('ticket_types-header-child', 'ticket_type-header-child', '_types/ticket_type/header/_header.html')}} + + {% from '_types/ticket_types/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/ticket_type/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/ticket_type/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/ticket_type/header/_header.html b/browser/templates/_types/ticket_type/header/_header.html new file mode 100644 index 0000000..3f3b594 --- /dev/null +++ b/browser/templates/_types/ticket_type/header/_header.html @@ -0,0 +1,33 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='ticket_type-row', oob=oob) %} + {% call links.link( + url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.ticket_types.ticket_type.get', + slug=post.slug, + calendar_slug=calendar.slug, + year=year, + month=month, + day=day, + entry_id=entry.id, + ticket_type_id=ticket_type.id + ), + hx_select_search, + ) %} +
    +
    + +
    + {{ ticket_type.name }} +
    +
    +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/ticket_type/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/ticket_type/index.html b/browser/templates/_types/ticket_type/index.html new file mode 100644 index 0000000..245992c --- /dev/null +++ b/browser/templates/_types/ticket_type/index.html @@ -0,0 +1,19 @@ +{% extends '_types/ticket_types/index.html' %} +{% import 'macros/layout.html' as layout %} + +{% block ticket_types_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('ticket_types-header-child', '_types/ticket_type/header/_header.html') %} + {% block ticket_type_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {#% include '_types/ticket_type/_nav.html' %#} +{% endblock %} + +{% block content %} + {% include '_types/ticket_type/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/ticket_types/_add.html b/browser/templates/_types/ticket_types/_add.html new file mode 100644 index 0000000..9e3e825 --- /dev/null +++ b/browser/templates/_types/ticket_types/_add.html @@ -0,0 +1,87 @@ +
    +
    +
    + + +
    + +
    + + +
    + +
    + + +
    +
    + +
    + + + +
    +
    diff --git a/browser/templates/_types/ticket_types/_add_button.html b/browser/templates/_types/ticket_types/_add_button.html new file mode 100644 index 0000000..525bc46 --- /dev/null +++ b/browser/templates/_types/ticket_types/_add_button.html @@ -0,0 +1,16 @@ + diff --git a/browser/templates/_types/ticket_types/_main_panel.html b/browser/templates/_types/ticket_types/_main_panel.html new file mode 100644 index 0000000..2afaa7a --- /dev/null +++ b/browser/templates/_types/ticket_types/_main_panel.html @@ -0,0 +1,24 @@ +
    + + + + + + + + + + + {% for tt in ticket_types %} + {% include '_types/ticket_types/_row.html' %} + {% else %} + + {% endfor %} + +
    NameCostCountActions
    No ticket types yet.
    + + +
    + {% include '_types/ticket_types/_add_button.html' %} +
    +
    diff --git a/browser/templates/_types/ticket_types/_nav.html b/browser/templates/_types/ticket_types/_nav.html new file mode 100644 index 0000000..f5c504d --- /dev/null +++ b/browser/templates/_types/ticket_types/_nav.html @@ -0,0 +1,2 @@ +{% from 'macros/admin_nav.html' import placeholder_nav %} +{{ placeholder_nav() }} diff --git a/browser/templates/_types/ticket_types/_oob_elements.html b/browser/templates/_types/ticket_types/_oob_elements.html new file mode 100644 index 0000000..a746f17 --- /dev/null +++ b/browser/templates/_types/ticket_types/_oob_elements.html @@ -0,0 +1,18 @@ +{% extends "oob_elements.html" %} + +{% block oobs %} + {% from '_types/root/_n/macros.html' import oob_header with context %} + {{oob_header('entry-admin-header-child', 'ticket_types-header-child', '_types/ticket_types/header/_header.html')}} + + {% from '_types/entry/admin/header/_header.html' import header_row with context %} + {{ header_row(oob=True) }} +{% endblock %} + + +{% block mobile_menu %} + {% include '_types/ticket_types/_nav.html' %} +{% endblock %} + +{% block content %} + {% include '_types/ticket_types/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/_types/ticket_types/_row.html b/browser/templates/_types/ticket_types/_row.html new file mode 100644 index 0000000..00e4ffa --- /dev/null +++ b/browser/templates/_types/ticket_types/_row.html @@ -0,0 +1,57 @@ +{% import 'macros/links.html' as links %} + + +
    + {% call links.link( + url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.ticket_types.ticket_type.get', + slug=post.slug, + calendar_slug=calendar.slug, + year=year, + month=month, + day=day, + entry_id=entry.id, + ticket_type_id=tt.id + ), + hx_select_search, + aclass=styles.pill + ) %} + {{ tt.name }} + {% endcall %} +
    + + + £{{ ('%.2f'|format(tt.cost)) if tt.cost is not none else '0.00' }} + + + {{ tt.count }} + + + + + diff --git a/browser/templates/_types/ticket_types/header/_header.html b/browser/templates/_types/ticket_types/header/_header.html new file mode 100644 index 0000000..757ab8f --- /dev/null +++ b/browser/templates/_types/ticket_types/header/_header.html @@ -0,0 +1,25 @@ +{% import 'macros/links.html' as links %} +{% macro header_row(oob=False) %} + {% call links.menu_row(id='ticket_types-row', oob=oob) %} + {% call links.link(url_for( + 'calendars.calendar.day.calendar_entries.calendar_entry.ticket_types.get', + slug=post.slug, + calendar_slug=calendar.slug, + entry_id=entry.id, + year=year, + month=month, + day=day + ), hx_select_search) %} + +
    + ticket types +
    + {% endcall %} + {% call links.desktop_nav() %} + {% include '_types/ticket_types/_nav.html' %} + {% endcall %} + {% endcall %} +{% endmacro %} + + + diff --git a/browser/templates/_types/ticket_types/index.html b/browser/templates/_types/ticket_types/index.html new file mode 100644 index 0000000..9d0362a --- /dev/null +++ b/browser/templates/_types/ticket_types/index.html @@ -0,0 +1,20 @@ +{% extends '_types/entry/admin/index.html' %} + +{% block entry_admin_header_child %} + {% from '_types/root/_n/macros.html' import index_row with context %} + {% call index_row('ticket_type-header-child', '_types/ticket_types/header/_header.html') %} + {% block ticket_types_header_child %} + {% endblock %} + {% endcall %} +{% endblock %} + + +{% block _main_mobile_menu %} + {% include '_types/ticket_types/_nav.html' %} +{% endblock %} + + + +{% block content %} + {% include '_types/ticket_types/_main_panel.html' %} +{% endblock %} diff --git a/browser/templates/aside_clear.html b/browser/templates/aside_clear.html new file mode 100644 index 0000000..e091ac2 --- /dev/null +++ b/browser/templates/aside_clear.html @@ -0,0 +1,7 @@ + + diff --git a/browser/templates/filter_clear.html b/browser/templates/filter_clear.html new file mode 100644 index 0000000..fc3901e --- /dev/null +++ b/browser/templates/filter_clear.html @@ -0,0 +1,5 @@ +
    +
    diff --git a/browser/templates/macros/admin_nav.html b/browser/templates/macros/admin_nav.html new file mode 100644 index 0000000..738a319 --- /dev/null +++ b/browser/templates/macros/admin_nav.html @@ -0,0 +1,21 @@ +{# + Shared admin navigation macro + Use this instead of duplicate _nav.html files +#} + +{% macro admin_nav_item(href, icon='cog', label='', select_colours='', aclass=styles.nav_button) %} + {% import 'macros/links.html' as links %} + {% call links.link(href, hx_select_search, select_colours, True, aclass=aclass) %} + + {{ label }} + {% endcall %} +{% endmacro %} + +{% macro placeholder_nav() %} +{# Placeholder for admin sections without specific nav items #} + +{% endmacro %} diff --git a/browser/templates/macros/date.html b/browser/templates/macros/date.html new file mode 100644 index 0000000..5954f28 --- /dev/null +++ b/browser/templates/macros/date.html @@ -0,0 +1,7 @@ +{% macro dt(d) -%} +{{ d.astimezone().strftime('%-d %b %Y, %H:%M') if d.tzinfo else d.strftime('%-d %b %Y, %H:%M') }} +{%- endmacro %} + +{% macro t(d) -%} +{{ d.astimezone().strftime('%H:%M') if d.tzinfo else d.strftime('%H:%M') }} +{%- endmacro %} diff --git a/browser/templates/macros/filters.html b/browser/templates/macros/filters.html new file mode 100644 index 0000000..8d13887 --- /dev/null +++ b/browser/templates/macros/filters.html @@ -0,0 +1,117 @@ +{# + Unified filter macros for browse/shop pages + Consolidates duplicate mobile/desktop filter components +#} + +{% macro filter_item(href, is_on, title, icon_html, count=none, variant='desktop') %} + {# + Generic filter item (works for labels, stickers, etc.) + variant: 'desktop' or 'mobile' + #} + {% set base_class = "flex flex-col items-center justify-center" %} + {% if variant == 'mobile' %} + {% set item_class = base_class ~ " p-1 rounded hover:bg-stone-50" %} + {% set count_class = "text-[10px] text-stone-500 mt-1 leading-none tabular-nums" if count != 0 else "text-md text-red-500 font-bold mt-1 leading-none tabular-nums" %} + {% else %} + {% set item_class = base_class ~ " py-2 w-full h-full" %} + {% set count_class = "text-xs text-stone-500 leading-none justify-self-end tabular-nums" if count != 0 else "text-md text-red-500 font-bold leading-none justify-self-end tabular-nums" %} + {% endif %} + + + {{ icon_html | safe }} + {% if count is not none %} + {{ count }} + {% endif %} + +{% endmacro %} + + +{% macro labels_list(labels, selected_labels, current_local_href, variant='desktop') %} + {# + Unified labels filter list + variant: 'desktop' or 'mobile' + #} + {% import 'macros/stickers.html' as stick %} + + {% if variant == 'mobile' %} + + {% endif %} +{% endmacro %} + + +{% macro stickers_list(stickers, selected_stickers, current_local_href, variant='desktop') %} + {# + Unified stickers filter list + variant: 'desktop' or 'mobile' + #} + {% import 'macros/stickers.html' as stick %} + + {% if variant == 'mobile' %} + + + {% endif %} +{% endmacro %} + + diff --git a/browser/templates/macros/glyphs.html b/browser/templates/macros/glyphs.html new file mode 100644 index 0000000..0e7e225 --- /dev/null +++ b/browser/templates/macros/glyphs.html @@ -0,0 +1,17 @@ +{% macro opener(group=False) %} + + + + +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/macros/layout.html b/browser/templates/macros/layout.html new file mode 100644 index 0000000..9fe3b57 --- /dev/null +++ b/browser/templates/macros/layout.html @@ -0,0 +1,51 @@ +{# templates/macros/layout.html #} + +{% macro details(group = '', _class='') %} +
    + {{ caller() }} +
    +{%- endmacro %} + +{% macro summary(id, _class=None, oob=False) %} + +
    +
    + {{ caller() }} +
    +
    +
    +{%- endmacro %} + +{% macro filter_summary(id, current_local_href, search, search_count, hx_select, oob=True) %} + +
    +
    + {% include '_types/blog/mobile/_filter/_hamburger.html' %} +
    +
    +
    + {{ caller() }} + +
    +
    + {% import '_types/browse/mobile/_filter/search.html' as s %} + {{ s.search(current_local_href, search, search_count, hx_select) }} +
    +
    +{%- endmacro %} + + +{% macro menu(id, _class="") %} +
    + {{ caller() }} +
    +{%- endmacro %} diff --git a/browser/templates/macros/links.html b/browser/templates/macros/links.html new file mode 100644 index 0000000..d80a51d --- /dev/null +++ b/browser/templates/macros/links.html @@ -0,0 +1,59 @@ + + +{% macro link(url, select, select_colours='', highlight=True, _class='', aclass='') %} + {% set href=url|host%} + +{% endmacro %} + + +{% macro menu_row(id=False, oob=False) %} +
    + {{ caller() }} +
    + {{level_up()}} +{% endmacro %} + +{% macro desktop_nav() %} + +{% endmacro %} + +{% macro admin() %} + +
    + settings +
    + +{% endmacro %} \ No newline at end of file diff --git a/browser/templates/macros/scrolling_menu.html b/browser/templates/macros/scrolling_menu.html new file mode 100644 index 0000000..d1a823a --- /dev/null +++ b/browser/templates/macros/scrolling_menu.html @@ -0,0 +1,68 @@ +{# + Scrolling menu macro with arrow navigation + + Creates a horizontally scrollable menu (desktop) or vertically scrollable (mobile) + with arrow buttons that appear/hide based on content overflow. + + Parameters: + - container_id: Unique ID for the scroll container + - items: List of items to iterate over + - item_content: Caller block that renders each item (receives 'item' variable) + - wrapper_class: Optional additional classes for outer wrapper + - container_class: Optional additional classes for scroll container + - item_class: Optional additional classes for each item wrapper +#} + +{% macro scrolling_menu(container_id, items, wrapper_class='', container_class='', item_class='') %} + {% if items %} + {# Left scroll arrow - desktop only #} + + + {# Scrollable container #} +
    +
    + {% for item in items %} +
    + {{ caller(item) }} +
    + {% endfor %} +
    +
    + + + + {# Right scroll arrow - desktop only #} + + {% endif %} +{% endmacro %} diff --git a/browser/templates/macros/stickers.html b/browser/templates/macros/stickers.html new file mode 100644 index 0000000..2be5b9f --- /dev/null +++ b/browser/templates/macros/stickers.html @@ -0,0 +1,24 @@ +{% macro sticker(src, title, enabled, size=40, found=false) -%} + + + + {{ title|capitalize }} + + + + + +{%- endmacro -%} + diff --git a/browser/templates/macros/title.html b/browser/templates/macros/title.html new file mode 100644 index 0000000..fc5c532 --- /dev/null +++ b/browser/templates/macros/title.html @@ -0,0 +1,10 @@ +{% macro title(_class='') %} + +

    + {{ site().title }} +

    +
    +{% endmacro %} diff --git a/browser/templates/mobile/menu.html b/browser/templates/mobile/menu.html new file mode 100644 index 0000000..729c141 --- /dev/null +++ b/browser/templates/mobile/menu.html @@ -0,0 +1,5 @@ + +
    +{% block menu %} +{% endblock %} +
    \ No newline at end of file diff --git a/browser/templates/oob_elements.html b/browser/templates/oob_elements.html new file mode 100644 index 0000000..7a6b88a --- /dev/null +++ b/browser/templates/oob_elements.html @@ -0,0 +1,38 @@ + +{% block oobs %} +{% endblock %} + +
    +{% block filter %} +{% endblock %} +
    + + + + + +
    + {% block mobile_menu %} + {% endblock %} +
    + + +
    + {% block content %} + + {% endblock %} + +
    diff --git a/browser/templates/sentinel/desktop_content.html b/browser/templates/sentinel/desktop_content.html new file mode 100644 index 0000000..1bb6127 --- /dev/null +++ b/browser/templates/sentinel/desktop_content.html @@ -0,0 +1,9 @@ +
    + loading… {{ page }} / {{ total_pages }} +
    + + \ No newline at end of file diff --git a/browser/templates/sentinel/mobile_content.html b/browser/templates/sentinel/mobile_content.html new file mode 100644 index 0000000..f4ca68e --- /dev/null +++ b/browser/templates/sentinel/mobile_content.html @@ -0,0 +1,11 @@ + +
    + loading… {{ page }} / {{ total_pages }} +
    + + + \ No newline at end of file diff --git a/browser/templates/sentinel/wireless_error.svg b/browser/templates/sentinel/wireless_error.svg new file mode 100644 index 0000000..7df8fac --- /dev/null +++ b/browser/templates/sentinel/wireless_error.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + diff --git a/browser/templates/social/meta_base.html b/browser/templates/social/meta_base.html new file mode 100644 index 0000000..215768e --- /dev/null +++ b/browser/templates/social/meta_base.html @@ -0,0 +1,54 @@ +{# social/meta_base.html — common, non-conflicting head tags #} +{# Expected context: + site: { title, url, logo, default_image, twitter_site, fb_app_id, description? } + request: Quart request (for canonical derivation) + robots_override: optional string ("index,follow" / "noindex,nofollow") +#} + + + + +{# Canonical #} +{% set _site_url = site().url.rstrip('/') if site and site().url else '' %} +{% set canonical = ( + request.url if request and request.url + else (_site_url ~ request.path if request and _site_url else _site_url or None) +) %} + +{# Robots: allow override; default to index,follow #} + + +{# Theme & RSS #} + +{% if _site_url %} + +{% endif %} + +{# JSON-LD: Organization & WebSite are safe on all pages (don't conflict with BlogPosting) #} +{% set org_jsonld = { + "@context": "https://schema.org", + "@type": "Organization", + "name": site().title if site and site().title else "", + "url": _site_url if _site_url else None, + "logo": site().logo if site and site().logo else None +} %} + + +{% set website_jsonld = { + "@context": "https://schema.org", + "@type": "WebSite", + "name": site().title if site and site().title else "", + "url": _site_url if _site_url else canonical, + "potentialAction": { + "@type": "SearchAction", + "target": (_site_url ~ "/search?q={query}") if _site_url else None, + "query-input": "required name=query" + } +} %} + diff --git a/browser/templates/social/meta_site.html b/browser/templates/social/meta_site.html new file mode 100644 index 0000000..6ccebb7 --- /dev/null +++ b/browser/templates/social/meta_site.html @@ -0,0 +1,25 @@ +{# social/meta_site.html — generic site/page meta #} +{% include 'social/meta_base.html' %} + +{# Title/description (site-level) #} +{% set description = site().description or '' %} + +{{ base_title }} +{% if description %}{% endif %} +{% if canonical %}{% endif %} + +{# Open Graph (website) #} + + + +{% if description %}{% endif %} +{% if canonical %}{% endif %} +{% if site and site().default_image %}{% endif %} +{% if site and site().fb_app_id %}{% endif %} + +{# Twitter (website) #} + +{% if site and site().twitter_site %}{% endif %} + +{% if description %}{% endif %} +{% if site and site().default_image %}{% endif %} diff --git a/config.py b/config.py new file mode 100644 index 0000000..edee631 --- /dev/null +++ b/config.py @@ -0,0 +1,84 @@ +# suma_browser/config.py +from __future__ import annotations + +import asyncio +import os +from types import MappingProxyType +from typing import Any, Optional +import copy +import yaml + +# Default config path (override with APP_CONFIG_FILE) +_DEFAULT_CONFIG_PATH = os.environ.get( + "APP_CONFIG_FILE", + os.path.join(os.getcwd(), "config/app-config.yaml"), +) + +# Module state +_init_lock = asyncio.Lock() +_data_frozen: Any = None # read-only view (mappingproxy / tuples / frozensets) +_data_plain: Any = None # plain builtins for pretty-print / logging + +# ---------------- utils ---------------- +def _freeze(obj: Any) -> Any: + """Deep-freeze containers to read-only equivalents.""" + if isinstance(obj, dict): + # freeze children first, then wrap dict in mappingproxy + return MappingProxyType({k: _freeze(v) for k, v in obj.items()}) + if isinstance(obj, list): + return tuple(_freeze(v) for v in obj) + if isinstance(obj, set): + return frozenset(_freeze(v) for v in obj) + if isinstance(obj, tuple): + return tuple(_freeze(v) for v in obj) + return obj + +# ---------------- API ---------------- +async def init_config(path: Optional[str] = None, *, force: bool = False) -> None: + """ + Load YAML exactly as-is and cache both a frozen (read-only) and a plain copy. + Idempotent; pass force=True to reload. + """ + global _data_frozen, _data_plain + + if _data_frozen is not None and not force: + return + + async with _init_lock: + if _data_frozen is not None and not force: + return + + cfg_path = path or _DEFAULT_CONFIG_PATH + if not os.path.exists(cfg_path): + raise FileNotFoundError(f"Config file not found: {cfg_path}") + + with open(cfg_path, "r", encoding="utf-8") as f: + raw = yaml.safe_load(f) # whatever the YAML root is + + # store plain as loaded; store frozen for normal use + _data_plain = raw + _data_frozen = _freeze(raw) + +def config() -> Any: + """ + Return the read-only (frozen) config. Call init_config() first. + """ + if _data_frozen is None: + raise RuntimeError("init_config() has not been awaited yet.") + return _data_frozen + +def as_plain() -> Any: + """ + Return a deep copy of the plain config for safe external use/pretty printing. + """ + if _data_plain is None: + raise RuntimeError("init_config() has not been awaited yet.") + return copy.deepcopy(_data_plain) + +def pretty() -> str: + """ + YAML pretty string without mappingproxy noise. + """ + if _data_plain is None: + raise RuntimeError("init_config() has not been awaited yet.") + return yaml.safe_dump(_data_plain, sort_keys=False, allow_unicode=True) diff --git a/containers.py b/containers.py new file mode 100644 index 0000000..4e2fff7 --- /dev/null +++ b/containers.py @@ -0,0 +1,20 @@ +""" +Generic container concept — replaces hard-wired post_id FKs +with container_type + container_id soft references. +""" +from __future__ import annotations + + +class ContainerType: + PAGE = "page" + # Future: GROUP = "group", MARKET = "market", etc. + + +def container_filter(model, container_type: str, container_id: int): + """Return SQLAlchemy filter clauses for a container reference.""" + return [model.container_type == container_type, model.container_id == container_id] + + +def content_filter(model, content_type: str, content_id: int): + """Return SQLAlchemy filter clauses for a content reference (e.g. CalendarEntryContent).""" + return [model.content_type == content_type, model.content_id == content_id] diff --git a/db/__init__.py b/db/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/db/base.py b/db/base.py new file mode 100644 index 0000000..e070835 --- /dev/null +++ b/db/base.py @@ -0,0 +1,4 @@ +from __future__ import annotations +from sqlalchemy.orm import declarative_base + +Base = declarative_base() diff --git a/db/session.py b/db/session.py new file mode 100644 index 0000000..366f8e0 --- /dev/null +++ b/db/session.py @@ -0,0 +1,76 @@ +from __future__ import annotations +import os +from contextlib import asynccontextmanager +from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker, AsyncSession +from quart import Quart, g + +DATABASE_URL = ( + os.getenv("DATABASE_URL_ASYNC") + or os.getenv("DATABASE_URL") + or "postgresql+asyncpg://localhost/coop" +) + +_engine = create_async_engine( + DATABASE_URL, + future=True, + echo=False, + pool_pre_ping=True, + pool_size=-1 # ned to look at this!!! +) + +_Session = async_sessionmaker( + bind=_engine, + class_=AsyncSession, + expire_on_commit=False, +) + +@asynccontextmanager +async def get_session(): + """Always create a fresh AsyncSession for this block.""" + sess = _Session() + try: + yield sess + finally: + await sess.close() + + + +def register_db(app: Quart): + + @app.before_request + async def open_session(): + g.s = _Session() + g.tx = await g.s.begin() + g.had_error = False + + @app.after_request + async def maybe_commit(response): + # Runs BEFORE bytes are sent. + if not g.had_error and 200 <= response.status_code < 400: + try: + if hasattr(g, "tx"): + await g.tx.commit() + except Exception as e: + print(f'commit failed {e}') + if hasattr(g, "tx"): + await g.tx.rollback() + from quart import make_response + return await make_response("Commit failed", 500) + return response + + @app.teardown_request + async def finish(exc): + try: + # If an exception occurred OR we didn't commit (still in txn), roll back. + if hasattr(g, "s"): + if exc is not None or g.s.in_transaction(): + if hasattr(g, "tx"): + await g.tx.rollback() + finally: + if hasattr(g, "s"): + await g.s.close() + + @app.errorhandler(Exception) + async def mark_error(e): + g.had_error = True + raise diff --git a/editor/build.mjs b/editor/build.mjs new file mode 100644 index 0000000..13f4cb3 --- /dev/null +++ b/editor/build.mjs @@ -0,0 +1,45 @@ +import * as esbuild from "esbuild"; +import path from "path"; +import { fileURLToPath } from "url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const isProduction = process.env.NODE_ENV === "production"; +const isWatch = process.argv.includes("--watch"); + +/** @type {import('esbuild').BuildOptions} */ +const opts = { + alias: { + "koenig-styles": path.resolve( + __dirname, + "node_modules/@tryghost/koenig-lexical/dist/index.css" + ), + }, + entryPoints: ["src/index.jsx"], + bundle: true, + outdir: "../static/scripts", + entryNames: "editor", + format: "iife", + target: "es2020", + jsx: "automatic", + minify: isProduction, + define: { + "process.env.NODE_ENV": JSON.stringify( + isProduction ? "production" : "development" + ), + }, + loader: { + ".svg": "dataurl", + ".woff": "file", + ".woff2": "file", + ".ttf": "file", + }, + logLevel: "info", +}; + +if (isWatch) { + const ctx = await esbuild.context(opts); + await ctx.watch(); + console.log("Watching for changes..."); +} else { + await esbuild.build(opts); +} diff --git a/editor/node_modules/.bin/esbuild b/editor/node_modules/.bin/esbuild new file mode 120000 index 0000000..c83ac07 --- /dev/null +++ b/editor/node_modules/.bin/esbuild @@ -0,0 +1 @@ +../esbuild/bin/esbuild \ No newline at end of file diff --git a/editor/node_modules/.bin/loose-envify b/editor/node_modules/.bin/loose-envify new file mode 120000 index 0000000..ed9009c --- /dev/null +++ b/editor/node_modules/.bin/loose-envify @@ -0,0 +1 @@ +../loose-envify/cli.js \ No newline at end of file diff --git a/editor/node_modules/.package-lock.json b/editor/node_modules/.package-lock.json new file mode 100644 index 0000000..2451fee --- /dev/null +++ b/editor/node_modules/.package-lock.json @@ -0,0 +1,116 @@ +{ + "name": "coop-lexical-editor", + "version": "2.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@esbuild/linux-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", + "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@tryghost/koenig-lexical": { + "version": "1.7.10", + "resolved": "https://registry.npmjs.org/@tryghost/koenig-lexical/-/koenig-lexical-1.7.10.tgz", + "integrity": "sha512-6tI2kbSzZ669hQ5GxpENB8n2aDLugZDmpR/nO0GriduOZJLLN8AdDDa/S3Y8dpF5/cOGKsOxFRj3oLGRDOi6tw==" + }, + "node_modules/esbuild": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", + "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.24.2", + "@esbuild/android-arm": "0.24.2", + "@esbuild/android-arm64": "0.24.2", + "@esbuild/android-x64": "0.24.2", + "@esbuild/darwin-arm64": "0.24.2", + "@esbuild/darwin-x64": "0.24.2", + "@esbuild/freebsd-arm64": "0.24.2", + "@esbuild/freebsd-x64": "0.24.2", + "@esbuild/linux-arm": "0.24.2", + "@esbuild/linux-arm64": "0.24.2", + "@esbuild/linux-ia32": "0.24.2", + "@esbuild/linux-loong64": "0.24.2", + "@esbuild/linux-mips64el": "0.24.2", + "@esbuild/linux-ppc64": "0.24.2", + "@esbuild/linux-riscv64": "0.24.2", + "@esbuild/linux-s390x": "0.24.2", + "@esbuild/linux-x64": "0.24.2", + "@esbuild/netbsd-arm64": "0.24.2", + "@esbuild/netbsd-x64": "0.24.2", + "@esbuild/openbsd-arm64": "0.24.2", + "@esbuild/openbsd-x64": "0.24.2", + "@esbuild/sunos-x64": "0.24.2", + "@esbuild/win32-arm64": "0.24.2", + "@esbuild/win32-ia32": "0.24.2", + "@esbuild/win32-x64": "0.24.2" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "dependencies": { + "loose-envify": "^1.1.0" + } + } + } +} diff --git a/editor/node_modules/@esbuild/linux-x64/README.md b/editor/node_modules/@esbuild/linux-x64/README.md new file mode 100644 index 0000000..b2f1930 --- /dev/null +++ b/editor/node_modules/@esbuild/linux-x64/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/editor/node_modules/@esbuild/linux-x64/bin/esbuild b/editor/node_modules/@esbuild/linux-x64/bin/esbuild new file mode 100755 index 0000000..3ae20d0 Binary files /dev/null and b/editor/node_modules/@esbuild/linux-x64/bin/esbuild differ diff --git a/editor/node_modules/@esbuild/linux-x64/package.json b/editor/node_modules/@esbuild/linux-x64/package.json new file mode 100644 index 0000000..ccc2a1e --- /dev/null +++ b/editor/node_modules/@esbuild/linux-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@esbuild/linux-x64", + "version": "0.24.2", + "description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.", + "repository": { + "type": "git", + "url": "git+https://github.com/evanw/esbuild.git" + }, + "license": "MIT", + "preferUnplugged": true, + "engines": { + "node": ">=18" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ] +} diff --git a/editor/node_modules/@tryghost/koenig-lexical/LICENSE b/editor/node_modules/@tryghost/koenig-lexical/LICENSE new file mode 100644 index 0000000..efad547 --- /dev/null +++ b/editor/node_modules/@tryghost/koenig-lexical/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013-2026 Ghost Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/editor/node_modules/@tryghost/koenig-lexical/README.md b/editor/node_modules/@tryghost/koenig-lexical/README.md new file mode 100644 index 0000000..8cd5523 --- /dev/null +++ b/editor/node_modules/@tryghost/koenig-lexical/README.md @@ -0,0 +1,130 @@ +# Koenig - Lexical edition + +Ghost editor, based on the Lexical framework. + +## Development + +The editor can be run in two modes: +- standalone mode: demo version that runs without a dependency on Ghost +- integrated mode: integrated into Ghost Admin + +### Standalone mode + +Run `yarn dev` to start the editor in standalone mode for development on http://localhost:5173. This command generates a demo site from the `index.html` file, which renders the demo app in `demo/demo.jsx`. + +### Integrated mode + +In order to run the editor inside Ghost Admin, follow the 3 steps below: + +1. Link Koenig server-side dependencies inside Ghost + - Run `yarn link` inside `Koenig/packages/kg-default-nodes` and `Koenig/packages/kg-lexical-html-renderer` + - Paste the output at the root of the Ghost monorepo: + - `yarn link @tryghost/kg-default-nodes` + - `yarn link @tryghost/kg-lexical-html-renderer` + +2. Start Ghost in dev mode: inside the Ghost monorepo, run `yarn dev --lexical`. + +3. Start the editor in dev mode: inside the Koenig monorepo, run `yarn dev`. + +Now, if you navigate to Ghost Admin at http://localhost:2368/ghost and open a post, it will use your local version of the editor. Changes to the editor will be reflected inside Ghost Admin after a few seconds - the time for the editor to get rebuilt. + +### Specific card setup + +#### Gif card + +To see this card locally, you need to create `.env.local` file in `koenig-lexical` root package with the next data: +``` +VITE_TENOR_API_KEY=xxx +``` + +How to get the tenor key is described here https://ghost.org/docs/config/#tenor + +#### Bookmark & Embed cards + +These cards make external web requests. Since the demo doesn't have a server to process these requests, we must fetch these resources on the front end. To do this we need to enable CORS, which is most easily done with a browser extension like 'Test CORS' for Chrome. Otherwise you will see blocked requests logging errors in the console. This can also be avoided by using test data directly without fetching via `fetchEmbed.js`. + +## Additional notes + +### Project structure + +**`/src`** + +The main module source. `/src/index.js` is the entry point for the exposed module and should export everything needed to use the module from an external app. + +**`/demo`** + +Used for developing/demoing the editor. Renders a blank editor with all features enabled. + +### Styling + +**CSS** + +Styling should be done using Tailwind classes where possible. + +All styles are scoped under `.koenig-lexical` class to avoid clashes and keep styling as isolated as possible. PostCSS nesting support is present to make this easier. + +- Styles located in `src/styles/` are included in the final built module. +- Styles located in `demo/*.css` are only used in the demo and will not be included in the built module. + +When packaging the module, styles are included inside the JS file rather than being separate to allow for a single import of the module in the consuming app. + +**SVGs** + +SVGs can be imported as React components in the [same way as create-react-app](https://create-react-app.dev/docs/adding-images-fonts-and-files/#adding-svgs). Typically files are stored in `src/assets/`. + +All imported files are processed/optimised via SVGO (see `svgo.config.js` for optimisation config) and included in the built JS file. + +## Testing + +We use [Vitest](https://vitest.dev) for unit tests and [Playwright](https://playwright.dev) for e2e testing. + +- `yarn test` runs all tests and exits +- `yarn test:unit` runs unit tests +- `yarn test:unit:watch` runs unit tests and starts a test watcher that re-runs tests on file changes +- `yarn test:unit:watch --ui` runs unit tests and opens a browser UI for exploring and re-running tests +- `yarn test:e2e` runs e2e tests +- `yarn test:e2e --headed` runs tests in browser so you can watch the tests execute +- `yarn test:slowmo` same as `yarn test:e2e --headed` but adds 100ms delay between instructions to make it easier to see what's happening (note that some tests may fail or timeout due to the added delays) +- `yarn test:e2e --ui` opens a [browser UI](https://playwright.dev/docs/test-ui-mode) in watch mode for exploring and re-running tests +- `yarn test:e2e --ui --headed` same as `yarn test:e2e --ui` but also runs tests in browser so you can watch the tests execute + +Before tests are started we build a version of the demo app that is used for the unit tests. + +When developing it can be useful to limit unit tests to specific keywords (taken from `describe` or `it/test` names). That's possible using the `-t` param and works with any of the above test commands, e.g.: + +- `yarn test:unit:watch -t "buildCardMenu"` + +### How to debug e2e tests on CI + +You can download the report in case of tests were failed. It can be found in the actions `Summary` in the `Artifacts` section. +To check traces, run command `npx playwright show-trace trace.zip`. +More information about traces can be found here https://playwright.dev/docs/trace-viewer + +### ESM in e2e tests + +Node enables ECMAScript modules if `type: 'module'` in package.json file. It leads to some restrictions: +- [No require, exports, module.exports, __filename, __dirname](https://github.com/GrosSacASac/node/blob/master/doc/api/esm.md#no-require-exports-moduleexports-__filename-__dirname) +- [Mandatory file extensions](https://github.com/GrosSacASac/node/blob/master/doc/api/esm.md#mandatory-file-extensions) +- [No require.extensions](https://github.com/GrosSacASac/node/blob/master/doc/api/esm.md#no-requireextensions). It means we don't have control over the extensions list. Further will be a description of why this is important. + +We can make file extension optional with [--experimental-specifier-resolution](https://nodejs.org/api/cli.html#--experimental-specifier-resolutionmode) +flag, which we use. But node is not recognized `jsx` extension. +It can be solved with [node loaders](https://github.com/nodejs/loaders-test/tree/main/commonjs-extension-resolution-loader), whereas +as they're still in [experimental mode](https://nodejs.org/api/esm.html#esm_experimental_loaders), there is no appropriate +implementation for this use case. +The same issue was raised in the babel repo, but the loader won't be added while node loaders are +in [experimental mode](https://github.com/babel/babel/issues/11934). + +We can add our loader implementation to solve the issue. Still, in reality, we shouldn't need real +JSX components in e2e tests. It can be a situation when some constants locate in the `jsx` file. In this case, +we can move them to js file. If it is a problem in the future, we can add our implementation of the loader or +add an extension to all imports in the project. + +### Editor integration + +There's a [vitest vscode extension](https://marketplace.visualstudio.com/items?itemName=ZixuanChen.vitest-explorer) that +lets you run and debug individual unit tests/groups directly inside vscode. + +## Deployment + +Koenig packages are shipped via Lerna at the monorepo level. Please refer to the monorepo's [README](../../README.md) for deployment instructions. diff --git a/editor/node_modules/@tryghost/koenig-lexical/dist/Koenig-editor-1.png b/editor/node_modules/@tryghost/koenig-lexical/dist/Koenig-editor-1.png new file mode 100644 index 0000000..f39338f Binary files /dev/null and b/editor/node_modules/@tryghost/koenig-lexical/dist/Koenig-editor-1.png differ diff --git a/editor/node_modules/@tryghost/koenig-lexical/dist/Koenig-editor-2.png b/editor/node_modules/@tryghost/koenig-lexical/dist/Koenig-editor-2.png new file mode 100644 index 0000000..d0b3d73 Binary files /dev/null and b/editor/node_modules/@tryghost/koenig-lexical/dist/Koenig-editor-2.png differ diff --git a/editor/node_modules/@tryghost/koenig-lexical/dist/assets/fonts/Inter.ttf b/editor/node_modules/@tryghost/koenig-lexical/dist/assets/fonts/Inter.ttf new file mode 100644 index 0000000..1cb674b Binary files /dev/null and b/editor/node_modules/@tryghost/koenig-lexical/dist/assets/fonts/Inter.ttf differ diff --git a/editor/node_modules/@tryghost/koenig-lexical/dist/index.css b/editor/node_modules/@tryghost/koenig-lexical/dist/index.css new file mode 100644 index 0000000..0e7ced1 --- /dev/null +++ b/editor/node_modules/@tryghost/koenig-lexical/dist/index.css @@ -0,0 +1,6 @@ +.koenig-lexical *,.koenig-lexical :before,.koenig-lexical :after{box-sizing:border-box;max-width:revert;max-height:revert;min-width:revert;min-height:revert;border-width:0;border-style:solid;border-color:currentColor}.koenig-lexical :before,.koenig-lexical :after{--tw-content: ""}.koenig-lexical html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif}.koenig-lexical body{margin:0;line-height:inherit}.koenig-lexical hr{height:0;color:inherit;border-top-width:1px}.koenig-lexical abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.koenig-lexical h1,.koenig-lexical h2,.koenig-lexical h3,.koenig-lexical h4,.koenig-lexical h5,.koenig-lexical h6{font-size:inherit;font-weight:inherit}.koenig-lexical a{color:inherit;text-decoration:inherit}.koenig-lexical b,.koenig-lexical strong{font-weight:bolder}.koenig-lexical code,.koenig-lexical kbd,.koenig-lexical samp,.koenig-lexical pre{font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}.koenig-lexical small{font-size:80%}.koenig-lexical sub,.koenig-lexical sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.koenig-lexical sub{bottom:-.25em}.koenig-lexical sup{top:-.5em}.koenig-lexical table{text-indent:0;border-color:inherit;border-collapse:collapse}.koenig-lexical button,.koenig-lexical input,.koenig-lexical optgroup,.koenig-lexical select,.koenig-lexical textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}.koenig-lexical button,.koenig-lexical select{text-transform:none}.koenig-lexical button,.koenig-lexical [type=button],.koenig-lexical [type=reset],.koenig-lexical [type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}.koenig-lexical :-moz-focusring{outline:none}.koenig-lexical :-moz-ui-invalid{box-shadow:none}.koenig-lexical progress{vertical-align:baseline}.koenig-lexical ::-webkit-inner-spin-button,.koenig-lexical ::-webkit-outer-spin-button{height:auto}.koenig-lexical [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.koenig-lexical ::-webkit-search-decoration{-webkit-appearance:none}.koenig-lexical ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.koenig-lexical summary{display:list-item}.koenig-lexical blockquote,.koenig-lexical dl,.koenig-lexical dd,.koenig-lexical h1,.koenig-lexical h2,.koenig-lexical h3,.koenig-lexical h4,.koenig-lexical h5,.koenig-lexical h6,.koenig-lexical hr,.koenig-lexical figure,.koenig-lexical p,.koenig-lexical pre{margin:0}.koenig-lexical fieldset{margin:0;padding:0}.koenig-lexical legend{padding:0}.koenig-lexical ol,.koenig-lexical ul,.koenig-lexical menu{list-style:none;margin:0;padding:0}.koenig-lexical textarea{resize:vertical}.koenig-lexical input::-moz-placeholder,.koenig-lexical textarea::-moz-placeholder{opacity:1;color:#aeb7c1}.koenig-lexical input::placeholder,.koenig-lexical textarea::placeholder{opacity:1;color:#aeb7c1}.koenig-lexical button:focus-visible,.koenig-lexical input:focus-visible{outline:none}.koenig-lexical img,.koenig-lexical svg,.koenig-lexical video,.koenig-lexical canvas,.koenig-lexical audio,.koenig-lexical iframe,.koenig-lexical embed,.koenig-lexical object{display:block;vertical-align:middle}.koenig-lexical img,.koenig-lexical video{max-width:100%;height:auto}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(20 184 255 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(20 184 255 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.\!container{width:100%!important}.container{width:100%}@media (min-width: 500px){.\!container{max-width:500px!important}.container{max-width:500px}}@media (min-width: 640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width: 768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width: 1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width: 1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width: 1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.koenig-lexical .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.koenig-lexical .pointer-events-none{pointer-events:none}.koenig-lexical .pointer-events-auto{pointer-events:auto}.koenig-lexical .visible{visibility:visible}.koenig-lexical .invisible{visibility:hidden}.koenig-lexical .collapse{visibility:collapse}.koenig-lexical .static{position:static}.koenig-lexical .fixed{position:fixed}.koenig-lexical .absolute{position:absolute}.koenig-lexical .relative{position:relative}.koenig-lexical .sticky{position:sticky}.koenig-lexical .inset-0{top:0;right:0;bottom:0;left:0}.koenig-lexical .inset-8{top:3.2rem;right:3.2rem;bottom:3.2rem;left:3.2rem}.koenig-lexical .inset-x-\[-1px\]{left:-1px;right:-1px}.koenig-lexical .inset-y-0{top:0;bottom:0}.koenig-lexical .\!top-\[-1px\]{top:-1px!important}.koenig-lexical .-left-2{left:-.8rem}.koenig-lexical .-right-3{right:-1.2rem}.koenig-lexical .-top-0\.5{top:-.2rem}.koenig-lexical .-top-8{top:-3.2rem}.koenig-lexical .bottom-0{bottom:0}.koenig-lexical .bottom-1{bottom:.4rem}.koenig-lexical .bottom-4{bottom:1.6rem}.koenig-lexical .bottom-\[1\.1em\]{bottom:1.1em}.koenig-lexical .bottom-full{bottom:100%}.koenig-lexical .left-0{left:0}.koenig-lexical .left-1\/2{left:50%}.koenig-lexical .left-4{left:1.6rem}.koenig-lexical .left-6{left:2.4rem}.koenig-lexical .left-\[-16px\]{left:-16px}.koenig-lexical .left-\[-32px\]{left:-32px}.koenig-lexical .left-\[-6rem\]{left:-6rem}.koenig-lexical .left-\[1em\]{left:1em}.koenig-lexical .left-\[22px\]{left:22px}.koenig-lexical .left-\[2px\]{left:2px}.koenig-lexical .left-\[3px\]{left:3px}.koenig-lexical .left-\[55\%\]{left:55%}.koenig-lexical .left-\[6px\]{left:6px}.koenig-lexical .right-0{right:0}.koenig-lexical .right-1{right:.4rem}.koenig-lexical .right-1\.5{right:.6rem}.koenig-lexical .right-16{right:6.4rem}.koenig-lexical .right-2{right:.8rem}.koenig-lexical .right-20{right:8rem}.koenig-lexical .right-3{right:1.2rem}.koenig-lexical .right-5{right:2rem}.koenig-lexical .right-6{right:2.4rem}.koenig-lexical .right-\[-100\%\]{right:-100%}.koenig-lexical .right-\[6px\]{right:6px}.koenig-lexical .top-0{top:0}.koenig-lexical .top-1{top:.4rem}.koenig-lexical .top-1\.5{top:.6rem}.koenig-lexical .top-1\/2{top:50%}.koenig-lexical .top-2{top:.8rem}.koenig-lexical .top-4{top:1.6rem}.koenig-lexical .top-5{top:2rem}.koenig-lexical .top-6{top:2.4rem}.koenig-lexical .top-\[-\.6rem\]{top:-.6rem}.koenig-lexical .top-\[-2px\]{top:-2px}.koenig-lexical .top-\[-46px\]{top:-46px}.koenig-lexical .top-\[-6px\]{top:-6px}.koenig-lexical .top-\[1\.5rem\]{top:1.5rem}.koenig-lexical .top-\[2px\]{top:2px}.koenig-lexical .top-\[3px\]{top:3px}.koenig-lexical .top-\[5px\]{top:5px}.koenig-lexical .z-0{z-index:0}.koenig-lexical .z-10{z-index:10}.koenig-lexical .z-20{z-index:20}.koenig-lexical .z-40{z-index:40}.koenig-lexical .z-50{z-index:50}.koenig-lexical .z-\[-1\]{z-index:-1}.koenig-lexical .z-\[10000\]{z-index:10000}.koenig-lexical .z-\[1000\]{z-index:1000}.koenig-lexical .z-\[9999999\]{z-index:9999999}.koenig-lexical .\!m-0{margin:0!important}.koenig-lexical .-m-1{margin:-.4rem}.koenig-lexical .m-0{margin:0}.koenig-lexical .m-2{margin:.8rem}.koenig-lexical .m-3{margin:1.2rem}.koenig-lexical .m-\[1rem\]{margin:1rem}.koenig-lexical .\!-mx-3{margin-left:-1.2rem!important;margin-right:-1.2rem!important}.koenig-lexical .\!my-0{margin-top:0!important;margin-bottom:0!important}.koenig-lexical .-mx-1{margin-left:-.4rem;margin-right:-.4rem}.koenig-lexical .-mx-6{margin-left:-2.4rem;margin-right:-2.4rem}.koenig-lexical .mx-1{margin-left:.4rem;margin-right:.4rem}.koenig-lexical .mx-2{margin-left:.8rem;margin-right:.8rem}.koenig-lexical .mx-6{margin-left:2.4rem;margin-right:2.4rem}.koenig-lexical .mx-\[-\.2rem\]{margin-left:-.2rem;margin-right:-.2rem}.koenig-lexical .mx-\[calc\(50\%-\(50vw-var\(--kg-breakout-adjustment-with-fallback\)\)-\.8rem\)\]{margin-left:calc(50% - (50vw - var(--kg-breakout-adjustment-with-fallback)) - .8rem);margin-right:calc(50% - (50vw - var(--kg-breakout-adjustment-with-fallback)) - .8rem)}.koenig-lexical .mx-\[calc\(50\%-50vw\)\]{margin-left:calc(50% - 50vw);margin-right:calc(50% - 50vw)}.koenig-lexical .mx-auto{margin-left:auto;margin-right:auto}.koenig-lexical .my-1{margin-top:.4rem;margin-bottom:.4rem}.koenig-lexical .my-2{margin-top:.8rem;margin-bottom:.8rem}.koenig-lexical .my-3{margin-top:1.2rem;margin-bottom:1.2rem}.koenig-lexical .my-4{margin-top:1.6rem;margin-bottom:1.6rem}.koenig-lexical .my-5{margin-top:2rem;margin-bottom:2rem}.koenig-lexical .my-8{margin-top:3.2rem;margin-bottom:3.2rem}.koenig-lexical .my-\[\.2rem\]{margin-top:.2rem;margin-bottom:.2rem}.koenig-lexical .my-auto{margin-top:auto;margin-bottom:auto}.koenig-lexical .\!mt-0{margin-top:0!important}.koenig-lexical .\!mt-2{margin-top:.8rem!important}.koenig-lexical .\!mt-3{margin-top:1.2rem!important}.koenig-lexical .\!mt-4{margin-top:1.6rem!important}.koenig-lexical .\!mt-\[-1px\]{margin-top:-1px!important}.koenig-lexical .-mb-px{margin-bottom:-1px}.koenig-lexical .-ml-1{margin-left:-.4rem}.koenig-lexical .mb-0{margin-bottom:0}.koenig-lexical .mb-1{margin-bottom:.4rem}.koenig-lexical .mb-1\.5{margin-bottom:.6rem}.koenig-lexical .mb-10{margin-bottom:4rem}.koenig-lexical .mb-12{margin-bottom:4.8rem}.koenig-lexical .mb-2{margin-bottom:.8rem}.koenig-lexical .mb-3{margin-bottom:1.2rem}.koenig-lexical .mb-4{margin-bottom:1.6rem}.koenig-lexical .mb-6{margin-bottom:2.4rem}.koenig-lexical .mb-\[1px\]{margin-bottom:1px}.koenig-lexical .ml-1{margin-left:.4rem}.koenig-lexical .ml-2{margin-left:.8rem}.koenig-lexical .ml-3{margin-left:1.2rem}.koenig-lexical .ml-4{margin-left:1.6rem}.koenig-lexical .ml-\[\.7rem\]{margin-left:.7rem}.koenig-lexical .ml-\[66px\]{margin-left:66px}.koenig-lexical .ml-auto{margin-left:auto}.koenig-lexical .ml-px{margin-left:1px}.koenig-lexical .mr-1{margin-right:.4rem}.koenig-lexical .mr-2{margin-right:.8rem}.koenig-lexical .mr-3{margin-right:1.2rem}.koenig-lexical .mr-4{margin-right:1.6rem}.koenig-lexical .mr-6{margin-right:2.4rem}.koenig-lexical .mr-9{margin-right:3.6rem}.koenig-lexical .mt-0{margin-top:0}.koenig-lexical .mt-0\.5{margin-top:.2rem}.koenig-lexical .mt-1{margin-top:.4rem}.koenig-lexical .mt-10{margin-top:4rem}.koenig-lexical .mt-12{margin-top:4.8rem}.koenig-lexical .mt-2{margin-top:.8rem}.koenig-lexical .mt-20{margin-top:8rem}.koenig-lexical .mt-3{margin-top:1.2rem}.koenig-lexical .mt-4{margin-top:1.6rem}.koenig-lexical .mt-6{margin-top:2.4rem}.koenig-lexical .mt-8{margin-top:3.2rem}.koenig-lexical .mt-\[-1px\]{margin-top:-1px}.koenig-lexical .mt-\[\.6rem\]{margin-top:.6rem}.koenig-lexical .mt-\[20px\]{margin-top:20px}.koenig-lexical .mt-\[2px\]{margin-top:2px}.koenig-lexical .mt-auto{margin-top:auto}.koenig-lexical .mt-px{margin-top:1px}.koenig-lexical .line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.koenig-lexical .line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.koenig-lexical .block{display:block}.koenig-lexical .inline-block{display:inline-block}.koenig-lexical .inline{display:inline}.koenig-lexical .flex{display:flex}.koenig-lexical .table{display:table}.koenig-lexical .grid{display:grid}.koenig-lexical .contents{display:contents}.koenig-lexical .hidden{display:none}.koenig-lexical .aspect-\[3\/2\]{aspect-ratio:3/2}.koenig-lexical .aspect-square{aspect-ratio:1 / 1}.koenig-lexical .size-12{width:4.8rem;height:4.8rem}.koenig-lexical .size-14{width:5.6rem;height:5.6rem}.koenig-lexical .size-16{width:6.4rem;height:6.4rem}.koenig-lexical .size-2{width:.8rem;height:.8rem}.koenig-lexical .size-20{width:8rem;height:8rem}.koenig-lexical .size-3{width:1.2rem;height:1.2rem}.koenig-lexical .size-32{width:12.8rem;height:12.8rem}.koenig-lexical .size-4{width:1.6rem;height:1.6rem}.koenig-lexical .size-5{width:2rem;height:2rem}.koenig-lexical .size-6{width:2.4rem;height:2.4rem}.koenig-lexical .size-7{width:2.8rem;height:2.8rem}.koenig-lexical .size-8{width:3.2rem;height:3.2rem}.koenig-lexical .size-9{width:3.6rem;height:3.6rem}.koenig-lexical .size-\[1\.4rem\]{width:1.4rem;height:1.4rem}.koenig-lexical .size-\[1\.5rem\]{width:1.5rem;height:1.5rem}.koenig-lexical .size-\[1\.8rem\]{width:1.8rem;height:1.8rem}.koenig-lexical .size-\[18px\]{width:18px;height:18px}.koenig-lexical .size-\[1rem\]{width:1rem;height:1rem}.koenig-lexical .size-\[3rem\]{width:3rem;height:3rem}.koenig-lexical .size-\[50px\]{width:50px;height:50px}.koenig-lexical .size-full{width:100%;height:100%}.koenig-lexical .\!h-3{height:1.2rem!important}.koenig-lexical .h-0{height:0px}.koenig-lexical .h-1{height:.4rem}.koenig-lexical .h-10{height:4rem}.koenig-lexical .h-11{height:4.4rem}.koenig-lexical .h-12{height:4.8rem}.koenig-lexical .h-20{height:8rem}.koenig-lexical .h-3{height:1.2rem}.koenig-lexical .h-32{height:12.8rem}.koenig-lexical .h-4{height:1.6rem}.koenig-lexical .h-5{height:2rem}.koenig-lexical .h-7{height:2.8rem}.koenig-lexical .h-8{height:3.2rem}.koenig-lexical .h-9{height:3.6rem}.koenig-lexical .h-\[100vh\]{height:100vh}.koenig-lexical .h-\[120px\]{height:120px}.koenig-lexical .h-\[1px\]{height:1px}.koenig-lexical .h-\[1rem\]{height:1rem}.koenig-lexical .h-\[22px\]{height:22px}.koenig-lexical .h-\[26px\]{height:26px}.koenig-lexical .h-\[2px\]{height:2px}.koenig-lexical .h-\[30px\]{height:30px}.koenig-lexical .h-\[40px\]{height:40px}.koenig-lexical .h-\[5\.2rem\]{height:5.2rem}.koenig-lexical .h-\[540px\]{height:540px}.koenig-lexical .h-\[64px\]{height:64px}.koenig-lexical .h-\[96px\]{height:96px}.koenig-lexical .h-auto{height:auto}.koenig-lexical .h-full{height:100%}.koenig-lexical .h-screen{height:100vh}.koenig-lexical .max-h-64{max-height:25.6rem}.koenig-lexical .max-h-\[100\%\]{max-height:100%}.koenig-lexical .max-h-\[214px\]{max-height:214px}.koenig-lexical .max-h-\[30vh\]{max-height:30vh}.koenig-lexical .max-h-\[376px\]{max-height:376px}.koenig-lexical .max-h-\[420px\]{max-height:420px}.koenig-lexical .max-h-\[44px\]{max-height:44px}.koenig-lexical .min-h-\[120px\]{min-height:120px}.koenig-lexical .min-h-\[170px\]{min-height:170px}.koenig-lexical .min-h-\[180px\]{min-height:180px}.koenig-lexical .min-h-\[3\.5vh\]{min-height:3.5vh}.koenig-lexical .min-h-\[40px\]{min-height:40px}.koenig-lexical .min-h-\[40vh\]{min-height:40vh}.koenig-lexical .min-h-\[60vh\]{min-height:60vh}.koenig-lexical .min-h-\[80vh\]{min-height:80vh}.koenig-lexical .\!w-3{width:1.2rem!important}.koenig-lexical .w-0{width:0px}.koenig-lexical .w-1\/5{width:20%}.koenig-lexical .w-11\/12{width:91.666667%}.koenig-lexical .w-16{width:6.4rem}.koenig-lexical .w-20{width:8rem}.koenig-lexical .w-3{width:1.2rem}.koenig-lexical .w-3\/5{width:60%}.koenig-lexical .w-4{width:1.6rem}.koenig-lexical .w-5{width:2rem}.koenig-lexical .w-7{width:2.8rem}.koenig-lexical .w-8{width:3.2rem}.koenig-lexical .w-9{width:3.6rem}.koenig-lexical .w-\[1170px\]{width:1170px}.koenig-lexical .w-\[136\%\]{width:136%}.koenig-lexical .w-\[1rem\]{width:1rem}.koenig-lexical .w-\[240px\]{width:240px}.koenig-lexical .w-\[312px\]{width:312px}.koenig-lexical .w-\[320px\]{width:320px}.koenig-lexical .w-\[400px\]{width:400px}.koenig-lexical .w-\[42px\]{width:42px}.koenig-lexical .w-\[560px\]{width:560px}.koenig-lexical .w-\[60\%\]{width:60%}.koenig-lexical .w-\[7\.2rem\]{width:7.2rem}.koenig-lexical .w-\[740px\]{width:740px}.koenig-lexical .w-\[80px\]{width:80px}.koenig-lexical .w-\[calc\(100vw\+2px\)\]{width:calc(100vw + 2px)}.koenig-lexical .w-\[calc\(740px\+4rem\)\]{width:calc(740px + 4rem)}.koenig-lexical .w-\[calc\(75vw-var\(--kg-breakout-adjustment-with-fallback\)\+2px\)\]{width:calc(75vw - var(--kg-breakout-adjustment-with-fallback) + 2px)}.koenig-lexical .w-\[max-content\]{width:-moz-max-content;width:max-content}.koenig-lexical .w-auto{width:auto}.koenig-lexical .w-full{width:100%}.koenig-lexical .w-px{width:1px}.koenig-lexical .min-w-\[296px\]{min-width:296px}.koenig-lexical .min-w-\[33\%\]{min-width:33%}.koenig-lexical .min-w-\[5\.2rem\]{min-width:5.2rem}.koenig-lexical .min-w-\[5px\]{min-width:5px}.koenig-lexical .min-w-\[5rem\]{min-width:5rem}.koenig-lexical .min-w-\[6\.8rem\]{min-width:6.8rem}.koenig-lexical .min-w-\[auto\]{min-width:auto}.koenig-lexical .min-w-\[calc\(100\%\+3\.6rem\)\]{min-width:calc(100% + 3.6rem)}.koenig-lexical .min-w-\[initial\]{min-width:initial}.koenig-lexical .min-w-full{min-width:100%}.koenig-lexical .max-w-2xl{max-width:67.2rem}.koenig-lexical .max-w-\[1172px\]{max-width:1172px}.koenig-lexical .max-w-\[240px\]{max-width:240px}.koenig-lexical .max-w-\[500px\]{max-width:500px}.koenig-lexical .max-w-\[550px\]{max-width:550px}.koenig-lexical .max-w-\[65\%\]{max-width:65%}.koenig-lexical .max-w-\[740px\]{max-width:740px}.koenig-lexical .max-w-\[96px\]{max-width:96px}.koenig-lexical .max-w-fit{max-width:-moz-fit-content;max-width:fit-content}.koenig-lexical .max-w-sm{max-width:38.4rem}.koenig-lexical .flex-1{flex:1 1 0%}.koenig-lexical .\!shrink{flex-shrink:1!important}.koenig-lexical .shrink{flex-shrink:1}.koenig-lexical .shrink-0{flex-shrink:0}.koenig-lexical .flex-grow,.koenig-lexical .grow{flex-grow:1}.koenig-lexical .basis-0{flex-basis:0px}.koenig-lexical .basis-full{flex-basis:100%}.koenig-lexical .origin-left{transform-origin:left}.koenig-lexical .-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .-translate-y-2{--tw-translate-y: -.8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .-translate-y-full{--tw-translate-y: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .translate-x-\[calc\(50vw-50\%\+\.8rem-var\(--kg-breakout-adjustment-with-fallback\)\)\]{--tw-translate-x: calc(50vw - 50% + .8rem - var(--kg-breakout-adjustment-with-fallback));transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .translate-y-\[-100\%\]{--tw-translate-y: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.koenig-lexical .animate-spin{animation:spin 1s linear infinite}.koenig-lexical .cursor-default{cursor:default}.koenig-lexical .cursor-pointer{cursor:pointer}.koenig-lexical .cursor-text{cursor:text}.koenig-lexical .cursor-zoom-in{cursor:zoom-in}.koenig-lexical .cursor-zoom-out{cursor:zoom-out}.koenig-lexical .touch-none{touch-action:none}.koenig-lexical .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.koenig-lexical .resize-none{resize:none}.koenig-lexical .resize{resize:both}.koenig-lexical .scroll-p-2{scroll-padding:.8rem}.koenig-lexical .\!list-none{list-style-type:none!important}.koenig-lexical .list-none{list-style-type:none}.koenig-lexical .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.koenig-lexical .flex-row{flex-direction:row}.koenig-lexical .flex-row-reverse{flex-direction:row-reverse}.koenig-lexical .flex-col{flex-direction:column}.koenig-lexical .flex-col-reverse{flex-direction:column-reverse}.koenig-lexical .flex-wrap{flex-wrap:wrap}.koenig-lexical .items-start{align-items:flex-start}.koenig-lexical .items-end{align-items:flex-end}.koenig-lexical .items-center{align-items:center}.koenig-lexical .justify-start{justify-content:flex-start}.koenig-lexical .justify-end{justify-content:flex-end}.koenig-lexical .justify-center{justify-content:center}.koenig-lexical .justify-between{justify-content:space-between}.koenig-lexical .justify-evenly{justify-content:space-evenly}.koenig-lexical .gap-1{gap:.4rem}.koenig-lexical .gap-1\.5{gap:.6rem}.koenig-lexical .gap-2{gap:.8rem}.koenig-lexical .gap-3{gap:1.2rem}.koenig-lexical .gap-4{gap:1.6rem}.koenig-lexical .gap-6{gap:2.4rem}.koenig-lexical .gap-\[\.6rem\]{gap:.6rem}.koenig-lexical :is(.space-x-1>:not([hidden])~:not([hidden])){--tw-space-x-reverse: 0;margin-right:calc(.4rem * var(--tw-space-x-reverse));margin-left:calc(.4rem * calc(1 - var(--tw-space-x-reverse)))}.koenig-lexical .self-stretch{align-self:stretch}.koenig-lexical .\!overflow-auto{overflow:auto!important}.koenig-lexical .overflow-auto{overflow:auto}.koenig-lexical .overflow-hidden{overflow:hidden}.koenig-lexical .overflow-visible{overflow:visible}.koenig-lexical .overflow-y-auto{overflow-y:auto}.koenig-lexical .overflow-x-hidden{overflow-x:hidden}.koenig-lexical .overflow-y-hidden{overflow-y:hidden}.koenig-lexical .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.koenig-lexical .whitespace-normal{white-space:normal}.koenig-lexical .whitespace-nowrap{white-space:nowrap}.koenig-lexical .whitespace-pre{white-space:pre}.koenig-lexical .whitespace-pre-wrap{white-space:pre-wrap}.koenig-lexical .text-pretty{text-wrap:pretty}.koenig-lexical .rounded{border-radius:.4rem}.koenig-lexical .rounded-full{border-radius:9999px}.koenig-lexical .rounded-lg{border-radius:.8rem}.koenig-lexical .rounded-md{border-radius:.6rem}.koenig-lexical .rounded-sm{border-radius:.2rem}.koenig-lexical .rounded-b{border-bottom-right-radius:.4rem;border-bottom-left-radius:.4rem}.koenig-lexical .rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.koenig-lexical .rounded-r-\[\.5rem\]{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.koenig-lexical .rounded-t{border-top-left-radius:.4rem;border-top-right-radius:.4rem}.koenig-lexical .border{border-width:1px}.koenig-lexical .border-0{border-width:0px}.koenig-lexical .border-2{border-width:2px}.koenig-lexical .border-4{border-width:4px}.koenig-lexical .border-y{border-top-width:1px;border-bottom-width:1px}.koenig-lexical .border-b{border-bottom-width:1px}.koenig-lexical .border-b-2{border-bottom-width:2px}.koenig-lexical .border-t{border-top-width:1px}.koenig-lexical .border-accent{border-color:var(--kg-accent-color, #ff0095)}.koenig-lexical .border-black{--tw-border-opacity: 1;border-color:rgb(21 23 26 / var(--tw-border-opacity, 1))}.koenig-lexical .border-black\/10{border-color:#15171a1a}.koenig-lexical .border-black\/15{border-color:#15171a26}.koenig-lexical .border-black\/5{border-color:#15171a0d}.koenig-lexical .border-black\/\[\.08\],.koenig-lexical .border-black\/\[0\.08\]{border-color:#15171a14}.koenig-lexical .border-green{--tw-border-opacity: 1;border-color:rgb(48 207 67 / var(--tw-border-opacity, 1))}.koenig-lexical .border-green\/20{border-color:#30cf4333}.koenig-lexical .border-grey{--tw-border-opacity: 1;border-color:rgb(171 180 190 / var(--tw-border-opacity, 1))}.koenig-lexical .border-grey-100{--tw-border-opacity: 1;border-color:rgb(244 245 246 / var(--tw-border-opacity, 1))}.koenig-lexical .border-grey-150{--tw-border-opacity: 1;border-color:rgb(241 243 244 / var(--tw-border-opacity, 1))}.koenig-lexical .border-grey-200{--tw-border-opacity: 1;border-color:rgb(235 238 240 / var(--tw-border-opacity, 1))}.koenig-lexical .border-grey-250{--tw-border-opacity: 1;border-color:rgb(229 233 237 / var(--tw-border-opacity, 1))}.koenig-lexical .border-grey-300{--tw-border-opacity: 1;border-color:rgb(221 225 229 / var(--tw-border-opacity, 1))}.koenig-lexical .border-grey-500\/30{border-color:#aeb7c14d}.koenig-lexical .border-grey-900\/15{border-color:#39404726}.koenig-lexical .border-grey-950{--tw-border-opacity: 1;border-color:rgb(35 41 47 / var(--tw-border-opacity, 1))}.koenig-lexical .border-grey\/20{border-color:#abb4be33}.koenig-lexical .border-grey\/30{border-color:#abb4be4d}.koenig-lexical .border-grey\/40{border-color:#abb4be66}.koenig-lexical .border-grey\/50{border-color:#abb4be80}.koenig-lexical .border-red{--tw-border-opacity: 1;border-color:rgb(245 11 35 / var(--tw-border-opacity, 1))}.koenig-lexical .border-transparent{border-color:transparent}.koenig-lexical .border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.koenig-lexical .border-b-red{--tw-border-opacity: 1;border-bottom-color:rgb(245 11 35 / var(--tw-border-opacity, 1))}.koenig-lexical .border-t-grey-300{--tw-border-opacity: 1;border-top-color:rgb(221 225 229 / var(--tw-border-opacity, 1))}.koenig-lexical .bg-\[\#ff0\]{--tw-bg-opacity: 1;background-color:rgb(255 255 0 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-accent{background-color:var(--kg-accent-color, #ff0095)}.koenig-lexical .bg-black{--tw-bg-opacity: 1;background-color:rgb(21 23 26 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-black\/50{background-color:#15171a80}.koenig-lexical .bg-black\/60{background-color:#15171a99}.koenig-lexical .bg-black\/80{background-color:#15171acc}.koenig-lexical .bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 244 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-blue\/10{background-color:#14b8ff1a}.koenig-lexical .bg-blue\/20{background-color:#14b8ff33}.koenig-lexical .bg-green{--tw-bg-opacity: 1;background-color:rgb(48 207 67 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-green-100{--tw-bg-opacity: 1;background-color:rgb(225 249 228 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-green\/10{background-color:#30cf431a}.koenig-lexical .bg-green\/20{background-color:#30cf4333}.koenig-lexical .bg-grey-100{--tw-bg-opacity: 1;background-color:rgb(244 245 246 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-grey-150{--tw-bg-opacity: 1;background-color:rgb(241 243 244 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-grey-200{--tw-bg-opacity: 1;background-color:rgb(235 238 240 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-grey-200\/70{background-color:#ebeef0b3}.koenig-lexical .bg-grey-200\/80{background-color:#ebeef0cc}.koenig-lexical .bg-grey-300{--tw-bg-opacity: 1;background-color:rgb(221 225 229 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-grey-300\/80{background-color:#dde1e5cc}.koenig-lexical .bg-grey-50{--tw-bg-opacity: 1;background-color:rgb(250 250 251 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-grey-900{--tw-bg-opacity: 1;background-color:rgb(57 64 71 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-grey-950{--tw-bg-opacity: 1;background-color:rgb(35 41 47 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-grey\/10{background-color:#abb4be1a}.koenig-lexical .bg-grey\/20{background-color:#abb4be33}.koenig-lexical .bg-grey\/30{background-color:#abb4be4d}.koenig-lexical .bg-lime-500{--tw-bg-opacity: 1;background-color:rgb(181 255 24 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-pink{--tw-bg-opacity: 1;background-color:rgb(251 45 141 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-pink-100{--tw-bg-opacity: 1;background-color:rgb(255 223 238 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-pink\/10{background-color:#fb2d8d1a}.koenig-lexical .bg-pink\/20{background-color:#fb2d8d33}.koenig-lexical .bg-purple{--tw-bg-opacity: 1;background-color:rgb(142 66 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(237 224 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-purple\/10{background-color:#8e42ff1a}.koenig-lexical .bg-purple\/20{background-color:#8e42ff33}.koenig-lexical .bg-red{--tw-bg-opacity: 1;background-color:rgb(245 11 35 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-red-100{--tw-bg-opacity: 1;background-color:rgb(255 224 224 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-red\/10{background-color:#f50b231a}.koenig-lexical .bg-red\/20{background-color:#f50b2333}.koenig-lexical .bg-transparent{background-color:transparent}.koenig-lexical .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-white\/30{background-color:#ffffff4d}.koenig-lexical .bg-white\/40{background-color:#fff6}.koenig-lexical .bg-white\/50{background-color:#ffffff80}.koenig-lexical .bg-white\/70{background-color:#ffffffb3}.koenig-lexical .bg-white\/90{background-color:#ffffffe6}.koenig-lexical .bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(255 241 214 / var(--tw-bg-opacity, 1))}.koenig-lexical .bg-yellow\/10{background-color:#ffb41f1a}.koenig-lexical .bg-yellow\/20{background-color:#ffb41f33}.koenig-lexical .bg-\[conic-gradient\(hsl\(360\,100\%\,50\%\)\,hsl\(315\,100\%\,50\%\)\,hsl\(270\,100\%\,50\%\)\,hsl\(225\,100\%\,50\%\)\,hsl\(180\,100\%\,50\%\)\,hsl\(135\,100\%\,50\%\)\,hsl\(90\,100\%\,50\%\)\,hsl\(45\,100\%\,50\%\)\,hsl\(0\,100\%\,50\%\)\)\]{background-image:conic-gradient(red,#ff00bf,#7f00ff,#0040ff,#0ff,#00ff40,#80ff00,#ffbf00,red)}.koenig-lexical .bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.koenig-lexical .bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.koenig-lexical .from-black\/0{--tw-gradient-from: rgb(21 23 26 / 0) var(--tw-gradient-from-position);--tw-gradient-to: rgb(21 23 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.koenig-lexical .from-black\/5{--tw-gradient-from: rgb(21 23 26 / .05) var(--tw-gradient-from-position);--tw-gradient-to: rgb(21 23 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.koenig-lexical .via-black\/5{--tw-gradient-to: rgb(21 23 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(21 23 26 / .05) var(--tw-gradient-via-position), var(--tw-gradient-to)}.koenig-lexical .to-black\/30{--tw-gradient-to: rgb(21 23 26 / .3) var(--tw-gradient-to-position)}.koenig-lexical .to-black\/50{--tw-gradient-to: rgb(21 23 26 / .5) var(--tw-gradient-to-position)}.koenig-lexical .bg-clip-padding{background-clip:padding-box}.koenig-lexical .bg-clip-content{background-clip:content-box}.koenig-lexical .fill-black{fill:#15171a}.koenig-lexical .fill-grey-200{fill:#ebeef0}.koenig-lexical .fill-grey-700{fill:#7c8b9a}.koenig-lexical .fill-grey-900{fill:#394047}.koenig-lexical .fill-red{fill:#f50b23}.koenig-lexical .fill-white{fill:#fff}.koenig-lexical .stroke-green-600{stroke:#2ab23a}.koenig-lexical .stroke-grey-700{stroke:#7c8b9a}.koenig-lexical .stroke-grey-800{stroke:#626d79}.koenig-lexical .stroke-red{stroke:#f50b23}.koenig-lexical .stroke-2{stroke-width:2}.koenig-lexical .stroke-\[1\.5\]{stroke-width:1.5}.koenig-lexical .stroke-\[1\.5px\]{stroke-width:1.5px}.koenig-lexical .stroke-\[2\.5\]{stroke-width:2.5}.koenig-lexical .stroke-\[3\]{stroke-width:3}.koenig-lexical .stroke-\[3px\]{stroke-width:3px}.koenig-lexical .object-contain{-o-object-fit:contain;object-fit:contain}.koenig-lexical .object-cover{-o-object-fit:cover;object-fit:cover}.koenig-lexical .\!p-4{padding:1.6rem!important}.koenig-lexical .p-0{padding:0}.koenig-lexical .p-1{padding:.4rem}.koenig-lexical .p-2{padding:.8rem}.koenig-lexical .p-20{padding:8rem}.koenig-lexical .p-3{padding:1.2rem}.koenig-lexical .p-4{padding:1.6rem}.koenig-lexical .p-5{padding:2rem}.koenig-lexical .p-6{padding:2.4rem}.koenig-lexical .p-8{padding:3.2rem}.koenig-lexical .p-\[\.2rem\]{padding:.2rem}.koenig-lexical .p-\[12vmin\]{padding:12vmin}.koenig-lexical .p-\[14vmin\]{padding:14vmin}.koenig-lexical .p-\[18vmin\]{padding:18vmin}.koenig-lexical .p-\[1px\]{padding:1px}.koenig-lexical .p-\[1rem\]{padding:1rem}.koenig-lexical .p-\[2px\]{padding:2px}.koenig-lexical .p-\[3px\]{padding:3px}.koenig-lexical .p-\[4px\]{padding:4px}.koenig-lexical .p-\[4rem\]{padding:4rem}.koenig-lexical .\!px-3{padding-left:1.2rem!important;padding-right:1.2rem!important}.koenig-lexical .px-0{padding-left:0;padding-right:0}.koenig-lexical .px-1{padding-left:.4rem;padding-right:.4rem}.koenig-lexical .px-2{padding-left:.8rem;padding-right:.8rem}.koenig-lexical .px-20{padding-left:8rem;padding-right:8rem}.koenig-lexical .px-3{padding-left:1.2rem;padding-right:1.2rem}.koenig-lexical .px-4{padding-left:1.6rem;padding-right:1.6rem}.koenig-lexical .px-5{padding-left:2rem;padding-right:2rem}.koenig-lexical .px-6{padding-left:2.4rem;padding-right:2.4rem}.koenig-lexical .px-7{padding-left:2.8rem;padding-right:2.8rem}.koenig-lexical .px-9{padding-left:3.6rem;padding-right:3.6rem}.koenig-lexical .px-\[10px\]{padding-left:10px;padding-right:10px}.koenig-lexical .px-\[1rem\]{padding-left:1rem;padding-right:1rem}.koenig-lexical .px-\[calc\(32px-\(4rem\/2\)\)\]{padding-left:calc(32px - 2rem);padding-right:calc(32px - 2rem)}.koenig-lexical .py-0{padding-top:0;padding-bottom:0}.koenig-lexical .py-1{padding-top:.4rem;padding-bottom:.4rem}.koenig-lexical .py-1\.5{padding-top:.6rem;padding-bottom:.6rem}.koenig-lexical .py-10{padding-top:4rem;padding-bottom:4rem}.koenig-lexical .py-2{padding-top:.8rem;padding-bottom:.8rem}.koenig-lexical .py-3{padding-top:1.2rem;padding-bottom:1.2rem}.koenig-lexical .py-4{padding-top:1.6rem;padding-bottom:1.6rem}.koenig-lexical .py-5{padding-top:2rem;padding-bottom:2rem}.koenig-lexical .py-8{padding-top:3.2rem;padding-bottom:3.2rem}.koenig-lexical .py-9{padding-top:3.6rem;padding-bottom:3.6rem}.koenig-lexical .py-\[\.6rem\]{padding-top:.6rem;padding-bottom:.6rem}.koenig-lexical .py-\[15vmin\]{padding-top:15vmin;padding-bottom:15vmin}.koenig-lexical .py-\[1rem\]{padding-top:1rem;padding-bottom:1rem}.koenig-lexical .py-\[4rem\]{padding-top:4rem;padding-bottom:4rem}.koenig-lexical .py-\[5px\]{padding-top:5px;padding-bottom:5px}.koenig-lexical .py-\[6px\]{padding-top:6px;padding-bottom:6px}.koenig-lexical .py-\[7px\]{padding-top:7px;padding-bottom:7px}.koenig-lexical .py-px{padding-top:1px;padding-bottom:1px}.koenig-lexical .pb-1{padding-bottom:.4rem}.koenig-lexical .pb-10{padding-bottom:4rem}.koenig-lexical .pb-16{padding-bottom:6.4rem}.koenig-lexical .pb-2{padding-bottom:.8rem}.koenig-lexical .pb-3{padding-bottom:1.2rem}.koenig-lexical .pb-4{padding-bottom:1.6rem}.koenig-lexical .pb-6{padding-bottom:2.4rem}.koenig-lexical .pb-7{padding-bottom:2.8rem}.koenig-lexical .pb-8{padding-bottom:3.2rem}.koenig-lexical .pb-\[\.2rem\]{padding-bottom:.2rem}.koenig-lexical .pb-\[8vh\]{padding-bottom:8vh}.koenig-lexical .pl-1{padding-left:.4rem}.koenig-lexical .pl-10{padding-left:4rem}.koenig-lexical .pl-2{padding-left:.8rem}.koenig-lexical .pl-3{padding-left:1.2rem}.koenig-lexical .pl-\[1rem\]{padding-left:1rem}.koenig-lexical .pr-1{padding-right:.4rem}.koenig-lexical .pr-2{padding-right:.8rem}.koenig-lexical .pr-5{padding-right:2rem}.koenig-lexical .pr-8{padding-right:3.2rem}.koenig-lexical .pr-9{padding-right:3.6rem}.koenig-lexical .pt-1{padding-top:.4rem}.koenig-lexical .pt-3{padding-top:1.2rem}.koenig-lexical .pt-4{padding-top:1.6rem}.koenig-lexical .pt-6{padding-top:2.4rem}.koenig-lexical .pt-\[\.6rem\]{padding-top:.6rem}.koenig-lexical .text-left{text-align:left}.koenig-lexical .\!text-center{text-align:center!important}.koenig-lexical .text-center{text-align:center}.koenig-lexical .\!font-sans{font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif!important}.koenig-lexical .font-mono{font-family:Consolas,Liberation Mono,Menlo,Courier,monospace}.koenig-lexical .font-sans{font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif}.koenig-lexical .font-serif{font-family:Georgia,Times,serif}.koenig-lexical .\!text-2xl{font-size:2.4rem!important}.koenig-lexical .\!text-\[1\.3rem\]{font-size:1.3rem!important}.koenig-lexical .\!text-\[1\.6rem\]{font-size:1.6rem!important}.koenig-lexical .\!text-sm{font-size:1.4rem!important}.koenig-lexical .\!text-xs{font-size:1.25rem!important}.koenig-lexical .text-2xl{font-size:2.4rem}.koenig-lexical .text-2xs{font-size:1.2rem}.koenig-lexical .text-3xl{font-size:3rem}.koenig-lexical .text-5xl{font-size:4.8rem;line-height:1.15}.koenig-lexical .text-\[1\.1rem\]{font-size:1.1rem}.koenig-lexical .text-\[1\.35rem\]{font-size:1.35rem}.koenig-lexical .text-\[1\.3rem\]{font-size:1.3rem}.koenig-lexical .text-\[1\.5rem\]{font-size:1.5rem}.koenig-lexical .text-\[1\.6rem\]{font-size:1.6rem}.koenig-lexical .text-\[1\.7rem\]{font-size:1.7rem}.koenig-lexical .text-lg{font-size:1.8rem}.koenig-lexical .text-md{font-size:1.5rem}.koenig-lexical .text-sm{font-size:1.4rem}.koenig-lexical .text-xl{font-size:2rem}.koenig-lexical .text-xs{font-size:1.25rem}.koenig-lexical .\!font-bold{font-weight:700!important}.koenig-lexical .\!font-medium{font-weight:500!important}.koenig-lexical .\!font-normal{font-weight:400!important}.koenig-lexical .font-bold{font-weight:700}.koenig-lexical .font-medium{font-weight:500}.koenig-lexical .font-normal{font-weight:400}.koenig-lexical .font-semibold{font-weight:600}.koenig-lexical .uppercase{text-transform:uppercase}.koenig-lexical .italic{font-style:italic}.koenig-lexical .\!leading-\[1\.1\]{line-height:1.1!important}.koenig-lexical .\!leading-\[1\.6em\]{line-height:1.6em!important}.koenig-lexical .\!leading-snug{line-height:1.375!important}.koenig-lexical .leading-4{line-height:1rem}.koenig-lexical .leading-6{line-height:1.5rem}.koenig-lexical .leading-7{line-height:1.75rem}.koenig-lexical .leading-8{line-height:2rem}.koenig-lexical .leading-9{line-height:2.25rem}.koenig-lexical .leading-\[1\.333em\]{line-height:1.333em}.koenig-lexical .leading-\[1\.35\]{line-height:1.35}.koenig-lexical .leading-\[1\.4\]{line-height:1.4}.koenig-lexical .leading-\[1\.5\]{line-height:1.5}.koenig-lexical .leading-\[1\.625\]{line-height:1.625}.koenig-lexical .leading-\[1\.65\]{line-height:1.65}.koenig-lexical .leading-\[24px\]{line-height:24px}.koenig-lexical .leading-\[4\.4rem\]{line-height:4.4rem}.koenig-lexical .leading-\[4\.8rem\]{line-height:4.8rem}.koenig-lexical .leading-\[4rem\]{line-height:4rem}.koenig-lexical .leading-loose{line-height:2}.koenig-lexical .leading-none{line-height:1}.koenig-lexical .leading-normal{line-height:1.5}.koenig-lexical .leading-snug{line-height:1.375}.koenig-lexical .leading-tight{line-height:1.25}.koenig-lexical .\!tracking-tight{letter-spacing:-.025em!important}.koenig-lexical .tracking-\[\.02rem\]{letter-spacing:.02rem}.koenig-lexical .tracking-\[\.06rem\]{letter-spacing:.06rem}.koenig-lexical .tracking-normal{letter-spacing:0em}.koenig-lexical .tracking-tight{letter-spacing:-.025em}.koenig-lexical .tracking-wide{letter-spacing:.025em}.koenig-lexical .\!text-grey-500{--tw-text-opacity: 1 !important;color:rgb(174 183 193 / var(--tw-text-opacity, 1))!important}.koenig-lexical .text-black{--tw-text-opacity: 1;color:rgb(21 23 26 / var(--tw-text-opacity, 1))}.koenig-lexical .text-black\/50{color:#15171a80}.koenig-lexical .text-current{color:currentColor}.koenig-lexical .text-green{--tw-text-opacity: 1;color:rgb(48 207 67 / var(--tw-text-opacity, 1))}.koenig-lexical .text-green-600{--tw-text-opacity: 1;color:rgb(42 178 58 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey{--tw-text-opacity: 1;color:rgb(171 180 190 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-300{--tw-text-opacity: 1;color:rgb(221 225 229 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-400{--tw-text-opacity: 1;color:rgb(206 212 217 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-500{--tw-text-opacity: 1;color:rgb(174 183 193 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-600{--tw-text-opacity: 1;color:rgb(149 161 173 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-700{--tw-text-opacity: 1;color:rgb(124 139 154 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-800{--tw-text-opacity: 1;color:rgb(98 109 121 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-900{--tw-text-opacity: 1;color:rgb(57 64 71 / var(--tw-text-opacity, 1))}.koenig-lexical .text-grey-900\/50{color:#39404780}.koenig-lexical .text-red{--tw-text-opacity: 1;color:rgb(245 11 35 / var(--tw-text-opacity, 1))}.koenig-lexical .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.koenig-lexical .text-white\/60{color:#fff9}.koenig-lexical .underline{text-decoration-line:underline}.koenig-lexical .line-through{text-decoration-line:line-through}.koenig-lexical .caret-black{caret-color:#15171a}.koenig-lexical .caret-current{caret-color:currentColor}.koenig-lexical .caret-grey-800{caret-color:#626d79}.koenig-lexical .caret-white{caret-color:#fff}.koenig-lexical .opacity-0{opacity:0}.koenig-lexical .opacity-100{opacity:1}.koenig-lexical .opacity-25{opacity:.25}.koenig-lexical .opacity-30{opacity:.3}.koenig-lexical .opacity-40{opacity:.4}.koenig-lexical .opacity-50{opacity:.5}.koenig-lexical .opacity-60{opacity:.6}.koenig-lexical .opacity-70{opacity:.7}.koenig-lexical .opacity-80{opacity:.8}.koenig-lexical .opacity-90{opacity:.9}.koenig-lexical .shadow{--tw-shadow: 0 0 1px rgba(0,0,0,.15), 0px 13px 27px -5px rgba(50, 50, 93, .08), 0px 8px 16px -8px rgba(0, 0, 0, .12);--tw-shadow-colored: 0 0 1px var(--tw-shadow-color), 0px 13px 27px -5px var(--tw-shadow-color), 0px 8px 16px -8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-\[0_0_0_1px_rgba\(0\,0\,0\,0\.08\)\,0_1px_3px_rgba\(0\,0\,0\,0\.08\)\,0_4px_12px_rgba\(0\,0\,0\,0\.04\)\]{--tw-shadow: 0 0 0 1px rgba(0,0,0,.08),0 1px 3px rgba(0,0,0,.08),0 4px 12px rgba(0,0,0,.04);--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color), 0 1px 3px var(--tw-shadow-color), 0 4px 12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-\[0_0_0_2px\]{--tw-shadow: 0 0 0 2px;--tw-shadow-colored: 0 0 0 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-\[0_0_0_2px_\#30cf43\]{--tw-shadow: 0 0 0 2px #30cf43;--tw-shadow-colored: 0 0 0 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-\[0_0_0_2px_rgba\(0\,0\,0\,1\)\]{--tw-shadow: 0 0 0 2px rgba(0,0,0,1);--tw-shadow-colored: 0 0 0 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-\[0_0_0_2px_rgba\(48\,207\,67\,\.25\)\]{--tw-shadow: 0 0 0 2px rgba(48,207,67,.25);--tw-shadow-colored: 0 0 0 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-lg{--tw-shadow: 0px 50px 100px -25px rgba(50, 50, 93, .2), 0px 30px 60px -20px rgba(0, 0, 0, .25);--tw-shadow-colored: 0px 50px 100px -25px var(--tw-shadow-color), 0px 30px 60px -20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-md{--tw-shadow: 0px 13px 27px -5px rgba(50, 50, 93, .25), 0px 8px 16px -8px rgba(0, 0, 0, .3);--tw-shadow-colored: 0px 13px 27px -5px var(--tw-shadow-color), 0px 8px 16px -8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-sm{--tw-shadow: 0px 2px 5px -1px rgba(50, 50, 93, .2), 0px 1px 3px -1px rgba(0, 0, 0, .25);--tw-shadow-colored: 0px 2px 5px -1px var(--tw-shadow-color), 0px 1px 3px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-xl{--tw-shadow: 0 2.8px 2.2px rgba(0, 0, 0, .02), 0 6.7px 5.3px rgba(0, 0, 0, .028), 0 12.5px 10px rgba(0, 0, 0, .035), 0 22.3px 17.9px rgba(0, 0, 0, .042), 0 41.8px 33.4px rgba(0, 0, 0, .05), 0 100px 80px rgba(0, 0, 0, .07);--tw-shadow-colored: 0 2.8px 2.2px var(--tw-shadow-color), 0 6.7px 5.3px var(--tw-shadow-color), 0 12.5px 10px var(--tw-shadow-color), 0 22.3px 17.9px var(--tw-shadow-color), 0 41.8px 33.4px var(--tw-shadow-color), 0 100px 80px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-xs{--tw-shadow: 0px 1px 2px rgba(0, 0, 0, .06);--tw-shadow-colored: 0px 1px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .shadow-green{--tw-shadow-color: #30CF43;--tw-shadow: var(--tw-shadow-colored)}.koenig-lexical .outline-none{outline:2px solid transparent;outline-offset:2px}.koenig-lexical .outline{outline-style:solid}.koenig-lexical .outline-2{outline-width:2px}.koenig-lexical .outline-green{outline-color:#30cf43}.koenig-lexical .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.koenig-lexical .drop-shadow-2xl{--tw-drop-shadow: drop-shadow(0 25px 25px rgb(0 0 0 / .15));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.koenig-lexical .\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.koenig-lexical .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.koenig-lexical .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.koenig-lexical .transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.koenig-lexical .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.koenig-lexical .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.koenig-lexical .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.koenig-lexical .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.koenig-lexical .duration-100{transition-duration:.1s}.koenig-lexical .duration-200{transition-duration:.2s}.koenig-lexical .duration-75{transition-duration:75ms}.koenig-lexical .ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.koenig-lexical .ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.koenig-lexical .ease-linear{transition-timing-function:linear}.koenig-lexical .will-change-transform{will-change:transform}.koenig-lexical{position:relative;--cta-link-color-text: var(--grey-900)}.koenig-lexical .cta-link-color{color:var(--cta-link-color)!important}.koenig-lexical>*{font-size:1.7rem;font-weight:400;letter-spacing:.1px;color:var(--grey-900);font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Droid Sans,Helvetica Neue,sans-serif;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-moz-font-feature-settings:"liga" on}.koenig-lexical.kg-inherit-styles>*{color:inherit;letter-spacing:inherit;font-weight:inherit;font-family:inherit}.koenig-lexical [contenteditable]{outline:none}.koenig-lexical ::-moz-selection{background:var(--grey-300)}.koenig-lexical ::selection{background:var(--grey-300)}.koenig-lexical>.dark,.koenig-lexical.dark,.dark .koenig-lexical{--cta-link-color-text: var(--grey-200)}.koenig-lexical>.dark:not(.kg-inherit-styles)>*,.koenig-lexical.dark:not(.kg-inherit-styles)>*,.dark .koenig-lexical:not(.kg-inherit-styles)>*{color:var(--grey-300)}.koenig-lexical>.dark ::-moz-selection,.koenig-lexical.dark ::-moz-selection,.dark .koenig-lexical ::-moz-selection{background:var(--grey-900)}.koenig-lexical>.dark ::selection,.koenig-lexical.dark ::selection,.dark .koenig-lexical ::selection{background:var(--grey-900)}.koenig-lexical>.dark em-emoji-picker,.koenig-lexical.dark em-emoji-picker,.dark .koenig-lexical em-emoji-picker{--rgb-accent: 48, 207, 67;--rgb-background: 35, 41, 47;--rgb-color: 221, 225, 229;--rgb-input: 57, 64, 71}.koenig-lexical.koenig-lexical-caption{font-size:0}.koenig-lexical.koenig-lexical-caption>*{font-size:1.4rem}.koenig-lexical-caption p{color:var(--grey-800)}.dark .koenig-lexical-caption p{color:var(--grey-500)}em-emoji-picker{--font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Droid Sans", "Helvetica Neue", sans-serif;--border-radius: 5px;--font-size: 13px;--rgb-accent: 57, 64, 71;--rgb-color: 174, 183, 193;--em-rgb-accent: (255,0,0) ;--shadow: 0 0 1px rgba(0,0,0,.05), 0 5px 18px rgba(0,0,0,.08);height:325px}em-emoji-picker #nav button[aria-selected] svg{fill:red}em-emoji-picker .search input[type=search]{border-radius:5px}.search input,.search button{font-size:20px!important}.koenig-lexical .js-embed-placeholder{margin:.4rem 0!important;color:var(--grey-700)!important}.koenig-lexical.dark .js-embed-placeholder{background:var(--grey-900);border:none}.koenig-lexical-cta-label a{text-decoration:underline}.kg-cardmenu-card-hover:hover svg [data-selector=bg]{fill:#fff}.dark .kg-cardmenu-card-hover svg [data-selector=bg]{fill:var(--grey-900)}.dark .kg-cardmenu-card-hover:hover svg [data-selector=bg]{fill:var(--grey-800)}.dark .kg-cardmenu-card-hover svg [data-selector=fold]{fill:var(--grey-800)}.dark .kg-cardmenu-card-hover:hover svg [data-selector=fold]{fill:var(--grey-700)}[data-kg-floating-toolbar=true] .fill-white g,[data-kg-floating-toolbar=true] .fill-white path,[data-kg-card-toolbar] .fill-white g,[data-kg-card-toolbar] .fill-white path{fill:#fff}.kg-cardmenu-card-hover button{display:none}.koenig-lexical table{font-size:1.75rem;margin:0;font-family:georgia,Times,serif;letter-spacing:.02rem;line-height:1.6em}.koenig-lexical table tr td,.koenig-lexical table tr th{vertical-align:top;border-bottom:1px solid var(--grey-200)}.koenig-lexical>.dark table tr td,.koenig-lexical>.dark table tr th,.koenig-lexical.dark table tr td,.koenig-lexical.dark table tr th,.dark .koenig-lexical table tr td,.dark .koenig-lexical table tr th{border-bottom:1px solid var(--grey-900)}.koenig-lexical .kg-prose :where(p,h1,h2,h3,h4,h5,h6,blockquote,aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1.6rem 0 0;min-width:100%;max-width:100%}.koenig-lexical .kg-prose :where(h1,h2,h3,h4,h5,h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;font-weight:700;color:var(--black)}.koenig-lexical .kg-prose :where(h1 strong,h2 strong,h3 strong,h4 strong,h5 strong,h6 strong):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-weight:800}.koenig-lexical .kg-prose :where(h1):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:4.4rem;line-height:1.15em;letter-spacing:-.015em}.koenig-lexical .kg-prose :where(h2):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3.2rem;line-height:1.2em;letter-spacing:-.014em}.koenig-lexical .kg-prose :where(h3):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.5rem;line-height:1.3em;letter-spacing:-.013em}.koenig-lexical .kg-prose :where(h4):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.2rem;line-height:1.35em;letter-spacing:-.011em}.koenig-lexical .kg-prose :where(h5):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2rem;line-height:1.35em;font-weight:700;letter-spacing:-.011em}.koenig-lexical .kg-prose :where(h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:1.85rem;line-height:1.4em;font-weight:700;letter-spacing:-.008em}.koenig-lexical .kg-prose :where(p+h1,p+h2,p+h3,p+h4,p+h5,p+h6,blockquote+h1,blockquote+h2,blockquote+h3,blockquote+h4,blockquote+h5,blockquote+h6,aside+h1,aside+h2,aside+h3,aside+h4,aside+h5,aside+h6,ul+h1,ul+h2,ul+h3,ul+h4,ul+h5,ul+h6,ol+h1,ol+h2,ol+h3,ol+h4,ol+h5,ol+h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:4.8rem 0 0}.koenig-lexical .kg-prose :where(h1+h1):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1.4rem 0 0}.koenig-lexical .kg-prose :where(h2+h1,h3+h1):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1rem 0 0}.koenig-lexical .kg-prose :where(h4+h1,h5+h1):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h6+h1):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.6rem 0 0}.koenig-lexical .kg-prose :where(div+h1):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:4.8rem 0 0}.koenig-lexical .kg-prose :where(h1+h2):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1.6rem 0 0}.koenig-lexical .kg-prose :where(h2+h2,h3+h2,h4+h2,.koenig-react__editor h5+h2):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h6+h2):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.4rem 0 0}.koenig-lexical .kg-prose :where(div+h2):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:4.8rem 0 0}.koenig-lexical .kg-prose :where(h1+h3,h2+h3,h1+h4,h2+h4,h1+h5,h2+h5,h1+h6,h2+h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1.2rem 0 0}.koenig-lexical .kg-prose :where(h3+h4):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h3+h3,h4+h3,h5+h3,h4+h4,h5+h4,h3+h5,h4+h5,h5+h5,h3+h6,h4+h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h5+h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.4rem 0 0}.koenig-lexical .kg-prose :where(h6+h3,h6+h4,h6+h5,h6+h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.4rem 0 0}.koenig-lexical .kg-prose :where(div+h3,div+h4,div+h5,div+h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:4.8rem 0 0}.koenig-lexical .kg-prose :where(h1:first-child,h2:first-child,h3:first-child,h4:first-child,.koenig-react__editor h5:first-child,h6:first-child):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin-top:0rem}@media (max-width: 500px){.koenig-lexical .kg-prose :where(h1):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3.2rem}.koenig-lexical .kg-prose :where(h2):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.8rem}.koenig-lexical .kg-prose :where(h3):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.4rem}.koenig-lexical .kg-prose :where(h4):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.3rem}.koenig-lexical .kg-prose :where(h5):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2rem}.koenig-lexical .kg-prose :where(h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:1.9rem}}.koenig-lexical .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:georgia,Times,serif;font-weight:400;line-height:1.6em;font-size:2rem}.koenig-lexical .kg-prose :where(p strong,blockquote strong,aside strong,ul strong,ol strong):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-weight:700}.koenig-lexical .kg-prose :where(h1+p):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1rem 0 0}.koenig-lexical .kg-prose :where(h2+p):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h3+p,h4+p,h5+p,h6+p):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(p+p,blockquote+p,aside+p,ul+p,ol+p):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:3.2rem 0 0}.koenig-lexical .kg-prose :where(div+p):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:2.8rem 0 0}.koenig-lexical .kg-prose :where(div+figure):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:2.8rem 0 0}.koenig-lexical .kg-prose :where(p:first-child):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin-top:0rem}@media (max-width: 500px){.koenig-lexical .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:1.8rem}}.koenig-lexical .kg-prose :where(ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1.6rem 0 0;padding:0;min-width:100%;max-width:100%}.koenig-lexical .kg-prose :where(ul li):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){display:list-item;list-style-type:disc;margin:1rem 0 0 2.4rem;padding:0 0 0 .6rem;line-height:3.2rem}.koenig-lexical .kg-prose :where(ul li:first-child):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:0 0 0 2.4rem}.koenig-lexical .kg-prose :where(ul ul li):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){list-style-type:circle}.koenig-lexical .kg-prose :where(ul ul ul li):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){list-style-type:square}.koenig-lexical .kg-prose :where(ol li):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){display:list-item;list-style-type:decimal;margin:1rem 0 0 2.2rem;padding:0 0 0 .8rem;line-height:3.2rem}.koenig-lexical .kg-prose :where(ol li:first-child):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:0 0 0 2.2rem}.koenig-lexical .kg-prose :where(ol ol li):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){list-style-type:lower-alpha}.koenig-lexical .kg-prose :where(ol ol ol li):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){list-style-type:lower-roman}.koenig-lexical .kg-prose :where(p+ul,p+ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:3rem 0 0}.koenig-lexical .kg-prose :where(ul+ul,ul+ol,ol+ul,ol+ol,blockquote+ul,blockquote+ol,aside+ul,aside+ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:3rem 0 0}.koenig-lexical .kg-prose :where(h1+ul,h1+ol,h2+ul,h2+ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h3+ul,h3+ol,h4+ul,h4+ol,h5+ul,h5+ol,h6+ul,h6+ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1.2rem 0 0}.koenig-lexical .kg-prose :where(div+ul,div+ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:2.8rem 0 0}.koenig-lexical .kg-prose :where(ul ul,ul ol,ol ul,ol ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:1rem 0 2rem}.koenig-lexical .kg-prose :where(ul:first-child,ol:first-child):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin-top:0rem}.koenig-lexical .kg-prose :where(a):not(.dark a):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){color:var(--kg-accent-color, #ff0095);text-decoration:underline}.koenig-lexical .kg-prose :where(.dark a):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-weight:600;text-decoration:underline}.koenig-lexical .kg-prose :where(blockquote p):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:0}.koenig-lexical .kg-prose :where(blockquote):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){border-left:.25rem solid var(--kg-accent-color, #ff0095);padding-left:2rem;font-style:italic}.koenig-lexical .kg-prose :where(h1+blockquote,h2+blockquote):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h3+blockquote,h4+blockquote,.koenig-react__editor h5+blockquote,h6+blockquote):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.4rem 0 0}.koenig-lexical .kg-prose :where(p+blockquote,blockquote+blockquote):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:3.2rem 0 0}.koenig-lexical .kg-prose :where(div+blockquote):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:2.8rem 0 0}.koenig-lexical .kg-prose :where(aside p):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:0}.koenig-lexical .kg-prose :where(aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:3.2rem 0 0;padding:1rem 6rem 1.25rem;font-style:italic;text-align:center;font-size:2.4rem;color:var(--grey-500)}.koenig-lexical .kg-prose :where(h1+aside,h2+aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.8rem 0 0}.koenig-lexical .kg-prose :where(h3+aside,h4+aside,h5+aside,h6+aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:.4rem 0 0}.koenig-lexical .kg-prose :where(p+aside,blockquote+aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:3.2rem 0 0}@media (max-width: 800px){.koenig-lexical .kg-prose :where(aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){padding-left:6rem;padding-right:6rem}}@media (max-width: 500px){.koenig-lexical .kg-prose :where(aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.2rem}}.koenig-lexical .kg-prose :where(div+aside):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){margin:2.8rem 0 0}.koenig-lexical .kg-prose :where(>div):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){line-height:0;min-width:100%}.koenig-lexical .kg-prose>:where(div+div):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){padding:3.2rem 0 0}.koenig-lexical .kg-prose>:where(div[data-kg-card-width=full]+div[data-kg-card-width=full]):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){padding:0}.koenig-lexical .kg-prose :where(p+div,blockquote+div,aside+div,ul+div,ol+div):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){padding:3.2rem 0 0}.koenig-lexical .kg-prose :where(h1+div):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){padding:2.8rem 0 0}.koenig-lexical .kg-prose :where(h2+div,h3+div,h4+div,h5+div,h6+div):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){padding:1.6rem 0 0}.koenig-lexical .kg-prose :where(hr):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){display:block;margin:1.6rem 0;border:0;border-top:1px solid var(--grey-300)}.koenig-lexical .kg-prose :where(code):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;background:var(--grey-100);border:1px solid var(--grey-200);border-radius:2px;color:var(--grey-900);font-size:.8em;line-height:1em;padding:.4rem .4rem .2rem;vertical-align:middle;white-space:pre-wrap}.koenig-lexical .kg-prose :where(pre):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;background:var(--grey-100);border:1px solid var(--grey-200);border-radius:2px;color:var(--grey-900);line-height:1.4em;padding:.8rem .8rem .4rem;vertical-align:middle;white-space:pre-wrap}.koenig-lexical .kg-prose :where(img):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){display:inline}.koenig-lexical .dark :where(h1,h2,h3,h4,h5,h6):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){color:var(--white)}.koenig-lexical .dark :where(code):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){background:var(--grey-900);border:1px solid var(--grey-900);border-radius:2px;color:var(--grey-300)}.koenig-lexical-caption .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;font-size:1.4rem;line-height:24px;letter-spacing:.025em}.koenig-lexical-section-title .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;font-size:1.5rem;font-weight:700;text-transform:uppercase;line-height:1.5;letter-spacing:-.01em}.koenig-lexical-section-title .kg-prose :where(strong):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-weight:800!important}.koenig-lexical-heading .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;font-weight:700;line-height:1.1!important;letter-spacing:-.025em}.koenig-lexical-heading .kg-prose :where(a,a span):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){color:currentColor!important}.koenig-lexical-heading.heading-xsmall .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.4rem}.koenig-lexical-heading.heading-small .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3rem}@media (min-width: 640px){.koenig-lexical-heading.heading-small .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3.6rem}}.koenig-lexical-heading.heading-medium .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3rem}@media (min-width: 640px){.koenig-lexical-heading.heading-medium .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3.6rem}}@media (min-width: 768px){.koenig-lexical-heading.heading-medium .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:4.8rem;line-height:1.15}}.koenig-lexical-heading.heading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3rem}@media (min-width: 640px){.koenig-lexical-heading.heading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:3.6rem}}@media (min-width: 768px){.koenig-lexical-heading.heading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:4.8rem;line-height:1.15}}@media (min-width: 1024px){.koenig-lexical-heading.heading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:6rem;line-height:1}}.koenig-lexical-subheading .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-family:Inter,-apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;font-weight:500;line-height:1.375!important;letter-spacing:-.025em}.koenig-lexical-subheading .kg-prose :where(strong):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-weight:700}.koenig-lexical-subheading .kg-prose :where(a,a span):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){color:currentColor!important}.koenig-lexical-subheading.subheading-xsmall .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:1.6rem;font-weight:400}.koenig-lexical-subheading.subheading-small .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:1.8rem}@media (min-width: 640px){.koenig-lexical-subheading.subheading-small .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2rem}}.koenig-lexical-subheading.subheading-medium .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:1.8rem}@media (min-width: 640px){.koenig-lexical-subheading.subheading-medium .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2rem}}@media (min-width: 768px){.koenig-lexical-subheading.subheading-medium .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.2rem}}.koenig-lexical-subheading.subheading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:1.8rem}@media (min-width: 640px){.koenig-lexical-subheading.subheading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2rem}}@media (min-width: 768px){.koenig-lexical-subheading.subheading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.2rem}}@media (min-width: 1024px){.koenig-lexical-subheading.subheading-large .kg-prose :where(p,blockquote,aside,ul,ol):not(:where(.not-kg-prose,[class~=not-kg-prose] *)){font-size:2.4rem}}.kg-header-accent,.kg-callout-accent{--kg-accent-color: #fff}.koenig-lexical .markdown-editor{position:static;z-index:0;overflow:visible;width:100%;padding-top:2px}.koenig-lexical .markdown-editor div{max-width:initial;line-height:initial}.koenig-lexical .markdown-editor .markdown-editor textarea{opacity:0}.koenig-lexical .markdown-editor .editor-toolbar{position:sticky;position:-webkit-sticky;bottom:0;z-index:2;display:flex;padding:6px;margin:auto -12px;border-top:1px solid var(--grey-200);border-right:none;border-left:none;background:var(--white);opacity:1;border-radius:0}.koenig-lexical .markdown-editor .editor-toolbar:hover{opacity:1}.koenig-lexical .markdown-editor .editor-toolbar a{color:var(--grey-900)!important}.koenig-lexical .markdown-editor .editor-toolbar a.active,.koenig-lexical .markdown-editor .editor-toolbar a:hover{border-color:var(--grey-400)}.koenig-lexical .markdown-editor .editor-toolbar a.disabled{color:var(--lightgrey)!important;pointer-events:none}.koenig-lexical .markdown-editor .editor-toolbar a.disabled:hover{border:none}.koenig-lexical .markdown-editor .editor-toolbar .fa-check{position:relative;margin-left:auto;vertical-align:bottom}.koenig-lexical .markdown-editor .editor-toolbar .fa-check:before{position:absolute;right:3px;bottom:4px;font-size:14px;line-height:14px}.koenig-lexical .markdown-editor .editor-toolbar .fa-check:after{content:"abc";position:absolute;top:6px;left:4px;font-family:var(--font-family);font-size:9px;line-height:9px}.koenig-lexical .markdown-editor .editor-toolbar .separator:last-of-type{display:none}.koenig-lexical .markdown-editor .editor-toolbar i.separator{border-right:none;border-left:color-mod(var(--lightgrey) l(-3%)) 1px solid}.koenig-lexical .markdown-editor .CodeMirror{margin-bottom:49px;overflow:visible;padding:0;background:transparent;border:none}.koenig-lexical .markdown-editor .CodeMirror-code:not([contenteditable=true]){-webkit-user-select:none;-moz-user-select:none;user-select:none}.koenig-lexical .markdown-editor .CodeMirror-code .cm-link{color:var(--green);text-decoration:none}.koenig-lexical .markdown-editor .CodeMirror-cursor{border-width:3px;border-color:var(--green)}.koenig-lexical .markdown-editor .CodeMirror-scroll{overflow:visible!important;padding-bottom:5rem}.koenig-lexical .markdown-editor .CodeMirror-scroll:hover{cursor:text}.koenig-lexical .markdown-editor .CodeMirror-wrap{max-width:740px;margin-right:auto;margin-left:auto;border:none;background:transparent}.koenig-lexical .markdown-editor .CodeMirror-wrap>div>textarea{top:0;height:26px;min-width:0;min-height:26px;margin-bottom:-26px}.koenig-lexical .markdown-editor .CodeMirror pre{padding:0;color:var(--grey-900);font-family:Consolas,monaco,monospace;font-size:1.6rem}.koenig-lexical .markdown-editor .CodeMirror .cm-strong{color:var(--grey-900)}.koenig-lexical .markdown-editor .CodeMirror .cm-url{text-decoration:underline}.koenig-lexical .markdown-editor .CodeMirror-selectedtext{color:#000!important;background:color-mod(var(--blue) lightness(+30%))}.koenig-lexical.dark .markdown-editor .CodeMirror pre,.koenig-lexical.dark .markdown-editor .CodeMirror .cm-strong{color:var(--grey-100)}.koenig-lexical.dark .markdown-editor .editor-toolbar{border-top:1px solid var(--grey-950);background:var(--grey-950)}.koenig-lexical.dark .markdown-editor .editor-toolbar a{color:var(--grey-450)!important}.koenig-lexical.dark .markdown-editor .editor-toolbar a.active,.koenig-lexical.dark .markdown-editor .editor-toolbar a:hover{border-color:var(--black);background:var(--grey-900)}.koenig-lexical.dark .markdown-editor .editor-toolbar a.disabled{color:var(--orange)!important}.koenig-lexical.dark .markdown-editor .editor-toolbar i.separator{border-right:none;border-left:color-mod(var(--yellow) l(-3%)) 1px solid}.koenig-lexical .react-colorful{width:100%;height:140px}.koenig-lexical .react-colorful .react-colorful__saturation{border-radius:4px 4px 0 0;border-bottom:1px solid #000}.koenig-lexical .react-colorful .react-colorful__hue{height:8px;border-radius:0 0 4px 4px}.koenig-lexical .react-colorful .react-colorful__pointer{width:14px;height:14px;border-width:1px}.koenig-lexical{--white: #FFF;--grey-50: #FAFAFB;--grey-100: #F4F5F6;--grey-200: #EBEEF0;--grey-300: #DDE1E5;--grey-400: #CED4D9;--grey-500: #AEB7C1;--grey-600: #95A1AD;--grey-700: #7C8B9A;--grey-800: #626D79;--grey-900: #394047;--grey-950: #23292F;--black: #15171A;--green: #30CF43;--kg-breakout-adjustment-with-fallback: var(--kg-breakout-adjustment, 0px)}.koenig-lexical :is(.selection\:bg-grey-800 *)::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical :is(.selection\:bg-grey-800 *)::selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical :is(.selection\:bg-grey\/40 *)::-moz-selection{background-color:#abb4be66}.koenig-lexical :is(.selection\:bg-grey\/40 *)::selection{background-color:#abb4be66}.koenig-lexical .selection\:bg-grey-800::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical .selection\:bg-grey-800::selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical .selection\:bg-grey\/40::-moz-selection{background-color:#abb4be66}.koenig-lexical .selection\:bg-grey\/40::selection{background-color:#abb4be66}.koenig-lexical .placeholder\:text-sm::-moz-placeholder{font-size:1.4rem}.koenig-lexical .placeholder\:text-sm::placeholder{font-size:1.4rem}.koenig-lexical .placeholder\:font-medium::-moz-placeholder{font-weight:500}.koenig-lexical .placeholder\:font-medium::placeholder{font-weight:500}.koenig-lexical .placeholder\:leading-snug::-moz-placeholder{line-height:1.375}.koenig-lexical .placeholder\:leading-snug::placeholder{line-height:1.375}.koenig-lexical .placeholder\:text-grey-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(174 183 193 / var(--tw-text-opacity, 1))}.koenig-lexical .placeholder\:text-grey-500::placeholder{--tw-text-opacity: 1;color:rgb(174 183 193 / var(--tw-text-opacity, 1))}.koenig-lexical .before\:absolute:before{content:var(--tw-content);position:absolute}.koenig-lexical .before\:bottom-\[2px\]:before{content:var(--tw-content);bottom:2px}.koenig-lexical .before\:left-\[2px\]:before{content:var(--tw-content);left:2px}.koenig-lexical .before\:z-10:before{content:var(--tw-content);z-index:10}.koenig-lexical .before\:mx-1\.5:before{content:var(--tw-content);margin-left:.6rem;margin-right:.6rem}.koenig-lexical .before\:mr-2:before{content:var(--tw-content);margin-right:.8rem}.koenig-lexical .before\:mt-\[7px\]:before{content:var(--tw-content);margin-top:7px}.koenig-lexical .before\:block:before{content:var(--tw-content);display:block}.koenig-lexical .before\:size-3:before{content:var(--tw-content);width:1.2rem;height:1.2rem}.koenig-lexical .before\:size-\[7px\]:before{content:var(--tw-content);width:7px;height:7px}.koenig-lexical .before\:flex-1:before{content:var(--tw-content);flex:1 1 0%}.koenig-lexical .before\:rounded-full:before{content:var(--tw-content);border-radius:9999px}.koenig-lexical .before\:border-t:before{content:var(--tw-content);border-top-width:1px}.koenig-lexical .before\:border-grey-300:before{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(221 225 229 / var(--tw-border-opacity, 1))}.koenig-lexical .before\:bg-grey-800:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical .before\:bg-white:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .before\:pb-\[12\.5\%\]:before{content:var(--tw-content);padding-bottom:12.5%}.koenig-lexical .before\:pb-\[62\.5\%\]:before{content:var(--tw-content);padding-bottom:62.5%}.koenig-lexical .before\:text-grey-900:before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(57 64 71 / var(--tw-text-opacity, 1))}.koenig-lexical .before\:transition-all:before{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.koenig-lexical .before\:duration-100:before{content:var(--tw-content);transition-duration:.1s}.koenig-lexical .before\:content-\[\'\'\]:before{--tw-content: "";content:var(--tw-content)}.koenig-lexical .before\:content-\[\'•\'\]:before{--tw-content: "•";content:var(--tw-content)}.koenig-lexical .after\:absolute:after{content:var(--tw-content);position:absolute}.koenig-lexical .after\:left-1\/2:after{content:var(--tw-content);left:50%}.koenig-lexical .after\:top-1\/2:after{content:var(--tw-content);top:50%}.koenig-lexical .after\:ml-2:after{content:var(--tw-content);margin-left:.8rem}.koenig-lexical .after\:mt-\[11px\]:after{content:var(--tw-content);margin-top:11px}.koenig-lexical .after\:block:after{content:var(--tw-content);display:block}.koenig-lexical .after\:size-1:after{content:var(--tw-content);width:.4rem;height:.4rem}.koenig-lexical .after\:h-\[1px\]:after{content:var(--tw-content);height:1px}.koenig-lexical .after\:w-\[18px\]:after{content:var(--tw-content);width:18px}.koenig-lexical .after\:flex-1:after{content:var(--tw-content);flex:1 1 0%}.koenig-lexical .after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .after\:-translate-y-1\/2:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .after\:-rotate-45:after{content:var(--tw-content);--tw-rotate: -45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.koenig-lexical .after\:border-t:after{content:var(--tw-content);border-top-width:1px}.koenig-lexical .after\:border-grey-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(221 225 229 / var(--tw-border-opacity, 1))}.koenig-lexical .after\:bg-green\/70:after{content:var(--tw-content);background-color:#30cf43b3}.koenig-lexical .after\:bg-red-500:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(245 11 35 / var(--tw-bg-opacity, 1))}.koenig-lexical .after\:pb-1:after{content:var(--tw-content);padding-bottom:.4rem}.koenig-lexical .after\:text-grey-500:after{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(174 183 193 / var(--tw-text-opacity, 1))}.koenig-lexical .after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.koenig-lexical .after\:content-\[attr\(data-placeholder\)\]:after{--tw-content: attr(data-placeholder);content:var(--tw-content)}.koenig-lexical .first\:m-0:first-child{margin:0}.koenig-lexical .odd\:bg-black:nth-child(odd){--tw-bg-opacity: 1;background-color:rgb(21 23 26 / var(--tw-bg-opacity, 1))}.koenig-lexical .even\:bg-grey-200:nth-child(2n){--tw-bg-opacity: 1;background-color:rgb(235 238 240 / var(--tw-bg-opacity, 1))}.koenig-lexical .first-of-type\:mr-3:first-of-type{margin-right:1.2rem}.koenig-lexical .first-of-type\:mt-0:first-of-type{margin-top:0}.koenig-lexical .first-of-type\:mt-8:first-of-type{margin-top:3.2rem}.koenig-lexical .first-of-type\:border-t-0:first-of-type{border-top-width:0px}.koenig-lexical .last-of-type\:mr-0:last-of-type{margin-right:0}.koenig-lexical .focus-within\:border-green:focus-within{--tw-border-opacity: 1;border-color:rgb(48 207 67 / var(--tw-border-opacity, 1))}.koenig-lexical .focus-within\:bg-white:focus-within{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .focus-within\:shadow-\[0_0_0_2px_rgba\(48\,207\,67\,\.25\)\]:focus-within{--tw-shadow: 0 0 0 2px rgba(48,207,67,.25);--tw-shadow-colored: 0 0 0 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .focus-within\:outline-none:focus-within{outline:2px solid transparent;outline-offset:2px}.koenig-lexical .hover\:-mx-3:hover{margin-left:-1.2rem;margin-right:-1.2rem}.koenig-lexical .hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical .hover\:border-grey-100:hover{--tw-border-opacity: 1;border-color:rgb(244 245 246 / var(--tw-border-opacity, 1))}.koenig-lexical .hover\:border-grey-500:hover{--tw-border-opacity: 1;border-color:rgb(174 183 193 / var(--tw-border-opacity, 1))}.koenig-lexical .hover\:border-grey-800:hover{--tw-border-opacity: 1;border-color:rgb(98 109 121 / var(--tw-border-opacity, 1))}.koenig-lexical .hover\:border-grey-900:hover{--tw-border-opacity: 1;border-color:rgb(57 64 71 / var(--tw-border-opacity, 1))}.koenig-lexical .hover\:bg-grey-100:hover{--tw-bg-opacity: 1;background-color:rgb(244 245 246 / var(--tw-bg-opacity, 1))}.koenig-lexical .hover\:bg-grey-200:hover{--tw-bg-opacity: 1;background-color:rgb(235 238 240 / var(--tw-bg-opacity, 1))}.koenig-lexical .hover\:bg-grey-200\/80:hover{background-color:#ebeef0cc}.koenig-lexical .hover\:bg-grey-500\/20:hover{background-color:#aeb7c133}.koenig-lexical .hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .hover\:px-3:hover{padding-left:1.2rem;padding-right:1.2rem}.koenig-lexical .hover\:font-bold:hover{font-weight:700}.koenig-lexical .hover\:text-black:hover{--tw-text-opacity: 1;color:rgb(21 23 26 / var(--tw-text-opacity, 1))}.koenig-lexical .hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(42 178 58 / var(--tw-text-opacity, 1))}.koenig-lexical .hover\:opacity-100:hover{opacity:1}.koenig-lexical .hover\:shadow-\[0_0_0_1px\]:hover{--tw-shadow: 0 0 0 1px;--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .hover\:shadow-\[0_0_0_1px_\#30cf43\]:hover{--tw-shadow: 0 0 0 1px #30cf43;--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .hover\:shadow-green:hover{--tw-shadow-color: #30CF43;--tw-shadow: var(--tw-shadow-colored)}.koenig-lexical .focus\:border-green:focus{--tw-border-opacity: 1;border-color:rgb(48 207 67 / var(--tw-border-opacity, 1))}.koenig-lexical .focus\:border-green-600:focus{--tw-border-opacity: 1;border-color:rgb(42 178 58 / var(--tw-border-opacity, 1))}.koenig-lexical .focus\:border-grey-400:focus{--tw-border-opacity: 1;border-color:rgb(206 212 217 / var(--tw-border-opacity, 1))}.koenig-lexical .focus\:bg-white:focus{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .focus\:shadow-\[0_0_0_2px_rgba\(48\,207\,67\,\.25\)\]:focus{--tw-shadow: 0 0 0 2px rgba(48,207,67,.25);--tw-shadow-colored: 0 0 0 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .focus\:shadow-insetgreen:focus{--tw-shadow: 0px 0px 0px 1px inset var(--green);--tw-shadow-colored: inset 0px 0px 0px 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.koenig-lexical :is(.group\/image:hover .group-hover\/image\:visible){visibility:visible}.koenig-lexical :is(.group:hover .group-hover\:visible){visibility:visible}.koenig-lexical :is(.group:hover .group-hover\:block){display:block}.koenig-lexical :is(.group:hover .group-hover\:inline){display:inline}.koenig-lexical :is(.group:hover .group-hover\:scale-105){--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical :is(.group:hover .group-hover\:stroke-grey-900){stroke:#394047}.koenig-lexical :is(.group:hover .group-hover\:font-bold){font-weight:700}.koenig-lexical :is(.group:hover .group-hover\:text-grey-800){--tw-text-opacity: 1;color:rgb(98 109 121 / var(--tw-text-opacity, 1))}.koenig-lexical :is(.group\/image:hover .group-hover\/image\:opacity-100){opacity:1}.koenig-lexical :is(.group:hover .group-hover\:opacity-100){opacity:1}.koenig-lexical :is(.peer:checked~.peer-checked\:bg-black){--tw-bg-opacity: 1;background-color:rgb(21 23 26 / var(--tw-bg-opacity, 1))}.koenig-lexical :is(.peer:checked~.peer-checked\:before\:translate-x-\[12px\]):before{content:var(--tw-content);--tw-translate-x: 12px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.koenig-lexical :is(.peer.koenig-lexical~.peer-\[\.koenig-lexical\]\:mt-10){margin-top:4rem}.koenig-lexical :is(.peer.koenig-lexical~.peer-\[\.koenig-lexical\]\:mt-12){margin-top:4.8rem}.koenig-lexical :is(.peer.koenig-lexical~.peer-\[\.koenig-lexical\]\:mt-8){margin-top:3.2rem}.koenig-lexical .dark\:border-none:is(.dark *){border-style:none}.koenig-lexical .dark\:border-black:is(.dark *){--tw-border-opacity: 1;border-color:rgb(21 23 26 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:border-grey-100\/20:is(.dark *){border-color:#f4f5f633}.koenig-lexical .dark\:border-grey-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(98 109 121 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:border-grey-800\/80:is(.dark *){border-color:#626d79cc}.koenig-lexical .dark\:border-grey-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(57 64 71 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:border-grey-950:is(.dark *){--tw-border-opacity: 1;border-color:rgb(35 41 47 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:border-grey\/10:is(.dark *){border-color:#abb4be1a}.koenig-lexical .dark\:border-grey\/20:is(.dark *){border-color:#abb4be33}.koenig-lexical .dark\:border-grey\/30:is(.dark *){border-color:#abb4be4d}.koenig-lexical .dark\:border-transparent:is(.dark *){border-color:transparent}.koenig-lexical .dark\:border-white:is(.dark *){--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:border-white\/10:is(.dark *){border-color:#ffffff1a}.koenig-lexical .dark\:border-white\/15:is(.dark *){border-color:#ffffff26}.koenig-lexical .dark\:border-t-grey-900:is(.dark *){--tw-border-opacity: 1;border-top-color:rgb(57 64 71 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:bg-black:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(21 23 26 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-grey-100:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(244 245 246 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-grey-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-grey-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(57 64 71 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-grey-925:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(46 51 56 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-grey-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(35 41 47 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-lime-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(70 102 0 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-transparent:is(.dark *){background-color:transparent}.koenig-lexical .dark\:bg-white:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:bg-white\/40:is(.dark *){background-color:#fff6}.koenig-lexical .dark\:fill-black:is(.dark *){fill:#15171a}.koenig-lexical .dark\:fill-grey-600:is(.dark *){fill:#95a1ad}.koenig-lexical .dark\:fill-grey-900:is(.dark *){fill:#394047}.koenig-lexical .dark\:fill-white:is(.dark *){fill:#fff}.koenig-lexical .dark\:stroke-grey-300:is(.dark *){stroke:#dde1e5}.koenig-lexical .dark\:stroke-grey-500:is(.dark *){stroke:#aeb7c1}.koenig-lexical .dark\:text-black:is(.dark *){--tw-text-opacity: 1;color:rgb(21 23 26 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-green-600:is(.dark *){--tw-text-opacity: 1;color:rgb(42 178 58 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-100:is(.dark *){--tw-text-opacity: 1;color:rgb(244 245 246 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-200:is(.dark *){--tw-text-opacity: 1;color:rgb(235 238 240 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-200\/40:is(.dark *){color:#ebeef066}.koenig-lexical .dark\:text-grey-300:is(.dark *){--tw-text-opacity: 1;color:rgb(221 225 229 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-400:is(.dark *){--tw-text-opacity: 1;color:rgb(206 212 217 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-50:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 251 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-500:is(.dark *){--tw-text-opacity: 1;color:rgb(174 183 193 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-600:is(.dark *){--tw-text-opacity: 1;color:rgb(149 161 173 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-800:is(.dark *){--tw-text-opacity: 1;color:rgb(98 109 121 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey-900:is(.dark *){--tw-text-opacity: 1;color:rgb(57 64 71 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-grey\/30:is(.dark *){color:#abb4be4d}.koenig-lexical .dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:text-white\/50:is(.dark *){color:#ffffff80}.koenig-lexical .dark\:caret-grey-300:is(.dark *){caret-color:#dde1e5}.koenig-lexical .dark\:shadow-\[0_0_0_1px_rgba\(255\,255\,255\,0\.1\)\]:is(.dark *){--tw-shadow: 0 0 0 1px rgba(255,255,255,.1);--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .dark\:shadow-\[0_0_0_2px_rgba\(255\,255\,255\,1\)\]:is(.dark *){--tw-shadow: 0 0 0 2px rgba(255,255,255,1);--tw-shadow-colored: 0 0 0 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical .dark\:shadow-xl:is(.dark *){--tw-shadow: 0 2.8px 2.2px rgba(0, 0, 0, .02), 0 6.7px 5.3px rgba(0, 0, 0, .028), 0 12.5px 10px rgba(0, 0, 0, .035), 0 22.3px 17.9px rgba(0, 0, 0, .042), 0 41.8px 33.4px rgba(0, 0, 0, .05), 0 100px 80px rgba(0, 0, 0, .07);--tw-shadow-colored: 0 2.8px 2.2px var(--tw-shadow-color), 0 6.7px 5.3px var(--tw-shadow-color), 0 12.5px 10px var(--tw-shadow-color), 0 22.3px 17.9px var(--tw-shadow-color), 0 41.8px 33.4px var(--tw-shadow-color), 0 100px 80px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.koenig-lexical :is(.dark\:selection\:bg-grey-600\/40 *:is(.dark *))::-moz-selection{background-color:#95a1ad66}.koenig-lexical :is(.dark\:selection\:bg-grey-600\/40 *:is(.dark *))::selection{background-color:#95a1ad66}.koenig-lexical :is(.dark\:selection\:bg-grey-800 *:is(.dark *))::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical :is(.dark\:selection\:bg-grey-800 *:is(.dark *))::selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical :is(.dark\:selection\:bg-grey-800\/40 *:is(.dark *))::-moz-selection{background-color:#626d7966}.koenig-lexical :is(.dark\:selection\:bg-grey-800\/40 *:is(.dark *))::selection{background-color:#626d7966}.koenig-lexical :is(.dark\:selection\:text-grey-100 *:is(.dark *))::-moz-selection{--tw-text-opacity: 1;color:rgb(244 245 246 / var(--tw-text-opacity, 1))}.koenig-lexical :is(.dark\:selection\:text-grey-100 *:is(.dark *))::selection{--tw-text-opacity: 1;color:rgb(244 245 246 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:selection\:bg-grey-600\/40:is(.dark *)::-moz-selection{background-color:#95a1ad66}.koenig-lexical .dark\:selection\:bg-grey-600\/40:is(.dark *)::selection{background-color:#95a1ad66}.koenig-lexical .dark\:selection\:bg-grey-800:is(.dark *)::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:selection\:bg-grey-800:is(.dark *)::selection{--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:selection\:bg-grey-800\/40:is(.dark *)::-moz-selection{background-color:#626d7966}.koenig-lexical .dark\:selection\:bg-grey-800\/40:is(.dark *)::selection{background-color:#626d7966}.koenig-lexical .dark\:selection\:text-grey-100:is(.dark *)::-moz-selection{--tw-text-opacity: 1;color:rgb(244 245 246 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:selection\:text-grey-100:is(.dark *)::selection{--tw-text-opacity: 1;color:rgb(244 245 246 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:placeholder\:text-grey-700:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(124 139 154 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:placeholder\:text-grey-700:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(124 139 154 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:placeholder\:text-grey-800:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(98 109 121 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:placeholder\:text-grey-800:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(98 109 121 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:before\:text-grey-100:is(.dark *):before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(244 245 246 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:after\:text-grey-600:is(.dark *):after{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(149 161 173 / var(--tw-text-opacity, 1))}.koenig-lexical .dark\:odd\:bg-white:nth-child(odd):is(.dark *){--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:even\:bg-grey-800:nth-child(2n):is(.dark *){--tw-bg-opacity: 1;background-color:rgb(98 109 121 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:focus-within\:border-green:focus-within:is(.dark *){--tw-border-opacity: 1;border-color:rgb(48 207 67 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:hover\:border-grey-400:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(206 212 217 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:hover\:border-grey-500:hover:is(.dark *){--tw-border-opacity: 1;border-color:rgb(174 183 193 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:hover\:bg-black:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(21 23 26 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:hover\:bg-grey-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(57 64 71 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:hover\:bg-grey-925:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(46 51 56 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:hover\:bg-grey-950:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(35 41 47 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:focus\:border-green:focus:is(.dark *){--tw-border-opacity: 1;border-color:rgb(48 207 67 / var(--tw-border-opacity, 1))}.koenig-lexical .dark\:focus\:bg-grey-900:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(57 64 71 / var(--tw-bg-opacity, 1))}.koenig-lexical .dark\:focus\:bg-grey-925:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(46 51 56 / var(--tw-bg-opacity, 1))}.koenig-lexical :is(.group:hover .dark\:group-hover\:stroke-grey-100:is(.dark *)){stroke:#f4f5f6}.koenig-lexical :is(.peer:checked~.dark\:peer-checked\:bg-green:is(.dark *)){--tw-bg-opacity: 1;background-color:rgb(48 207 67 / var(--tw-bg-opacity, 1))}@media (min-width: 500px){.koenig-lexical .xs\:left-\[-66px\]{left:-66px}.koenig-lexical .xs\:w-\[calc\(740px\+8rem\)\]{width:calc(740px + 8rem)}.koenig-lexical .xs\:overflow-visible{overflow:visible}.koenig-lexical .xs\:px-\[calc\(92px-\(8rem\/2\)\)\]{padding-left:calc(92px - 4rem);padding-right:calc(92px - 4rem)}}@media (min-width: 640px){.koenig-lexical .sm\:relative{position:relative}.koenig-lexical .sm\:my-10{margin-top:4rem;margin-bottom:4rem}.koenig-lexical .sm\:w-1\/2{width:50%}.koenig-lexical .sm\:w-\[440px\]{width:440px}.koenig-lexical .sm\:flex-row{flex-direction:row}.koenig-lexical .sm\:flex-row-reverse{flex-direction:row-reverse}.koenig-lexical .sm\:px-\[calc\(92px-\(12rem\/2\)\)\]{padding-left:calc(92px - 6rem);padding-right:calc(92px - 6rem)}.koenig-lexical .sm\:py-\[6rem\]{padding-top:6rem;padding-bottom:6rem}.koenig-lexical .sm\:pl-0{padding-left:0}.koenig-lexical .sm\:pl-\[calc\(92px-\(12rem\/2\)\)\]{padding-left:calc(92px - 6rem)}.koenig-lexical .sm\:pr-0{padding-right:0}.koenig-lexical .sm\:pr-\[calc\(92px-\(12rem\/2\)\)\]{padding-right:calc(92px - 6rem)}.koenig-lexical .sm\:text-4xl{font-size:3.6rem}.koenig-lexical .sm\:text-xl{font-size:2rem}}@media (min-width: 768px){.koenig-lexical .md\:col-span-2{grid-column:span 2 / span 2}.koenig-lexical .md\:my-14{margin-top:5.6rem;margin-bottom:5.6rem}.koenig-lexical .md\:grid{display:grid}.koenig-lexical .md\:size-9{width:3.6rem;height:3.6rem}.koenig-lexical .md\:h-\[38px\]{height:38px}.koenig-lexical .md\:w-2\/3{width:66.666667%}.koenig-lexical .md\:w-\[348px\]{width:348px}.koenig-lexical .md\:w-\[calc\(740px\+12rem\)\]{width:calc(740px + 12rem)}.koenig-lexical .md\:min-w-\[calc\(100\%\+10rem\)\]{min-width:calc(100% + 10rem)}.koenig-lexical .md\:gap-y-\[\.2rem\]{row-gap:.2rem}.koenig-lexical .md\:rounded-md{border-radius:.6rem}.koenig-lexical .md\:px-2{padding-left:.8rem;padding-right:.8rem}.koenig-lexical .md\:px-\[6rem\]{padding-left:6rem;padding-right:6rem}.koenig-lexical .md\:px-\[8rem\]{padding-left:8rem;padding-right:8rem}.koenig-lexical .md\:px-\[calc\(92px-\(12rem\/2\)\)\]{padding-left:calc(92px - 6rem);padding-right:calc(92px - 6rem)}.koenig-lexical .md\:py-2{padding-top:.8rem;padding-bottom:.8rem}.koenig-lexical .md\:py-\[10rem\]{padding-top:10rem;padding-bottom:10rem}.koenig-lexical .md\:py-\[12rem\]{padding-top:12rem;padding-bottom:12rem}.koenig-lexical .md\:py-\[14rem\]{padding-top:14rem;padding-bottom:14rem}.koenig-lexical .md\:py-\[8rem\]{padding-top:8rem;padding-bottom:8rem}.koenig-lexical .md\:pl-\[calc\(92px-\(12rem\/2\)\)\]{padding-left:calc(92px - 6rem)}.koenig-lexical .md\:pr-\[calc\(92px-\(12rem\/2\)\)\]{padding-right:calc(92px - 6rem)}.koenig-lexical .md\:text-5xl{font-size:4.8rem;line-height:1.15}.koenig-lexical .md\:text-\[2\.2rem\]{font-size:2.2rem}.koenig-lexical :is(.peer.koenig-lexical~.peer-\[\.koenig-lexical\]\:md\:mt-16){margin-top:6.4rem}.koenig-lexical :is(.peer.koenig-lexical~.peer-\[\.koenig-lexical\]\:md\:mt-8){margin-top:3.2rem}}@media (min-width: 1024px){.koenig-lexical .lg\:top-8{top:3.2rem}.koenig-lexical .lg\:mx-\[calc\(50\%-50vw\+\(var\(--kg-breakout-adjustment-with-fallback\)\/2\)\)\]{margin-left:calc(50% - 50vw + (var(--kg-breakout-adjustment-with-fallback) / 2));margin-right:calc(50% - 50vw + (var(--kg-breakout-adjustment-with-fallback) / 2))}.koenig-lexical .lg\:w-\[calc\(100vw-var\(--kg-breakout-adjustment-with-fallback\)\+2px\)\]{width:calc(100vw - var(--kg-breakout-adjustment-with-fallback) + 2px)}.koenig-lexical .lg\:w-\[calc\(740px\+22rem\)\]{width:calc(740px + 22rem)}.koenig-lexical .lg\:min-w-\[calc\(100\%\+18rem\)\]{min-width:calc(100% + 18rem)}.koenig-lexical .lg\:px-0{padding-left:0;padding-right:0}.koenig-lexical .lg\:px-\[8rem\]{padding-left:8rem;padding-right:8rem}.koenig-lexical .lg\:py-\[14rem\]{padding-top:14rem;padding-bottom:14rem}.koenig-lexical .lg\:py-\[16rem\]{padding-top:16rem;padding-bottom:16rem}.koenig-lexical .lg\:pl-0{padding-left:0}.koenig-lexical .lg\:pr-0{padding-right:0}.koenig-lexical .lg\:text-2xl{font-size:2.4rem}.koenig-lexical .lg\:text-6xl{font-size:6rem;line-height:1}.koenig-lexical .lg\:text-\[2\.6rem\]{font-size:2.6rem}}@media (min-width: 1280px){.koenig-lexical .xl\:w-1\/2{width:50%}.koenig-lexical .xl\:w-\[calc\(740px\+40rem\)\]{width:calc(740px + 40rem)}.koenig-lexical .xl\:max-w-\[880px\]{max-width:880px}.koenig-lexical .xl\:py-\[18rem\]{padding-top:18rem;padding-bottom:18rem}}.koenig-lexical .\[\&\:has\(\.placeholder\)\]\:w-fit:has(.placeholder){width:-moz-fit-content;width:fit-content}.koenig-lexical .\[\&\:has\(\.placeholder\)\]\:text-left:has(.placeholder){text-align:left}/** + * simplemde v1.11.2 + * Copyright Next Step Webs, Inc. + * @link https://github.com/NextStepWebs/simplemde-markdown-editor + * @license MIT + */.koenig-lexical .CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.koenig-lexical .CodeMirror-lines{padding:4px 0}.koenig-lexical .CodeMirror pre{padding:0 4px}.koenig-lexical .CodeMirror-gutter-filler,.koenig-lexical .CodeMirror-scrollbar-filler{background-color:#fff}.koenig-lexical .CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.koenig-lexical .CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.koenig-lexical .CodeMirror-guttermarker{color:#000}.koenig-lexical .CodeMirror-guttermarker-subtle{color:#999}.koenig-lexical .CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.koenig-lexical .CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.koenig-lexical .cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.koenig-lexical .cm-fat-cursor div.CodeMirror-cursors{z-index:1}.koenig-lexical .cm-fat-cursor-mark{background-color:#14ff1480;animation:blink 1.06s steps(1) infinite}.koenig-lexical .cm-animate-fat-cursor{width:auto;border:0;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@keyframes blink{50%{background-color:transparent}}.koenig-lexical .cm-tab{display:inline-block;text-decoration:inherit}.koenig-lexical .CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.koenig-lexical .CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.koenig-lexical .cm-s-default .cm-header{color:#00f}.koenig-lexical .cm-s-default .cm-quote{color:#090}.koenig-lexical .cm-negative{color:#d44}.koenig-lexical .cm-positive{color:#292}.koenig-lexical .cm-header,.koenig-lexical .cm-strong{font-weight:700}.koenig-lexical .cm-em{font-style:italic}.koenig-lexical .cm-link{text-decoration:underline}.koenig-lexical .cm-strikethrough{text-decoration:line-through}.koenig-lexical .cm-s-default .cm-keyword{color:#708}.koenig-lexical .cm-s-default .cm-atom{color:#219}.koenig-lexical .cm-s-default .cm-number{color:#164}.koenig-lexical .cm-s-default .cm-def{color:#00f}.koenig-lexical .cm-s-default .cm-variable-2{color:#05a}.koenig-lexical .cm-s-default .cm-type,.koenig-lexical .cm-s-default .cm-variable-3{color:#085}.koenig-lexical .cm-s-default .cm-comment{color:#a50}.koenig-lexical .cm-s-default .cm-string{color:#a11}.koenig-lexical .cm-s-default .cm-string-2{color:#f50}.koenig-lexical .cm-s-default .cm-meta,.koenig-lexical .cm-s-default .cm-qualifier{color:#555}.koenig-lexical .cm-s-default .cm-builtin{color:#30a}.koenig-lexical .cm-s-default .cm-bracket{color:#997}.koenig-lexical .cm-s-default .cm-tag{color:#170}.koenig-lexical .cm-s-default .cm-attribute{color:#00c}.koenig-lexical .cm-s-default .cm-hr{color:#999}.koenig-lexical .cm-s-default .cm-link{color:#00c}.koenig-lexical .cm-s-default .cm-error,.koenig-lexical .cm-invalidchar{color:red}.koenig-lexical .CodeMirror-composing{border-bottom:2px solid}.koenig-lexical div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}.koenig-lexical div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.koenig-lexical .CodeMirror-matchingtag{background:#ff96004d}.koenig-lexical .CodeMirror-activeline-background{background:#e8f2ff}.koenig-lexical .CodeMirror{position:relative;overflow:hidden;background:#fff}.koenig-lexical .CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.koenig-lexical .CodeMirror-sizer{position:relative;border-right:30px solid transparent}.koenig-lexical .CodeMirror-gutter-filler,.koenig-lexical .CodeMirror-hscrollbar,.koenig-lexical .CodeMirror-scrollbar-filler,.koenig-lexical .CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.koenig-lexical .CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.koenig-lexical .CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.koenig-lexical .CodeMirror-scrollbar-filler{right:0;bottom:0}.koenig-lexical .CodeMirror-gutter-filler{left:0;bottom:0}.koenig-lexical .CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.koenig-lexical .CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.koenig-lexical .CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.koenig-lexical .CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.koenig-lexical .CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.koenig-lexical .CodeMirror-gutter-wrapper ::selection{background-color:transparent}.koenig-lexical .CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.koenig-lexical .CodeMirror-lines{cursor:text;min-height:1px}.koenig-lexical .CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;font-variant-ligatures:contextual}.koenig-lexical .CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.koenig-lexical .CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.koenig-lexical .CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.koenig-lexical .CodeMirror-rtl pre{direction:rtl}.koenig-lexical .CodeMirror-code{outline:0}.koenig-lexical .CodeMirror-gutter,.koenig-lexical .CodeMirror-gutters,.koenig-lexical .CodeMirror-linenumber,.koenig-lexical .CodeMirror-scroll,.koenig-lexical .CodeMirror-sizer{box-sizing:content-box}.koenig-lexical .CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.koenig-lexical .CodeMirror-cursor{position:absolute;pointer-events:none}.koenig-lexical .CodeMirror-measure pre{position:static}.koenig-lexical div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.koenig-lexical div.CodeMirror-dragcursors,.koenig-lexical .CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.koenig-lexical .CodeMirror-selected{background:#d9d9d9}.koenig-lexical .CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.koenig-lexical .CodeMirror-crosshair{cursor:crosshair}.koenig-lexical .CodeMirror-line::selection,.koenig-lexical .CodeMirror-line>span::selection,.koenig-lexical .CodeMirror-line>span>span::selection{background:#d7d4f0}.koenig-lexical .CodeMirror-line::-moz-selection,.koenig-lexical .CodeMirror-line>span::-moz-selection,.koenig-lexical .CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.koenig-lexical .cm-searching{background-color:#ffa;background-color:#ff06}.koenig-lexical .cm-force-border{padding-right:.1px}@media print{.koenig-lexical .CodeMirror div.CodeMirror-cursors{visibility:hidden}}.koenig-lexical .cm-tab-wrap-hack:after{content:""}.koenig-lexical span.CodeMirror-selectedtext{background:0 0}.koenig-lexical .CodeMirror{height:auto;min-height:300px;border:1px solid #ddd;border-bottom-left-radius:4px;border-bottom-right-radius:4px;padding:10px;font:inherit;z-index:1}.koenig-lexical .CodeMirror-scroll{min-height:300px}.koenig-lexical .CodeMirror-fullscreen{background:#fff;position:fixed!important;top:50px;left:0;right:0;bottom:0;height:auto;z-index:9}.koenig-lexical .CodeMirror-sided{width:50%!important}.koenig-lexical .editor-toolbar{position:relative;opacity:.6;-webkit-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;padding:0 10px;border-top:1px solid #bbb;border-left:1px solid #bbb;border-right:1px solid #bbb;border-top-left-radius:4px;border-top-right-radius:4px}.koenig-lexical .editor-toolbar:after,.koenig-lexical .editor-toolbar:before{display:block;content:" ";height:1px}.koenig-lexical .editor-toolbar:before{margin-bottom:8px}.koenig-lexical .editor-toolbar:after{margin-top:8px}.koenig-lexical .editor-toolbar:hover,.koenig-lexical .editor-wrapper input.title:focus,.koenig-lexical .editor-wrapper input.title:hover{opacity:.8}.koenig-lexical .editor-toolbar.fullscreen{width:100%;height:50px;overflow-x:auto;overflow-y:hidden;white-space:nowrap;padding-top:10px;padding-bottom:10px;box-sizing:border-box;background:#fff;border:0;position:fixed;top:0;left:0;opacity:1;z-index:9}.koenig-lexical .editor-toolbar.fullscreen:before{width:20px;height:50px;background:linear-gradient(to right,#fff 0,#fff0);position:fixed;top:0;left:0;margin:0;padding:0}.koenig-lexical .editor-toolbar.fullscreen:after{width:20px;height:50px;background:linear-gradient(to right,#fff0 0,#fff);position:fixed;top:0;right:0;margin:0;padding:0}.koenig-lexical .editor-toolbar a{display:inline-block;text-align:center;text-decoration:none!important;color:#2c3e50!important;width:30px;height:30px;margin:0;border:1px solid transparent;border-radius:3px;cursor:pointer}.koenig-lexical .editor-toolbar a.active,.koenig-lexical .editor-toolbar a:hover{background:#fcfcfc;border-color:#95a5a6}.koenig-lexical .editor-toolbar a:before{line-height:30px}.koenig-lexical .editor-toolbar i.separator{display:inline-block;width:0;border-left:1px solid #d9d9d9;border-right:1px solid #fff;color:transparent;text-indent:-10px;margin:0 6px}.koenig-lexical .editor-toolbar a.fa-header-x:after{font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:65%;vertical-align:text-bottom;position:relative;top:2px}.koenig-lexical .editor-toolbar a.fa-header-1:after{content:"1"}.koenig-lexical .editor-toolbar a.fa-header-2:after{content:"2"}.koenig-lexical .editor-toolbar a.fa-header-3:after{content:"3"}.koenig-lexical .editor-toolbar a.fa-header-bigger:after{content:"▲"}.koenig-lexical .editor-toolbar a.fa-header-smaller:after{content:"▼"}.koenig-lexical .editor-toolbar.disabled-for-preview a:not(.no-disable){pointer-events:none;background:#fff;border-color:transparent;text-shadow:inherit}@media only screen and (max-width:700px){.koenig-lexical .editor-toolbar a.no-mobile{display:none}}.koenig-lexical .editor-statusbar{padding:8px 10px;font-size:12px;color:#959694;text-align:right}.koenig-lexical .editor-statusbar span{display:inline-block;min-width:4em;margin-left:1em}.koenig-lexical .editor-statusbar .lines:before{content:"lines: "}.koenig-lexical .editor-statusbar .words:before{content:"words: "}.koenig-lexical .editor-statusbar .characters:before{content:"characters: "}.koenig-lexical .editor-preview{padding:10px;position:absolute;width:100%;height:100%;top:0;left:0;background:#fafafa;z-index:7;overflow:auto;display:none;box-sizing:border-box}.koenig-lexical .editor-preview-side{padding:10px;position:fixed;bottom:0;width:50%;top:50px;right:0;background:#fafafa;z-index:9;overflow:auto;display:none;box-sizing:border-box;border:1px solid #ddd}.koenig-lexical .editor-preview-active-side,.koenig-lexical .editor-preview-active{display:block}.koenig-lexical .editor-preview-side>p,.koenig-lexical .editor-preview>p{margin-top:0}.koenig-lexical .editor-preview pre,.koenig-lexical .editor-preview-side pre{background:#eee;margin-bottom:10px}.koenig-lexical .editor-preview table td,.koenig-lexical .editor-preview table th,.koenig-lexical .editor-preview-side table td,.koenig-lexical .editor-preview-side table th{border:1px solid #ddd;padding:5px}.koenig-lexical .CodeMirror .CodeMirror-code .cm-tag{color:#63a35c}.koenig-lexical .CodeMirror .CodeMirror-code .cm-attribute{color:#795da3}.koenig-lexical .CodeMirror .CodeMirror-code .cm-string{color:#183691}.koenig-lexical .CodeMirror .CodeMirror-selected{background:#d9d9d9}.koenig-lexical .CodeMirror .CodeMirror-code .cm-header-1{font-size:200%;line-height:200%}.koenig-lexical .CodeMirror .CodeMirror-code .cm-header-2{font-size:160%;line-height:160%}.koenig-lexical .CodeMirror .CodeMirror-code .cm-header-3{font-size:125%;line-height:125%}.koenig-lexical .CodeMirror .CodeMirror-code .cm-header-4{font-size:110%;line-height:110%}.koenig-lexical .CodeMirror .CodeMirror-code .cm-comment{background:#0000000d;border-radius:2px}.koenig-lexical .CodeMirror .CodeMirror-code .cm-link{color:#7f8c8d}.koenig-lexical .CodeMirror .CodeMirror-code .cm-url{color:#aab2b3}.koenig-lexical .CodeMirror .CodeMirror-code .cm-strikethrough{text-decoration:line-through}.koenig-lexical .CodeMirror .CodeMirror-placeholder{opacity:.5}.koenig-lexical .CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word){background:#ff000026} diff --git a/editor/node_modules/@tryghost/koenig-lexical/dist/koenig-lexical.js b/editor/node_modules/@tryghost/koenig-lexical/dist/koenig-lexical.js new file mode 100644 index 0000000..10609f5 --- /dev/null +++ b/editor/node_modules/@tryghost/koenig-lexical/dist/koenig-lexical.js @@ -0,0 +1,130151 @@ +var hne = Object.defineProperty; +var pne = (t, e, n) => e in t ? hne(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; +var we = (t, e, n) => pne(t, typeof e != "symbol" ? e + "" : e, n); +import * as J from "react"; +import j, { useState as ft, useEffect as kt, forwardRef as mne, useRef as ct, useImperativeHandle as gne, useCallback as $t, useContext as Au, useLayoutEffect as rh, useMemo as Vm, Fragment as vne } from "react"; +import xj, { createPortal as _j } from "react-dom"; +(function() { + try { + var t = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, e = new t.Error().stack; + e && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[e] = "bfe81679-99e3-4b92-baf2-93d0d8b7ea9d", t._sentryDebugIdIdentifier = "sentry-dbid-bfe81679-99e3-4b92-baf2-93d0d8b7ea9d"); + } catch { + } +})(); +var on = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function Gs(t) { + return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; +} +function Sk(t) { + if (t.__esModule) return t; + var e = t.default; + if (typeof e == "function") { + var n = function i() { + return this instanceof i ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); + }; + n.prototype = e.prototype; + } else n = {}; + return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(t).forEach(function(i) { + var r = Object.getOwnPropertyDescriptor(t, i); + Object.defineProperty(n, i, r.get ? r : { + enumerable: !0, + get: function() { + return t[i]; + } + }); + }), n; +} +var Oj = { exports: {} }, Ck = {}; +/** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var bne = j, yne = Symbol.for("react.element"), wne = Symbol.for("react.fragment"), kne = Object.prototype.hasOwnProperty, xne = bne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ne = { key: !0, ref: !0, __self: !0, __source: !0 }; +function Sj(t, e, n) { + var i, r = {}, s = null, o = null; + n !== void 0 && (s = "" + n), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref); + for (i in e) kne.call(e, i) && !_ne.hasOwnProperty(i) && (r[i] = e[i]); + if (t && t.defaultProps) for (i in e = t.defaultProps, e) r[i] === void 0 && (r[i] = e[i]); + return { $$typeof: yne, type: t, key: s, ref: o, props: r, _owner: xne.current }; +} +Ck.Fragment = wne; +Ck.jsx = Sj; +Ck.jsxs = Sj; +Oj.exports = Ck; +var y = Oj.exports; +const Cj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M12 2v20m10-10H2" })), xS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 }, /* @__PURE__ */ J.createElement("path", { d: "M8 7h15" }), /* @__PURE__ */ J.createElement("path", { d: "M23 17.5V1H8v18.5", "data-cap": "butt" }), /* @__PURE__ */ J.createElement("circle", { cx: 4.5, cy: 19.5, r: 3.5 }), /* @__PURE__ */ J.createElement("circle", { cx: 19.5, cy: 17.5, r: 3.5 }))), Ej = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M5 2v10h8a5 5 0 0 0 0-10H3m2 20V12h9c3.314 0 6 2.238 6 5s-2.686 5-6 5H3" })), _S = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m21 22-9-5-9 5V3a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v19Z" })), OS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M22 6H2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1ZM7 12h10" })), SS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20.8 2H3.2C1.985 2 1 2.895 1 4v16c0 1.105.985 2 2.2 2h17.6c1.215 0 2.2-.895 2.2-2V4c0-1.105-.985-2-2.2-2Z" }), /* @__PURE__ */ J.createElement("path", { fill: "currentColor", d: "M12 18a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 6.5v6" })), Tj = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("path", { d: "M31.976 10.886c-.007-.039-.014-.078-.024-.116l-.022-.066c-.01-.034-.022-.068-.035-.1l-.03-.067c-.015-.031-.03-.062-.048-.092-.012-.022-.026-.042-.039-.063-.018-.029-.037-.057-.058-.084-.015-.02-.03-.04-.047-.059-.022-.026-.045-.05-.068-.075l-.055-.053c-.025-.023-.051-.045-.078-.065-.021-.016-.041-.033-.063-.047-.008-.006-.014-.013-.023-.018L16.762.231c-.461-.308-1.063-.308-1.525 0L.612 9.981l-.022.017c-.022.015-.042.031-.063.047-.027.021-.053.043-.078.065-.019.017-.037.035-.055.054-.024.024-.046.048-.068.074-.017.02-.032.039-.047.06-.02.028-.04.055-.058.084l-.04.064c-.017.03-.032.06-.046.09-.01.022-.022.045-.03.067-.014.033-.026.067-.036.1l-.022.065c-.01.038-.017.076-.024.115-.004.02-.008.04-.01.06-.009.06-.013.119-.013.18v9.751c0 .06.004.121.013.18.003.022.009.039.013.06.007.038.013.077.026.116l.021.067c.011.034.022.069.035.1.009.022.021.043.03.065.014.03.03.06.047.092.012.021.026.043.04.062.018.03.038.056.06.082.014.022.03.04.047.06.022.026.043.051.069.074.017.018.034.04.056.052l.077.066c.021.017.043.03.06.046.009.005.014.013.022.017l14.621 9.755c.231.155.496.233.763.232.267-.002.532-.078.763-.232l14.625-9.75.022-.016c.022-.015.042-.031.063-.047.027-.021.053-.043.078-.066l.055-.053c.024-.024.047-.049.068-.075.017-.02.032-.039.047-.06.02-.026.04-.054.058-.083.014-.02.027-.042.04-.063.017-.03.032-.06.047-.092l.03-.066c.014-.033.025-.067.035-.1.008-.023.016-.045.022-.067.01-.038.017-.077.024-.116.004-.02.009-.039.01-.06.009-.059.013-.118.013-.179v-9.75c0-.06-.005-.12-.012-.18-.004-.02-.01-.038-.014-.06h.002zM16 19.253L11.137 16 16 12.747 20.863 16 16 19.253zm-1.375-8.895l-5.962 3.988-4.812-3.22 10.774-7.182v6.414zM6.19 16l-3.44 2.3V13.7l3.44 2.3zm2.473 1.655l5.962 3.987v6.414L3.85 20.873l4.812-3.219v.001zm8.712 3.986l5.961-3.987 4.813 3.22-10.774 7.181v-6.414zm8.434-5.64l3.44-2.302v4.602L25.81 16zm-2.473-1.655l-5.961-3.987V3.944l10.774 7.183-4.813 3.219z", fill: "#000", fillRule: "nonzero" })), CS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M2 12h20" })), ES = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m2 5 10 8 10-8" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 4H3c-.53 0-1.04.199-1.414.553A1.837 1.837 0 0 0 1 5.89v13.22c0 .501.21.982.586 1.336C1.96 20.8 2.47 21 3 21h18c.53 0 1.04-.199 1.414-.553.375-.354.586-.835.586-1.336V5.89c0-.501-.21-.982-.586-1.336A2.061 2.061 0 0 0 21 4Z" })), Ug = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 7 2 2l5 18 3-7 8 8 3-3-8-8z" })), TS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m22 11.4-8.8 8.8c-2.5 2.5-6.7 2.5-9.2 0h0c-2.5-2.5-2.5-6.7 0-9.2l7.8-7.8c1.8-1.8 4.6-1.8 6.4 0h0C20 5 20 7.8 18.2 9.6L11 16.7c-1 1-2.6 1-3.5 0h0c-1-1-1-2.6 0-3.5l6-6" })), $S = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("g", { clipPath: "url(#a)" }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20.8 5H3.2C1.985 5 1 5.806 1 6.8v14.4c0 .994.985 1.8 2.2 1.8h17.6c1.215 0 2.2-.806 2.2-1.8V6.8c0-.994-.985-1.8-2.2-1.8ZM6 1h12" }), /* @__PURE__ */ J.createElement("path", { fill: "currentColor", d: "M15.142 10.264a.75.75 0 0 1 .529.4l4 8A.75.75 0 0 1 19 19.75H6a.75.75 0 0 1-.498-1.31l9-8a.75.75 0 0 1 .64-.176ZM7 12a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" })), /* @__PURE__ */ J.createElement("defs", null, /* @__PURE__ */ J.createElement("clipPath", { id: "a" }, /* @__PURE__ */ J.createElement("path", { fill: "#fff", d: "M0 0h24v24H0z" })))), $j = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", ...t }, /* @__PURE__ */ J.createElement("g", { strokeLinecap: "round", strokeWidth: 2, fill: "none", stroke: "currentColor", strokeLinejoin: "round", className: "nc-icon-wrapper" }, /* @__PURE__ */ J.createElement("path", { d: "M3 9h42v36H3zm7-6h28" }), /* @__PURE__ */ J.createElement("path", { d: "m10 38 7-10 5 4 8-11 9 17H10z" }), /* @__PURE__ */ J.createElement("circle", { cx: 17, cy: 19, r: 3 }))), Mj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M1.5 2.75h21m-21 18.5h21M16 17V9a2 2 0 0 1 2-2h2m-4 6h3m-7 4V7m-5 6h1v2a2 2 0 0 1-4 0V9a2 2 0 0 1 2-2h2" })), Xb = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M22 7H2a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1ZM1 21h22M1 3h22" })), Nj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M7 19.5v-6.25M7 7v6.25m0 0h10M17 7v12.5" })), Aj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M4 22V12M4 2v10m0 0h16m0-10v20" })), MS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m8 6-6 6 6 6m8-12 6 6-6 6" })), NS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20.8 2H3.2C1.985 2 1 2.895 1 4v16c0 1.105.985 2 2.2 2h17.6c1.215 0 2.2-.895 2.2-2V4c0-1.105-.985-2-2.2-2Z" }), /* @__PURE__ */ J.createElement("path", { fill: "currentColor", d: "m19.642 16.276-3.85-7a.517.517 0 0 0-.181-.189.585.585 0 0 0-.749.115l-4.533 5.494-2.307-2.516a.548.548 0 0 0-.206-.14.598.598 0 0 0-.499.031.529.529 0 0 0-.183.164l-2.75 4a.468.468 0 0 0-.015.507.526.526 0 0 0 .202.189c.084.045.18.069.28.069H19.15a.594.594 0 0 0 .268-.063.532.532 0 0 0 .2-.174.462.462 0 0 0 .024-.487ZM9.25 9c.911 0 1.65-.672 1.65-1.5S10.161 6 9.25 6c-.91 0-1.65.672-1.65 1.5S8.34 9 9.25 9Z" })), K0 = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M4 12h16m-4-4 4 4-4 4m-8 0-4-4 4-4" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: 0.5, d: "M1 3v18M23 3v18" })), AS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", ...t }, /* @__PURE__ */ J.createElement("g", { strokeLinecap: "round", strokeWidth: 2, fill: "none", stroke: "currentColor", strokeLinejoin: "round", className: "nc-icon-wrapper" }, /* @__PURE__ */ J.createElement("circle", { cx: 18, cy: 16, r: 4 }), /* @__PURE__ */ J.createElement("path", { "data-cap": "butt", d: "M20.849 33.164 33 20l13 13M2 38l12-11 10 9" }), /* @__PURE__ */ J.createElement("path", { d: "M2 6h44v36H2z" }))), J0 = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M23 8H1v8h22V8Z" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: 0.5, d: "M1 21h22M1 3h22" })), e1 = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M23 8H1v8h22V8Z" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeOpacity: 0.5, d: "M8 21h8M8 3h8" })), Dj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M22 2h-9.333m-1.334 20H2m4.667 0L17.333 2" })), DS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M13.54 10.46c2.2 2.2 2.2 5.61 0 7.81l-3.08 3.08c-2.2 2.2-5.61 2.2-7.81 0-2.2-2.2-2.2-5.61 0-7.81L5.4 10.9" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M10.46 13.54c-2.2-2.2-2.2-5.61 0-7.81l3.08-3.08c2.2-2.2 5.61-2.2 7.81 0 2.2 2.2 2.2 5.61 0 7.81L18.6 13.1" })), PS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 25 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 6v12m-3-2 2.813 2.813L23.625 16" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 19V6h-1L8 18.071H7L2 6H1v13" })), One = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("path", { d: "M32 16C32 24.8361 24.8361 32 16 32C7.16394 32 0 24.8361 0 16C0 7.16394 7.16394 0 16 0C24.8379 0 32 7.16394 32 16Z", fill: "#2081E2" }), /* @__PURE__ */ J.createElement("path", { d: "M7.89371 16.5376L7.96274 16.4291L12.125 9.91784C12.1858 9.82251 12.3288 9.83236 12.3748 9.93592C13.0702 11.4943 13.6702 13.4324 13.3891 14.639C13.2691 15.1354 12.9403 15.8078 12.5704 16.4291C12.5228 16.5196 12.4702 16.6083 12.4143 16.6938C12.388 16.7333 12.3436 16.7563 12.2959 16.7563H8.01534C7.90027 16.7563 7.83288 16.6313 7.89371 16.5376Z", fill: "white" }), /* @__PURE__ */ J.createElement("path", { d: "M26.4461 17.7475V18.7782C26.4461 18.8374 26.4099 18.89 26.3573 18.913C26.0351 19.0511 24.9321 19.5574 24.4734 20.1952C23.303 21.8242 22.4088 24.1536 20.4098 24.1536H12.0706C9.11495 24.1536 6.71985 21.7503 6.71985 18.7848V18.6894C6.71985 18.6105 6.78394 18.5464 6.86286 18.5464H11.5117C11.6037 18.5464 11.6711 18.6319 11.6629 18.7223C11.63 19.0248 11.6859 19.3338 11.8289 19.6149C12.1051 20.1755 12.6772 20.5256 13.2952 20.5256H15.5966V18.7289H13.3215C13.2048 18.7289 13.1358 18.5941 13.2032 18.4987C13.2278 18.4609 13.2558 18.4215 13.2854 18.3771C13.5007 18.0714 13.8081 17.5963 14.1139 17.0555C14.3227 16.6905 14.5248 16.3009 14.6876 15.9097C14.7205 15.839 14.7468 15.7666 14.7731 15.696C14.8174 15.571 14.8635 15.4543 14.8964 15.3376C14.9293 15.239 14.9555 15.1354 14.9818 15.0384C15.0591 14.7064 15.092 14.3546 15.092 13.9897C15.092 13.8467 15.0854 13.697 15.0723 13.554C15.0657 13.3979 15.046 13.2417 15.0262 13.0855C15.0131 12.9474 14.9884 12.811 14.9621 12.668C14.9293 12.4592 14.8832 12.2521 14.8306 12.0433L14.8125 11.9644C14.7731 11.8214 14.7402 11.685 14.6942 11.542C14.5643 11.0932 14.4147 10.6559 14.2569 10.2466C14.1994 10.0839 14.1336 9.92771 14.0678 9.77155C13.9709 9.53647 13.8722 9.32278 13.7818 9.12057C13.7358 9.02851 13.6964 8.94467 13.6569 8.85919C13.6125 8.7622 13.5665 8.66521 13.5205 8.57318C13.4876 8.50249 13.4498 8.43673 13.4235 8.37097L13.1424 7.85151C13.1029 7.78083 13.1687 7.69699 13.2459 7.71836L15.0049 8.19507H15.0098C15.0131 8.19507 15.0147 8.19673 15.0164 8.19673L15.2481 8.26083L15.503 8.33318L15.5966 8.35945V7.31398C15.5966 6.80931 16.001 6.39999 16.5008 6.39999C16.7506 6.39999 16.9775 6.50191 17.1402 6.66793C17.303 6.83398 17.4049 7.06083 17.4049 7.31398V8.86579L17.5923 8.91836C17.6071 8.92332 17.6219 8.92988 17.635 8.93974C17.6811 8.97427 17.7468 9.02521 17.8306 9.08771C17.8964 9.14028 17.9671 9.20441 18.0526 9.27017C18.2219 9.40659 18.4241 9.58249 18.646 9.7847C18.7052 9.83564 18.7627 9.88825 18.8153 9.94086C19.1014 10.2072 19.4219 10.5195 19.7277 10.8647C19.8131 10.9617 19.897 11.0603 19.9824 11.1639C20.0679 11.2691 20.1583 11.3726 20.2372 11.4762C20.3408 11.6143 20.4526 11.7573 20.5496 11.9069C20.5956 11.9776 20.6482 12.0499 20.6926 12.1206C20.8175 12.3096 20.9277 12.5053 21.0329 12.7009C21.0773 12.7913 21.1233 12.8899 21.1627 12.9869C21.2794 13.2483 21.3715 13.5146 21.4307 13.7809C21.4487 13.8384 21.4619 13.9009 21.4685 13.9568V13.9699C21.4882 14.0488 21.4948 14.1327 21.5014 14.2181C21.5277 14.491 21.5145 14.7639 21.4553 15.0384C21.4307 15.1552 21.3978 15.2653 21.3583 15.382C21.3189 15.4938 21.2794 15.6105 21.2285 15.7206C21.1299 15.9491 21.0131 16.1776 20.875 16.3913C20.8307 16.4702 20.7781 16.5541 20.7254 16.633C20.6679 16.7168 20.6087 16.7957 20.5561 16.873C20.4838 16.9716 20.4066 17.0752 20.3277 17.1672C20.257 17.2642 20.1846 17.3612 20.1057 17.4467C19.9956 17.5765 19.8904 17.6998 19.7802 17.8182C19.7145 17.8954 19.6438 17.9744 19.5715 18.045C19.5008 18.1239 19.4285 18.1946 19.3627 18.2604C19.2526 18.3705 19.1605 18.456 19.0832 18.5267L18.9024 18.6927C18.8761 18.7157 18.8416 18.7289 18.8054 18.7289H17.4049V20.5256H19.1671C19.5616 20.5256 19.9364 20.3859 20.2389 20.1294C20.3424 20.039 20.7945 19.6478 21.3287 19.0577C21.3468 19.0379 21.3699 19.0231 21.3962 19.0166L26.2636 17.6094C26.354 17.5831 26.4461 17.6522 26.4461 17.7475Z", fill: "white" })), IS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 }, /* @__PURE__ */ J.createElement("circle", { cx: 12, cy: 13, r: 2 }), /* @__PURE__ */ J.createElement("circle", { cx: 3, cy: 13, r: 2 }), /* @__PURE__ */ J.createElement("circle", { cx: 21, cy: 13, r: 2 }))), Ek = (t) => /* @__PURE__ */ J.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("g", { fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ J.createElement("path", { d: "M12 1.5v21M1.5 12h21", strokeLinecap: "round", strokeLinejoin: "round" }))), LS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2 }, /* @__PURE__ */ J.createElement("path", { d: "M1.373 13.183a2.064 2.064 0 0 1 0-2.366C2.946 8.59 6.819 4 12 4s9.054 4.59 10.627 6.817a2.064 2.064 0 0 1 0 2.366C21.054 15.41 17.181 20 12 20s-9.054-4.59-10.627-6.817Z" }), /* @__PURE__ */ J.createElement("circle", { cx: 12, cy: 12, r: 4 }))), RS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m12 2.489 3.09 6.262L22 9.755l-5 4.874 1.18 6.882-6.18-3.25-6.18 3.25L7 14.629 2 9.755l6.91-1.004L12 2.489z" })), Pj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M1 12h8v10H1V12Zm0 0C1 5 2.75 3.344 6 2m8 10h8v10h-8V12Zm0 0c0-7 1.75-8.656 5-10" })), Ij = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M13.5 22H10a5 5 0 0 1-5-5v-7" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "m1 14 4-4 4 4m1.5-12H14a5 5 0 0 1 5 5v7" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "m23 10-4 4-4-4" })), Lj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M22 13.667V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9.667M22 13.667 13.667 22M22 13.667h-6.333a2 2 0 0 0-2 2V22" })), Gb = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", d: "M22 13.667V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9.667M22 13.667 13.667 22M22 13.667h-6.333a2 2 0 0 0-2 2V22" })), Rj = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("path", { d: "M15.924 9.922c-.236 0-.43.194-.434.433l-.177 8.866.178 3.218c.003.235.197.43.433.43s.43-.195.433-.433v.004l.193-3.219-.193-8.867c-.003-.238-.197-.432-.433-.432zm12.14 5.102c-.54 0-1.054.11-1.522.306C26.228 11.783 23.254 9 19.625 9c-.887 0-1.753.175-2.517.47-.298.115-.377.234-.38.463v12.492c.004.242.19.442.426.466l10.91.006c2.174 0 3.936-1.762 3.936-3.936s-1.762-3.937-3.936-3.937zM10.886 22.56v-.002l.226-3.338-.226-7.276c-.006-.181-.148-.323-.325-.323-.176 0-.319.142-.324.323l-.202 7.276.202 3.34c.005.178.148.32.324.32.177 0 .318-.142.325-.321v.001zm-2.952.32c.144 0 .262-.117.27-.267l.264-3.394-.265-6.497c-.007-.15-.125-.267-.27-.267-.144 0-.263.117-.269.267l-.234 6.497.234 3.395c.006.149.125.266.27.266zm5.297-10.868c-.209 0-.375.166-.38.377l-.169 6.832.17 3.287c.004.21.17.375.379.375.207 0 .373-.166.378-.377v.002l.19-3.287-.19-6.832c-.005-.211-.17-.377-.378-.377zM2.802 22.657c.083 0 .15-.066.16-.156l.34-3.286-.34-3.41c-.01-.091-.077-.157-.16-.157-.084 0-.152.066-.16.157l-.299 3.41.299 3.285c.008.091.076.157.16.157zm2.546.188c.113 0 .206-.092.214-.212l.302-3.418-.302-3.25c-.008-.12-.1-.211-.214-.211-.116 0-.208.09-.216.212l-.266 3.25.266 3.417c.008.12.1.212.216.212zm6.543.03c.191 0 .346-.154.351-.35v.003l.209-3.309-.209-7.09c-.005-.196-.16-.35-.351-.35-.193 0-.348.154-.352.35l-.185 7.09.185 3.308c.004.194.159.348.352.348zm2.69.013c.22 0 .401-.181.405-.404v.002-.002l.172-3.263-.172-8.13c-.004-.223-.186-.405-.406-.405-.22 0-.403.182-.406.405l-.153 8.127.153 3.268c.003.22.186.402.406.402zm-5.338-.016c.16 0 .29-.129.296-.294l.246-3.36-.246-7.039c-.006-.165-.137-.294-.296-.294-.162 0-.292.13-.297.295l-.218 7.038.218 3.361c.005.164.135.293.297.293zM4.07 15.527c-.1 0-.18.08-.188.185L3.6 19.215l.282 3.39c.008.104.089.184.188.184.098 0 .178-.08.187-.184l.32-3.39-.32-3.504c-.009-.104-.09-.184-.187-.184zm2.565-1.837c-.129 0-.235.105-.242.24l-.25 5.287.25 3.417c.007.133.113.239.242.239s.235-.106.243-.24v.001l.283-3.417-.283-5.288c-.008-.134-.114-.24-.243-.24zm-4.957 2.65c-.01-.076-.066-.129-.133-.129-.068 0-.124.055-.133.13l-.315 2.873.315 2.81c.01.076.065.13.133.13.067 0 .122-.053.133-.129l.358-2.81-.358-2.874zm-1.316.972c-.067 0-.12.052-.128.125L0 19.214l.234 1.747c.009.074.061.125.128.125.065 0 .117-.05.128-.124l.277-1.748-.277-1.778c-.01-.073-.063-.124-.128-.124z", fill: "#EE7C25", fillRule: "evenodd" })), jj = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("path", { d: "M16 .053C7.19.053.047 7.194.047 16.003c0 8.81 7.142 15.951 15.951 15.951 8.81 0 15.951-7.14 15.951-15.95C31.95 7.194 24.81.054 16 .054V.053zm7.314 23.005c-.285.469-.899.618-1.367.33-3.745-2.288-8.46-2.806-14.013-1.537-.535.122-1.068-.213-1.19-.749-.122-.535.212-1.068.748-1.19 6.076-1.389 11.288-.79 15.493 1.779.468.287.617.899.33 1.367zm1.953-4.343c-.36.585-1.126.77-1.71.41-4.288-2.636-10.824-3.4-15.896-1.86-.657.199-1.352-.172-1.552-.828-.198-.658.173-1.351.83-1.551 5.793-1.758 12.994-.907 17.918 2.12.585.36.77 1.125.41 1.709zm.167-4.523c-5.14-3.054-13.623-3.334-18.531-1.845-.788.24-1.622-.205-1.86-.994-.24-.788.205-1.621.994-1.86 5.634-1.711 15.001-1.38 20.92 2.133.71.42.943 1.336.522 2.044-.42.71-1.337.943-2.044.522z", fill: "#1ED760", fillRule: "nonzero" })), jS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20.8 2H3.2C1.985 2 1 2.895 1 4v16c0 1.105.985 2 2.2 2h17.6c1.215 0 2.2-.895 2.2-2V4c0-1.105-.985-2-2.2-2Z" }), /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16.5 11 12 15l-4.5-4" })), Sne = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("path", { d: "M10.063 29.002c12.076 0 18.68-10.005 18.68-18.68 0-.285 0-.567-.019-.85C30.01 8.545 31.12 7.393 32 6.076c-1.198.53-2.47.879-3.77 1.032 1.37-.82 2.395-2.11 2.886-3.63-1.29.764-2.7 1.303-4.17 1.593-2.035-2.164-5.268-2.694-7.887-1.292-2.62 1.401-3.973 4.386-3.3 7.28-5.28-.265-10.198-2.758-13.532-6.86-1.742 3-.852 6.838 2.033 8.764-1.045-.03-2.067-.313-2.98-.822v.084c0 3.125 2.204 5.817 5.267 6.435-.966.264-1.98.303-2.964.113.86 2.675 3.325 4.507 6.133 4.56-2.324 1.827-5.196 2.818-8.153 2.815-.522 0-1.044-.032-1.563-.094 3.002 1.927 6.496 2.949 10.063 2.944", fill: "#1DA1F2", fillRule: "nonzero" })), Fj = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 122.43 122.41", ...t }, /* @__PURE__ */ J.createElement("path", { d: "M83.86 54.15v34.13H38.57V54.15H0v68.26h122.43V54.15H83.86zM38.57 0h45.3v34.13h-45.3z" })), FS = (t) => /* @__PURE__ */ J.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", ...t }, /* @__PURE__ */ J.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6.555 20.963A1 1 0 0 1 5 20.131V3.87a1 1 0 0 1 1.555-.833l12.197 8.132a1 1 0 0 1 0 1.664l-12.197 8.13Z" })), Bj = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("g", { fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ J.createElement("path", { d: "M31.886 25.508c0 3.522-2.855 6.377-6.377 6.377H6.377C2.857 31.885 0 29.03 0 25.508V6.378C0 2.854 2.857 0 6.377 0H25.51c3.522 0 6.377 2.855 6.377 6.377v19.131", fill: "#0FB7FF" }), /* @__PURE__ */ J.createElement("path", { d: "M25.998 10.58c.175-.982.17-1.992-.436-2.755-.846-1.07-2.646-1.11-3.88-.921-1.003.153-4.397 1.651-5.552 5.236 2.046-.156 3.118.148 2.921 2.4-.082.943-.558 1.976-1.09 2.966-.614 1.141-1.765 3.382-3.274 1.767-1.36-1.454-1.257-4.235-1.568-6.086-.173-1.04-.356-2.334-.697-3.402-.293-.92-.966-2.027-1.788-2.267-.884-.26-1.976.146-2.618.523-2.042 1.2-3.598 2.908-5.365 4.317v.132c.35.335.444.884.96.959 1.216.179 2.375-1.134 3.184.232.492.834.645 1.749.96 2.648.42 1.198.746 2.503 1.09 3.88.583 2.334 1.299 5.82 3.316 6.675 1.029.437 2.575-.148 3.358-.612 2.122-1.255 3.775-3.075 5.19-4.927 3.234-4.382 5.019-9.347 5.289-10.765", fill: "#FFFFFE" }))), zj = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("g", { fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ J.createElement("path", { d: "M31.252 8.488c-.366-1.37-1.448-2.452-2.824-2.823C25.941 5 15.958 5 15.958 5s-9.977 0-12.47.665c-1.37.366-2.452 1.447-2.823 2.823C0 10.976 0 16.17 0 16.17s0 5.194.665 7.682c.366 1.372 1.447 2.453 2.823 2.823 2.493.666 12.47.666 12.47.666s9.983 0 12.47-.666c1.372-.365 2.453-1.447 2.824-2.823.665-2.488.665-7.682.665-7.682s0-5.194-.665-7.682", fill: "#D9252A" }), /* @__PURE__ */ J.createElement("path", { fill: "#FFFFFE", d: "M12.77 20.958l8.291-4.788-8.291-4.788v9.576" }))), FUe = () => { + return /* @__PURE__ */ y.jsxs("div", { className: "koenig-lexical", children: [ + /* @__PURE__ */ y.jsx(t, { label: "Text toolbar" }), + /* @__PURE__ */ y.jsx(e, {}), + /* @__PURE__ */ y.jsx(t, { label: "Image toolbar" }), + /* @__PURE__ */ y.jsx(n, {}), + /* @__PURE__ */ y.jsx(t, { label: "Gallery toolbar" }), + /* @__PURE__ */ y.jsx(i, {}), + /* @__PURE__ */ y.jsx(t, { label: "Plus menu" }), + /* @__PURE__ */ y.jsx(o, {}), + /* @__PURE__ */ y.jsx(t, { label: "Card menu" }), + /* @__PURE__ */ y.jsx(a, {}), + /* @__PURE__ */ y.jsx(t, { label: "Divider card" }), + /* @__PURE__ */ y.jsx("div", { className: "relative max-w-[740px]", children: /* @__PURE__ */ y.jsx(d, {}) }), + /* @__PURE__ */ y.jsx(t, { label: "Code block" }), + /* @__PURE__ */ y.jsx("div", { className: "relative max-w-[740px]", children: /* @__PURE__ */ y.jsx(h, {}) }), + /* @__PURE__ */ y.jsx(t, { label: "Image card" }), + /* @__PURE__ */ y.jsx("div", { className: "relative max-w-[740px]", children: /* @__PURE__ */ y.jsx(m, {}) }), + /* @__PURE__ */ y.jsx(t, { label: "Gallery card" }), + /* @__PURE__ */ y.jsx("div", { className: "relative max-w-[1172px]", children: /* @__PURE__ */ y.jsx(x, {}) }) + ] }); + function t({ label: _ }) { + return /* @__PURE__ */ y.jsx("h3", { className: "mb-4 mt-20 text-xl font-bold first-of-type:mt-8", children: _ }); + } + function e() { + return /* @__PURE__ */ y.jsx("div", { className: "max-w-fit", children: /* @__PURE__ */ y.jsxs("ul", { className: "m-0 flex items-center justify-evenly rounded bg-black px-1 py-0 font-sans text-md font-normal text-white", children: [ + /* @__PURE__ */ y.jsx(r, { Icon: Ej, label: "Format text as bold" }), + /* @__PURE__ */ y.jsx(r, { Icon: Dj, label: "Format text as italics" }), + /* @__PURE__ */ y.jsx(r, { Icon: Aj, label: "Toggle heading 1" }), + /* @__PURE__ */ y.jsx(r, { Icon: Nj, label: "Toggle heading 2" }), + /* @__PURE__ */ y.jsx(s, {}), + /* @__PURE__ */ y.jsx(r, { Icon: Pj, label: "Toggle blockquote" }), + /* @__PURE__ */ y.jsx(r, { Icon: DS, label: "Insert link" }), + /* @__PURE__ */ y.jsx(s, {}), + /* @__PURE__ */ y.jsx(r, { Icon: Gb, label: "Save as snippet" }) + ] }) }); + } + function n() { + return /* @__PURE__ */ y.jsx("div", { className: "max-w-fit", children: /* @__PURE__ */ y.jsxs("ul", { className: "m-0 flex items-center justify-evenly rounded bg-black px-1 py-0 font-sans text-md font-normal text-white", children: [ + /* @__PURE__ */ y.jsx(r, { Icon: J0, label: "Set image to regular" }), + /* @__PURE__ */ y.jsx(r, { Icon: e1, label: "Set image to wide" }), + /* @__PURE__ */ y.jsx(r, { Icon: K0, label: "Set image to full" }), + /* @__PURE__ */ y.jsx(s, {}), + /* @__PURE__ */ y.jsx(r, { Icon: DS, label: "Insert link" }), + /* @__PURE__ */ y.jsx(r, { Icon: Ij, label: "Replace image" }), + /* @__PURE__ */ y.jsx(s, {}), + /* @__PURE__ */ y.jsx(r, { Icon: Gb, label: "Save as snippet" }) + ] }) }); + } + function i() { + return /* @__PURE__ */ y.jsx("div", { className: "max-w-fit", children: /* @__PURE__ */ y.jsxs("ul", { className: "m-0 flex items-center justify-evenly rounded bg-black px-1 py-0 font-sans text-md font-normal text-white", children: [ + /* @__PURE__ */ y.jsx(r, { Icon: Cj, label: "Add image" }), + /* @__PURE__ */ y.jsx(s, {}), + /* @__PURE__ */ y.jsx(r, { Icon: Gb, label: "Save as snippet" }) + ] }) }); + } + function r({ label: _, Icon: S, ...C }) { + return /* @__PURE__ */ y.jsx("li", { className: "m-0 flex p-0 first:m-0", ...C, children: /* @__PURE__ */ y.jsx( + "div", + { + className: "flex size-9 items-center justify-center", + type: "button", + children: /* @__PURE__ */ y.jsx(S, { className: "fill-white" }) + } + ) }); + } + function s() { + return /* @__PURE__ */ y.jsx("li", { className: "m-0 mx-1 h-5 w-px bg-grey-900" }); + } + function o() { + return /* @__PURE__ */ y.jsx( + "button", + { + "aria-label": "Add a card", + className: "group relative flex size-7 cursor-pointer items-center justify-center rounded-full border border-grey bg-white transition-all ease-linear hover:border-grey-900 md:size-9", + type: "button", + children: /* @__PURE__ */ y.jsx(Ek, { className: "size-4 stroke-grey-800 stroke-2 group-hover:stroke-grey-900" }) + } + ); + } + function a() { + return /* @__PURE__ */ y.jsxs("div", { className: "z-[9999999] m-0 mb-3 max-h-[376px] w-[312px] flex-col overflow-y-auto rounded-lg bg-white bg-clip-padding p-0 text-sm shadow", children: [ + /* @__PURE__ */ y.jsx(l, { label: "Primary" }), + /* @__PURE__ */ y.jsx(u, { desc: "Upload, or embed with /image [url]", Icon: NS, label: "Image" }), + /* @__PURE__ */ y.jsx(u, { desc: "Insert a Markdown editor card", Icon: PS, label: "Markdown" }), + /* @__PURE__ */ y.jsx(u, { desc: "Insert a raw HTML card", Icon: MS, label: "HTML" }), + /* @__PURE__ */ y.jsx(u, { desc: "Create an image gallery", Icon: $S, label: "Gallery" }), + /* @__PURE__ */ y.jsx(u, { desc: "Insert a dividing line", Icon: CS, label: "Divider" }), + /* @__PURE__ */ y.jsx(u, { desc: "Embed a link as a visual bookmark", Icon: _S, label: "Bookmark" }), + /* @__PURE__ */ y.jsx(u, { desc: "Only visible when delivered by email", Icon: ES, label: "Email content" }), + /* @__PURE__ */ y.jsx(u, { desc: "Target free or paid members with a CTA", Icon: Ug, label: "Email call to action" }), + /* @__PURE__ */ y.jsx(u, { desc: "Attract signups with a public intro", Icon: LS, label: "Public preview" }), + /* @__PURE__ */ y.jsx(u, { desc: "Add a button to your post", Icon: OS, label: "Button" }), + /* @__PURE__ */ y.jsx(u, { desc: "Info boxes that stand out", Icon: SS, label: "Callout" }), + /* @__PURE__ */ y.jsx(u, { desc: "Search and embed gifs", Icon: Mj, label: "GIF" }), + /* @__PURE__ */ y.jsx(u, { desc: "Add collapsible content", Icon: jS, label: "Toggle" }), + /* @__PURE__ */ y.jsx(u, { desc: "Upload and play a video", Icon: FS, label: "Video" }), + /* @__PURE__ */ y.jsx(u, { desc: "Upload and play an audio file", Icon: xS, label: "Audio" }), + /* @__PURE__ */ y.jsx(u, { desc: "Upload a downloadable file", Icon: TS, label: "File" }), + /* @__PURE__ */ y.jsx(u, { desc: "Add a product recommendation", Icon: RS, label: "Product" }), + /* @__PURE__ */ y.jsx(u, { desc: "Add a bold section header", Icon: Xb, label: "Header" }), + /* @__PURE__ */ y.jsx(l, { label: "Embed" }), + /* @__PURE__ */ y.jsx(u, { desc: "/youtube [video url]", Icon: zj, label: "YouTube" }), + /* @__PURE__ */ y.jsx(u, { desc: "/twitter [tweet url]", Icon: Sne, label: "Twitter" }), + /* @__PURE__ */ y.jsx(u, { desc: "/unsplash [search-term or url]", Icon: Fj, label: "Unsplash" }), + /* @__PURE__ */ y.jsx(u, { desc: "/vimeo [video url]", Icon: Bj, label: "Vimeo" }), + /* @__PURE__ */ y.jsx(u, { desc: "/codepen [pen url]", Icon: Tj, label: "CodePen" }), + /* @__PURE__ */ y.jsx(u, { desc: "/spotify [track or playlist url]", Icon: jj, label: "Spotify" }), + /* @__PURE__ */ y.jsx(u, { desc: "/soundcloud [track or playlist url]", Icon: Rj, label: "SoundCloud" }), + /* @__PURE__ */ y.jsx(u, { desc: "/nft [opensea url]", Icon: One, label: "NFT" }), + /* @__PURE__ */ y.jsx(u, { desc: "/embed [url]", Icon: IS, label: "Other..." }), + /* @__PURE__ */ y.jsx(l, { label: "Snippets" }), + /* @__PURE__ */ y.jsx(f, { Icon: Lj, label: "A random snippet" }) + ] }); + } + function l({ label: _, ...S }) { + return /* @__PURE__ */ y.jsx("div", { className: "mb-2 flex shrink-0 flex-col justify-center px-4 pt-3 text-2xs font-medium uppercase tracking-[.06rem] text-grey", style: { minWidth: "calc(100% - 3.2rem)" }, ...S, children: _ }); + } + function u({ label: _, desc: S, Icon: C, ...E }) { + return /* @__PURE__ */ y.jsxs("div", { className: "flex cursor-pointer flex-row items-center border border-transparent px-4 py-2 text-grey-800 hover:bg-grey-100", ...E, children: [ + /* @__PURE__ */ y.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ y.jsx(C, { className: "size-7" }) }), + /* @__PURE__ */ y.jsxs("div", { className: "flex flex-col", children: [ + /* @__PURE__ */ y.jsx("div", { className: "m-0 ml-4 truncate text-[1.3rem] font-normal leading-[1.333em] tracking-[.02rem] text-grey-900", children: _ }), + /* @__PURE__ */ y.jsx("div", { className: "m-0 ml-4 truncate text-2xs font-normal leading-[1.333em] tracking-[.02rem] text-grey", children: S }) + ] }) + ] }); + } + function f({ label: _, Icon: S, ...C }) { + return /* @__PURE__ */ y.jsxs("div", { className: "flex cursor-pointer flex-row items-center border border-transparent px-4 py-2 text-grey-800 hover:bg-grey-100", ...C, children: [ + /* @__PURE__ */ y.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ y.jsx(S, { className: "size-7" }) }), + /* @__PURE__ */ y.jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ y.jsx("div", { className: "m-0 ml-4 truncate text-[1.3rem] font-normal leading-[1.333em] tracking-[.02rem] text-grey-900", children: _ }) }) + ] }); + } + function d() { + return /* @__PURE__ */ y.jsx("div", { children: /* @__PURE__ */ y.jsx("hr", { className: "block h-[1px] border-0 border-t border-grey-300" }) }); + } + function h() { + return /* @__PURE__ */ y.jsxs("div", { className: "border-2 border-green", children: [ + /* @__PURE__ */ y.jsx("div", { className: "rounded bg-grey-50 px-3 py-2", children: /* @__PURE__ */ y.jsx("textarea", { className: "w-full resize-none bg-grey-50 font-mono text-[1.7rem]" }) }), + /* @__PURE__ */ y.jsx(w, { placeholder: "Type caption for code block (optional)" }) + ] }); + } + function m() { + const [_, S] = ft(!1), [C, E] = ft(!1), M = () => { + S(!_); + }, $ = (P) => { + P.stopPropagation(), E(!C); + }; + return _ ? /* @__PURE__ */ y.jsxs( + "div", + { + className: `border border-transparent ${_ ? "shadow-[0_0_0_2px_#30cf43]" : "hover:shadow-[0_0_0_1px_#30cf43]"}`, + onClick: M, + children: [ + /* @__PURE__ */ y.jsx(g, { desc: "Click to select an image", Icon: AS }), + /* @__PURE__ */ y.jsx(w, { placeholder: "Type caption for image (optional)" }), + /* @__PURE__ */ y.jsx( + "button", + { + className: `absolute bottom-0 right-0 m-3 cursor-pointer rounded border px-1 text-[1.3rem] font-normal leading-7 tracking-wide transition-all duration-100 ${C ? "border-green bg-green text-white" : "border-grey text-grey"} `, + type: "button", + onClick: (P) => $(P), + children: "Alt" + } + ) + ] + } + ) : /* @__PURE__ */ y.jsx( + "div", + { + className: `border border-transparent ${_ ? "shadow-[0_0_0_2px_#30cf43]" : "hover:shadow-[0_0_0_1px_#30cf43]"}`, + onClick: M, + children: /* @__PURE__ */ y.jsx(g, { desc: "Click to select an image", Icon: AS }) + } + ); + } + function g({ desc: _, Icon: S, ...C }) { + return /* @__PURE__ */ y.jsxs("div", { className: "relative", children: [ + /* @__PURE__ */ y.jsx("figure", { className: "cursor-pointer border border-transparent", ...C, children: /* @__PURE__ */ y.jsx("div", { className: "h-100 relative flex items-center justify-center border border-grey-100 bg-grey-50 before:pb-[62.5%]", children: /* @__PURE__ */ y.jsxs("button", { className: "group flex flex-col items-center justify-center p-20", type: "button", children: [ + /* @__PURE__ */ y.jsx(S, { className: "size-32 opacity-80 transition-all ease-linear group-hover:scale-105 group-hover:opacity-100" }), + /* @__PURE__ */ y.jsx("p", { className: "mt-4 text-sm font-normal text-grey-700 group-hover:text-grey-800", children: _ }) + ] }) }) }), + /* @__PURE__ */ y.jsx("form", { children: /* @__PURE__ */ y.jsx( + "input", + { + accept: "image/*", + hidden: !0, + name: "image", + type: "file" + } + ) }) + ] }); + } + function w({ placeholder: _ }) { + return /* @__PURE__ */ y.jsx( + "input", + { + className: "not-kg-prose w-full p-2 text-center font-sans text-sm font-normal tracking-wide text-grey-900", + placeholder: _ + } + ); + } + function x() { + return /* @__PURE__ */ y.jsxs("div", { className: "border-2 border-green", children: [ + /* @__PURE__ */ y.jsx(g, { desc: "Click to select up to 9 images", Icon: $j }), + /* @__PURE__ */ y.jsx(w, { placeholder: "Type caption for gallery (optional)" }) + ] }); + } +}, gn = j.createContext({}), dt = j.createContext({}); +var me = {}; +let Tk = {}, Wj = {}, sh = {}, yg = {}, BS = {}, oh = {}, Y6 = {}, zS = {}, Zg = {}, qg = {}, ku = {}, V6 = {}, X6 = {}, Hj = {}, Qj = {}, Uj = {}, Zj = {}, qj = {}, Yj = {}, Vj = {}, Wy = {}, Xj = {}, Gj = {}, Kj = {}, Jj = {}, eF = {}, tF = {}, nF = {}, iF = {}, rF = {}, G6 = {}, K6 = {}, WS = {}, sF = {}, oF = {}, aF = {}; +function Le(t) { + let e = new URLSearchParams(); + e.append("code", t); + for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]); + throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`); +} +let Ia = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Cne = Ia && "documentMode" in document ? document.documentMode : null, wr = Ia && /Mac|iPod|iPhone|iPad/.test(navigator.platform), zu = Ia && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent), Hy = Ia && "InputEvent" in window && !Cne ? "getTargetRanges" in new window.InputEvent("input") : !1, J6 = Ia && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), $k = Ia && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Ene = Ia && /Android/.test(navigator.userAgent), Tne = Ia && /^(?=.*Chrome).*/i.test(navigator.userAgent), e5 = Ia && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Tne, Mk = J6 || $k || e5 ? " " : "​", $ne = zu ? " " : Mk, Mne = /^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/, Nne = /^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/, Oh = { bold: 1, code: 16, highlight: 128, italic: 2, strikethrough: 4, subscript: 32, superscript: 64, underline: 8 }, Ane = { directionless: 1, unmergeable: 2 }, W$ = { center: 2, end: 6, justify: 4, left: 1, right: 3, start: 5 }, Dne = { 2: "center", 6: "end", 4: "justify", 1: "left", 3: "right", 5: "start" }, Pne = { normal: 0, segmented: 2, token: 1 }, Ine = { 0: "normal", 2: "segmented", 1: "token" }, HS = !1, t5 = 0; +function Lne(t) { + t5 = t.timeStamp; +} +function n3(t, e, n) { + return e.__lexicalLineBreak === t || t[`__lexicalKey_${n._key}`] !== void 0; +} +function Rne(t) { + return t.getEditorState().read(() => { + let e = pn(); + return e !== null ? e.clone() : null; + }); +} +function lF(t, e, n) { + HS = !0; + let i = 100 < performance.now() - t5; + try { + qs(t, () => { + let r = pn() || Rne(t); + var s = /* @__PURE__ */ new Map(), o = t.getRootElement(), a = t._editorState, l = t._blockCursorElement; + let u = !1, f = ""; + for (var d = 0; d < e.length; d++) { + var h = e[d], m = h.type, g = h.target, w = n1(g, a); + if (!(w === null && g !== o || ii(w))) { + if (m === "characterData") { + if (h = i && Ze(w)) e: { + h = r, m = g; + var x = w; + if (xt(h)) { + var _ = h.anchor.getNode(); + if (_.is(x) && h.format !== _.getFormat()) { + h = !1; + break e; + } + } + h = m.nodeType === 3 && x.isAttached(); + } + h && (x = La(t._window), m = h = null, x !== null && x.anchorNode === g && (h = x.anchorOffset, m = x.focusOffset), g = g.nodeValue, g !== null && o5(w, g, h, m, !1)); + } else if (m === "childList") { + for (u = !0, m = h.addedNodes, x = 0; x < m.length; x++) { + _ = m[x]; + var S = pF(_), C = _.parentNode; + C == null || _ === l || S !== null || _.nodeName === "BR" && n3(_, C, t) || (zu && (S = _.innerText || _.nodeValue) && (f += S), C.removeChild(_)); + } + if (h = h.removedNodes, m = h.length, 0 < m) { + for (x = 0, _ = 0; _ < m; _++) C = h[_], (C.nodeName === "BR" && n3(C, g, t) || l === C) && (g.appendChild(C), x++); + m !== x && (g === o && (w = a._nodeMap.get("root")), s.set(g, w)); + } + } + } + } + if (0 < s.size) for (let [ + E, + M + ] of s) if (xe(M)) for (s = M.getChildrenKeys(), o = E.firstChild, a = 0; a < s.length; a++) l = t.getElementByKey(s[a]), l !== null && (o == null ? (E.appendChild(l), o = l) : o !== l && E.replaceChild(l, o), o = o.nextSibling); + else Ze(M) && M.markDirty(); + if (s = n.takeRecords(), 0 < s.length) { + for (o = 0; o < s.length; o++) for (l = s[o], a = l.addedNodes, l = l.target, d = 0; d < a.length; d++) w = a[d], g = w.parentNode, g == null || w.nodeName !== "BR" || n3(w, l, t) || g.removeChild(w); + n.takeRecords(); + } + r !== null && (u && (r.dirty = !0, $a(r)), zu && bF(t) && r.insertRawText(f)); + }); + } finally { + HS = !1; + } +} +function uF(t) { + let e = t._observer; + if (e !== null) { + let n = e.takeRecords(); + lF(t, n, e); + } +} +function cF(t) { + t5 === 0 && Ak(t).addEventListener("textInput", Lne, !0), t._observer = new MutationObserver((e, n) => { + lF(t, e, n); + }); +} +function H$(t, e) { + let n = t.__mode, i = t.__format; + t = t.__style; + let r = e.__mode, s = e.__format; + return e = e.__style, (n === null || n === r) && (i === null || i === s) && (t === null || t === e); +} +function Q$(t, e) { + let n = t.mergeWithSibling(e), i = Ln()._normalizedNodes; + return i.add(t.__key), i.add(e.__key), n; +} +function fF(t) { + if (t.__text === "" && t.isSimpleText() && !t.isUnmergeable()) t.remove(); + else { + for (var e; (e = t.getPreviousSibling()) !== null && Ze(e) && e.isSimpleText() && !e.isUnmergeable(); ) if (e.__text === "") e.remove(); + else { + H$(e, t) && (t = Q$(e, t)); + break; + } + for (var n; (n = t.getNextSibling()) !== null && Ze(n) && n.isSimpleText() && !n.isUnmergeable(); ) if (n.__text === "") n.remove(); + else { + H$(t, n) && Q$(t, n); + break; + } + } +} +function dF(t) { + return U$(t.anchor), U$(t.focus), t; +} +function U$(t) { + for (; t.type === "element"; ) { + var e = t.getNode(), n = t.offset; + if (n === e.getChildrenSize() ? (e = e.getChildAtIndex(n - 1), n = !0) : (e = e.getChildAtIndex(n), n = !1), Ze(e)) { + t.set(e.__key, n ? e.getTextContentSize() : 0, "text"); + break; + } else if (!xe(e)) break; + t.set(e.__key, n ? e.getChildrenSize() : 0, "element"); + } +} +let jne = 1, Fne = typeof queueMicrotask == "function" ? queueMicrotask : (t) => { + Promise.resolve().then(t); +}; +function n5(t) { + let e = document.activeElement; + if (e === null) return !1; + let n = e.nodeName; + return ii(n1(t)) && (n === "INPUT" || n === "TEXTAREA" || e.contentEditable === "true" && e.__lexicalEditor == null); +} +function t1(t, e, n) { + let i = t.getRootElement(); + try { + return i !== null && i.contains(e) && i.contains(n) && e !== null && !n5(e) && i5(e) === t; + } catch { + return !1; + } +} +function i5(t) { + for (; t != null; ) { + let e = t.__lexicalEditor; + if (e != null) return e; + t = Nk(t); + } + return null; +} +function QS(t) { + return t.isToken() || t.isSegmented(); +} +function Qy(t) { + for (; t != null; ) { + if (t.nodeType === 3) return t; + t = t.firstChild; + } + return null; +} +function US(t, e, n) { + let i = Oh[e]; + return n !== null && (t & i) === (n & i) || (t ^= i, e === "subscript" ? t &= -65 : e === "superscript" && (t &= -33)), t; +} +function hF(t, e) { + if (e != null) t.__key = e; + else { + qr(), 99 < Gg && Le(14), e = Ln(); + var n = Ra(), i = "" + jne++; + n._nodeMap.set(i, t), xe(t) ? e._dirtyElements.set(i, !0) : e._dirtyLeaves.add(i), e._cloneNotNeeded.add(i), e._dirtyType = 1, t.__key = i; + } +} +function of(t) { + var e = t.getParent(); + if (e !== null) { + let r = t.getWritable(); + e = e.getWritable(); + var n = t.getPreviousSibling(); + if (t = t.getNextSibling(), n === null) if (t !== null) { + var i = t.getWritable(); + e.__first = t.__key, i.__prev = null; + } else e.__first = null; + else { + if (i = n.getWritable(), t !== null) { + let s = t.getWritable(); + s.__prev = i.__key, i.__next = s.__key; + } else i.__next = null; + r.__prev = null; + } + t === null ? n !== null ? (t = n.getWritable(), e.__last = n.__key, t.__next = null) : e.__last = null : (t = t.getWritable(), n !== null ? (n = n.getWritable(), n.__next = t.__key, t.__prev = n.__key) : t.__prev = null, r.__next = null), e.__size--, r.__parent = null; + } +} +function Uy(t) { + 99 < Gg && Le(14); + var e = t.getLatest(), n = e.__parent, i = Ra(); + let r = Ln(), s = i._nodeMap; + if (i = r._dirtyElements, n !== null) e: for (; n !== null; ) { + if (i.has(n)) break e; + let o = s.get(n); + if (o === void 0) break; + i.set(n, !1), n = o.__parent; + } + e = e.__key, r._dirtyType = 1, xe(t) ? i.set(e, !0) : r._dirtyLeaves.add(e); +} +function Pi(t) { + qr(); + var e = Ln(); + let n = e._compositionKey; + t !== n && (e._compositionKey = t, n !== null && (e = Tr(n), e !== null && e.getWritable()), t !== null && (t = Tr(t), t !== null && t.getWritable())); +} +function xu() { + return Vh() ? null : Ln()._compositionKey; +} +function Tr(t, e) { + return t = (e || Ra())._nodeMap.get(t), t === void 0 ? null : t; +} +function pF(t, e) { + let n = Ln(); + return t = t[`__lexicalKey_${n._key}`], t !== void 0 ? Tr(t, e) : null; +} +function n1(t, e) { + for (; t != null; ) { + let n = pF(t, e); + if (n !== null) return n; + t = Nk(t); + } + return null; +} +function mF(t) { + let e = Object.assign({}, t._decorators); + return t._pendingDecorators = e; +} +function Z$(t) { + return t.read(() => Zs().getTextContent()); +} +function Bne(t, e) { + qs(t, () => { + var n = Ra(); + if (!n.isEmpty()) if (e === "root") Zs().markDirty(); + else { + n = n._nodeMap; + for (let [, i] of n) i.markDirty(); + } + }, t._pendingEditorState === null ? { tag: "history-merge" } : void 0); +} +function Zs() { + return Ra()._nodeMap.get("root"); +} +function $a(t) { + qr(); + let e = Ra(); + t !== null && (t.dirty = !0, t.setCachedNodes(null)), e._selection = t; +} +function Xd(t) { + var e = Ln(), n; + e: { + for (n = t; n != null; ) { + let i = n[`__lexicalKey_${e._key}`]; + if (i !== void 0) { + n = i; + break e; + } + n = Nk(n); + } + n = null; + } + return n === null ? (e = e.getRootElement(), t === e ? Tr("root") : null) : Tr(n); +} +function gF(t) { + return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t); +} +function r5(t) { + let e = []; + for (; t !== null; ) e.push(t), t = t._parentEditor; + return e; +} +function vF() { + return Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 5); +} +function s5(t, e, n) { + if (e = La(e._window), e !== null) { + var i = e.anchorNode, { anchorOffset: r, focusOffset: s } = e; + if (i !== null && (e = i.nodeType === 3 ? i.nodeValue : null, i = n1(i), e !== null && Ze(i))) { + if (e === Mk && n) { + let o = n.length; + e = n, s = r = o; + } + e !== null && o5(i, e, r, s, t); + } + } +} +function o5(t, e, n, i, r) { + let s = t; + if (s.isAttached() && (r || !s.isDirty())) { + let u = s.isComposing(), f = e; + if ((u || r) && e[e.length - 1] === Mk && (f = e.slice(0, -1)), e = s.getTextContent(), r || f !== e) if (f === "") if (Pi(null), J6 || $k || e5) s.remove(); + else { + let d = Ln(); + setTimeout(() => { + d.update(() => { + s.isAttached() && s.remove(); + }); + }, 20); + } + else { + r = s.getParent(), e = Yh(); + var o = s.getTextContentSize(), a = xu(), l = s.getKey(); + s.isToken() || a !== null && l === a && !u || xt(e) && (r !== null && !r.canInsertTextBefore() && e.anchor.offset === 0 || e.anchor.key === t.__key && e.anchor.offset === 0 && !s.canInsertTextBefore() && !u || e.focus.key === t.__key && e.focus.offset === o && !s.canInsertTextAfter() && !u) ? s.markDirty() : (t = pn(), xt(t) && n !== null && i !== null && (t.setTextNodeRange(s, n, s, i), s.isSegmented() && (n = s.getTextContent(), n = rr(n), s.replace(n), s = n)), s.setTextContent(f)); + } + } +} +function zne(t, e) { + if (e.isSegmented()) return !0; + if (!t.isCollapsed()) return !1; + t = t.anchor.offset; + let n = e.getParentOrThrow(), i = e.isToken(); + return t === 0 ? ((t = !e.canInsertTextBefore() || !n.canInsertTextBefore() || i) || (e = e.getPreviousSibling(), t = (Ze(e) || xe(e) && e.isInline()) && !e.canInsertTextAfter()), t) : t === e.getTextContentSize() ? !e.canInsertTextAfter() || !n.canInsertTextAfter() || i : !1; +} +function wg(t, e) { + t.__lexicalClassNameCache === void 0 && (t.__lexicalClassNameCache = {}); + let n = t.__lexicalClassNameCache, i = n[e]; + return i !== void 0 ? i : (t = t[e], typeof t == "string" ? (t = t.split(" "), n[e] = t) : t); +} +function a5(t, e, n, i, r) { + n.size !== 0 && (n = i.__type, i = i.__key, e = e.get(n), e === void 0 && Le(33, n), n = e.klass, e = t.get(n), e === void 0 && (e = /* @__PURE__ */ new Map(), t.set(n, e)), t = e.get(i), n = t === "destroyed" && r === "created", (t === void 0 || n) && e.set(i, n ? "updated" : r)); +} +function q$(t, e, n) { + let i = t.getParent(), r = n; + return i !== null && (e && n === 0 ? (r = t.getIndexWithinParent(), t = i) : e || n !== t.getChildrenSize() || (r = t.getIndexWithinParent() + 1, t = i)), t.getChildAtIndex(e ? r - 1 : r); +} +function ZS(t, e) { + var n = t.offset; + return t.type === "element" ? (t = t.getNode(), q$(t, e, n)) : (t = t.getNode(), e && n === 0 || !e && n === t.getTextContentSize() ? (n = e ? t.getPreviousSibling() : t.getNextSibling(), n === null ? q$(t.getParentOrThrow(), e, t.getIndexWithinParent() + (e ? 0 : 1)) : n) : null); +} +function bF(t) { + return t = (t = Ak(t).event) && t.inputType, t === "insertFromPaste" || t === "insertFromPasteAsQuotation"; +} +function Zy(t) { + return !Ws(t) && !t.isLastChild() && !t.isInline(); +} +function qy(t, e) { + return t = t._keyToDOMMap.get(e), t === void 0 && Le(75, e), t; +} +function Nk(t) { + return t = t.assignedSlot || t.parentElement, t !== null && t.nodeType === 11 ? t.host : t; +} +function Yy(t, e) { + for (t = t.getParent(); t !== null; ) { + if (t.is(e)) return !0; + t = t.getParent(); + } + return !1; +} +function Ak(t) { + return t = t._window, t === null && Le(78), t; +} +function yF(t) { + for (t = t.getParentOrThrow(); t !== null && !Wu(t); ) t = t.getParentOrThrow(); + return t; +} +function Wu(t) { + return Ws(t) || xe(t) && t.isShadowRoot(); +} +function wF(t) { + return t = t.constructor.clone(t), hF(t, null), t; +} +function i1(t) { + var e = Ln(); + let n = t.constructor.getType(); + return e = e._nodes.get(n), e === void 0 && Le(97), e = e.replace, e !== null ? (e = e(t), e instanceof t.constructor || Le(98), e) : t; +} +function i3(t, e) { + t = t.getParent(), !Ws(t) || xe(e) || ii(e) || Le(99); +} +function r3(t) { + return (ii(t) || xe(t) && !t.canBeEmpty()) && !t.isInline(); +} +function qS(t, e, n) { + n.style.removeProperty("caret-color"), e._blockCursorElement = null, e = t.parentElement, e !== null && e.removeChild(t); +} +function La(t) { + return Ia ? (t || window).getSelection() : null; +} +function Dk(t) { + return t.nodeType === 1; +} +function jd(t) { + if (ii(t) && !t.isInline()) return !0; + if (!xe(t) || Wu(t)) return !1; + var e = t.getFirstChild(); + return e = e === null || hf(e) || Ze(e) || e.isInline(), !t.isInline() && t.canBeEmpty() !== !1 && e; +} +function s3(t, e) { + for (; t !== null && t.getParent() !== null && !e(t); ) t = t.getParentOrThrow(); + return e(t) ? t : null; +} +function kF(t, e, n, i, r, s) { + for (t = t.getFirstChild(); t !== null; ) { + let o = t.__key; + t.__parent === e && (xe(t) && kF(t, o, n, i, r, s), n.has(o) || s.delete(o), r.push(o)), t = t.getNextSibling(); + } +} +function Wne(t, e, n, i) { + t = t._nodeMap, e = e._nodeMap; + let r = []; + for (let [s] of i) { + let o = e.get(s); + o === void 0 || o.isAttached() || (xe(o) && kF(o, s, t, e, r, i), t.has(s) || i.delete(s), r.push(s)); + } + for (let s of r) e.delete(s); + for (let s of n) i = e.get(s), i === void 0 || i.isAttached() || (t.has(s) || n.delete(s), e.delete(s)); +} +let Ni = "", Zr = "", dl = "", Hu, Ar, Yg, xF = !1, l5 = !1, Pk, Kb = null, YS, VS, df, Qu, XS, Vg; +function Jb(t, e) { + let n = df.get(t); + if (e !== null) { + let i = JS(t); + i.parentNode === e && e.removeChild(i); + } + Qu.has(t) || Ar._keyToDOMMap.delete(t), xe(n) && (t = Vy(n, df), GS(t, 0, t.length - 1, null)), n !== void 0 && a5(Vg, Yg, Pk, n, "destroyed"); +} +function GS(t, e, n, i) { + for (; e <= n; ++e) { + let r = t[e]; + r !== void 0 && Jb(r, i); + } +} +function Nc(t, e) { + t.setProperty("text-align", e); +} +function _F(t, e) { + var n = Hu.theme.indent; + if (typeof n == "string") { + let i = t.classList.contains(n); + 0 < e && !i ? t.classList.add(n) : 1 > e && i && t.classList.remove(n); + } + n = getComputedStyle(t).getPropertyValue("--lexical-indent-base-value") || "40px", t.style.setProperty("padding-inline-start", e === 0 ? "" : `calc(${e} * ${n})`); +} +function OF(t, e) { + t = t.style, e === 0 ? Nc(t, "") : e === 1 ? Nc(t, "left") : e === 2 ? Nc(t, "center") : e === 3 ? Nc(t, "right") : e === 4 ? Nc(t, "justify") : e === 5 ? Nc(t, "start") : e === 6 && Nc(t, "end"); +} +function ey(t, e, n) { + let i = Qu.get(t); + i === void 0 && Le(60); + let r = i.createDOM(Hu, Ar); + var s = Ar._keyToDOMMap; + if (r["__lexicalKey_" + Ar._key] = t, s.set(t, r), Ze(i) ? r.setAttribute("data-lexical-text", "true") : ii(i) && r.setAttribute("data-lexical-decorator", "true"), xe(i)) { + if (t = i.__indent, s = i.__size, t !== 0 && _F(r, t), s !== 0) { + --s, t = Vy(i, Qu); + var o = Zr; + Zr = "", KS(t, i, 0, s, r, null), CF(i, r), Zr = o; + } + t = i.__format, t !== 0 && OF(r, t), i.isInline() || SF(null, i, r), Zy(i) && (Ni += ` + +`, dl += ` + +`); + } else s = i.getTextContent(), ii(i) ? (o = i.decorate(Ar, Hu), o !== null && EF(t, o), r.contentEditable = "false") : Ze(i) && (i.isDirectionless() || (Zr += s)), Ni += s, dl += s; + return e !== null && (n != null ? e.insertBefore(r, n) : (n = e.__lexicalLineBreak, n != null ? e.insertBefore(r, n) : e.appendChild(r))), a5(Vg, Yg, Pk, i, "created"), r; +} +function KS(t, e, n, i, r, s) { + let o = Ni; + for (Ni = ""; n <= i; ++n) ey(t[n], r, s); + Zy(e) && (Ni += ` + +`), r.__lexicalTextContent = Ni, Ni = o + Ni; +} +function Y$(t, e) { + return t = e.get(t), hf(t) || ii(t) && t.isInline(); +} +function SF(t, e, n) { + t = t !== null && (t.__size === 0 || Y$(t.__last, df)), e = e.__size === 0 || Y$(e.__last, Qu), t ? e || (e = n.__lexicalLineBreak, e != null && n.removeChild(e), n.__lexicalLineBreak = null) : e && (e = document.createElement("br"), n.__lexicalLineBreak = e, n.appendChild(e)); +} +function CF(t, e) { + var n = e.__lexicalDir; + if (e.__lexicalDirTextContent !== Zr || n !== Kb) { + let s = Zr === ""; + if (s) var i = Kb; + else i = Zr, i = Mne.test(i) ? "rtl" : Nne.test(i) ? "ltr" : null; + if (i !== n) { + let o = e.classList, a = Hu.theme; + var r = n !== null ? a[n] : void 0; + let l = i !== null ? a[i] : void 0; + r !== void 0 && (typeof r == "string" && (r = r.split(" "), r = a[n] = r), o.remove(...r)), i === null || s && i === "ltr" ? e.removeAttribute("dir") : (l !== void 0 && (typeof l == "string" && (n = l.split(" "), l = a[i] = n), l !== void 0 && o.add(...l)), e.dir = i), l5 || (t.getWritable().__dir = i); + } + Kb = i, e.__lexicalDirTextContent = Zr, e.__lexicalDir = i; + } +} +function Vy(t, e) { + let n = []; + for (t = t.__first; t !== null; ) { + let i = e.get(t); + i === void 0 && Le(101), n.push(t), t = i.__next; + } + return n; +} +function Xm(t, e) { + var n = df.get(t), i = Qu.get(t); + n !== void 0 && i !== void 0 || Le(61); + var r = xF || VS.has(t) || YS.has(t); + let s = qy(Ar, t); + if (n === i && !r) return xe(n) ? (i = s.__lexicalTextContent, i !== void 0 && (Ni += i, dl += i), i = s.__lexicalDirTextContent, i !== void 0 && (Zr += i)) : (i = n.getTextContent(), Ze(n) && !n.isDirectionless() && (Zr += i), dl += i, Ni += i), s; + if (n !== i && r && a5(Vg, Yg, Pk, i, "updated"), i.updateDOM(n, s, Hu)) return i = ey(t, null, null), e === null && Le(62), e.replaceChild(i, s), Jb(t, null), i; + if (xe(n) && xe(i)) { + if (t = i.__indent, t !== n.__indent && _F(s, t), t = i.__format, t !== n.__format && OF(s, t), r) { + t = Zr, Zr = "", r = Ni; + var o = n.__size, a = i.__size; + if (Ni = "", o === 1 && a === 1) { + var l = n.__first; + if (e = i.__first, l === e) Xm(l, s); + else { + var u = JS(l); + e = ey(e, null, null), s.replaceChild(e, u), Jb(l, null); + } + } else { + e = Vy(n, df); + var f = Vy(i, Qu); + if (o === 0) a !== 0 && KS(f, i, 0, a - 1, s, null); + else if (a === 0) o !== 0 && (l = s.__lexicalLineBreak == null, GS(e, 0, o - 1, l ? null : s), l && (s.textContent = "")); + else { + var d = e; + e = f, f = o - 1, o = a - 1; + let m = s.firstChild, g = 0; + for (a = 0; g <= f && a <= o; ) { + var h = d[g]; + let w = e[a]; + if (h === w) m = o3(Xm(w, s)), g++, a++; + else { + l === void 0 && (l = new Set(d)), u === void 0 && (u = new Set(e)); + let x = u.has(h), _ = l.has(w); + x ? (_ ? (h = qy(Ar, w), h === m ? m = o3(Xm(w, s)) : (m != null ? s.insertBefore(h, m) : s.appendChild(h), Xm(w, s)), g++) : ey(w, s, m), a++) : (m = o3(JS(h)), Jb(h, s), g++); + } + } + l = g > f, u = a > o, l && !u ? (l = e[o + 1], l = l === void 0 ? null : Ar.getElementByKey(l), KS(e, i, a, o, s, l)) : u && !l && GS(d, g, f, s); + } + } + Zy(i) && (Ni += ` + +`), s.__lexicalTextContent = Ni, Ni = r + Ni, CF(i, s), Zr = t, Ws(i) || i.isInline() || SF(n, i, s); + } + Zy(i) && (Ni += ` + +`, dl += ` + +`); + } else n = i.getTextContent(), ii(i) ? (r = i.decorate(Ar, Hu), r !== null && EF(t, r)) : Ze(i) && !i.isDirectionless() && (Zr += n), Ni += n, dl += n; + return !l5 && Ws(i) && i.__cachedText !== dl && (i.getWritable().__cachedText = dl), s; +} +function EF(t, e) { + let n = Ar._pendingDecorators, i = Ar._decorators; + if (n === null) { + if (i[t] === e) return; + n = mF(Ar); + } + n[t] = e; +} +function o3(t) { + return t = t.nextSibling, t !== null && t === Ar._blockCursorElement && (t = t.nextSibling), t; +} +function JS(t) { + let e = XS.get(t); + return e === void 0 && Le(75, t), e; +} +let il = Object.freeze({}), e4 = [["keydown", Xne], ["pointerdown", Qne], ["compositionstart", Yne], ["compositionend", Vne], ["input", qne], ["click", Hne], ["cut", il], ["copy", il], ["dragstart", il], ["dragover", il], ["dragend", il], ["paste", il], ["focus", il], ["blur", il], ["drop", il]]; +Hy && e4.push(["beforeinput", (t, e) => Zne(t, e)]); +let Xg = 0, TF = 0, $F = 0, Fd = null, kg = 0, t4 = !1, n4 = !1, xg = !1, Gm = !1, MF = [0, "", 0, "root", 0]; +function NF(t, e, n, i, r) { + let s = t.anchor, o = t.focus, a = s.getNode(); + var l = Ln(); + let u = La(l._window), f = u !== null ? u.anchorNode : null, d = s.key; + l = l.getElementByKey(d); + let h = n.length; + return d !== o.key || !Ze(a) || (!r && (!Hy || $F < i + 50) || a.isDirty() && 2 > h || gF(n)) && s.offset !== o.offset && !a.isComposing() || QS(a) || a.isDirty() && 1 < h || (r || !Hy) && l !== null && !a.isComposing() && f !== Qy(l) || u !== null && e !== null && (!e.collapsed || e.startContainer !== u.anchorNode || e.startOffset !== u.anchorOffset) || a.getFormat() !== t.format || a.getStyle() !== t.style || zne(t, a); +} +function V$(t, e) { + return t !== null && t.nodeValue !== null && t.nodeType === 3 && e !== 0 && e !== t.nodeValue.length; +} +function X$(t, e, n) { + let { anchorNode: i, anchorOffset: r, focusNode: s, focusOffset: o } = t; + t4 && (t4 = !1, V$(i, r) && V$(s, o)) || qs(e, () => { + if (!n) $a(null); + else if (t1(e, i, s)) { + var a = pn(); + if (xt(a)) { + var l = a.anchor, u = l.getNode(); + if (a.isCollapsed()) { + t.type === "Range" && t.anchorNode === t.focusNode && (a.dirty = !0); + var f = Ak(e).event; + f = f ? f.timeStamp : performance.now(); + let [w, x, _, S, C] = MF; + var d = Zs(); + d = e.isComposing() === !1 && d.getTextContent() === "", f < C + 200 && l.offset === _ && l.key === S ? (a.format = w, a.style = x) : l.type === "text" ? (Ze(u) || Le(141), a.format = u.getFormat(), a.style = u.getStyle()) : l.type !== "element" || d || (a.format = 0, a.style = ""); + } else { + var h = l.key, m = a.focus.key; + l = a.getNodes(), u = l.length; + var g = a.isBackward(); + f = g ? o : r, d = g ? r : o; + let w = g ? m : h; + h = g ? h : m, m = 255, g = !1; + for (let x = 0; x < u; x++) { + let _ = l[x], S = _.getTextContentSize(); + if (Ze(_) && S !== 0 && !(x === 0 && _.__key === w && f === S || x === u - 1 && _.__key === h && d === 0) && (g = !0, m &= _.getFormat(), m === 0)) break; + } + a.format = g ? m : 0; + } + } + Pe(e, Tk, void 0); + } + }); +} +function Hne(t, e) { + qs(e, () => { + let n = pn(); + var i = La(e._window); + let r = Yh(); + if (i) if (xt(n)) { + let o = n.anchor; + var s = o.getNode(); + o.type === "element" && o.offset === 0 && n.isCollapsed() && !Ws(s) && Zs().getChildrenSize() === 1 && s.getTopLevelElementOrThrow().isEmpty() && r !== null && n.is(r) ? (i.removeAllRanges(), n.dirty = !0) : t.detail !== 3 || n.isCollapsed() || (i = n.focus.getNode(), s !== i && (xe(s) ? s.select(0) : s.getParentOrThrow().select(0))); + } else t.pointerType === "touch" && (s = i.anchorNode, s !== null && (s = s.nodeType, s === 1 || s === 3)) && (i = u5(r, i, e, t), $a(i)); + Pe(e, Wj, t); + }); +} +function Qne(t, e) { + let n = t.target; + t = t.pointerType, n instanceof Node && t !== "touch" && qs(e, () => { + ii(n1(n)) || (n4 = !0); + }); +} +function AF(t) { + return t.getTargetRanges ? (t = t.getTargetRanges(), t.length === 0 ? null : t[0]) : null; +} +function Une(t, e) { + return t !== e || xe(t) || xe(e) || !t.isToken() || !e.isToken(); +} +function Zne(t, e) { + let n = t.inputType, i = AF(t); + n === "deleteCompositionText" || zu && bF(e) || n !== "insertCompositionText" && qs(e, () => { + let r = pn(); + if (n === "deleteContentBackward") { + if (r === null) { + var s = Yh(); + if (!xt(s)) return; + $a(s.clone()); + } + if (xt(r)) { + Ene && Pi(r.anchor.key), TF === 229 && t.timeStamp < Xg + 30 && e.isComposing() && r.anchor.key === r.focus.key ? (Pi(null), Xg = 0, setTimeout(() => { + qs(e, () => { + Pi(null); + }); + }, 30), xt(r) && (s = r.anchor.getNode(), s.markDirty(), r.format = s.getFormat(), Ze(s) || Le(142), r.style = s.getStyle()), 1 >= r.anchor.getNode().getTextContent().length && (t.preventDefault(), Pe(e, sh, !0))) : (Pi(null), t.preventDefault(), Pe(e, sh, !0)); + return; + } + } + if (xt(r)) { + s = t.data, Fd !== null && s5(!1, e, Fd), r.dirty && Fd === null || !r.isCollapsed() || Ws(r.anchor.getNode()) || i === null || r.applyDOMRange(i), Fd = null; + var o = r.focus, a = r.anchor.getNode(); + if (o = o.getNode(), n === "insertText" || n === "insertTranspose") s === ` +` ? (t.preventDefault(), Pe(e, yg, !1)) : s === ` + +` ? (t.preventDefault(), Pe(e, BS, void 0)) : s == null && t.dataTransfer ? (s = t.dataTransfer.getData("text/plain"), t.preventDefault(), r.insertRawText(s)) : s != null && NF(r, i, s, t.timeStamp, !0) ? (t.preventDefault(), Pe(e, oh, s)) : Fd = s, $F = t.timeStamp; + else switch (t.preventDefault(), n) { + case "insertFromYank": + case "insertFromDrop": + case "insertReplacementText": + Pe(e, oh, t); + break; + case "insertFromComposition": + Pi(null), Pe(e, oh, t); + break; + case "insertLineBreak": + Pi(null), Pe(e, yg, !1); + break; + case "insertParagraph": + Pi(null), xg && !$k ? (xg = !1, Pe(e, yg, !1)) : Pe(e, BS, void 0); + break; + case "insertFromPaste": + case "insertFromPasteAsQuotation": + Pe(e, Y6, t); + break; + case "deleteByComposition": + Une(a, o) && Pe( + e, + zS, + t + ); + break; + case "deleteByDrag": + case "deleteByCut": + Pe(e, zS, t); + break; + case "deleteContent": + Pe(e, sh, !1); + break; + case "deleteWordBackward": + Pe(e, Zg, !0); + break; + case "deleteWordForward": + Pe(e, Zg, !1); + break; + case "deleteHardLineBackward": + case "deleteSoftLineBackward": + Pe(e, qg, !0); + break; + case "deleteContentForward": + case "deleteHardLineForward": + case "deleteSoftLineForward": + Pe(e, qg, !1); + break; + case "formatStrikeThrough": + Pe(e, ku, "strikethrough"); + break; + case "formatBold": + Pe(e, ku, "bold"); + break; + case "formatItalic": + Pe(e, ku, "italic"); + break; + case "formatUnderline": + Pe(e, ku, "underline"); + break; + case "historyUndo": + Pe(e, V6, void 0); + break; + case "historyRedo": + Pe(e, X6, void 0); + } + } + }); +} +function qne(t, e) { + t.stopPropagation(), qs(e, () => { + var n = pn(), i = t.data, r = AF(t); + if (i != null && xt(n) && NF(n, r, i, t.timeStamp, !1)) { + Gm && (i4(e, i), Gm = !1); + var s = n.anchor, o = s.getNode(); + if (r = La(e._window), r === null) return; + let a = s.offset; + (s = Hy && !n.isCollapsed() && Ze(o) && r.anchorNode !== null) && (o = o.getTextContent().slice(0, a) + i + o.getTextContent().slice(a + n.focus.offset), r = r.anchorNode, s = o === (r.nodeType === 3 ? r.nodeValue : null)), s || Pe(e, oh, i), i = i.length, zu && 1 < i && t.inputType === "insertCompositionText" && !e.isComposing() && (n.anchor.offset -= i), J6 || $k || e5 || !e.isComposing() || (Xg = 0, Pi(null)); + } else s5(!1, e, i !== null ? i : void 0), Gm && (i4(e, i || void 0), Gm = !1); + qr(), n = Ln(), uF(n); + }), Fd = null; +} +function Yne(t, e) { + qs(e, () => { + let n = pn(); + if (xt(n) && !e.isComposing()) { + let i = n.anchor, r = n.anchor.getNode(); + Pi(i.key), (t.timeStamp < Xg + 30 || i.type === "element" || !n.isCollapsed() || r.getFormat() !== n.format || Ze(r) && r.getStyle() !== n.style) && Pe(e, oh, $ne); + } + }); +} +function i4(t, e) { + var n = t._compositionKey; + if (Pi(null), n !== null && e != null) { + if (e === "") { + e = Tr(n), t = Qy(t.getElementByKey(n)), t !== null && t.nodeValue !== null && Ze(e) && o5(e, t.nodeValue, null, null, !0); + return; + } + if (e[e.length - 1] === ` +` && (n = pn(), xt(n))) { + e = n.focus, n.anchor.set(e.key, e.offset, e.type), Pe(t, Wy, null); + return; + } + } + s5(!0, t, e); +} +function Vne(t, e) { + zu ? Gm = !0 : qs(e, () => { + i4(e, t.data); + }); +} +function Xne(t, e) { + if (Xg = t.timeStamp, TF = t.keyCode, !e.isComposing()) { + var { keyCode: n, shiftKey: i, ctrlKey: r, metaKey: s, altKey: o } = t; + if (!Pe(e, Hj, t)) { + if (n !== 39 || r || s || o) if (n !== 39 || o || i || !r && !s) if (n !== 37 || r || s || o) if (n !== 37 || o || i || !r && !s) if (n !== 38 || r || s) if (n !== 40 || r || s) if (n === 13 && i) xg = !0, Pe(e, Wy, t); + else if (n === 32) Pe(e, Xj, t); + else if (wr && r && n === 79) t.preventDefault(), xg = !0, Pe(e, yg, !0); + else if (n !== 13 || i) { + var a = wr ? o || s ? !1 : n === 8 || n === 72 && r : r || o || s ? !1 : n === 8; + a ? n === 8 ? Pe(e, Gj, t) : (t.preventDefault(), Pe(e, sh, !0)) : n === 27 ? Pe( + e, + Kj, + t + ) : (a = wr ? i || o || s ? !1 : n === 46 || n === 68 && r : r || o || s ? !1 : n === 46, a ? n === 46 ? Pe(e, Jj, t) : (t.preventDefault(), Pe(e, sh, !1)) : n === 8 && (wr ? o : r) ? (t.preventDefault(), Pe(e, Zg, !0)) : n === 46 && (wr ? o : r) ? (t.preventDefault(), Pe(e, Zg, !1)) : wr && s && n === 8 ? (t.preventDefault(), Pe(e, qg, !0)) : wr && s && n === 46 ? (t.preventDefault(), Pe(e, qg, !1)) : n === 66 && !o && (wr ? s : r) ? (t.preventDefault(), Pe(e, ku, "bold")) : n === 85 && !o && (wr ? s : r) ? (t.preventDefault(), Pe(e, ku, "underline")) : n === 73 && !o && (wr ? s : r) ? (t.preventDefault(), Pe(e, ku, "italic")) : n !== 9 || o || r || s ? n === 90 && !i && (wr ? s : r) ? (t.preventDefault(), Pe(e, V6, void 0)) : (a = wr ? n === 90 && s && i : n === 89 && r || n === 90 && r && i, a ? (t.preventDefault(), Pe(e, X6, void 0)) : r1(e._editorState._selection) ? (a = i ? !1 : n === 67 ? wr ? s : r : !1, a ? (t.preventDefault(), Pe(e, G6, t)) : (a = i ? !1 : n === 88 ? wr ? s : r : !1, a ? (t.preventDefault(), Pe(e, K6, t)) : n === 65 && (wr ? s : r) && (t.preventDefault(), Pe(e, WS, t)))) : !zu && n === 65 && (wr ? s : r) && (t.preventDefault(), Pe(e, WS, t))) : Pe(e, eF, t)); + } else xg = !1, Pe(e, Wy, t); + else Pe(e, Vj, t); + else Pe(e, Yj, t); + else Pe(e, qj, t); + else Pe(e, Zj, t); + else Pe(e, Uj, t); + else Pe(e, Qj, t); + (r || i || o || s) && Pe(e, aF, t); + } + } +} +function DF(t) { + let e = t.__lexicalEventHandles; + return e === void 0 && (e = [], t.__lexicalEventHandles = e), e; +} +let ah = /* @__PURE__ */ new Map(); +function PF(t) { + var e = t.target; + let n = La(e == null ? null : e.nodeType === 9 ? e.defaultView : e.ownerDocument.defaultView); + if (n !== null) { + var i = i5(n.anchorNode); + if (i !== null) { + n4 && (n4 = !1, qs(i, () => { + var a = Yh(), l = n.anchorNode; + l !== null && (l = l.nodeType, l === 1 || l === 3) && (a = u5(a, n, i, t), $a(a)); + })), e = r5(i), e = e[e.length - 1]; + var r = e._key, s = ah.get(r), o = s || e; + o !== i && X$(n, o, !1), X$(n, i, !0), i !== e ? ah.set(r, i) : s && ah.delete(r); + } + } +} +function Gne(t, e) { + kg === 0 && t.ownerDocument.addEventListener("selectionchange", PF), kg++, t.__lexicalEditor = e; + let n = DF(t); + for (let i = 0; i < e4.length; i++) { + let [r, s] = e4[i], o = typeof s == "function" ? (a) => { + a._lexicalHandled !== !0 && (a._lexicalHandled = !0, e.isEditable() && s(a, e)); + } : (a) => { + if (a._lexicalHandled !== !0 && (a._lexicalHandled = !0, e.isEditable())) switch (r) { + case "cut": + return Pe(e, K6, a); + case "copy": + return Pe(e, G6, a); + case "paste": + return Pe(e, Y6, a); + case "dragstart": + return Pe(e, nF, a); + case "dragover": + return Pe(e, iF, a); + case "dragend": + return Pe( + e, + rF, + a + ); + case "focus": + return Pe(e, sF, a); + case "blur": + return Pe(e, oF, a); + case "drop": + return Pe(e, tF, a); + } + }; + t.addEventListener(r, o), n.push(() => { + t.removeEventListener(r, o); + }); + } +} +function r4(t, e, n) { + qr(); + var i = t.__key; + let r = t.getParent(); + if (r !== null) { + var s = pn(); + if (xt(s) && xe(t)) { + var { anchor: o, focus: a } = s, l = o.getNode(), u = a.getNode(); + Yy(l, t) && o.set(t.__key, 0, "element"), Yy(u, t) && a.set(t.__key, 0, "element"); + } + if (l = s, u = !1, xt(l) && e) { + s = l.anchor; + let f = l.focus; + s.key === i && (Gy(s, t, r, t.getPreviousSibling(), t.getNextSibling()), u = !0), f.key === i && (Gy(f, t, r, t.getPreviousSibling(), t.getNextSibling()), u = !0); + } else r1(l) && e && t.isSelected() && t.selectPrevious(); + xt(l) && e && !u ? (i = t.getIndexWithinParent(), of(t), Xy(l, r, i, -1)) : of(t), n || Wu(r) || r.canBeEmpty() || !r.isEmpty() || r4(r, e), e && Ws(r) && r.isEmpty() && r.selectEnd(); + } +} +class Ik { + static getType() { + Le(64, this.name); + } + static clone() { + Le(65, this.name); + } + constructor(e) { + this.__type = this.constructor.getType(), this.__next = this.__prev = this.__parent = null, hF(this, e); + } + getType() { + return this.__type; + } + isInline() { + Le(137, this.constructor.name); + } + isAttached() { + for (var e = this.__key; e !== null; ) { + if (e === "root") return !0; + if (e = Tr(e), e === null) break; + e = e.__parent; + } + return !1; + } + isSelected(e) { + if (e = e || pn(), e == null) return !1; + let n = e.getNodes().some((i) => i.__key === this.__key); + return Ze(this) ? n : xt(e) && e.anchor.type === "element" && e.focus.type === "element" && e.anchor.key === e.focus.key && e.anchor.offset === e.focus.offset ? !1 : n; + } + getKey() { + return this.__key; + } + getIndexWithinParent() { + var e = this.getParent(); + if (e === null) return -1; + e = e.getFirstChild(); + let n = 0; + for (; e !== null; ) { + if (this.is(e)) return n; + n++, e = e.getNextSibling(); + } + return -1; + } + getParent() { + let e = this.getLatest().__parent; + return e === null ? null : Tr(e); + } + getParentOrThrow() { + let e = this.getParent(); + return e === null && Le(66, this.__key), e; + } + getTopLevelElement() { + let e = this; + for (; e !== null; ) { + let n = e.getParent(); + if (Wu(n)) return xe(e) || Le(138), e; + e = n; + } + return null; + } + getTopLevelElementOrThrow() { + let e = this.getTopLevelElement(); + return e === null && Le(67, this.__key), e; + } + getParents() { + let e = [], n = this.getParent(); + for (; n !== null; ) e.push(n), n = n.getParent(); + return e; + } + getParentKeys() { + let e = [], n = this.getParent(); + for (; n !== null; ) e.push(n.__key), n = n.getParent(); + return e; + } + getPreviousSibling() { + let e = this.getLatest().__prev; + return e === null ? null : Tr(e); + } + getPreviousSiblings() { + let e = []; + var n = this.getParent(); + if (n === null) return e; + for (n = n.getFirstChild(); n !== null && !n.is(this); ) e.push(n), n = n.getNextSibling(); + return e; + } + getNextSibling() { + let e = this.getLatest().__next; + return e === null ? null : Tr(e); + } + getNextSiblings() { + let e = [], n = this.getNextSibling(); + for (; n !== null; ) e.push(n), n = n.getNextSibling(); + return e; + } + getCommonAncestor(e) { + let n = this.getParents(); + var i = e.getParents(); + xe(this) && n.unshift(this), xe(e) && i.unshift(e), e = n.length; + var r = i.length; + if (e === 0 || r === 0 || n[e - 1] !== i[r - 1]) return null; + for (i = new Set(i), r = 0; r < e; r++) { + let s = n[r]; + if (i.has(s)) return s; + } + return null; + } + is(e) { + return e == null ? !1 : this.__key === e.__key; + } + isBefore(e) { + if (this === e) return !1; + if (e.isParentOf(this)) return !0; + if (this.isParentOf(e)) return !1; + var n = this.getCommonAncestor(e); + let i = this; + for (; ; ) { + var r = i.getParentOrThrow(); + if (r === n) { + r = i.getIndexWithinParent(); + break; + } + i = r; + } + for (i = e; ; ) { + if (e = i.getParentOrThrow(), e === n) { + n = i.getIndexWithinParent(); + break; + } + i = e; + } + return r < n; + } + isParentOf(e) { + let n = this.__key; + if (n === e.__key) return !1; + for (; e !== null; ) { + if (e.__key === n) return !0; + e = e.getParent(); + } + return !1; + } + getNodesBetween(e) { + let n = this.isBefore(e), i = [], r = /* @__PURE__ */ new Set(); + for (var s = this; ; ) { + var o = s.__key; + if (r.has(o) || (r.add(o), i.push(s)), s === e) break; + if (o = xe(s) ? n ? s.getFirstChild() : s.getLastChild() : null, o !== null) s = o; + else if (o = n ? s.getNextSibling() : s.getPreviousSibling(), o !== null) s = o; + else { + if (s = s.getParentOrThrow(), r.has(s.__key) || i.push(s), s === e) break; + o = s; + do + o === null && Le(68), s = n ? o.getNextSibling() : o.getPreviousSibling(), o = o.getParent(), o !== null && (s !== null || r.has(o.__key) || i.push(o)); + while (s === null); + } + } + return n || i.reverse(), i; + } + isDirty() { + let e = Ln()._dirtyLeaves; + return e !== null && e.has(this.__key); + } + getLatest() { + let e = Tr(this.__key); + return e === null && Le(113), e; + } + getWritable() { + qr(); + var e = Ra(), n = Ln(); + e = e._nodeMap; + let i = this.__key, r = this.getLatest(), s = r.__parent; + n = n._cloneNotNeeded; + var o = pn(); + return o !== null && o.setCachedNodes(null), n.has(i) ? (Uy(r), r) : (o = r.constructor.clone(r), o.__parent = s, o.__next = r.__next, o.__prev = r.__prev, xe(r) && xe(o) ? (o.__first = r.__first, o.__last = r.__last, o.__size = r.__size, o.__indent = r.__indent, o.__format = r.__format, o.__dir = r.__dir) : Ze(r) && Ze(o) && (o.__format = r.__format, o.__style = r.__style, o.__mode = r.__mode, o.__detail = r.__detail), n.add(i), o.__key = i, Uy(o), e.set(i, o), o); + } + getTextContent() { + return ""; + } + getTextContentSize() { + return this.getTextContent().length; + } + createDOM() { + Le(70); + } + updateDOM() { + Le(71); + } + exportDOM(e) { + return { element: this.createDOM(e._config, e) }; + } + exportJSON() { + Le(72); + } + static importJSON() { + Le(18, this.name); + } + static transform() { + return null; + } + remove(e) { + r4(this, !0, e); + } + replace(e, n) { + qr(); + var i = pn(); + i !== null && (i = i.clone()), i3(this, e); + let r = this.getLatest(), s = this.__key, o = e.__key, a = e.getWritable(); + e = this.getParentOrThrow().getWritable(); + let l = e.__size; + of(a); + let u = r.getPreviousSibling(), f = r.getNextSibling(), d = r.__prev, h = r.__next, m = r.__parent; + return r4(r, !1, !0), u === null ? e.__first = o : u.getWritable().__next = o, a.__prev = d, f === null ? e.__last = o : f.getWritable().__prev = o, a.__next = h, a.__parent = m, e.__size = l, n && (xe(this) && xe(a) || Le(139), this.getChildren().forEach((g) => { + a.append(g); + })), xt(i) && ($a(i), n = i.anchor, i = i.focus, n.key === s && eM(n, a), i.key === s && eM(i, a)), xu() === s && Pi(o), a; + } + insertAfter(e, n = !0) { + qr(), i3(this, e); + var i = this.getWritable(); + let r = e.getWritable(); + var s = r.getParent(); + let o = pn(); + var a = !1, l = !1; + if (s !== null) { + var u = e.getIndexWithinParent(); + of(r), xt(o) && (l = s.__key, a = o.anchor, s = o.focus, a = a.type === "element" && a.key === l && a.offset === u + 1, l = s.type === "element" && s.key === l && s.offset === u + 1); + } + s = this.getNextSibling(), u = this.getParentOrThrow().getWritable(); + let f = r.__key, d = i.__next; + return s === null ? u.__last = f : s.getWritable().__prev = f, u.__size++, i.__next = f, r.__next = d, r.__prev = i.__key, r.__parent = i.__parent, n && xt(o) && (n = this.getIndexWithinParent(), Xy(o, u, n + 1), i = u.__key, a && o.anchor.set(i, n + 2, "element"), l && o.focus.set(i, n + 2, "element")), e; + } + insertBefore(e, n = !0) { + qr(), i3(this, e); + var i = this.getWritable(); + let r = e.getWritable(), s = r.__key; + of(r); + let o = this.getPreviousSibling(), a = this.getParentOrThrow().getWritable(), l = i.__prev, u = this.getIndexWithinParent(); + return o === null ? a.__first = s : o.getWritable().__next = s, a.__size++, i.__prev = s, r.__prev = l, r.__next = i.__key, r.__parent = i.__parent, i = pn(), n && xt(i) && (n = this.getParentOrThrow(), Xy( + i, + n, + u + )), e; + } + isParentRequired() { + return !1; + } + createParentElementNode() { + return kl(); + } + selectStart() { + return this.selectPrevious(); + } + selectEnd() { + return this.selectNext(0, 0); + } + selectPrevious(e, n) { + qr(); + let i = this.getPreviousSibling(), r = this.getParentOrThrow(); + return i === null ? r.select(0, 0) : xe(i) ? i.select() : Ze(i) ? i.select(e, n) : (e = i.getIndexWithinParent() + 1, r.select(e, e)); + } + selectNext(e, n) { + qr(); + let i = this.getNextSibling(), r = this.getParentOrThrow(); + return i === null ? r.select() : xe(i) ? i.select(0, 0) : Ze(i) ? i.select(e, n) : (e = i.getIndexWithinParent(), r.select(e, e)); + } + markDirty() { + this.getWritable(); + } +} +function Kne(t, e, n) { + n = n || e.getParentOrThrow().getLastChild(); + let i = e; + for (e = [e]; i !== n; ) i.getNextSibling() || Le(140), i = i.getNextSibling(), e.push(i); + for (let r of e) t = t.insertAfter(r); +} +class Zh extends Ik { + static getType() { + return "linebreak"; + } + static clone(e) { + return new Zh(e.__key); + } + constructor(e) { + super(e); + } + getTextContent() { + return ` +`; + } + createDOM() { + return document.createElement("br"); + } + updateDOM() { + return !1; + } + static importDOM() { + return { br: (e) => { + e: { + var n = e.parentElement; + if (n !== null) { + let i = n.firstChild; + if ((i === e || i.nextSibling === e && G$(i)) && (n = n.lastChild, n === e || n.previousSibling === e && G$(n))) { + e = !0; + break e; + } + } + e = !1; + } + return e ? null : { conversion: Jne, priority: 0 }; + } }; + } + static importJSON() { + return Sh(); + } + exportJSON() { + return { + type: "linebreak", + version: 1 + }; + } +} +function Jne() { + return { node: Sh() }; +} +function Sh() { + return i1(new Zh()); +} +function hf(t) { + return t instanceof Zh; +} +function G$(t) { + return t.nodeType === 3 && /^( |\t|\r?\n)+$/.test(t.textContent || ""); +} +function a3(t, e) { + return e & 16 ? "code" : e & 128 ? "mark" : e & 32 ? "sub" : e & 64 ? "sup" : null; +} +function l3(t, e) { + return e & 1 ? "strong" : e & 2 ? "em" : "span"; +} +function u3(t, e, n, i, r) { + t = i.classList, i = wg(r, "base"), i !== void 0 && t.add(...i), i = wg(r, "underlineStrikethrough"); + let s = !1, o = e & 8 && e & 4; + var a = n & 8 && n & 4; + i !== void 0 && (a ? (s = !0, o || t.add(...i)) : o && t.remove(...i)); + for (let l in Oh) a = Oh[l], i = wg(r, l), i !== void 0 && (n & a ? !s || l !== "underline" && l !== "strikethrough" ? (!(e & a) || o && l === "underline" || l === "strikethrough") && t.add(...i) : e & a && t.remove(...i) : e & a && t.remove(...i)); +} +function c3(t, e, n) { + let i = e.firstChild; + if (n = n.isComposing(), t += n ? Mk : "", i == null) e.textContent = t; + else if (e = i.nodeValue, e !== t) if (n || zu) { + n = e.length; + let r = t.length, s = 0, o = 0; + for (; s < n && s < r && e[s] === t[s]; ) s++; + for (; o + s < n && o + s < r && e[n - o - 1] === t[r - o - 1]; ) o++; + t = [s, n - s - o, t.slice(s, r - o)]; + let [a, l, u] = t; + l !== 0 && i.deleteData(a, l), i.insertData(a, u); + } else i.nodeValue = t; +} +function Bv(t, e) { + return e = document.createElement(e), e.appendChild(t), e; +} +class Mf extends Ik { + static getType() { + return "text"; + } + static clone(e) { + return new Mf(e.__text, e.__key); + } + constructor(e, n) { + super(n), this.__text = e, this.__format = 0, this.__style = "", this.__detail = this.__mode = 0; + } + getFormat() { + return this.getLatest().__format; + } + getDetail() { + return this.getLatest().__detail; + } + getMode() { + let e = this.getLatest(); + return Ine[e.__mode]; + } + getStyle() { + return this.getLatest().__style; + } + isToken() { + return this.getLatest().__mode === 1; + } + isComposing() { + return this.__key === xu(); + } + isSegmented() { + return this.getLatest().__mode === 2; + } + isDirectionless() { + return (this.getLatest().__detail & 1) !== 0; + } + isUnmergeable() { + return (this.getLatest().__detail & 2) !== 0; + } + hasFormat(e) { + return e = Oh[e], (this.getFormat() & e) !== 0; + } + isSimpleText() { + return this.__type === "text" && this.__mode === 0; + } + getTextContent() { + return this.getLatest().__text; + } + getFormatFlags(e, n) { + let i = this.getLatest().__format; + return US(i, e, n); + } + canHaveFormat() { + return !0; + } + createDOM(e) { + var n = this.__format, i = a3(this, n); + let r = l3(this, n), s = document.createElement(i === null ? r : i), o = s; + return this.hasFormat("code") && s.setAttribute("spellcheck", "false"), i !== null && (o = document.createElement(r), s.appendChild(o)), i = o, c3(this.__text, i, this), e = e.theme.text, e !== void 0 && u3(r, 0, n, i, e), n = this.__style, n !== "" && (s.style.cssText = n), s; + } + updateDOM(e, n, i) { + let r = this.__text; + var s = e.__format, o = this.__format, a = a3(this, s); + let l = a3(this, o); + var u = l3(this, s); + let f = l3(this, o); + return (a === null ? u : a) !== (l === null ? f : l) ? !0 : a === l && u !== f ? (s = n.firstChild, s == null && Le(48), e = a = document.createElement(f), c3(r, e, this), i = i.theme.text, i !== void 0 && u3(f, 0, o, e, i), n.replaceChild( + a, + s + ), !1) : (u = n, l !== null && a !== null && (u = n.firstChild, u == null && Le(49)), c3(r, u, this), i = i.theme.text, i !== void 0 && s !== o && u3(f, s, o, u, i), o = this.__style, e.__style !== o && (n.style.cssText = o), !1); + } + static importDOM() { + return { + "#text": () => ({ conversion: nie, priority: 0 }), + b: () => ({ conversion: tie, priority: 0 }), + code: () => ({ conversion: nu, priority: 0 }), + em: () => ({ conversion: nu, priority: 0 }), + i: () => ({ conversion: nu, priority: 0 }), + s: () => ({ conversion: nu, priority: 0 }), + span: () => ({ conversion: eie, priority: 0 }), + strong: () => ({ conversion: nu, priority: 0 }), + sub: () => ({ conversion: nu, priority: 0 }), + sup: () => ({ conversion: nu, priority: 0 }), + u: () => ({ conversion: nu, priority: 0 }) + }; + } + static importJSON(e) { + let n = rr(e.text); + return n.setFormat(e.format), n.setDetail(e.detail), n.setMode(e.mode), n.setStyle(e.style), n; + } + exportDOM(e) { + return { element: e } = super.exportDOM(e), e !== null && Dk(e) || Le(132), e.style.whiteSpace = "pre-wrap", this.hasFormat("bold") && (e = Bv(e, "b")), this.hasFormat("italic") && (e = Bv(e, "i")), this.hasFormat("strikethrough") && (e = Bv(e, "s")), this.hasFormat("underline") && (e = Bv(e, "u")), { element: e }; + } + exportJSON() { + return { detail: this.getDetail(), format: this.getFormat(), mode: this.getMode(), style: this.getStyle(), text: this.getTextContent(), type: "text", version: 1 }; + } + selectionTransform() { + } + setFormat(e) { + let n = this.getWritable(); + return n.__format = typeof e == "string" ? Oh[e] : e, n; + } + setDetail(e) { + let n = this.getWritable(); + return n.__detail = typeof e == "string" ? Ane[e] : e, n; + } + setStyle(e) { + let n = this.getWritable(); + return n.__style = e, n; + } + toggleFormat(e) { + let n = this.getFormat(); + return e = US(n, e, null), this.setFormat(e); + } + toggleDirectionless() { + let e = this.getWritable(); + return e.__detail ^= 1, e; + } + toggleUnmergeable() { + let e = this.getWritable(); + return e.__detail ^= 2, e; + } + setMode(e) { + if (e = Pne[e], this.__mode === e) return this; + let n = this.getWritable(); + return n.__mode = e, n; + } + setTextContent(e) { + if (this.__text === e) return this; + let n = this.getWritable(); + return n.__text = e, n; + } + select(e, n) { + qr(); + let i = pn(); + var r = this.getTextContent(); + let s = this.__key; + if (typeof r == "string" ? (r = r.length, e === void 0 && (e = r), n === void 0 && (n = r)) : n = e = 0, xt(i)) r = xu(), r !== i.anchor.key && r !== i.focus.key || Pi(s), i.setTextNodeRange( + this, + e, + this, + n + ); + else return WF(s, e, s, n, "text", "text"); + return i; + } + selectStart() { + return this.select(0, 0); + } + selectEnd() { + let e = this.getTextContentSize(); + return this.select(e, e); + } + spliceText(e, n, i, r) { + let s = this.getWritable(), o = s.__text, a = i.length, l = e; + 0 > l && (l = a + l, 0 > l && (l = 0)); + let u = pn(); + return r && xt(u) && (e += a, u.setTextNodeRange(s, e, s, e)), n = o.slice(0, l) + i + o.slice(l + n), s.__text = n, s; + } + canInsertTextBefore() { + return !0; + } + canInsertTextAfter() { + return !0; + } + splitText(...e) { + qr(); + var n = this.getLatest(), i = n.getTextContent(), r = n.__key, s = xu(), o = new Set(e); + e = []; + for (var a = i.length, l = "", u = 0; u < a; u++) l !== "" && o.has(u) && (e.push(l), l = ""), l += i[u]; + if (l !== "" && e.push(l), o = e.length, o === 0) return []; + if (e[0] === i) return [n]; + var f = e[0]; + i = n.getParentOrThrow(), u = n.getFormat(); + let d = n.getStyle(), h = n.__detail; + a = !1, n.isSegmented() ? (l = rr(f), l.__format = u, l.__style = d, l.__detail = h, a = !0) : (l = n.getWritable(), l.__text = f), n = pn(), l = [l], f = f.length; + for (let w = 1; w < o; w++) { + var m = e[w], g = m.length; + m = rr(m).getWritable(), m.__format = u, m.__style = d, m.__detail = h; + let x = m.__key; + if (g = f + g, xt(n)) { + let _ = n.anchor, S = n.focus; + _.key === r && _.type === "text" && _.offset > f && _.offset <= g && (_.key = x, _.offset -= f, n.dirty = !0), S.key === r && S.type === "text" && S.offset > f && S.offset <= g && (S.key = x, S.offset -= f, n.dirty = !0); + } + s === r && Pi(x), f = g, l.push(m); + } + return r = this.getPreviousSibling(), s = this.getNextSibling(), r !== null && Uy(r), s !== null && Uy(s), r = i.getWritable(), s = this.getIndexWithinParent(), a ? (r.splice(s, 0, l), this.remove()) : r.splice(s, 1, l), xt(n) && Xy(n, i, s, o - 1), l; + } + mergeWithSibling(e) { + var n = e === this.getPreviousSibling(); + n || e === this.getNextSibling() || Le(50); + var i = this.__key; + let r = e.__key, s = this.__text, o = s.length; + xu() === r && Pi(i); + let a = pn(); + if (xt(a)) { + let l = a.anchor, u = a.focus; + l !== null && l.key === r && (aM(l, n, i, e, o), a.dirty = !0), u !== null && u.key === r && (aM(u, n, i, e, o), a.dirty = !0); + } + return i = e.__text, this.setTextContent(n ? i + s : s + i), n = this.getWritable(), e.remove(), n; + } + isTextEntity() { + return !1; + } +} +function eie(t) { + let e = t.style.fontWeight === "700", n = t.style.textDecoration === "line-through", i = t.style.fontStyle === "italic", r = t.style.textDecoration === "underline", s = t.style.verticalAlign; + return { forChild: (o) => (Ze(o) && (e && o.toggleFormat("bold"), n && o.toggleFormat("strikethrough"), i && o.toggleFormat("italic"), r && o.toggleFormat("underline"), s === "sub" && o.toggleFormat("subscript"), s === "super" && o.toggleFormat("superscript")), o), node: null }; +} +function tie(t) { + let e = t.style.fontWeight === "normal"; + return { forChild: (n) => (Ze(n) && !e && n.toggleFormat("bold"), n), node: null }; +} +let K$ = /* @__PURE__ */ new WeakMap(); +function nie(t) { + t.parentElement === null && Le(129); + for (var e = t.textContent || "", n, i = t.parentNode, r = [t]; i !== null && (n = K$.get(i)) === void 0 && !(i.nodeName === "PRE" || i.nodeType === 1 && i.style !== void 0 && i.style.whiteSpace !== void 0 && i.style.whiteSpace.startsWith("pre")); ) r.push(i), i = i.parentNode; + for (n = n === void 0 ? i : n, i = 0; i < r.length; i++) K$.set(r[i], n); + if (n !== null) { + for (e = e.split(/(\r?\n|\t)/), t = [], r = e.length, n = 0; n < r; n++) i = e[n], i === ` +` || i === `\r +` ? t.push(Sh()) : i === " " ? t.push(Rk()) : i !== "" && t.push(rr(i)); + return { node: t }; + } + if (e = e.replace(/\r/g, "").replace(/[ \t\n]+/g, " "), e === "") return { node: null }; + if (e[0] === " ") { + for (r = t, n = !0; r !== null && (r = J$(r, !1)) !== null; ) if (i = r.textContent || "", 0 < i.length) { + /[ \t\n]$/.test(i) && (e = e.slice(1)), n = !1; + break; + } + n && (e = e.slice(1)); + } + if (e[e.length - 1] === " ") { + for (r = !0; t !== null && (t = J$(t, !0)) !== null; ) if (0 < (t.textContent || "").replace(/^( |\t|\r?\n)+/, "").length) { + r = !1; + break; + } + r && (e = e.slice(0, e.length - 1)); + } + return e === "" ? { node: null } : { node: rr(e) }; +} +let iie = new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/, "i"); +function J$(t, e) { + for (; ; ) { + for (var n = void 0; (n = e ? t.nextSibling : t.previousSibling) === null; ) if (t = t.parentElement, t === null) return null; + if (t = n, t.nodeType === 1 && (n = t.style.display, n === "" && t.nodeName.match(iie) === null || n !== "" && !n.startsWith("inline"))) return null; + for (; (n = e ? t.firstChild : t.lastChild) !== null; ) t = n; + if (t.nodeType === 3) return t; + if (t.nodeName === "BR") return null; + } +} +let rie = { code: "code", em: "italic", i: "italic", s: "strikethrough", strong: "bold", sub: "subscript", sup: "superscript", u: "underline" }; +function nu(t) { + let e = rie[t.nodeName.toLowerCase()]; + return e === void 0 ? { node: null } : { forChild: (n) => (Ze(n) && !n.hasFormat(e) && n.toggleFormat(e), n), node: null }; +} +function rr(t = "") { + return i1(new Mf(t)); +} +function Ze(t) { + return t instanceof Mf; +} +let Lk = class IF extends Mf { + static getType() { + return "tab"; + } + static clone(e) { + let n = new IF(e.__key); + return n.__text = e.__text, n.__format = e.__format, n.__style = e.__style, n; + } + constructor(e) { + super(" ", e), this.__detail = 2; + } + static importDOM() { + return null; + } + static importJSON(e) { + let n = Rk(); + return n.setFormat(e.format), n.setStyle(e.style), n; + } + exportJSON() { + return { ...super.exportJSON(), type: "tab", version: 1 }; + } + setTextContent() { + Le(126); + } + setDetail() { + Le(127); + } + setMode() { + Le(128); + } + canInsertTextBefore() { + return !1; + } + canInsertTextAfter() { + return !1; + } +}; +function Rk() { + return i1(new Lk()); +} +function LF(t) { + return t instanceof Lk; +} +class sie { + constructor(e, n, i) { + this._selection = null, this.key = e, this.offset = n, this.type = i; + } + is(e) { + return this.key === e.key && this.offset === e.offset && this.type === e.type; + } + isBefore(e) { + let n = this.getNode(), i = e.getNode(), r = this.offset; + if (e = e.offset, xe(n)) { + var s = n.getDescendantByIndex(r); + n = s ?? n; + } + return xe(i) && (s = i.getDescendantByIndex(e), i = s ?? i), n === i ? r < e : n.isBefore(i); + } + getNode() { + let e = Tr(this.key); + return e === null && Le(20), e; + } + set(e, n, i) { + let r = this._selection, s = this.key; + this.key = e, this.offset = n, this.type = i, Vh() || (xu() === s && Pi(e), r !== null && (r.setCachedNodes(null), r.dirty = !0)); + } +} +function Ro(t, e, n) { + return new sie(t, e, n); +} +function f3(t, e) { + let n = e.__key, i = t.offset, r = "element"; + if (Ze(e)) r = "text", e = e.getTextContentSize(), i > e && (i = e); + else if (!xe(e)) { + var s = e.getNextSibling(); + Ze(s) ? (n = s.__key, i = 0, r = "text") : (s = e.getParent()) && (n = s.__key, i = e.getIndexWithinParent() + 1); + } + t.set(n, i, r); +} +function eM(t, e) { + if (xe(e)) { + let n = e.getLastDescendant(); + xe(n) || Ze(n) ? f3(t, n) : f3(t, e); + } else f3(t, e); +} +function tM(t, e, n, i) { + let r = t.getNode(), s = r.getChildAtIndex(t.offset), o = rr(), a = Ws(r) ? kl().append(o) : o; + o.setFormat(n), o.setStyle(i), s === null ? r.append(a) : s.insertBefore(a), t.is(e) && e.set(o.__key, 0, "text"), t.set(o.__key, 0, "text"); +} +function fu(t, e, n, i) { + t.key = e, t.offset = n, t.type = i; +} +let RF = class jF { + constructor(e) { + this._cachedNodes = null, this._nodes = e, this.dirty = !1; + } + getCachedNodes() { + return this._cachedNodes; + } + setCachedNodes(e) { + this._cachedNodes = e; + } + is(e) { + if (!r1(e)) return !1; + let n = this._nodes, i = e._nodes; + return n.size === i.size && Array.from(n).every((r) => i.has(r)); + } + isCollapsed() { + return !1; + } + isBackward() { + return !1; + } + getStartEndPoints() { + return null; + } + add(e) { + this.dirty = !0, this._nodes.add(e), this._cachedNodes = null; + } + delete(e) { + this.dirty = !0, this._nodes.delete(e), this._cachedNodes = null; + } + clear() { + this.dirty = !0, this._nodes.clear(), this._cachedNodes = null; + } + has(e) { + return this._nodes.has(e); + } + clone() { + return new jF(new Set(this._nodes)); + } + extract() { + return this.getNodes(); + } + insertRawText() { + } + insertText() { + } + insertNodes(e) { + let n = this.getNodes(), i = n.length; + var r = n[i - 1]; + if (Ze(r)) r = r.select(); + else { + let s = r.getIndexWithinParent() + 1; + r = r.getParentOrThrow().select(s, s); + } + for (r.insertNodes(e), e = 0; e < i; e++) n[e].remove(); + } + getNodes() { + var e = this._cachedNodes; + if (e !== null) return e; + var n = this._nodes; + e = []; + for (let i of n) n = Tr(i), n !== null && e.push(n); + return Vh() || (this._cachedNodes = e), e; + } + getTextContent() { + let e = this.getNodes(), n = ""; + for (let i = 0; i < e.length; i++) n += e[i].getTextContent(); + return n; + } +}; +function xt(t) { + return t instanceof qh; +} +let qh = class FF { + constructor(e, n, i, r) { + this.anchor = e, this.focus = n, e._selection = this, n._selection = this, this._cachedNodes = null, this.format = i, this.style = r, this.dirty = !1; + } + getCachedNodes() { + return this._cachedNodes; + } + setCachedNodes(e) { + this._cachedNodes = e; + } + is(e) { + return xt(e) ? this.anchor.is(e.anchor) && this.focus.is(e.focus) && this.format === e.format && this.style === e.style : !1; + } + isCollapsed() { + return this.anchor.is(this.focus); + } + getNodes() { + var e = this._cachedNodes; + if (e !== null) return e; + e = this.anchor; + var n = this.focus, i = e.isBefore(n), r = i ? e : n; + i = i ? n : e, e = r.getNode(), n = i.getNode(); + let s = r.offset; + return r = i.offset, xe(e) && (i = e.getDescendantByIndex(s), e = i ?? e), xe(n) && (i = n.getDescendantByIndex(r), i !== null && i !== e && n.getChildAtIndex(r) === i && (i = i.getPreviousSibling()), n = i ?? n), e = e.is(n) ? xe(e) && 0 < e.getChildrenSize() ? [] : [e] : e.getNodesBetween(n), Vh() || (this._cachedNodes = e), e; + } + setTextNodeRange(e, n, i, r) { + fu(this.anchor, e.__key, n, "text"), fu(this.focus, i.__key, r, "text"), this._cachedNodes = null, this.dirty = !0; + } + getTextContent() { + let e = this.getNodes(); + if (e.length === 0) return ""; + let n = e[0], i = e[e.length - 1], r = this.anchor, s = this.focus, o = r.isBefore(s), [a, l] = s4(this), u = "", f = !0; + for (let d = 0; d < e.length; d++) { + let h = e[d]; + if (xe(h) && !h.isInline()) f || (u += ` +`), f = !h.isEmpty(); + else if (f = !1, Ze(h)) { + let m = h.getTextContent(); + h === n ? h === i ? (r.type !== "element" || s.type !== "element" || s.offset === r.offset) && (m = a < l ? m.slice(a, l) : m.slice(l, a)) : m = o ? m.slice(a) : m.slice(l) : h === i && (m = o ? m.slice(0, l) : m.slice(0, a)), u += m; + } else !ii(h) && !hf(h) || h === i && this.isCollapsed() || (u += h.getTextContent()); + } + return u; + } + applyDOMRange(e) { + let n = Ln(), i = n.getEditorState()._selection; + if (e = zF(e.startContainer, e.startOffset, e.endContainer, e.endOffset, n, i), e !== null) { + var [r, s] = e; + fu(this.anchor, r.key, r.offset, r.type), fu(this.focus, s.key, s.offset, s.type), this._cachedNodes = null; + } + } + clone() { + let e = this.anchor, n = this.focus; + return new FF(Ro(e.key, e.offset, e.type), Ro(n.key, n.offset, n.type), this.format, this.style); + } + toggleFormat(e) { + this.format = US(this.format, e, null), this.dirty = !0; + } + setStyle(e) { + this.style = e, this.dirty = !0; + } + hasFormat(e) { + return (this.format & Oh[e]) !== 0; + } + insertRawText(e) { + e = e.split(/(\r?\n|\t)/); + let n = [], i = e.length; + for (let r = 0; r < i; r++) { + let s = e[r]; + s === ` +` || s === `\r +` ? n.push(Sh()) : s === " " ? n.push(Rk()) : n.push(rr(s)); + } + this.insertNodes(n); + } + insertText(e) { + var n = this.anchor, i = this.focus, r = this.isCollapsed() || n.isBefore(i), s = this.format, o = this.style; + r && n.type === "element" ? tM(n, i, s, o) : r || i.type !== "element" || tM(i, n, s, o); + var a = this.getNodes(), l = a.length, u = r ? i : n; + i = (r ? n : i).offset; + var f = u.offset; + n = a[0], Ze(n) || Le(26), r = n.getTextContent().length; + var d = n.getParentOrThrow(), h = a[l - 1]; + if (this.isCollapsed() && i === r && (n.isSegmented() || n.isToken() || !n.canInsertTextAfter() || !d.canInsertTextAfter() && n.getNextSibling() === null)) { + var m = n.getNextSibling(); + if (Ze(m) && m.canInsertTextBefore() && !QS(m) || (m = rr(), m.setFormat(s), d.canInsertTextAfter() ? n.insertAfter(m) : d.insertAfter(m)), m.select(0, 0), n = m, e !== "") { + this.insertText(e); + return; + } + } else if (this.isCollapsed() && i === 0 && (n.isSegmented() || n.isToken() || !n.canInsertTextBefore() || !d.canInsertTextBefore() && n.getPreviousSibling() === null)) { + if (m = n.getPreviousSibling(), (!Ze(m) || QS(m)) && (m = rr(), m.setFormat(s), d.canInsertTextBefore() ? n.insertBefore(m) : d.insertBefore(m)), m.select(), n = m, e !== "") { + this.insertText(e); + return; + } + } else if (n.isSegmented() && i !== r) d = rr(n.getTextContent()), d.setFormat(s), n.replace(d), n = d; + else if (!(this.isCollapsed() || e === "" || (m = h.getParent(), d.canInsertTextBefore() && d.canInsertTextAfter() && (!xe(m) || m.canInsertTextBefore() && m.canInsertTextAfter())))) { + this.insertText(""), BF(this.anchor, this.focus, null), this.insertText(e); + return; + } + if (l === 1) if (n.isToken()) e = rr(e), e.select(), n.replace(e); + else { + if (a = n.getFormat(), l = n.getStyle(), i === f && (a !== s || l !== o)) if (n.getTextContent() === "") n.setFormat(s), n.setStyle(o); + else { + a = rr(e), a.setFormat(s), a.setStyle(o), a.select(), i === 0 ? n.insertBefore(a, !1) : ([l] = n.splitText(i), l.insertAfter(a, !1)), a.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length); + return; + } + else if (LF(n)) { + e = rr(e), e.setFormat(s), e.setStyle(o), e.select(), n.replace(e); + return; + } + n = n.spliceText(i, f - i, e, !0), n.getTextContent() === "" ? n.remove() : this.anchor.type === "text" && (n.isComposing() ? this.anchor.offset -= e.length : (this.format = a, this.style = l)); + } + else { + if (s = /* @__PURE__ */ new Set([...n.getParentKeys(), ...h.getParentKeys()]), m = xe(n) ? n : n.getParentOrThrow(), o = xe(h) ? h : h.getParentOrThrow(), d = h, !m.is(o) && o.isInline()) + do + d = o, o = o.getParentOrThrow(); + while (o.isInline()); + if (u.type === "text" && (f !== 0 || h.getTextContent() === "") || u.type === "element" && h.getIndexWithinParent() < f) if (Ze(h) && !h.isToken() && f !== h.getTextContentSize()) { + if (h.isSegmented()) { + var g = rr(h.getTextContent()); + h.replace(g), h = g; + } + Ws(u.getNode()) || u.type !== "text" || (h = h.spliceText(0, f, "")), s.add(h.__key); + } else u = h.getParentOrThrow(), u.canBeEmpty() || u.getChildrenSize() !== 1 ? h.remove() : u.remove(); + else s.add(h.__key); + for (u = o.getChildren(), f = new Set(a), h = m.is(o), m = m.isInline() && n.getNextSibling() === null ? m : n, g = u.length - 1; 0 <= g; g--) { + let w = u[g]; + if (w.is(n) || xe(w) && w.isParentOf(n)) break; + w.isAttached() && (!f.has(w) || w.is(d) ? h || m.insertAfter(w, !1) : w.remove()); + } + if (!h) for (u = o, o = null; u !== null; ) + f = u.getChildren(), h = f.length, (h === 0 || f[h - 1].is(o)) && (s.delete(u.__key), o = u), u = u.getParent(); + for (n.isToken() ? i === r ? n.select() : (e = rr(e), e.select(), n.replace(e)) : (n = n.spliceText(i, r - i, e, !0), n.getTextContent() === "" ? n.remove() : n.isComposing() && this.anchor.type === "text" && (this.anchor.offset -= e.length)), e = 1; e < l; e++) n = a[e], s.has(n.__key) || n.remove(); + } + } + removeText() { + this.insertText(""); + } + formatText(e) { + if (this.isCollapsed()) this.toggleFormat(e), Pi(null); + else { + var n = this.getNodes(), i = []; + for (var r of n) Ze(r) && i.push(r); + var s = i.length; + if (s === 0) this.toggleFormat(e), Pi(null); + else { + r = this.anchor; + var o = this.focus, a = this.isBackward(); + n = a ? o : r, r = a ? r : o; + var l = 0, u = i[0]; + if (o = n.type === "element" ? 0 : n.offset, n.type === "text" && o === u.getTextContentSize() && (l = 1, u = i[1], o = 0), u != null) { + a = u.getFormatFlags(e, null); + var f = s - 1, d = i[f]; + if (s = r.type === "text" ? r.offset : d.getTextContentSize(), u.is(d)) o !== s && (o === 0 && s === u.getTextContentSize() ? u.setFormat(a) : (e = u.splitText(o, s), e = o === 0 ? e[0] : e[1], e.setFormat(a), n.type === "text" && n.set(e.__key, 0, "text"), r.type === "text" && r.set(e.__key, s - o, "text")), this.format = a); + else { + o !== 0 && ([, u] = u.splitText(o), o = 0), u.setFormat(a); + var h = d.getFormatFlags(e, a); + for (0 < s && (s !== d.getTextContentSize() && ([d] = d.splitText(s)), d.setFormat(h)), l += 1; l < f; l++) { + let m = i[l]; + if (!m.isToken()) { + let g = m.getFormatFlags(e, h); + m.setFormat(g); + } + } + n.type === "text" && n.set(u.__key, o, "text"), r.type === "text" && r.set(d.__key, s, "text"), this.format = a | h; + } + } + } + } + } + insertNodes(e) { + if (e.length !== 0) { + if (this.anchor.key === "root") { + this.insertParagraph(); + var n = pn(); + return xt(n) || Le(134), n.insertNodes(e); + } + n = this.isBackward() ? this.focus : this.anchor; + var i = s3(n.getNode(), jd); + if (n = e[e.length - 1], "__language" in i && xe(i)) if ("__language" in e[0]) this.insertText(e[0].getTextContent()); + else { + var r = d3(this); + i.splice(r, 0, e), n.selectEnd(); + } + else if (e.some((a) => (xe(a) || ii(a)) && !a.isInline())) { + n = uie(e), e = n.getLastDescendant(); + var s = n.getChildren(); + n = xe(i) && i.isEmpty() ? null : this.insertParagraph(), r = s[s.length - 1]; + var o = s[0]; + ((a) => xe(a) && jd(a) && !a.isEmpty() && xe(i) && (!i.isEmpty() || "__value" in i && "__checked" in i))(o) && (xe(i) || Le(135), i.append(...o.getChildren()), o = s[1]), o && Kne(i, o), s = s3(e, jd), n && xe(s) && ("__value" in n && "__checked" in n || jd(r)) && (s.append(...n.getChildren()), n.remove()), xe(i) && i.isEmpty() && i.remove(), e.selectEnd(), e = xe(i) ? i.getLastChild() : null, hf(e) && s !== i && e.remove(); + } else xe(i) || Le(135), r = d3(this), i.splice(r, 0, e), n.selectEnd(); + } + } + insertParagraph() { + if (this.anchor.key === "root") { + var e = kl(); + return Zs().splice(this.anchor.offset, 0, [e]), e.select(), e; + } + var n = d3(this); + return e = s3(this.anchor.getNode(), jd), xe(e) || Le(136), n = (n = e.getChildAtIndex(n)) ? [n, ...n.getNextSiblings()] : [], (e = e.insertNewAfter(this, !1)) ? (e.append(...n), e.selectStart(), e) : null; + } + insertLineBreak(e) { + var n = Sh(); + this.insertNodes([n]), e && (e = n.getParentOrThrow(), n = n.getIndexWithinParent(), e.select(n, n)); + } + extract() { + var e = this.getNodes(), n = e.length, i = n - 1, r = this.anchor; + let s = this.focus; + var o = e[0]; + let a = e[i], [l, u] = s4(this); + return n === 0 ? [] : n === 1 ? Ze(o) && !this.isCollapsed() ? (e = l > u ? u : l, i = o.splitText(e, l > u ? l : u), e = e === 0 ? i[0] : i[1], e != null ? [e] : []) : [o] : (n = r.isBefore(s), Ze(o) && (r = n ? l : u, r === o.getTextContentSize() ? e.shift() : r !== 0 && ([, o] = o.splitText(r), e[0] = o)), Ze(a) && (o = a.getTextContent().length, n = n ? u : l, n === 0 ? e.pop() : n !== o && ([a] = a.splitText(n), e[i] = a)), e); + } + modify(e, n, i) { + var r = this.focus, s = this.anchor, o = e === "move", a = ZS(r, n); + if (ii(a) && !a.isIsolated()) o && a.isKeyboardSelectable() ? (n = o4(), n.add(a.__key), $a(n)) : (e = n ? a.getPreviousSibling() : a.getNextSibling(), Ze(e) ? (a = e.__key, n = n ? e.getTextContent().length : 0, r.set(a, n, "text"), o && s.set(a, n, "text")) : (i = a.getParentOrThrow(), xe(e) ? (i = e.__key, a = n ? e.getChildrenSize() : 0) : (a = a.getIndexWithinParent(), i = i.__key, n || a++), r.set(i, a, "element"), o && s.set(i, a, "element"))); + else if (s = Ln(), r = La(s._window)) { + var l = s._blockCursorElement, u = s._rootElement; + if (u === null || l === null || !xe(a) || a.isInline() || a.canBeEmpty() || qS(l, s, u), r.modify(e, n ? "backward" : "forward", i), 0 < r.rangeCount && (a = r.getRangeAt(0), s = this.anchor.getNode(), s = Ws(s) ? s : yF(s), this.applyDOMRange(a), this.dirty = !0, !o)) { + for (o = this.getNodes(), e = [], i = !1, l = 0; l < o.length; l++) u = o[l], Yy(u, s) ? e.push(u) : i = !0; + i && 0 < e.length && (n ? (n = e[0], xe(n) ? n.selectStart() : n.getParentOrThrow().selectStart()) : (n = e[e.length - 1], xe(n) ? n.selectEnd() : n.getParentOrThrow().selectEnd())), (r.anchorNode !== a.startContainer || r.anchorOffset !== a.startOffset) && (n = this.focus, o = this.anchor, r = o.key, a = o.offset, s = o.type, fu(o, n.key, n.offset, n.type), fu(n, r, a, s), this._cachedNodes = null); + } + } + } + deleteCharacter(e) { + let n = this.isCollapsed(); + if (this.isCollapsed()) { + var i = this.anchor, r = this.focus, s = i.getNode(); + if (!e && (i.type === "element" && xe(s) && i.offset === s.getChildrenSize() || i.type === "text" && i.offset === s.getTextContentSize())) { + var o = s.getParent(); + if (o = s.getNextSibling() || (o === null ? null : o.getNextSibling()), xe(o) && o.isShadowRoot()) return; + } + if (o = ZS(r, e), ii(o) && !o.isIsolated()) { + o.isKeyboardSelectable() && xe(s) && s.getChildrenSize() === 0 ? (s.remove(), e = o4(), e.add(o.__key), $a(e)) : (o.remove(), Ln().dispatchCommand(Tk, void 0)); + return; + } + if (!e && xe(o) && xe(s) && s.isEmpty()) { + s.remove(), o.selectStart(); + return; + } + if (this.modify("extend", e, "character"), this.isCollapsed()) { + if (e && i.offset === 0 && (i.type === "element" ? i.getNode() : i.getNode().getParentOrThrow()).collapseAtStart(this)) return; + } else { + if (o = r.type === "text" ? r.getNode() : null, s = i.type === "text" ? i.getNode() : null, o !== null && o.isSegmented()) { + if (i = r.offset, r = o.getTextContentSize(), o.is(s) || e && i !== r || !e && i !== 0) { + iM(o, e, i); + return; + } + } else if (s !== null && s.isSegmented() && (i = i.offset, r = s.getTextContentSize(), s.is(o) || e && i !== 0 || !e && i !== r)) { + iM(s, e, i); + return; + } + if (s = this.anchor, o = this.focus, i = s.getNode(), r = o.getNode(), i === r && s.type === "text" && o.type === "text") { + var a = s.offset, l = o.offset; + let u = a < l; + r = u ? a : l, l = u ? l : a, a = l - 1, r !== a && (i = i.getTextContent().slice(r, l), gF(i) || (e ? o.offset = a : s.offset = a)); + } + } + } + this.removeText(), e && !n && this.isCollapsed() && this.anchor.type === "element" && this.anchor.offset === 0 && (e = this.anchor.getNode(), e.isEmpty() && Ws(e.getParent()) && e.getIndexWithinParent() === 0 && e.collapseAtStart(this)); + } + deleteLine(e) { + this.isCollapsed() && (this.anchor.type === "text" && this.modify("extend", e, "lineboundary"), (e ? this.focus : this.anchor).offset === 0 && this.modify("extend", e, "character")), this.removeText(); + } + deleteWord(e) { + this.isCollapsed() && this.modify("extend", e, "word"), this.removeText(); + } + isBackward() { + return this.focus.isBefore(this.anchor); + } + getStartEndPoints() { + return [this.anchor, this.focus]; + } +}; +function r1(t) { + return t instanceof RF; +} +function nM(t) { + let e = t.offset; + return t.type === "text" ? e : (t = t.getNode(), e === t.getChildrenSize() ? t.getTextContent().length : 0); +} +function s4(t) { + if (t = t.getStartEndPoints(), t === null) return [0, 0]; + let [e, n] = t; + return e.type === "element" && n.type === "element" && e.key === n.key && e.offset === n.offset ? [0, 0] : [nM(e), nM(n)]; +} +function iM(t, e, n) { + let i = t.getTextContent().split(/(?=\s)/g), r = i.length, s = 0, o = 0; + for (let a = 0; a < r; a++) { + let l = i[a], u = a === r - 1; + if (o = s, s += l.length, e && s === n || s > n || u) { + i.splice(a, 1), u && (o = void 0); + break; + } + } + e = i.join("").trim(), e === "" ? t.remove() : (t.setTextContent(e), t.select(o, o)); +} +function rM(t, e, n, i) { + var r = e; + if (t.nodeType === 1) { + let a = !1; + var s = t.childNodes, o = s.length; + r === o && (a = !0, r = o - 1); + let l = s[r]; + if (o = !1, l === i._blockCursorElement ? (l = s[r + 1], o = !0) : i._blockCursorElement !== null && r--, i = Xd(l), Ze(i)) r = a ? i.getTextContentSize() : 0; + else { + if (s = Xd(t), s === null) return null; + if (xe(s) ? (t = s.getChildAtIndex(r), (e = xe(t)) && (e = t.getParent(), e = n === null || e === null || !e.canBeEmpty() || e !== n.getNode()), e && (n = a ? t.getLastDescendant() : t.getFirstDescendant(), n === null ? (s = t, r = 0) : (t = n, s = xe(t) ? t : t.getParentOrThrow())), Ze(t) ? (i = t, s = null, r = a ? t.getTextContentSize() : 0) : t !== s && a && !o && r++) : (r = s.getIndexWithinParent(), r = e === 0 && ii(s) && Xd(t) === s ? r : r + 1, s = s.getParentOrThrow()), xe(s)) return Ro(s.__key, r, "element"); + } + } else i = Xd(t); + return Ze(i) ? Ro(i.__key, r, "text") : null; +} +function sM(t, e, n) { + var i = t.offset, r = t.getNode(); + i === 0 ? (i = r.getPreviousSibling(), r = r.getParent(), e ? (n || !e) && i === null && xe(r) && r.isInline() && (e = r.getPreviousSibling(), Ze(e) && (t.key = e.__key, t.offset = e.getTextContent().length)) : xe(i) && !n && i.isInline() ? (t.key = i.__key, t.offset = i.getChildrenSize(), t.type = "element") : Ze(i) && (t.key = i.__key, t.offset = i.getTextContent().length)) : i === r.getTextContent().length && (i = r.getNextSibling(), r = r.getParent(), e && xe(i) && i.isInline() ? (t.key = i.__key, t.offset = 0, t.type = "element") : (n || e) && i === null && xe(r) && r.isInline() && !r.canInsertTextAfter() && (e = r.getNextSibling(), Ze(e) && (t.key = e.__key, t.offset = 0))); +} +function BF(t, e, n) { + if (t.type === "text" && e.type === "text") { + var i = t.isBefore(e); + let r = t.is(e); + sM(t, i, r), sM(e, !i, r), r && (e.key = t.key, e.offset = t.offset, e.type = t.type), i = Ln(), i.isComposing() && i._compositionKey !== t.key && xt(n) && (i = n.anchor, n = n.focus, fu(t, i.key, i.offset, i.type), fu(e, n.key, n.offset, n.type)); + } +} +function zF(t, e, n, i, r, s) { + return t === null || n === null || !t1(r, t, n) || (e = rM(t, e, xt(s) ? s.anchor : null, r), e === null) || (i = rM(n, i, xt(s) ? s.focus : null, r), i === null || e.type === "element" && i.type === "element" && (t = Xd(t), n = Xd(n), ii(t) && ii(n))) ? null : (BF(e, i, s), [e, i]); +} +function WF(t, e, n, i, r, s) { + let o = Ra(); + return t = new qh(Ro(t, e, r), Ro(n, i, s), 0, ""), t.dirty = !0, o._selection = t; +} +function o4() { + return new RF(/* @__PURE__ */ new Set()); +} +function oie(t) { + let e = t.getEditorState()._selection, n = La(t._window); + return xt(e) || e == null ? u5(e, n, t, null) : e.clone(); +} +function u5(t, e, n, i) { + var r = n._window; + if (r === null) return null; + var s = (r = i || r.event) ? r.type : void 0; + i = s === "selectionchange", r = !HS && (i || s === "beforeinput" || s === "compositionstart" || s === "compositionend" || s === "click" && r && r.detail === 3 || s === "drop" || s === void 0); + let o; + if (!xt(t) || r) { + if (e === null) return null; + if (r = e.anchorNode, s = e.focusNode, o = e.anchorOffset, e = e.focusOffset, i && xt(t) && !t1(n, r, s)) return t.clone(); + } else return t.clone(); + if (n = zF(r, o, s, e, n, t), n === null) return null; + let [a, l] = n; + return new qh(a, l, xt(t) ? t.format : 0, xt(t) ? t.style : ""); +} +function pn() { + return Ra()._selection; +} +function Yh() { + return Ln()._editorState._selection; +} +function Xy(t, e, n, i = 1) { + var r = t.anchor, s = t.focus, o = r.getNode(), a = s.getNode(); + if (e.is(o) || e.is(a)) { + if (o = e.__key, t.isCollapsed()) + e = r.offset, (n <= e && 0 < i || n < e && 0 > i) && (n = Math.max(0, e + i), r.set(o, n, "element"), s.set(o, n, "element"), oM(t)); + else { + let u = t.isBackward(); + a = u ? s : r; + var l = a.getNode(); + r = u ? r : s, s = r.getNode(), e.is(l) && (l = a.offset, (n <= l && 0 < i || n < l && 0 > i) && a.set(o, Math.max(0, l + i), "element")), e.is(s) && (e = r.offset, (n <= e && 0 < i || n < e && 0 > i) && r.set(o, Math.max(0, e + i), "element")); + } + oM(t); + } +} +function oM(t) { + var e = t.anchor, n = e.offset; + let i = t.focus; + var r = i.offset, s = e.getNode(), o = i.getNode(); + if (t.isCollapsed()) xe(s) && (o = s.getChildrenSize(), o = (r = n >= o) ? s.getChildAtIndex(o - 1) : s.getChildAtIndex(n), Ze(o) && (n = 0, r && (n = o.getTextContentSize()), e.set(o.__key, n, "text"), i.set(o.__key, n, "text"))); + else { + if (xe(s)) { + let a = s.getChildrenSize(); + n = (t = n >= a) ? s.getChildAtIndex(a - 1) : s.getChildAtIndex(n), Ze(n) && (s = 0, t && (s = n.getTextContentSize()), e.set(n.__key, s, "text")); + } + xe(o) && (n = o.getChildrenSize(), r = (e = r >= n) ? o.getChildAtIndex(n - 1) : o.getChildAtIndex(r), Ze(r) && (o = 0, e && (o = r.getTextContentSize()), i.set(r.__key, o, "text"))); + } +} +function aie(t, e) { + if (e = e.getEditorState()._selection, t = t._selection, xt(t)) { + var n = t.anchor; + let i = t.focus, r; + n.type === "text" && (r = n.getNode(), r.selectionTransform(e, t)), i.type === "text" && (n = i.getNode(), r !== n && n.selectionTransform(e, t)); + } +} +function Gy(t, e, n, i, r) { + let s = null, o = 0, a = null; + i !== null ? (s = i.__key, Ze(i) ? (o = i.getTextContentSize(), a = "text") : xe(i) && (o = i.getChildrenSize(), a = "element")) : r !== null && (s = r.__key, Ze(r) ? a = "text" : xe(r) && (a = "element")), s !== null && a !== null ? t.set(s, o, a) : (o = e.getIndexWithinParent(), o === -1 && (o = n.getChildrenSize()), t.set(n.__key, o, "element")); +} +function aM(t, e, n, i, r) { + t.type === "text" ? (t.key = n, e || (t.offset += r)) : t.offset > i.getIndexWithinParent() && --t.offset; +} +function d3(t) { + t.isCollapsed() || t.removeText(); + var e = t.anchor; + for (t = e.getNode(), e = e.offset; !jd(t); ) [t, e] = lie(t, e); + return e; +} +function lie(t, e) { + var n = t.getParent(); + if (!n) return n = kl(), Zs().append(n), n.select(), [Zs(), 0]; + if (Ze(t)) { + var i = t.splitText(e); + return i.length === 0 ? [n, t.getIndexWithinParent()] : (t = e === 0 ? 0 : 1, t = i[0].getIndexWithinParent() + t, [n, t]); + } + return !xe(t) || e === 0 ? [n, t.getIndexWithinParent()] : ((i = t.getChildAtIndex(e)) && (e = new qh(Ro(t.__key, e, "element"), Ro(t.__key, e, "element"), 0, ""), (e = t.insertNewAfter(e)) && e.append(i, ...i.getNextSiblings())), [n, t.getIndexWithinParent() + 1]); +} +function uie(t) { + let e = kl(), n = null; + for (let i = 0; i < t.length; i++) { + let r = t[i], s = hf(r); + if (s || ii(r) && r.isInline() || xe(r) && r.isInline() || Ze(r) || r.isParentRequired()) { + if (n === null && (n = r.createParentElementNode(), e.append(n), s)) continue; + n !== null && n.append(r); + } else e.append(r), n = null; + } + return e; +} +let Qi = null, Ui = null, ws = !1, h3 = !1, Gg = 0, lM = { characterData: !0, childList: !0, subtree: !0 }; +function Vh() { + return ws || Qi !== null && Qi._readOnly; +} +function qr() { + ws && Le(13); +} +function Ra() { + return Qi === null && Le(15), Qi; +} +function Ln() { + return Ui === null && Le(16), Ui; +} +function uM(t, e, n) { + var i = e.__type; + let r = t._nodes.get(i); + for (r === void 0 && Le(30, i), t = n.get(i), t === void 0 && (t = Array.from(r.transforms), n.set(i, t)), n = t.length, i = 0; i < n && (t[i](e), e.isAttached()); i++) ; +} +function cie(t, e) { + e = e._dirtyLeaves, t = t._nodeMap; + for (let n of e) e = t.get(n), Ze(e) && e.isAttached() && e.isSimpleText() && !e.isUnmergeable() && fF(e); +} +function fie(t, e) { + let n = e._dirtyLeaves, i = e._dirtyElements; + t = t._nodeMap; + let r = xu(), s = /* @__PURE__ */ new Map(); + var o = n; + let a = o.size; + for (var l = i, u = l.size; 0 < a || 0 < u; ) { + if (0 < a) { + e._dirtyLeaves = /* @__PURE__ */ new Set(); + for (let f of o) o = t.get(f), Ze(o) && o.isAttached() && o.isSimpleText() && !o.isUnmergeable() && fF(o), o !== void 0 && o !== void 0 && o.__key !== r && o.isAttached() && uM(e, o, s), n.add(f); + if (o = e._dirtyLeaves, a = o.size, 0 < a) { + Gg++; + continue; + } + } + e._dirtyLeaves = /* @__PURE__ */ new Set(), e._dirtyElements = /* @__PURE__ */ new Map(); + for (let f of l) l = f[0], u = f[1], (l === "root" || u) && (o = t.get(l), o !== void 0 && o !== void 0 && o.__key !== r && o.isAttached() && uM(e, o, s), i.set(l, u)); + o = e._dirtyLeaves, a = o.size, l = e._dirtyElements, u = l.size, Gg++; + } + e._dirtyLeaves = n, e._dirtyElements = i; +} +function c5(t, e) { + var n = t.type, i = e.get(n); + if (i === void 0 && Le(17, n), n = i.klass, t.type !== n.getType() && Le(18, n.name), n = n.importJSON(t), t = t.children, xe(n) && Array.isArray(t)) for (i = 0; i < t.length; i++) { + let r = c5(t[i], e); + n.append(r); + } + return n; +} +function cM(t, e) { + let n = Qi, i = ws, r = Ui; + Qi = t, ws = !0, Ui = null; + try { + return e(); + } finally { + Qi = n, ws = i, Ui = r; + } +} +function af(t, e) { + let n = t._pendingEditorState, i = t._rootElement, r = t._headless || i === null; + if (n !== null) { + var s = t._editorState, o = s._selection, a = n._selection, l = t._dirtyType !== 0, u = Qi, f = ws, d = Ui, h = t._updating, m = t._observer, g = null; + if (t._pendingEditorState = null, t._editorState = n, !r && l && m !== null) { + Ui = t, Qi = n, ws = !1, t._updating = !0; + try { + let He = t._dirtyType, Ct = t._dirtyElements, Lt = t._dirtyLeaves; + m.disconnect(); + var w = He, x = Ct, _ = Lt; + Zr = dl = Ni = "", xF = w === 2, Kb = null, Ar = t, Hu = t._config, Yg = t._nodes, Pk = Ar._listeners.mutation, YS = x, VS = _, df = s._nodeMap, Qu = n._nodeMap, l5 = n._readOnly, XS = new Map(t._keyToDOMMap); + let Be = /* @__PURE__ */ new Map(); + Vg = Be, Xm("root", null), Vg = XS = Hu = Qu = df = VS = YS = Yg = Ar = void 0, g = Be; + } catch (He) { + if (He instanceof Error && t._onError(He), h3) throw He; + ZF(t, null, i, n), cF(t), t._dirtyType = 2, h3 = !0, af(t, s), h3 = !1; + return; + } finally { + m.observe(i, lM), t._updating = h, Qi = u, ws = f, Ui = d; + } + } + n._readOnly || (n._readOnly = !0); + var S = t._dirtyLeaves, C = t._dirtyElements, E = t._normalizedNodes, M = t._updateTags, $ = t._deferred; + l && (t._dirtyType = 0, t._cloneNotNeeded.clear(), t._dirtyLeaves = /* @__PURE__ */ new Set(), t._dirtyElements = /* @__PURE__ */ new Map(), t._normalizedNodes = /* @__PURE__ */ new Set(), t._updateTags = /* @__PURE__ */ new Set()); + var P = t._decorators, W = t._pendingDecorators || P, z = n._nodeMap, Z; + for (Z in W) z.has(Z) || (W === P && (W = mF(t)), delete W[Z]); + var L = r ? null : La(t._window); + if (t._editable && L !== null && (l || a === null || a.dirty)) { + Ui = t, Qi = n; + try { + if (m !== null && m.disconnect(), l || a === null || a.dirty) { + let He = t._blockCursorElement; + He !== null && qS(He, t, i); + e: { + let Ct = L.anchorNode, Lt = L.focusNode, Be = L.anchorOffset, Ie = L.focusOffset, ae = document.activeElement; + if (!(M.has("collaboration") && ae !== i || ae !== null && n5(ae))) if (xt(a)) { + var Q = a.anchor, V = a.focus, H = Q.key, R = V.key, q = qy(t, H), Y = qy(t, R), K = Q.offset, te = V.offset, se = a.format, ce = a.style, U = a.isCollapsed(), F = q, oe = Y, le = !1; + if (Q.type === "text") { + F = Qy(q); + let Ue = Q.getNode(); + le = Ue.getFormat() !== se || Ue.getStyle() !== ce; + } else xt(o) && o.anchor.type === "text" && (le = !0); + if (V.type === "text" && (oe = Qy(Y)), F !== null && oe !== null) { + if (U && (o === null || le || xt(o) && (o.format !== se || o.style !== ce))) { + var pe = performance.now(); + MF = [se, ce, K, H, pe]; + } + if (Be === K && Ie === te && Ct === F && Lt === oe && (L.type !== "Range" || !U) && (ae !== null && i.contains(ae) || i.focus({ preventScroll: !0 }), Q.type !== "element")) break e; + try { + L.setBaseAndExtent(F, K, oe, te); + } catch { + } + if (!M.has("skip-scroll-into-view") && a.isCollapsed() && i !== null && i === document.activeElement) { + let Ue = a instanceof qh && a.anchor.type === "element" ? F.childNodes[K] || null : 0 < L.rangeCount ? L.getRangeAt(0) : null; + if (Ue !== null) { + let qt; + if (Ue instanceof Text) { + let vn = document.createRange(); + vn.selectNode(Ue), qt = vn.getBoundingClientRect(); + } else qt = Ue.getBoundingClientRect(); + let Xn = i.ownerDocument, Dt = Xn.defaultView; + if (Dt !== null) for (var { top: Re, bottom: ze } = qt, rt, pt, ge = i; ge !== null; ) { + let vn = ge === Xn.body; + if (vn) rt = 0, pt = Ak(t).innerHeight; + else { + let Za = ge.getBoundingClientRect(); + rt = Za.top, pt = Za.bottom; + } + let Os = 0; + if (Re < rt ? Os = -(rt - Re) : ze > pt && (Os = ze - pt), Os !== 0) if (vn) Dt.scrollBy(0, Os); + else { + let Za = ge.scrollTop; + ge.scrollTop += Os; + let qa = ge.scrollTop - Za; + Re -= qa, ze -= qa; + } + if (vn) break; + ge = Nk(ge); + } + } + } + t4 = !0; + } + } else o !== null && t1(t, Ct, Lt) && L.removeAllRanges(); + } + } + e: { + let He = t._blockCursorElement; + if (xt(a) && a.isCollapsed() && a.anchor.type === "element" && i.contains(document.activeElement)) { + let Ct = a.anchor, Lt = Ct.getNode(), Be = Ct.offset, Ie = Lt.getChildrenSize(), ae = !1, Ue = null; + if (Be === Ie) { + let qt = Lt.getChildAtIndex(Be - 1); + r3(qt) && (ae = !0); + } else { + let qt = Lt.getChildAtIndex(Be); + if (r3(qt)) { + let Xn = qt.getPreviousSibling(); + (Xn === null || r3(Xn)) && (ae = !0, Ue = t.getElementByKey(qt.__key)); + } + } + if (ae) { + let qt = t.getElementByKey(Lt.__key); + if (He === null) { + let Xn = t._config.theme, Dt = document.createElement("div"); + Dt.contentEditable = "false", Dt.setAttribute("data-lexical-cursor", "true"); + let vn = Xn.blockCursor; + if (vn !== void 0) { + if (typeof vn == "string") { + let Os = vn.split(" "); + vn = Xn.blockCursor = Os; + } + vn !== void 0 && Dt.classList.add(...vn); + } + t._blockCursorElement = He = Dt; + } + i.style.caretColor = "transparent", Ue === null ? qt.appendChild(He) : qt.insertBefore(He, Ue); + break e; + } + } + He !== null && qS(He, t, i); + } + m !== null && m.observe(i, lM); + } finally { + Ui = d, Qi = u; + } + } + if (g !== null) { + var De = g; + let He = Array.from(t._listeners.mutation), Ct = He.length; + for (let Lt = 0; Lt < Ct; Lt++) { + let [Be, Ie] = He[Lt], ae = De.get(Ie); + ae !== void 0 && Be(ae, { dirtyLeaves: S, prevEditorState: s, updateTags: M }); + } + } + xt(a) || a === null || o !== null && o.is(a) || t.dispatchCommand(Tk, void 0); + var st = t._pendingDecorators; + st !== null && (t._decorators = st, t._pendingDecorators = null, _g("decorator", t, !0, st)); + var It = Z$(e || s), At = Z$(n); + if (It !== At && _g("textcontent", t, !0, At), _g("update", t, !0, { dirtyElements: C, dirtyLeaves: S, editorState: n, normalizedNodes: E, prevEditorState: e || s, tags: M }), t._deferred = [], $.length !== 0) { + let He = t._updating; + t._updating = !0; + try { + for (let Ct = 0; Ct < $.length; Ct++) $[Ct](); + } finally { + t._updating = He; + } + } + var Ut = t._updates; + if (Ut.length !== 0) { + let He = Ut.shift(); + if (He) { + let [Ct, Lt] = He; + HF(t, Ct, Lt); + } + } + } +} +function _g(t, e, n, ...i) { + let r = e._updating; + e._updating = n; + try { + let s = Array.from(e._listeners[t]); + for (t = 0; t < s.length; t++) s[t].apply(null, i); + } finally { + e._updating = r; + } +} +function Pe(t, e, n) { + if (t._updating === !1 || Ui !== t) { + let s = !1; + return t.update(() => { + s = Pe(t, e, n); + }), s; + } + let i = r5(t); + for (let s = 4; 0 <= s; s--) for (let o = 0; o < i.length; o++) { + var r = i[o]._commands.get(e); + if (r !== void 0 && (r = r[s], r !== void 0)) { + r = Array.from(r); + let a = r.length; + for (let l = 0; l < a; l++) if (r[l](n, t) === !0) return !0; + } + } + return !1; +} +function fM(t, e) { + let n = t._updates; + for (e = e || !1; n.length !== 0; ) { + var i = n.shift(); + if (i) { + let [r, s] = i, o; + s !== void 0 && (i = s.onUpdate, o = s.tag, s.skipTransforms && (e = !0), i && t._deferred.push(i), o && t._updateTags.add(o)), r(); + } + } + return e; +} +function HF(t, e, n) { + let i = t._updateTags; + var r, s = r = !1; + if (n !== void 0) { + var o = n.onUpdate; + r = n.tag, r != null && i.add(r), r = n.skipTransforms || !1, s = n.discrete || !1; + } + o && t._deferred.push(o), n = t._editorState, o = t._pendingEditorState; + let a = !1; + (o === null || o._readOnly) && (o = t._pendingEditorState = new Fk(new Map((o || n)._nodeMap)), a = !0), o._flushSync = s, s = Qi; + let l = ws, u = Ui, f = t._updating; + Qi = o, ws = !1, t._updating = !0, Ui = t; + try { + a && (t._headless ? n._selection !== null && (o._selection = n._selection.clone()) : o._selection = oie(t)); + let d = t._compositionKey; + e(), r = fM(t, r), aie(o, t), t._dirtyType !== 0 && (r ? cie(o, t) : fie(o, t), fM(t), Wne(n, o, t._dirtyLeaves, t._dirtyElements)), d !== t._compositionKey && (o._flushSync = !0); + let h = o._selection; + if (xt(h)) { + let m = o._nodeMap, g = h.focus.key; + m.get(h.anchor.key) !== void 0 && m.get(g) !== void 0 || Le(19); + } else r1(h) && h._nodes.size === 0 && (o._selection = null); + } catch (d) { + d instanceof Error && t._onError(d), t._pendingEditorState = n, t._dirtyType = 2, t._cloneNotNeeded.clear(), t._dirtyLeaves = /* @__PURE__ */ new Set(), t._dirtyElements.clear(), af(t); + return; + } finally { + Qi = s, ws = l, Ui = u, t._updating = f, Gg = 0; + } + t._dirtyType !== 0 || die(o, t) ? o._flushSync ? (o._flushSync = !1, af(t)) : a && Fne(() => { + af(t); + }) : (o._flushSync = !1, a && (i.clear(), t._deferred = [], t._pendingEditorState = null)); +} +function qs(t, e, n) { + t._updating ? t._updates.push([e, n]) : HF(t, e, n); +} +class QF extends Ik { + constructor(e) { + super(e); + } + decorate() { + Le(47); + } + isIsolated() { + return !1; + } + isInline() { + return !0; + } + isKeyboardSelectable() { + return !0; + } +} +function ii(t) { + return t instanceof QF; +} +class jk extends Ik { + constructor(e) { + super(e), this.__last = this.__first = null, this.__indent = this.__format = this.__size = 0, this.__dir = null; + } + getFormat() { + return this.getLatest().__format; + } + getFormatType() { + let e = this.getFormat(); + return Dne[e] || ""; + } + getIndent() { + return this.getLatest().__indent; + } + getChildren() { + let e = [], n = this.getFirstChild(); + for (; n !== null; ) e.push(n), n = n.getNextSibling(); + return e; + } + getChildrenKeys() { + let e = [], n = this.getFirstChild(); + for (; n !== null; ) e.push(n.__key), n = n.getNextSibling(); + return e; + } + getChildrenSize() { + return this.getLatest().__size; + } + isEmpty() { + return this.getChildrenSize() === 0; + } + isDirty() { + let e = Ln()._dirtyElements; + return e !== null && e.has(this.__key); + } + isLastChild() { + let e = this.getLatest(), n = this.getParentOrThrow().getLastChild(); + return n !== null && n.is(e); + } + getAllTextNodes() { + let e = [], n = this.getFirstChild(); + for (; n !== null; ) { + if (Ze(n) && e.push(n), xe(n)) { + let i = n.getAllTextNodes(); + e.push(...i); + } + n = n.getNextSibling(); + } + return e; + } + getFirstDescendant() { + let e = this.getFirstChild(); + for (; e !== null; ) { + if (xe(e)) { + let n = e.getFirstChild(); + if (n !== null) { + e = n; + continue; + } + } + break; + } + return e; + } + getLastDescendant() { + let e = this.getLastChild(); + for (; e !== null; ) { + if (xe(e)) { + let n = e.getLastChild(); + if (n !== null) { + e = n; + continue; + } + } + break; + } + return e; + } + getDescendantByIndex(e) { + let n = this.getChildren(), i = n.length; + return e >= i ? (e = n[i - 1], xe(e) && e.getLastDescendant() || e || null) : (e = n[e], xe(e) && e.getFirstDescendant() || e || null); + } + getFirstChild() { + let e = this.getLatest().__first; + return e === null ? null : Tr(e); + } + getFirstChildOrThrow() { + let e = this.getFirstChild(); + return e === null && Le(45, this.__key), e; + } + getLastChild() { + let e = this.getLatest().__last; + return e === null ? null : Tr(e); + } + getLastChildOrThrow() { + let e = this.getLastChild(); + return e === null && Le(96, this.__key), e; + } + getChildAtIndex(e) { + var n = this.getChildrenSize(); + let i; + if (e < n / 2) { + for (i = this.getFirstChild(), n = 0; i !== null && n <= e; ) { + if (n === e) return i; + i = i.getNextSibling(), n++; + } + return null; + } + for (i = this.getLastChild(), --n; i !== null && n >= e; ) { + if (n === e) return i; + i = i.getPreviousSibling(), n--; + } + return null; + } + getTextContent() { + let e = "", n = this.getChildren(), i = n.length; + for (let r = 0; r < i; r++) { + let s = n[r]; + e += s.getTextContent(), xe(s) && r !== i - 1 && !s.isInline() && (e += ` + +`); + } + return e; + } + getTextContentSize() { + let e = 0, n = this.getChildren(), i = n.length; + for (let r = 0; r < i; r++) { + let s = n[r]; + e += s.getTextContentSize(), xe(s) && r !== i - 1 && !s.isInline() && (e += 2); + } + return e; + } + getDirection() { + return this.getLatest().__dir; + } + hasFormat(e) { + return e !== "" ? (e = W$[e], (this.getFormat() & e) !== 0) : !1; + } + select(e, n) { + qr(); + let i = pn(), r = e, s = n; + var o = this.getChildrenSize(); + if (!this.canBeEmpty()) { + if (e === 0 && n === 0) { + if (e = this.getFirstChild(), Ze(e) || xe(e)) return e.select(0, 0); + } else if (!(e !== void 0 && e !== o || n !== void 0 && n !== o) && (e = this.getLastChild(), Ze(e) || xe(e))) return e.select(); + } + if (r === void 0 && (r = o), s === void 0 && (s = o), o = this.__key, xt(i)) i.anchor.set(o, r, "element"), i.focus.set(o, s, "element"), i.dirty = !0; + else return WF(o, r, o, s, "element", "element"); + return i; + } + selectStart() { + let e = this.getFirstDescendant(); + return e ? e.selectStart() : this.select(); + } + selectEnd() { + let e = this.getLastDescendant(); + return e ? e.selectEnd() : this.select(); + } + clear() { + let e = this.getWritable(); + return this.getChildren().forEach((n) => n.remove()), e; + } + append(...e) { + return this.splice( + this.getChildrenSize(), + 0, + e + ); + } + setDirection(e) { + let n = this.getWritable(); + return n.__dir = e, n; + } + setFormat(e) { + return this.getWritable().__format = e !== "" ? W$[e] : 0, this; + } + setIndent(e) { + return this.getWritable().__indent = e, this; + } + splice(e, n, i) { + let r = i.length, s = this.getChildrenSize(), o = this.getWritable(), a = o.__key; + var l = [], u = []; + let f = this.getChildAtIndex(e + n), d = null, h = s - n + r; + if (e !== 0) if (e === s) d = this.getLastChild(); + else { + var m = this.getChildAtIndex(e); + m !== null && (d = m.getPreviousSibling()); + } + if (0 < n) { + var g = d === null ? this.getFirstChild() : d.getNextSibling(); + for (m = 0; m < n; m++) { + g === null && Le(100); + var w = g.getNextSibling(), x = g.__key; + g = g.getWritable(), of(g), u.push(x), g = w; + } + } + for (m = d, w = 0; w < r; w++) { + x = i[w], m !== null && x.is(m) && (d = m = m.getPreviousSibling()), g = x.getWritable(), g.__parent === a && h--, of(g); + let _ = x.__key; + m === null ? (o.__first = _, g.__prev = null) : (m = m.getWritable(), m.__next = _, g.__prev = m.__key), x.__key === a && Le(76), g.__parent = a, l.push(_), m = x; + } + if (e + n === s ? m !== null && (m.getWritable().__next = null, o.__last = m.__key) : f !== null && (e = f.getWritable(), m !== null ? (n = m.getWritable(), e.__prev = m.__key, n.__next = f.__key) : e.__prev = null), o.__size = h, u.length && (e = pn(), xt(e))) { + u = new Set(u), l = new Set(l); + let { anchor: _, focus: S } = e; + dM(_, u, l) && Gy(_, _.getNode(), this, d, f), dM(S, u, l) && Gy(S, S.getNode(), this, d, f), h !== 0 || this.canBeEmpty() || Wu(this) || this.remove(); + } + return o; + } + exportJSON() { + return { children: [], direction: this.getDirection(), format: this.getFormatType(), indent: this.getIndent(), type: "element", version: 1 }; + } + insertNewAfter() { + return null; + } + canIndent() { + return !0; + } + collapseAtStart() { + return !1; + } + excludeFromCopy() { + return !1; + } + canExtractContents() { + return !0; + } + canReplaceWith() { + return !0; + } + canInsertAfter() { + return !0; + } + canBeEmpty() { + return !0; + } + canInsertTextBefore() { + return !0; + } + canInsertTextAfter() { + return !0; + } + isInline() { + return !1; + } + isShadowRoot() { + return !1; + } + canMergeWith() { + return !1; + } + extractWithChild() { + return !1; + } +} +function xe(t) { + return t instanceof jk; +} +function dM(t, e, n) { + for (t = t.getNode(); t; ) { + let i = t.__key; + if (e.has(i) && !n.has(i)) return !0; + t = t.getParent(); + } + return !1; +} +class Xh extends jk { + static getType() { + return "root"; + } + static clone() { + return new Xh(); + } + constructor() { + super("root"), this.__cachedText = null; + } + getTopLevelElementOrThrow() { + Le(51); + } + getTextContent() { + let e = this.__cachedText; + return !Vh() && Ln()._dirtyType !== 0 || e === null ? super.getTextContent() : e; + } + remove() { + Le(52); + } + replace() { + Le(53); + } + insertBefore() { + Le(54); + } + insertAfter() { + Le(55); + } + updateDOM() { + return !1; + } + append(...e) { + for (let n = 0; n < e.length; n++) { + let i = e[n]; + xe(i) || ii(i) || Le(56); + } + return super.append(...e); + } + static importJSON(e) { + let n = Zs(); + return n.setFormat(e.format), n.setIndent(e.indent), n.setDirection(e.direction), n; + } + exportJSON() { + return { children: [], direction: this.getDirection(), format: this.getFormatType(), indent: this.getIndent(), type: "root", version: 1 }; + } + collapseAtStart() { + return !0; + } +} +function Ws(t) { + return t instanceof Xh; +} +function die(t, e) { + if (e = e.getEditorState()._selection, t = t._selection, t !== null) { + if (t.dirty || !t.is(e)) return !0; + } else if (e !== null) return !0; + return !1; +} +function f5() { + return new Fk(/* @__PURE__ */ new Map([["root", new Xh()]])); +} +function UF(t) { + let e = t.exportJSON(); + var n = t.constructor; + if (e.type !== n.getType() && Le(130, n.name), xe(t)) { + let i = e.children; + for (Array.isArray(i) || Le(59, n.name), t = t.getChildren(), n = 0; n < t.length; n++) { + let r = UF(t[n]); + i.push(r); + } + } + return e; +} +class Fk { + constructor(e, n) { + this._nodeMap = e, this._selection = n || null, this._readOnly = this._flushSync = !1; + } + isEmpty() { + return this._nodeMap.size === 1 && this._selection === null; + } + read(e) { + return cM(this, e); + } + clone(e) { + return e = new Fk(this._nodeMap, e === void 0 ? this._selection : e), e._readOnly = !0, e; + } + toJSON() { + return cM(this, () => ({ root: UF(Zs()) })); + } +} +class Gh extends jk { + static getType() { + return "paragraph"; + } + static clone(e) { + return new Gh(e.__key); + } + createDOM(e) { + let n = document.createElement("p"); + return e = wg(e.theme, "paragraph"), e !== void 0 && n.classList.add(...e), n; + } + updateDOM() { + return !1; + } + static importDOM() { + return { p: () => ({ conversion: hie, priority: 0 }) }; + } + exportDOM(e) { + if ({ element: e } = super.exportDOM(e), e && Dk(e)) { + this.isEmpty() && e.append(document.createElement("br")); + var n = this.getFormatType(); + e.style.textAlign = n, (n = this.getDirection()) && (e.dir = n), n = this.getIndent(), 0 < n && (e.style.textIndent = `${20 * n}px`); + } + return { element: e }; + } + static importJSON(e) { + let n = kl(); + return n.setFormat(e.format), n.setIndent(e.indent), n.setDirection(e.direction), n; + } + exportJSON() { + return { ...super.exportJSON(), type: "paragraph", version: 1 }; + } + insertNewAfter(e, n) { + e = kl(); + let i = this.getDirection(); + return e.setDirection(i), this.insertAfter(e, n), e; + } + collapseAtStart() { + let e = this.getChildren(); + if (e.length === 0 || Ze(e[0]) && e[0].getTextContent().trim() === "") { + if (this.getNextSibling() !== null) return this.selectNext(), this.remove(), !0; + if (this.getPreviousSibling() !== null) return this.selectPrevious(), this.remove(), !0; + } + return !1; + } +} +function hie(t) { + let e = kl(); + return t.style && (e.setFormat(t.style.textAlign), t = parseInt(t.style.textIndent, 10) / 20, 0 < t && e.setIndent(t)), { node: e }; +} +function kl() { + return i1(new Gh()); +} +function ZF(t, e, n, i) { + let r = t._keyToDOMMap; + r.clear(), t._editorState = f5(), t._pendingEditorState = i, t._compositionKey = null, t._dirtyType = 0, t._cloneNotNeeded.clear(), t._dirtyLeaves = /* @__PURE__ */ new Set(), t._dirtyElements.clear(), t._normalizedNodes = /* @__PURE__ */ new Set(), t._updateTags = /* @__PURE__ */ new Set(), t._updates = [], t._blockCursorElement = null, i = t._observer, i !== null && (i.disconnect(), t._observer = null), e !== null && (e.textContent = ""), n !== null && (n.textContent = "", r.set("root", n)); +} +function pie(t, e) { + let n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), r = (s) => { + Object.keys(s).forEach((o) => { + let a = n.get(o); + a === void 0 && (a = [], n.set(o, a)), a.push(s[o]); + }); + }; + return t.forEach((s) => { + s = s.klass.importDOM != null ? s.klass.importDOM.bind(s.klass) : null, s == null || i.has(s) || (i.add(s), s = s(), s !== null && r(s)); + }), e && r(e), n; +} +class mie { + constructor(e, n, i, r, s, o, a) { + this._parentEditor = n, this._rootElement = null, this._editorState = e, this._compositionKey = this._pendingEditorState = null, this._deferred = [], this._keyToDOMMap = /* @__PURE__ */ new Map(), this._updates = [], this._updating = !1, this._listeners = { decorator: /* @__PURE__ */ new Set(), editable: /* @__PURE__ */ new Set(), mutation: /* @__PURE__ */ new Map(), root: /* @__PURE__ */ new Set(), textcontent: /* @__PURE__ */ new Set(), update: /* @__PURE__ */ new Set() }, this._commands = /* @__PURE__ */ new Map(), this._config = r, this._nodes = i, this._decorators = {}, this._pendingDecorators = null, this._dirtyType = 0, this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._dirtyElements = /* @__PURE__ */ new Map(), this._normalizedNodes = /* @__PURE__ */ new Set(), this._updateTags = /* @__PURE__ */ new Set(), this._observer = null, this._key = vF(), this._onError = s, this._htmlConversions = o, this._editable = a, this._headless = n !== null && n._headless, this._blockCursorElement = this._window = null; + } + isComposing() { + return this._compositionKey != null; + } + registerUpdateListener(e) { + let n = this._listeners.update; + return n.add(e), () => { + n.delete(e); + }; + } + registerEditableListener(e) { + let n = this._listeners.editable; + return n.add(e), () => { + n.delete(e); + }; + } + registerDecoratorListener(e) { + let n = this._listeners.decorator; + return n.add(e), () => { + n.delete(e); + }; + } + registerTextContentListener(e) { + let n = this._listeners.textcontent; + return n.add(e), () => { + n.delete(e); + }; + } + registerRootListener(e) { + let n = this._listeners.root; + return e(this._rootElement, null), n.add(e), () => { + e(null, this._rootElement), n.delete(e); + }; + } + registerCommand(e, n, i) { + i === void 0 && Le(35); + let r = this._commands; + r.has(e) || r.set(e, [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()]); + let s = r.get(e); + s === void 0 && Le(36, String(e)); + let o = s[i]; + return o.add(n), () => { + o.delete(n), s.every((a) => a.size === 0) && r.delete(e); + }; + } + registerMutationListener(e, n) { + this._nodes.get(e.getType()) === void 0 && Le(37, e.name); + let i = this._listeners.mutation; + return i.set(n, e), () => { + i.delete(n); + }; + } + registerNodeTransformToKlass(e, n) { + var i = e.getType(); + return i = this._nodes.get(i), i === void 0 && Le(37, e.name), i.transforms.add(n), i; + } + registerNodeTransform(e, n) { + var i = this.registerNodeTransformToKlass(e, n); + let r = [i]; + return i = i.replaceWithKlass, i != null && (i = this.registerNodeTransformToKlass(i, n), r.push(i)), Bne(this, e.getType()), () => { + r.forEach((s) => s.transforms.delete(n)); + }; + } + hasNode(e) { + return this._nodes.has(e.getType()); + } + hasNodes(e) { + return e.every(this.hasNode.bind(this)); + } + dispatchCommand(e, n) { + return Pe(this, e, n); + } + getDecorators() { + return this._decorators; + } + getRootElement() { + return this._rootElement; + } + getKey() { + return this._key; + } + setRootElement(e) { + let n = this._rootElement; + if (e !== n) { + let o = wg(this._config.theme, "root"); + var i = this._pendingEditorState || this._editorState; + if (this._rootElement = e, ZF(this, n, e, i), n !== null) { + if (!this._config.disableEvents) { + kg !== 0 && (kg--, kg === 0 && n.ownerDocument.removeEventListener("selectionchange", PF)); + var r = n.__lexicalEditor; + if (r != null) { + if (r._parentEditor !== null) { + var s = r5(r); + s = s[s.length - 1]._key, ah.get(s) === r && ah.delete(s); + } else ah.delete(r._key); + n.__lexicalEditor = null; + } + for (r = DF(n), s = 0; s < r.length; s++) r[s](); + n.__lexicalEventHandles = []; + } + o != null && n.classList.remove(...o); + } + e !== null ? (i = (i = e.ownerDocument) && i.defaultView || null, r = e.style, r.userSelect = "text", r.whiteSpace = "pre-wrap", r.wordBreak = "break-word", e.setAttribute( + "data-lexical-editor", + "true" + ), this._window = i, this._dirtyType = 2, cF(this), this._updateTags.add("history-merge"), af(this), this._config.disableEvents || Gne(e, this), o != null && e.classList.add(...o)) : (this._editorState = i, this._window = this._pendingEditorState = null), _g("root", this, !1, e, n); + } + } + getElementByKey(e) { + return this._keyToDOMMap.get(e) || null; + } + getEditorState() { + return this._editorState; + } + setEditorState(e, n) { + e.isEmpty() && Le(38), uF(this); + let i = this._pendingEditorState, r = this._updateTags; + n = n !== void 0 ? n.tag : null, i === null || i.isEmpty() || (n != null && r.add(n), af(this)), this._pendingEditorState = e, this._dirtyType = 2, this._dirtyElements.set("root", !1), this._compositionKey = null, n != null && r.add(n), af(this); + } + parseEditorState(e, n) { + e = typeof e == "string" ? JSON.parse(e) : e; + let i = f5(), r = Qi, s = ws, o = Ui, a = this._dirtyElements, l = this._dirtyLeaves, u = this._cloneNotNeeded, f = this._dirtyType; + this._dirtyElements = /* @__PURE__ */ new Map(), this._dirtyLeaves = /* @__PURE__ */ new Set(), this._cloneNotNeeded = /* @__PURE__ */ new Set(), this._dirtyType = 0, Qi = i, ws = !1, Ui = this; + try { + c5(e.root, this._nodes), n && n(), i._readOnly = !0; + } catch (d) { + d instanceof Error && this._onError(d); + } finally { + this._dirtyElements = a, this._dirtyLeaves = l, this._cloneNotNeeded = u, this._dirtyType = f, Qi = r, ws = s, Ui = o; + } + return i; + } + update(e, n) { + qs(this, e, n); + } + focus(e, n = {}) { + let i = this._rootElement; + i !== null && (i.setAttribute("autocapitalize", "off"), qs(this, () => { + let r = pn(), s = Zs(); + r !== null ? r.dirty = !0 : s.getChildrenSize() !== 0 && (n.defaultSelection === "rootStart" ? s.selectStart() : s.selectEnd()); + }, { onUpdate: () => { + i.removeAttribute("autocapitalize"), e && e(); + }, tag: "focus" }), this._pendingEditorState === null && i.removeAttribute("autocapitalize")); + } + blur() { + var e = this._rootElement; + e !== null && e.blur(), e = La(this._window), e !== null && e.removeAllRanges(); + } + isEditable() { + return this._editable; + } + setEditable(e) { + this._editable !== e && (this._editable = e, _g("editable", this, !0, e)); + } + toJSON() { + return { editorState: this._editorState.toJSON() }; + } +} +me.$addUpdateTag = function(t) { + qr(), Ln()._updateTags.add(t); +}; +me.$applyNodeReplacement = i1; +me.$copyNode = wF; +me.$createLineBreakNode = Sh; +me.$createNodeSelection = o4; +me.$createParagraphNode = kl; +me.$createPoint = Ro; +me.$createRangeSelection = function() { + let t = Ro("root", 0, "element"), e = Ro("root", 0, "element"); + return new qh(t, e, 0, ""); +}; +me.$createTabNode = Rk; +me.$createTextNode = rr; +me.$getAdjacentNode = ZS; +me.$getCharacterOffsets = s4; +me.$getEditor = function() { + return Ln(); +}; +me.$getNearestNodeFromDOMNode = n1; +me.$getNearestRootOrShadowRoot = yF; +me.$getNodeByKey = Tr; +me.$getPreviousSelection = Yh; +me.$getRoot = Zs; +me.$getSelection = pn; +me.$getTextContent = function() { + let t = pn(); + return t === null ? "" : t.getTextContent(); +}; +me.$hasAncestor = Yy; +me.$hasUpdateTag = function(t) { + return Ln()._updateTags.has(t); +}; +me.$insertNodes = function(t) { + let e = pn() || Yh(); + e === null && (e = Zs().selectEnd()), e.insertNodes(t); +}; +me.$isBlockElementNode = function(t) { + return xe(t) && !t.isInline(); +}; +me.$isDecoratorNode = ii; +me.$isElementNode = xe; +me.$isInlineElementOrDecoratorNode = function(t) { + return xe(t) && t.isInline() || ii(t) && t.isInline(); +}; +me.$isLeafNode = function(t) { + return Ze(t) || hf(t) || ii(t); +}; +me.$isLineBreakNode = hf; +me.$isNodeSelection = r1; +me.$isParagraphNode = function(t) { + return t instanceof Gh; +}; +me.$isRangeSelection = xt; +me.$isRootNode = Ws; +me.$isRootOrShadowRoot = Wu; +me.$isTabNode = LF; +me.$isTextNode = Ze; +me.$nodesOfType = function(t) { + var e = Ra(); + let n = e._readOnly, i = t.getType(); + e = e._nodeMap; + let r = []; + for (let [, s] of e) s instanceof t && s.__type === i && (n || s.isAttached()) && r.push(s); + return r; +}; +me.$normalizeSelection__EXPERIMENTAL = dF; +me.$parseSerializedNode = function(t) { + return c5(t, Ln()._nodes); +}; +me.$selectAll = function() { + var t = Zs(); + t = t.select(0, t.getChildrenSize()), $a(dF(t)); +}; +me.$setCompositionKey = Pi; +me.$setSelection = $a; +me.$splitNode = function(t, e) { + let n = t.getChildAtIndex(e); + n == null && (n = t), Wu(t) && Le(102); + let i = (o) => { + const a = o.getParentOrThrow(), l = Wu(a), u = o !== n || l ? wF(o) : o; + if (l) return xe(o) && xe(u) || Le(133), o.insertAfter(u), [o, u, u]; + const [f, d, h] = i(a); + return o = o.getNextSiblings(), h.append(u, ...o), [f, d, u]; + }, [r, s] = i(n); + return [r, s]; +}; +me.BLUR_COMMAND = oF; +me.CAN_REDO_COMMAND = {}; +me.CAN_UNDO_COMMAND = {}; +me.CLEAR_EDITOR_COMMAND = {}; +me.CLEAR_HISTORY_COMMAND = {}; +me.CLICK_COMMAND = Wj; +me.COMMAND_PRIORITY_CRITICAL = 4; +me.COMMAND_PRIORITY_EDITOR = 0; +me.COMMAND_PRIORITY_HIGH = 3; +me.COMMAND_PRIORITY_LOW = 1; +me.COMMAND_PRIORITY_NORMAL = 2; +me.CONTROLLED_TEXT_INSERTION_COMMAND = oh; +me.COPY_COMMAND = G6; +me.CUT_COMMAND = K6; +me.DELETE_CHARACTER_COMMAND = sh; +me.DELETE_LINE_COMMAND = qg; +me.DELETE_WORD_COMMAND = Zg; +me.DRAGEND_COMMAND = rF; +me.DRAGOVER_COMMAND = iF; +me.DRAGSTART_COMMAND = nF; +me.DROP_COMMAND = tF; +me.DecoratorNode = QF; +me.ElementNode = jk; +me.FOCUS_COMMAND = sF; +me.FORMAT_ELEMENT_COMMAND = {}; +me.FORMAT_TEXT_COMMAND = ku; +me.INDENT_CONTENT_COMMAND = {}; +me.INSERT_LINE_BREAK_COMMAND = yg; +me.INSERT_PARAGRAPH_COMMAND = BS; +me.INSERT_TAB_COMMAND = {}; +me.KEY_ARROW_DOWN_COMMAND = Vj; +me.KEY_ARROW_LEFT_COMMAND = Zj; +me.KEY_ARROW_RIGHT_COMMAND = Qj; +me.KEY_ARROW_UP_COMMAND = Yj; +me.KEY_BACKSPACE_COMMAND = Gj; +me.KEY_DELETE_COMMAND = Jj; +me.KEY_DOWN_COMMAND = Hj; +me.KEY_ENTER_COMMAND = Wy; +me.KEY_ESCAPE_COMMAND = Kj; +me.KEY_MODIFIER_COMMAND = aF; +me.KEY_SPACE_COMMAND = Xj; +me.KEY_TAB_COMMAND = eF; +me.LineBreakNode = Zh; +me.MOVE_TO_END = Uj; +me.MOVE_TO_START = qj; +me.OUTDENT_CONTENT_COMMAND = {}; +me.PASTE_COMMAND = Y6; +me.ParagraphNode = Gh; +me.REDO_COMMAND = X6; +me.REMOVE_TEXT_COMMAND = zS; +me.RootNode = Xh; +me.SELECTION_CHANGE_COMMAND = Tk; +me.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND = {}; +me.SELECT_ALL_COMMAND = WS; +me.TabNode = Lk; +me.TextNode = Mf; +me.UNDO_COMMAND = V6; +me.createCommand = function() { + return {}; +}; +me.createEditor = function(t) { + var e = t || {}, n = Ui, i = e.theme || {}; + let r = t === void 0 ? n : e.parentEditor || null, s = e.disableEvents || !1, o = f5(), a = e.namespace || (r !== null ? r._config.namespace : vF()), l = e.editorState, u = [Xh, Mf, Zh, Lk, Gh, ...e.nodes || []], { onError: f, html: d } = e; + if (e = e.editable !== void 0 ? e.editable : !0, t === void 0 && n !== null) t = n._nodes; + else for (t = /* @__PURE__ */ new Map(), n = 0; n < u.length; n++) { + let m = u[n], g = null; + var h = null; + typeof m != "function" && (h = m, m = h.replace, g = h.with, h = h.withKlass || null); + let w = m.getType(), x = m.transform(), _ = /* @__PURE__ */ new Set(); + x !== null && _.add(x), t.set(w, { exportDOM: d && d.export ? d.export.get(m) : void 0, klass: m, replace: g, replaceWithKlass: h, transforms: _ }); + } + return i = new mie(o, r, t, { disableEvents: s, namespace: a, theme: i }, f || console.error, pie(t, d ? d.import : void 0), e), l !== void 0 && (i._pendingEditorState = l, i._dirtyType = 2), i; +}; +me.getNearestEditorFromDOMNode = i5; +me.isCurrentlyReadOnlyMode = Vh; +me.isHTMLAnchorElement = function(t) { + return Dk(t) && t.tagName === "A"; +}; +me.isHTMLElement = Dk; +me.isSelectionCapturedInDecoratorInput = n5; +me.isSelectionWithinEditor = t1; +const gie = me; +var N = gie, qF = { exports: {} }, vie = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED", bie = vie, yie = bie; +function YF() { +} +function VF() { +} +VF.resetWarningCache = YF; +var wie = function() { + function t(i, r, s, o, a, l) { + if (l !== yie) { + var u = new Error( + "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types" + ); + throw u.name = "Invariant Violation", u; + } + } + t.isRequired = t; + function e() { + return t; + } + var n = { + array: t, + bigint: t, + bool: t, + func: t, + number: t, + object: t, + string: t, + symbol: t, + any: t, + arrayOf: e, + element: t, + elementType: t, + instanceOf: e, + node: t, + objectOf: e, + oneOf: e, + oneOfType: e, + shape: e, + exact: e, + checkPropTypes: VF, + resetWarningCache: YF + }; + return n.PropTypes = n, n; +}; +qF.exports = wie(); +var kie = qF.exports; +const A = /* @__PURE__ */ Gs(kie), xie = (t) => /* @__PURE__ */ J.createElement("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("path", { d: "M9 20.4214C9.93991 20.785 10.9427 21 12 21C17.1812 21 21.0543 15.8362 22.6273 13.3309C22.8699 12.9407 23 12.4761 23 12C23 11.5239 22.8699 11.0593 22.6273 10.6691C22.2278 10.0328 21.68 9.22509 21 8.37401M5.63183 18.3627C3.66995 16.7105 2.20181 14.6514 1.37268 13.3309C1.1301 12.9407 1 12.4761 1 12C1 11.5239 1.1301 11.0593 1.37268 10.6691C2.94573 8.16375 6.81884 3 12 3C14.4123 3 16.5411 4.11939 18.2862 5.56867", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ J.createElement("path", { d: "M17 12C17 14.7614 14.7614 17 12 17M8.42928 15.5C7.54516 14.5981 7 13.3627 7 12C7 9.23858 9.23858 7 12 7C13.3627 7 14.5981 7.54516 15.5 8.42928", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ J.createElement("path", { d: "M2 22L22 2", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })), _ie = { + wide: [ + "w-[calc(75vw-var(--kg-breakout-adjustment-with-fallback)+2px)] mx-[calc(50%-(50vw-var(--kg-breakout-adjustment-with-fallback))-.8rem)] min-w-[calc(100%+3.6rem)] translate-x-[calc(50vw-50%+.8rem-var(--kg-breakout-adjustment-with-fallback))]", + "md:min-w-[calc(100%+10rem)]", + "lg:min-w-[calc(100%+18rem)]" + ].join(" "), + full: "inset-x-[-1px] mx-[calc(50%-50vw)] w-[calc(100vw+2px)] lg:mx-[calc(50%-50vw+(var(--kg-breakout-adjustment-with-fallback)/2))] lg:w-[calc(100vw-var(--kg-breakout-adjustment-with-fallback)+2px)]" +}, hM = { + top: ".6rem" +}, d5 = j.forwardRef(({ + cardType: t, + cardWidth: e = "regular", + feature: n, + IndicatorIcon: i, + indicatorPosition: r = hM, + isDragging: s, + isEditing: o, + isSelected: a, + isVisibilityActive: l, + onIndicatorClick: u, + wrapperStyle: f, + children: d, + ...h +}, m) => { + const g = () => f === "wide" && (o || a) ? "!-mx-3 !px-3" : f === "code-card" && o ? "-mx-6" : f === "wide" ? "hover:-mx-3 hover:px-3" : "border", w = [ + "relative border-transparent caret-grey-800", + a ? "z-20" : "z-10", + // ensure setting panels sit above other cards + a && !s ? "shadow-[0_0_0_2px] shadow-green" : "", + !a && !s ? "hover:shadow-[0_0_0_1px] hover:shadow-green" : "", + _ie[e] || "", + g() + ].join(" "), x = { + ...hM, + ...r || {}, + ...t === "call-to-action" && { top: "1.4rem" } + }; + let _; + return l ? _ = /* @__PURE__ */ y.jsx("div", { className: "sticky top-0 lg:top-8", children: /* @__PURE__ */ y.jsx( + xie, + { + "aria-label": "Card is hidden for select audiences", + className: "absolute left-[-6rem] size-5 cursor-pointer text-grey", + "data-testid": "visibility-indicator", + style: { + left: x.left, + top: x.top + }, + onClick: u + } + ) }) : i && (_ = /* @__PURE__ */ y.jsx("div", { className: "sticky top-0 lg:top-8", children: /* @__PURE__ */ y.jsx( + i, + { + "aria-label": `${t} indicator`, + className: "absolute left-[-6rem] size-5 text-grey", + style: { + left: x.left, + top: x.top + } + } + ) })), /* @__PURE__ */ y.jsxs(y.Fragment, { children: [ + _, + /* @__PURE__ */ y.jsx( + "div", + { + ref: m, + className: w, + "data-kg-card": t, + "data-kg-card-editing": o, + "data-kg-card-selected": a, + ...h, + children: d + } + ) + ] }); +}); +d5.displayName = "CardWrapper"; +d5.propTypes = { + isSelected: A.bool, + isEditing: A.bool, + cardWidth: A.oneOf(["regular", "wide", "full"]), + icon: A.string, + indicatorPosition: A.shape({ + left: A.string, + top: A.string + }) +}; +function Oie(t) { + return t.replace(/]*>((.*?){.*?}(.*?))<\/code>/gi, "$1"); +} +function mi(t = "", e = {}) { + const i = Object.assign({}, {}, e); + if (!i.createDocument) { + const s = typeof DOMParser < "u" && DOMParser || typeof window < "u" && window.DOMParser; + if (!s) + throw new Error("cleanBasicHtml() must be passed a `createDocument` function as an option when used in a non-browser environment"); + i.createDocument = function(o) { + return new s().parseFromString(o, "text/html"); + }; + } + let r = t; + if ((!i.allowBr || r === "
    ") && (r = r.replace(//g, " ")), i.removeCodeWrappers && (r = Oie(r)), r = r.replace(/(\s| ){2,}/g, " ").trim().replace(/^ | $/g, "").trim(), r) { + let s = i.createDocument(r); + if (s.body.textContent === "") + return null; + s.body.querySelectorAll("*").forEach((o) => { + if (!o.textContent.trim().replace(/\u200c+/g, "")) { + if (i.allowBr && o.tagName === "BR") + return; + if (i.allowBr && o.querySelector("br")) + return o.replaceWith(s.createElement("br")); + if (o.textContent.length > 0) { + let a = s.createTextNode(" "); + return o.replaceWith(a); + } + return o.remove(); + } + }), i.firstChildInnerContent && s.body.firstElementChild ? r = s.body.firstElementChild.innerHTML.trim() : r = s.body.innerHTML.trim(); + } + return r; +} +var s1 = {}; +const pM = {}; +function Sie(t) { + let e = pM[t]; + if (e) + return e; + e = pM[t] = []; + for (let n = 0; n < 128; n++) { + const i = String.fromCharCode(n); + e.push(i); + } + for (let n = 0; n < t.length; n++) { + const i = t.charCodeAt(n); + e[i] = "%" + ("0" + i.toString(16).toUpperCase()).slice(-2); + } + return e; +} +function Bk(t, e) { + typeof e != "string" && (e = Bk.defaultChars); + const n = Sie(e); + return t.replace(/(%[a-f0-9]{2})+/gi, function(i) { + let r = ""; + for (let s = 0, o = i.length; s < o; s += 3) { + const a = parseInt(i.slice(s + 1, s + 3), 16); + if (a < 128) { + r += n[a]; + continue; + } + if ((a & 224) === 192 && s + 3 < o) { + const l = parseInt(i.slice(s + 4, s + 6), 16); + if ((l & 192) === 128) { + const u = a << 6 & 1984 | l & 63; + u < 128 ? r += "��" : r += String.fromCharCode(u), s += 3; + continue; + } + } + if ((a & 240) === 224 && s + 6 < o) { + const l = parseInt(i.slice(s + 4, s + 6), 16), u = parseInt(i.slice(s + 7, s + 9), 16); + if ((l & 192) === 128 && (u & 192) === 128) { + const f = a << 12 & 61440 | l << 6 & 4032 | u & 63; + f < 2048 || f >= 55296 && f <= 57343 ? r += "���" : r += String.fromCharCode(f), s += 6; + continue; + } + } + if ((a & 248) === 240 && s + 9 < o) { + const l = parseInt(i.slice(s + 4, s + 6), 16), u = parseInt(i.slice(s + 7, s + 9), 16), f = parseInt(i.slice(s + 10, s + 12), 16); + if ((l & 192) === 128 && (u & 192) === 128 && (f & 192) === 128) { + let d = a << 18 & 1835008 | l << 12 & 258048 | u << 6 & 4032 | f & 63; + d < 65536 || d > 1114111 ? r += "����" : (d -= 65536, r += String.fromCharCode(55296 + (d >> 10), 56320 + (d & 1023))), s += 9; + continue; + } + } + r += "�"; + } + return r; + }); +} +Bk.defaultChars = ";/?:@&=+$,#"; +Bk.componentChars = ""; +const mM = {}; +function Cie(t) { + let e = mM[t]; + if (e) + return e; + e = mM[t] = []; + for (let n = 0; n < 128; n++) { + const i = String.fromCharCode(n); + /^[0-9a-z]$/i.test(i) ? e.push(i) : e.push("%" + ("0" + n.toString(16).toUpperCase()).slice(-2)); + } + for (let n = 0; n < t.length; n++) + e[t.charCodeAt(n)] = t[n]; + return e; +} +function zk(t, e, n) { + typeof e != "string" && (n = e, e = zk.defaultChars), typeof n > "u" && (n = !0); + const i = Cie(e); + let r = ""; + for (let s = 0, o = t.length; s < o; s++) { + const a = t.charCodeAt(s); + if (n && a === 37 && s + 2 < o && /^[0-9a-f]{2}$/i.test(t.slice(s + 1, s + 3))) { + r += t.slice(s, s + 3), s += 2; + continue; + } + if (a < 128) { + r += i[a]; + continue; + } + if (a >= 55296 && a <= 57343) { + if (a >= 55296 && a <= 56319 && s + 1 < o) { + const l = t.charCodeAt(s + 1); + if (l >= 56320 && l <= 57343) { + r += encodeURIComponent(t[s] + t[s + 1]), s++; + continue; + } + } + r += "%EF%BF%BD"; + continue; + } + r += encodeURIComponent(t[s]); + } + return r; +} +zk.defaultChars = ";/?:@&=+$,-_.!~*'()#"; +zk.componentChars = "-_.!~*'()"; +function Eie(t) { + let e = ""; + return e += t.protocol || "", e += t.slashes ? "//" : "", e += t.auth ? t.auth + "@" : "", t.hostname && t.hostname.indexOf(":") !== -1 ? e += "[" + t.hostname + "]" : e += t.hostname || "", e += t.port ? ":" + t.port : "", e += t.pathname || "", e += t.search || "", e += t.hash || "", e; +} +function Ky() { + this.protocol = null, this.slashes = null, this.auth = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.pathname = null; +} +const Tie = /^([a-z0-9.+-]+:)/i, $ie = /:[0-9]*$/, Mie = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, Nie = ["<", ">", '"', "`", " ", "\r", ` +`, " "], Aie = ["{", "}", "|", "\\", "^", "`"].concat(Nie), Die = ["'"].concat(Aie), gM = ["%", "/", "?", ";", "#"].concat(Die), vM = ["/", "?", "#"], Pie = 255, bM = /^[+a-z0-9A-Z_-]{0,63}$/, Iie = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, yM = { + javascript: !0, + "javascript:": !0 +}, wM = { + http: !0, + https: !0, + ftp: !0, + gopher: !0, + file: !0, + "http:": !0, + "https:": !0, + "ftp:": !0, + "gopher:": !0, + "file:": !0 +}; +function Lie(t, e) { + if (t && t instanceof Ky) return t; + const n = new Ky(); + return n.parse(t, e), n; +} +Ky.prototype.parse = function(t, e) { + let n, i, r, s = t; + if (s = s.trim(), !e && t.split("#").length === 1) { + const u = Mie.exec(s); + if (u) + return this.pathname = u[1], u[2] && (this.search = u[2]), this; + } + let o = Tie.exec(s); + if (o && (o = o[0], n = o.toLowerCase(), this.protocol = o, s = s.substr(o.length)), (e || o || s.match(/^\/\/[^@\/]+@[^@\/]+/)) && (r = s.substr(0, 2) === "//", r && !(o && yM[o]) && (s = s.substr(2), this.slashes = !0)), !yM[o] && (r || o && !wM[o])) { + let u = -1; + for (let g = 0; g < vM.length; g++) + i = s.indexOf(vM[g]), i !== -1 && (u === -1 || i < u) && (u = i); + let f, d; + u === -1 ? d = s.lastIndexOf("@") : d = s.lastIndexOf("@", u), d !== -1 && (f = s.slice(0, d), s = s.slice(d + 1), this.auth = f), u = -1; + for (let g = 0; g < gM.length; g++) + i = s.indexOf(gM[g]), i !== -1 && (u === -1 || i < u) && (u = i); + u === -1 && (u = s.length), s[u - 1] === ":" && u--; + const h = s.slice(0, u); + s = s.slice(u), this.parseHost(h), this.hostname = this.hostname || ""; + const m = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]"; + if (!m) { + const g = this.hostname.split(/\./); + for (let w = 0, x = g.length; w < x; w++) { + const _ = g[w]; + if (_ && !_.match(bM)) { + let S = ""; + for (let C = 0, E = _.length; C < E; C++) + _.charCodeAt(C) > 127 ? S += "x" : S += _[C]; + if (!S.match(bM)) { + const C = g.slice(0, w), E = g.slice(w + 1), M = _.match(Iie); + M && (C.push(M[1]), E.unshift(M[2])), E.length && (s = E.join(".") + s), this.hostname = C.join("."); + break; + } + } + } + } + this.hostname.length > Pie && (this.hostname = ""), m && (this.hostname = this.hostname.substr(1, this.hostname.length - 2)); + } + const a = s.indexOf("#"); + a !== -1 && (this.hash = s.substr(a), s = s.slice(0, a)); + const l = s.indexOf("?"); + return l !== -1 && (this.search = s.substr(l), s = s.slice(0, l)), s && (this.pathname = s), wM[n] && this.hostname && !this.pathname && (this.pathname = ""), this; +}; +Ky.prototype.parseHost = function(t) { + let e = $ie.exec(t); + e && (e = e[0], e !== ":" && (this.port = e.substr(1)), t = t.substr(0, t.length - e.length)), t && (this.hostname = t); +}; +s1.decode = Bk; +s1.encode = zk; +s1.format = Eie; +s1.parse = Lie; +var Nf = {}, Rie = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, jie = /[\0-\x1F\x7F-\x9F]/, Fie = /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/, Bie = /[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/, zie = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/; +Nf.Any = Rie; +Nf.Cc = jie; +Nf.Cf = Fie; +Nf.P = Bie; +Nf.Z = zie; +var XF = {}, a4 = {}, h5 = {}; +Object.defineProperty(h5, "__esModule", { value: !0 }); +h5.default = new Uint16Array( + // prettier-ignore + 'ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(function(t) { + return t.charCodeAt(0); + }) +); +var p5 = {}; +Object.defineProperty(p5, "__esModule", { value: !0 }); +p5.default = new Uint16Array( + // prettier-ignore + "Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(function(t) { + return t.charCodeAt(0); + }) +); +var l4 = {}; +(function(t) { + var e; + Object.defineProperty(t, "__esModule", { value: !0 }), t.replaceCodePoint = t.fromCodePoint = void 0; + var n = /* @__PURE__ */ new Map([ + [0, 65533], + // C1 Unicode control character reference replacements + [128, 8364], + [130, 8218], + [131, 402], + [132, 8222], + [133, 8230], + [134, 8224], + [135, 8225], + [136, 710], + [137, 8240], + [138, 352], + [139, 8249], + [140, 338], + [142, 381], + [145, 8216], + [146, 8217], + [147, 8220], + [148, 8221], + [149, 8226], + [150, 8211], + [151, 8212], + [152, 732], + [153, 8482], + [154, 353], + [155, 8250], + [156, 339], + [158, 382], + [159, 376] + ]); + t.fromCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins + (e = String.fromCodePoint) !== null && e !== void 0 ? e : function(s) { + var o = ""; + return s > 65535 && (s -= 65536, o += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), o += String.fromCharCode(s), o; + }; + function i(s) { + var o; + return s >= 55296 && s <= 57343 || s > 1114111 ? 65533 : (o = n.get(s)) !== null && o !== void 0 ? o : s; + } + t.replaceCodePoint = i; + function r(s) { + return (0, t.fromCodePoint)(i(s)); + } + t.default = r; +})(l4); +(function(t) { + var e = on && on.__createBinding || (Object.create ? function(L, Q, V, H) { + H === void 0 && (H = V); + var R = Object.getOwnPropertyDescriptor(Q, V); + (!R || ("get" in R ? !Q.__esModule : R.writable || R.configurable)) && (R = { enumerable: !0, get: function() { + return Q[V]; + } }), Object.defineProperty(L, H, R); + } : function(L, Q, V, H) { + H === void 0 && (H = V), L[H] = Q[V]; + }), n = on && on.__setModuleDefault || (Object.create ? function(L, Q) { + Object.defineProperty(L, "default", { enumerable: !0, value: Q }); + } : function(L, Q) { + L.default = Q; + }), i = on && on.__importStar || function(L) { + if (L && L.__esModule) return L; + var Q = {}; + if (L != null) for (var V in L) V !== "default" && Object.prototype.hasOwnProperty.call(L, V) && e(Q, L, V); + return n(Q, L), Q; + }, r = on && on.__importDefault || function(L) { + return L && L.__esModule ? L : { default: L }; + }; + Object.defineProperty(t, "__esModule", { value: !0 }), t.decodeXML = t.decodeHTMLStrict = t.decodeHTMLAttribute = t.decodeHTML = t.determineBranch = t.EntityDecoder = t.DecodingMode = t.BinTrieFlags = t.fromCodePoint = t.replaceCodePoint = t.decodeCodePoint = t.xmlDecodeTree = t.htmlDecodeTree = void 0; + var s = r(h5); + t.htmlDecodeTree = s.default; + var o = r(p5); + t.xmlDecodeTree = o.default; + var a = i(l4); + t.decodeCodePoint = a.default; + var l = l4; + Object.defineProperty(t, "replaceCodePoint", { enumerable: !0, get: function() { + return l.replaceCodePoint; + } }), Object.defineProperty(t, "fromCodePoint", { enumerable: !0, get: function() { + return l.fromCodePoint; + } }); + var u; + (function(L) { + L[L.NUM = 35] = "NUM", L[L.SEMI = 59] = "SEMI", L[L.EQUALS = 61] = "EQUALS", L[L.ZERO = 48] = "ZERO", L[L.NINE = 57] = "NINE", L[L.LOWER_A = 97] = "LOWER_A", L[L.LOWER_F = 102] = "LOWER_F", L[L.LOWER_X = 120] = "LOWER_X", L[L.LOWER_Z = 122] = "LOWER_Z", L[L.UPPER_A = 65] = "UPPER_A", L[L.UPPER_F = 70] = "UPPER_F", L[L.UPPER_Z = 90] = "UPPER_Z"; + })(u || (u = {})); + var f = 32, d; + (function(L) { + L[L.VALUE_LENGTH = 49152] = "VALUE_LENGTH", L[L.BRANCH_LENGTH = 16256] = "BRANCH_LENGTH", L[L.JUMP_TABLE = 127] = "JUMP_TABLE"; + })(d = t.BinTrieFlags || (t.BinTrieFlags = {})); + function h(L) { + return L >= u.ZERO && L <= u.NINE; + } + function m(L) { + return L >= u.UPPER_A && L <= u.UPPER_F || L >= u.LOWER_A && L <= u.LOWER_F; + } + function g(L) { + return L >= u.UPPER_A && L <= u.UPPER_Z || L >= u.LOWER_A && L <= u.LOWER_Z || h(L); + } + function w(L) { + return L === u.EQUALS || g(L); + } + var x; + (function(L) { + L[L.EntityStart = 0] = "EntityStart", L[L.NumericStart = 1] = "NumericStart", L[L.NumericDecimal = 2] = "NumericDecimal", L[L.NumericHex = 3] = "NumericHex", L[L.NamedEntity = 4] = "NamedEntity"; + })(x || (x = {})); + var _; + (function(L) { + L[L.Legacy = 0] = "Legacy", L[L.Strict = 1] = "Strict", L[L.Attribute = 2] = "Attribute"; + })(_ = t.DecodingMode || (t.DecodingMode = {})); + var S = ( + /** @class */ + function() { + function L(Q, V, H) { + this.decodeTree = Q, this.emitCodePoint = V, this.errors = H, this.state = x.EntityStart, this.consumed = 1, this.result = 0, this.treeIndex = 0, this.excess = 1, this.decodeMode = _.Strict; + } + return L.prototype.startEntity = function(Q) { + this.decodeMode = Q, this.state = x.EntityStart, this.result = 0, this.treeIndex = 0, this.excess = 1, this.consumed = 1; + }, L.prototype.write = function(Q, V) { + switch (this.state) { + case x.EntityStart: + return Q.charCodeAt(V) === u.NUM ? (this.state = x.NumericStart, this.consumed += 1, this.stateNumericStart(Q, V + 1)) : (this.state = x.NamedEntity, this.stateNamedEntity(Q, V)); + case x.NumericStart: + return this.stateNumericStart(Q, V); + case x.NumericDecimal: + return this.stateNumericDecimal(Q, V); + case x.NumericHex: + return this.stateNumericHex(Q, V); + case x.NamedEntity: + return this.stateNamedEntity(Q, V); + } + }, L.prototype.stateNumericStart = function(Q, V) { + return V >= Q.length ? -1 : (Q.charCodeAt(V) | f) === u.LOWER_X ? (this.state = x.NumericHex, this.consumed += 1, this.stateNumericHex(Q, V + 1)) : (this.state = x.NumericDecimal, this.stateNumericDecimal(Q, V)); + }, L.prototype.addToNumericResult = function(Q, V, H, R) { + if (V !== H) { + var q = H - V; + this.result = this.result * Math.pow(R, q) + parseInt(Q.substr(V, q), R), this.consumed += q; + } + }, L.prototype.stateNumericHex = function(Q, V) { + for (var H = V; V < Q.length; ) { + var R = Q.charCodeAt(V); + if (h(R) || m(R)) + V += 1; + else + return this.addToNumericResult(Q, H, V, 16), this.emitNumericEntity(R, 3); + } + return this.addToNumericResult(Q, H, V, 16), -1; + }, L.prototype.stateNumericDecimal = function(Q, V) { + for (var H = V; V < Q.length; ) { + var R = Q.charCodeAt(V); + if (h(R)) + V += 1; + else + return this.addToNumericResult(Q, H, V, 10), this.emitNumericEntity(R, 2); + } + return this.addToNumericResult(Q, H, V, 10), -1; + }, L.prototype.emitNumericEntity = function(Q, V) { + var H; + if (this.consumed <= V) + return (H = this.errors) === null || H === void 0 || H.absenceOfDigitsInNumericCharacterReference(this.consumed), 0; + if (Q === u.SEMI) + this.consumed += 1; + else if (this.decodeMode === _.Strict) + return 0; + return this.emitCodePoint((0, a.replaceCodePoint)(this.result), this.consumed), this.errors && (Q !== u.SEMI && this.errors.missingSemicolonAfterCharacterReference(), this.errors.validateNumericCharacterReference(this.result)), this.consumed; + }, L.prototype.stateNamedEntity = function(Q, V) { + for (var H = this.decodeTree, R = H[this.treeIndex], q = (R & d.VALUE_LENGTH) >> 14; V < Q.length; V++, this.excess++) { + var Y = Q.charCodeAt(V); + if (this.treeIndex = E(H, R, this.treeIndex + Math.max(1, q), Y), this.treeIndex < 0) + return this.result === 0 || // If we are parsing an attribute + this.decodeMode === _.Attribute && // We shouldn't have consumed any characters after the entity, + (q === 0 || // And there should be no invalid characters. + w(Y)) ? 0 : this.emitNotTerminatedNamedEntity(); + if (R = H[this.treeIndex], q = (R & d.VALUE_LENGTH) >> 14, q !== 0) { + if (Y === u.SEMI) + return this.emitNamedEntityData(this.treeIndex, q, this.consumed + this.excess); + this.decodeMode !== _.Strict && (this.result = this.treeIndex, this.consumed += this.excess, this.excess = 0); + } + } + return -1; + }, L.prototype.emitNotTerminatedNamedEntity = function() { + var Q, V = this, H = V.result, R = V.decodeTree, q = (R[H] & d.VALUE_LENGTH) >> 14; + return this.emitNamedEntityData(H, q, this.consumed), (Q = this.errors) === null || Q === void 0 || Q.missingSemicolonAfterCharacterReference(), this.consumed; + }, L.prototype.emitNamedEntityData = function(Q, V, H) { + var R = this.decodeTree; + return this.emitCodePoint(V === 1 ? R[Q] & ~d.VALUE_LENGTH : R[Q + 1], H), V === 3 && this.emitCodePoint(R[Q + 2], H), H; + }, L.prototype.end = function() { + var Q; + switch (this.state) { + case x.NamedEntity: + return this.result !== 0 && (this.decodeMode !== _.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0; + case x.NumericDecimal: + return this.emitNumericEntity(0, 2); + case x.NumericHex: + return this.emitNumericEntity(0, 3); + case x.NumericStart: + return (Q = this.errors) === null || Q === void 0 || Q.absenceOfDigitsInNumericCharacterReference(this.consumed), 0; + case x.EntityStart: + return 0; + } + }, L; + }() + ); + t.EntityDecoder = S; + function C(L) { + var Q = "", V = new S(L, function(H) { + return Q += (0, a.fromCodePoint)(H); + }); + return function(R, q) { + for (var Y = 0, K = 0; (K = R.indexOf("&", K)) >= 0; ) { + Q += R.slice(Y, K), V.startEntity(q); + var te = V.write( + R, + // Skip the "&" + K + 1 + ); + if (te < 0) { + Y = K + V.end(); + break; + } + Y = K + te, K = te === 0 ? Y + 1 : Y; + } + var se = Q + R.slice(Y); + return Q = "", se; + }; + } + function E(L, Q, V, H) { + var R = (Q & d.BRANCH_LENGTH) >> 7, q = Q & d.JUMP_TABLE; + if (R === 0) + return q !== 0 && H === q ? V : -1; + if (q) { + var Y = H - q; + return Y < 0 || Y >= R ? -1 : L[V + Y] - 1; + } + for (var K = V, te = K + R - 1; K <= te; ) { + var se = K + te >>> 1, ce = L[se]; + if (ce < H) + K = se + 1; + else if (ce > H) + te = se - 1; + else + return L[se + R]; + } + return -1; + } + t.determineBranch = E; + var M = C(s.default), $ = C(o.default); + function P(L, Q) { + return Q === void 0 && (Q = _.Legacy), M(L, Q); + } + t.decodeHTML = P; + function W(L) { + return M(L, _.Attribute); + } + t.decodeHTMLAttribute = W; + function z(L) { + return M(L, _.Strict); + } + t.decodeHTMLStrict = z; + function Z(L) { + return $(L, _.Strict); + } + t.decodeXML = Z; +})(a4); +var pf = {}, m5 = {}; +Object.defineProperty(m5, "__esModule", { value: !0 }); +function zv(t) { + for (var e = 1; e < t.length; e++) + t[e][0] += t[e - 1][0] + 1; + return t; +} +m5.default = new Map(/* @__PURE__ */ zv([[9, " "], [0, " "], [22, "!"], [0, """], [0, "#"], [0, "$"], [0, "%"], [0, "&"], [0, "'"], [0, "("], [0, ")"], [0, "*"], [0, "+"], [0, ","], [1, "."], [0, "/"], [10, ":"], [0, ";"], [0, { v: "<", n: 8402, o: "<⃒" }], [0, { v: "=", n: 8421, o: "=⃥" }], [0, { v: ">", n: 8402, o: ">⃒" }], [0, "?"], [0, "@"], [26, "["], [0, "\"], [0, "]"], [0, "^"], [0, "_"], [0, "`"], [5, { n: 106, o: "fj" }], [20, "{"], [0, "|"], [0, "}"], [34, " "], [0, "¡"], [0, "¢"], [0, "£"], [0, "¤"], [0, "¥"], [0, "¦"], [0, "§"], [0, "¨"], [0, "©"], [0, "ª"], [0, "«"], [0, "¬"], [0, "­"], [0, "®"], [0, "¯"], [0, "°"], [0, "±"], [0, "²"], [0, "³"], [0, "´"], [0, "µ"], [0, "¶"], [0, "·"], [0, "¸"], [0, "¹"], [0, "º"], [0, "»"], [0, "¼"], [0, "½"], [0, "¾"], [0, "¿"], [0, "À"], [0, "Á"], [0, "Â"], [0, "Ã"], [0, "Ä"], [0, "Å"], [0, "Æ"], [0, "Ç"], [0, "È"], [0, "É"], [0, "Ê"], [0, "Ë"], [0, "Ì"], [0, "Í"], [0, "Î"], [0, "Ï"], [0, "Ð"], [0, "Ñ"], [0, "Ò"], [0, "Ó"], [0, "Ô"], [0, "Õ"], [0, "Ö"], [0, "×"], [0, "Ø"], [0, "Ù"], [0, "Ú"], [0, "Û"], [0, "Ü"], [0, "Ý"], [0, "Þ"], [0, "ß"], [0, "à"], [0, "á"], [0, "â"], [0, "ã"], [0, "ä"], [0, "å"], [0, "æ"], [0, "ç"], [0, "è"], [0, "é"], [0, "ê"], [0, "ë"], [0, "ì"], [0, "í"], [0, "î"], [0, "ï"], [0, "ð"], [0, "ñ"], [0, "ò"], [0, "ó"], [0, "ô"], [0, "õ"], [0, "ö"], [0, "÷"], [0, "ø"], [0, "ù"], [0, "ú"], [0, "û"], [0, "ü"], [0, "ý"], [0, "þ"], [0, "ÿ"], [0, "Ā"], [0, "ā"], [0, "Ă"], [0, "ă"], [0, "Ą"], [0, "ą"], [0, "Ć"], [0, "ć"], [0, "Ĉ"], [0, "ĉ"], [0, "Ċ"], [0, "ċ"], [0, "Č"], [0, "č"], [0, "Ď"], [0, "ď"], [0, "Đ"], [0, "đ"], [0, "Ē"], [0, "ē"], [2, "Ė"], [0, "ė"], [0, "Ę"], [0, "ę"], [0, "Ě"], [0, "ě"], [0, "Ĝ"], [0, "ĝ"], [0, "Ğ"], [0, "ğ"], [0, "Ġ"], [0, "ġ"], [0, "Ģ"], [1, "Ĥ"], [0, "ĥ"], [0, "Ħ"], [0, "ħ"], [0, "Ĩ"], [0, "ĩ"], [0, "Ī"], [0, "ī"], [2, "Į"], [0, "į"], [0, "İ"], [0, "ı"], [0, "IJ"], [0, "ij"], [0, "Ĵ"], [0, "ĵ"], [0, "Ķ"], [0, "ķ"], [0, "ĸ"], [0, "Ĺ"], [0, "ĺ"], [0, "Ļ"], [0, "ļ"], [0, "Ľ"], [0, "ľ"], [0, "Ŀ"], [0, "ŀ"], [0, "Ł"], [0, "ł"], [0, "Ń"], [0, "ń"], [0, "Ņ"], [0, "ņ"], [0, "Ň"], [0, "ň"], [0, "ʼn"], [0, "Ŋ"], [0, "ŋ"], [0, "Ō"], [0, "ō"], [2, "Ő"], [0, "ő"], [0, "Œ"], [0, "œ"], [0, "Ŕ"], [0, "ŕ"], [0, "Ŗ"], [0, "ŗ"], [0, "Ř"], [0, "ř"], [0, "Ś"], [0, "ś"], [0, "Ŝ"], [0, "ŝ"], [0, "Ş"], [0, "ş"], [0, "Š"], [0, "š"], [0, "Ţ"], [0, "ţ"], [0, "Ť"], [0, "ť"], [0, "Ŧ"], [0, "ŧ"], [0, "Ũ"], [0, "ũ"], [0, "Ū"], [0, "ū"], [0, "Ŭ"], [0, "ŭ"], [0, "Ů"], [0, "ů"], [0, "Ű"], [0, "ű"], [0, "Ų"], [0, "ų"], [0, "Ŵ"], [0, "ŵ"], [0, "Ŷ"], [0, "ŷ"], [0, "Ÿ"], [0, "Ź"], [0, "ź"], [0, "Ż"], [0, "ż"], [0, "Ž"], [0, "ž"], [19, "ƒ"], [34, "Ƶ"], [63, "ǵ"], [65, "ȷ"], [142, "ˆ"], [0, "ˇ"], [16, "˘"], [0, "˙"], [0, "˚"], [0, "˛"], [0, "˜"], [0, "˝"], [51, "̑"], [127, "Α"], [0, "Β"], [0, "Γ"], [0, "Δ"], [0, "Ε"], [0, "Ζ"], [0, "Η"], [0, "Θ"], [0, "Ι"], [0, "Κ"], [0, "Λ"], [0, "Μ"], [0, "Ν"], [0, "Ξ"], [0, "Ο"], [0, "Π"], [0, "Ρ"], [1, "Σ"], [0, "Τ"], [0, "Υ"], [0, "Φ"], [0, "Χ"], [0, "Ψ"], [0, "Ω"], [7, "α"], [0, "β"], [0, "γ"], [0, "δ"], [0, "ε"], [0, "ζ"], [0, "η"], [0, "θ"], [0, "ι"], [0, "κ"], [0, "λ"], [0, "μ"], [0, "ν"], [0, "ξ"], [0, "ο"], [0, "π"], [0, "ρ"], [0, "ς"], [0, "σ"], [0, "τ"], [0, "υ"], [0, "φ"], [0, "χ"], [0, "ψ"], [0, "ω"], [7, "ϑ"], [0, "ϒ"], [2, "ϕ"], [0, "ϖ"], [5, "Ϝ"], [0, "ϝ"], [18, "ϰ"], [0, "ϱ"], [3, "ϵ"], [0, "϶"], [10, "Ё"], [0, "Ђ"], [0, "Ѓ"], [0, "Є"], [0, "Ѕ"], [0, "І"], [0, "Ї"], [0, "Ј"], [0, "Љ"], [0, "Њ"], [0, "Ћ"], [0, "Ќ"], [1, "Ў"], [0, "Џ"], [0, "А"], [0, "Б"], [0, "В"], [0, "Г"], [0, "Д"], [0, "Е"], [0, "Ж"], [0, "З"], [0, "И"], [0, "Й"], [0, "К"], [0, "Л"], [0, "М"], [0, "Н"], [0, "О"], [0, "П"], [0, "Р"], [0, "С"], [0, "Т"], [0, "У"], [0, "Ф"], [0, "Х"], [0, "Ц"], [0, "Ч"], [0, "Ш"], [0, "Щ"], [0, "Ъ"], [0, "Ы"], [0, "Ь"], [0, "Э"], [0, "Ю"], [0, "Я"], [0, "а"], [0, "б"], [0, "в"], [0, "г"], [0, "д"], [0, "е"], [0, "ж"], [0, "з"], [0, "и"], [0, "й"], [0, "к"], [0, "л"], [0, "м"], [0, "н"], [0, "о"], [0, "п"], [0, "р"], [0, "с"], [0, "т"], [0, "у"], [0, "ф"], [0, "х"], [0, "ц"], [0, "ч"], [0, "ш"], [0, "щ"], [0, "ъ"], [0, "ы"], [0, "ь"], [0, "э"], [0, "ю"], [0, "я"], [1, "ё"], [0, "ђ"], [0, "ѓ"], [0, "є"], [0, "ѕ"], [0, "і"], [0, "ї"], [0, "ј"], [0, "љ"], [0, "њ"], [0, "ћ"], [0, "ќ"], [1, "ў"], [0, "џ"], [7074, " "], [0, " "], [0, " "], [0, " "], [1, " "], [0, " "], [0, " "], [0, " "], [0, "​"], [0, "‌"], [0, "‍"], [0, "‎"], [0, "‏"], [0, "‐"], [2, "–"], [0, "—"], [0, "―"], [0, "‖"], [1, "‘"], [0, "’"], [0, "‚"], [1, "“"], [0, "”"], [0, "„"], [1, "†"], [0, "‡"], [0, "•"], [2, "‥"], [0, "…"], [9, "‰"], [0, "‱"], [0, "′"], [0, "″"], [0, "‴"], [0, "‵"], [3, "‹"], [0, "›"], [3, "‾"], [2, "⁁"], [1, "⁃"], [0, "⁄"], [10, "⁏"], [7, "⁗"], [7, { v: " ", n: 8202, o: "  " }], [0, "⁠"], [0, "⁡"], [0, "⁢"], [0, "⁣"], [72, "€"], [46, "⃛"], [0, "⃜"], [37, "ℂ"], [2, "℅"], [4, "ℊ"], [0, "ℋ"], [0, "ℌ"], [0, "ℍ"], [0, "ℎ"], [0, "ℏ"], [0, "ℐ"], [0, "ℑ"], [0, "ℒ"], [0, "ℓ"], [1, "ℕ"], [0, "№"], [0, "℗"], [0, "℘"], [0, "ℙ"], [0, "ℚ"], [0, "ℛ"], [0, "ℜ"], [0, "ℝ"], [0, "℞"], [3, "™"], [1, "ℤ"], [2, "℧"], [0, "ℨ"], [0, "℩"], [2, "ℬ"], [0, "ℭ"], [1, "ℯ"], [0, "ℰ"], [0, "ℱ"], [1, "ℳ"], [0, "ℴ"], [0, "ℵ"], [0, "ℶ"], [0, "ℷ"], [0, "ℸ"], [12, "ⅅ"], [0, "ⅆ"], [0, "ⅇ"], [0, "ⅈ"], [10, "⅓"], [0, "⅔"], [0, "⅕"], [0, "⅖"], [0, "⅗"], [0, "⅘"], [0, "⅙"], [0, "⅚"], [0, "⅛"], [0, "⅜"], [0, "⅝"], [0, "⅞"], [49, "←"], [0, "↑"], [0, "→"], [0, "↓"], [0, "↔"], [0, "↕"], [0, "↖"], [0, "↗"], [0, "↘"], [0, "↙"], [0, "↚"], [0, "↛"], [1, { v: "↝", n: 824, o: "↝̸" }], [0, "↞"], [0, "↟"], [0, "↠"], [0, "↡"], [0, "↢"], [0, "↣"], [0, "↤"], [0, "↥"], [0, "↦"], [0, "↧"], [1, "↩"], [0, "↪"], [0, "↫"], [0, "↬"], [0, "↭"], [0, "↮"], [1, "↰"], [0, "↱"], [0, "↲"], [0, "↳"], [1, "↵"], [0, "↶"], [0, "↷"], [2, "↺"], [0, "↻"], [0, "↼"], [0, "↽"], [0, "↾"], [0, "↿"], [0, "⇀"], [0, "⇁"], [0, "⇂"], [0, "⇃"], [0, "⇄"], [0, "⇅"], [0, "⇆"], [0, "⇇"], [0, "⇈"], [0, "⇉"], [0, "⇊"], [0, "⇋"], [0, "⇌"], [0, "⇍"], [0, "⇎"], [0, "⇏"], [0, "⇐"], [0, "⇑"], [0, "⇒"], [0, "⇓"], [0, "⇔"], [0, "⇕"], [0, "⇖"], [0, "⇗"], [0, "⇘"], [0, "⇙"], [0, "⇚"], [0, "⇛"], [1, "⇝"], [6, "⇤"], [0, "⇥"], [15, "⇵"], [7, "⇽"], [0, "⇾"], [0, "⇿"], [0, "∀"], [0, "∁"], [0, { v: "∂", n: 824, o: "∂̸" }], [0, "∃"], [0, "∄"], [0, "∅"], [1, "∇"], [0, "∈"], [0, "∉"], [1, "∋"], [0, "∌"], [2, "∏"], [0, "∐"], [0, "∑"], [0, "−"], [0, "∓"], [0, "∔"], [1, "∖"], [0, "∗"], [0, "∘"], [1, "√"], [2, "∝"], [0, "∞"], [0, "∟"], [0, { v: "∠", n: 8402, o: "∠⃒" }], [0, "∡"], [0, "∢"], [0, "∣"], [0, "∤"], [0, "∥"], [0, "∦"], [0, "∧"], [0, "∨"], [0, { v: "∩", n: 65024, o: "∩︀" }], [0, { v: "∪", n: 65024, o: "∪︀" }], [0, "∫"], [0, "∬"], [0, "∭"], [0, "∮"], [0, "∯"], [0, "∰"], [0, "∱"], [0, "∲"], [0, "∳"], [0, "∴"], [0, "∵"], [0, "∶"], [0, "∷"], [0, "∸"], [1, "∺"], [0, "∻"], [0, { v: "∼", n: 8402, o: "∼⃒" }], [0, { v: "∽", n: 817, o: "∽̱" }], [0, { v: "∾", n: 819, o: "∾̳" }], [0, "∿"], [0, "≀"], [0, "≁"], [0, { v: "≂", n: 824, o: "≂̸" }], [0, "≃"], [0, "≄"], [0, "≅"], [0, "≆"], [0, "≇"], [0, "≈"], [0, "≉"], [0, "≊"], [0, { v: "≋", n: 824, o: "≋̸" }], [0, "≌"], [0, { v: "≍", n: 8402, o: "≍⃒" }], [0, { v: "≎", n: 824, o: "≎̸" }], [0, { v: "≏", n: 824, o: "≏̸" }], [0, { v: "≐", n: 824, o: "≐̸" }], [0, "≑"], [0, "≒"], [0, "≓"], [0, "≔"], [0, "≕"], [0, "≖"], [0, "≗"], [1, "≙"], [0, "≚"], [1, "≜"], [2, "≟"], [0, "≠"], [0, { v: "≡", n: 8421, o: "≡⃥" }], [0, "≢"], [1, { v: "≤", n: 8402, o: "≤⃒" }], [0, { v: "≥", n: 8402, o: "≥⃒" }], [0, { v: "≦", n: 824, o: "≦̸" }], [0, { v: "≧", n: 824, o: "≧̸" }], [0, { v: "≨", n: 65024, o: "≨︀" }], [0, { v: "≩", n: 65024, o: "≩︀" }], [0, { v: "≪", n: new Map(/* @__PURE__ */ zv([[824, "≪̸"], [7577, "≪⃒"]])) }], [0, { v: "≫", n: new Map(/* @__PURE__ */ zv([[824, "≫̸"], [7577, "≫⃒"]])) }], [0, "≬"], [0, "≭"], [0, "≮"], [0, "≯"], [0, "≰"], [0, "≱"], [0, "≲"], [0, "≳"], [0, "≴"], [0, "≵"], [0, "≶"], [0, "≷"], [0, "≸"], [0, "≹"], [0, "≺"], [0, "≻"], [0, "≼"], [0, "≽"], [0, "≾"], [0, { v: "≿", n: 824, o: "≿̸" }], [0, "⊀"], [0, "⊁"], [0, { v: "⊂", n: 8402, o: "⊂⃒" }], [0, { v: "⊃", n: 8402, o: "⊃⃒" }], [0, "⊄"], [0, "⊅"], [0, "⊆"], [0, "⊇"], [0, "⊈"], [0, "⊉"], [0, { v: "⊊", n: 65024, o: "⊊︀" }], [0, { v: "⊋", n: 65024, o: "⊋︀" }], [1, "⊍"], [0, "⊎"], [0, { v: "⊏", n: 824, o: "⊏̸" }], [0, { v: "⊐", n: 824, o: "⊐̸" }], [0, "⊑"], [0, "⊒"], [0, { v: "⊓", n: 65024, o: "⊓︀" }], [0, { v: "⊔", n: 65024, o: "⊔︀" }], [0, "⊕"], [0, "⊖"], [0, "⊗"], [0, "⊘"], [0, "⊙"], [0, "⊚"], [0, "⊛"], [1, "⊝"], [0, "⊞"], [0, "⊟"], [0, "⊠"], [0, "⊡"], [0, "⊢"], [0, "⊣"], [0, "⊤"], [0, "⊥"], [1, "⊧"], [0, "⊨"], [0, "⊩"], [0, "⊪"], [0, "⊫"], [0, "⊬"], [0, "⊭"], [0, "⊮"], [0, "⊯"], [0, "⊰"], [1, "⊲"], [0, "⊳"], [0, { v: "⊴", n: 8402, o: "⊴⃒" }], [0, { v: "⊵", n: 8402, o: "⊵⃒" }], [0, "⊶"], [0, "⊷"], [0, "⊸"], [0, "⊹"], [0, "⊺"], [0, "⊻"], [1, "⊽"], [0, "⊾"], [0, "⊿"], [0, "⋀"], [0, "⋁"], [0, "⋂"], [0, "⋃"], [0, "⋄"], [0, "⋅"], [0, "⋆"], [0, "⋇"], [0, "⋈"], [0, "⋉"], [0, "⋊"], [0, "⋋"], [0, "⋌"], [0, "⋍"], [0, "⋎"], [0, "⋏"], [0, "⋐"], [0, "⋑"], [0, "⋒"], [0, "⋓"], [0, "⋔"], [0, "⋕"], [0, "⋖"], [0, "⋗"], [0, { v: "⋘", n: 824, o: "⋘̸" }], [0, { v: "⋙", n: 824, o: "⋙̸" }], [0, { v: "⋚", n: 65024, o: "⋚︀" }], [0, { v: "⋛", n: 65024, o: "⋛︀" }], [2, "⋞"], [0, "⋟"], [0, "⋠"], [0, "⋡"], [0, "⋢"], [0, "⋣"], [2, "⋦"], [0, "⋧"], [0, "⋨"], [0, "⋩"], [0, "⋪"], [0, "⋫"], [0, "⋬"], [0, "⋭"], [0, "⋮"], [0, "⋯"], [0, "⋰"], [0, "⋱"], [0, "⋲"], [0, "⋳"], [0, "⋴"], [0, { v: "⋵", n: 824, o: "⋵̸" }], [0, "⋶"], [0, "⋷"], [1, { v: "⋹", n: 824, o: "⋹̸" }], [0, "⋺"], [0, "⋻"], [0, "⋼"], [0, "⋽"], [0, "⋾"], [6, "⌅"], [0, "⌆"], [1, "⌈"], [0, "⌉"], [0, "⌊"], [0, "⌋"], [0, "⌌"], [0, "⌍"], [0, "⌎"], [0, "⌏"], [0, "⌐"], [1, "⌒"], [0, "⌓"], [1, "⌕"], [0, "⌖"], [5, "⌜"], [0, "⌝"], [0, "⌞"], [0, "⌟"], [2, "⌢"], [0, "⌣"], [9, "⌭"], [0, "⌮"], [7, "⌶"], [6, "⌽"], [1, "⌿"], [60, "⍼"], [51, "⎰"], [0, "⎱"], [2, "⎴"], [0, "⎵"], [0, "⎶"], [37, "⏜"], [0, "⏝"], [0, "⏞"], [0, "⏟"], [2, "⏢"], [4, "⏧"], [59, "␣"], [164, "Ⓢ"], [55, "─"], [1, "│"], [9, "┌"], [3, "┐"], [3, "└"], [3, "┘"], [3, "├"], [7, "┤"], [7, "┬"], [7, "┴"], [7, "┼"], [19, "═"], [0, "║"], [0, "╒"], [0, "╓"], [0, "╔"], [0, "╕"], [0, "╖"], [0, "╗"], [0, "╘"], [0, "╙"], [0, "╚"], [0, "╛"], [0, "╜"], [0, "╝"], [0, "╞"], [0, "╟"], [0, "╠"], [0, "╡"], [0, "╢"], [0, "╣"], [0, "╤"], [0, "╥"], [0, "╦"], [0, "╧"], [0, "╨"], [0, "╩"], [0, "╪"], [0, "╫"], [0, "╬"], [19, "▀"], [3, "▄"], [3, "█"], [8, "░"], [0, "▒"], [0, "▓"], [13, "□"], [8, "▪"], [0, "▫"], [1, "▭"], [0, "▮"], [2, "▱"], [1, "△"], [0, "▴"], [0, "▵"], [2, "▸"], [0, "▹"], [3, "▽"], [0, "▾"], [0, "▿"], [2, "◂"], [0, "◃"], [6, "◊"], [0, "○"], [32, "◬"], [2, "◯"], [8, "◸"], [0, "◹"], [0, "◺"], [0, "◻"], [0, "◼"], [8, "★"], [0, "☆"], [7, "☎"], [49, "♀"], [1, "♂"], [29, "♠"], [2, "♣"], [1, "♥"], [0, "♦"], [3, "♪"], [2, "♭"], [0, "♮"], [0, "♯"], [163, "✓"], [3, "✗"], [8, "✠"], [21, "✶"], [33, "❘"], [25, "❲"], [0, "❳"], [84, "⟈"], [0, "⟉"], [28, "⟦"], [0, "⟧"], [0, "⟨"], [0, "⟩"], [0, "⟪"], [0, "⟫"], [0, "⟬"], [0, "⟭"], [7, "⟵"], [0, "⟶"], [0, "⟷"], [0, "⟸"], [0, "⟹"], [0, "⟺"], [1, "⟼"], [2, "⟿"], [258, "⤂"], [0, "⤃"], [0, "⤄"], [0, "⤅"], [6, "⤌"], [0, "⤍"], [0, "⤎"], [0, "⤏"], [0, "⤐"], [0, "⤑"], [0, "⤒"], [0, "⤓"], [2, "⤖"], [2, "⤙"], [0, "⤚"], [0, "⤛"], [0, "⤜"], [0, "⤝"], [0, "⤞"], [0, "⤟"], [0, "⤠"], [2, "⤣"], [0, "⤤"], [0, "⤥"], [0, "⤦"], [0, "⤧"], [0, "⤨"], [0, "⤩"], [0, "⤪"], [8, { v: "⤳", n: 824, o: "⤳̸" }], [1, "⤵"], [0, "⤶"], [0, "⤷"], [0, "⤸"], [0, "⤹"], [2, "⤼"], [0, "⤽"], [7, "⥅"], [2, "⥈"], [0, "⥉"], [0, "⥊"], [0, "⥋"], [2, "⥎"], [0, "⥏"], [0, "⥐"], [0, "⥑"], [0, "⥒"], [0, "⥓"], [0, "⥔"], [0, "⥕"], [0, "⥖"], [0, "⥗"], [0, "⥘"], [0, "⥙"], [0, "⥚"], [0, "⥛"], [0, "⥜"], [0, "⥝"], [0, "⥞"], [0, "⥟"], [0, "⥠"], [0, "⥡"], [0, "⥢"], [0, "⥣"], [0, "⥤"], [0, "⥥"], [0, "⥦"], [0, "⥧"], [0, "⥨"], [0, "⥩"], [0, "⥪"], [0, "⥫"], [0, "⥬"], [0, "⥭"], [0, "⥮"], [0, "⥯"], [0, "⥰"], [0, "⥱"], [0, "⥲"], [0, "⥳"], [0, "⥴"], [0, "⥵"], [0, "⥶"], [1, "⥸"], [0, "⥹"], [1, "⥻"], [0, "⥼"], [0, "⥽"], [0, "⥾"], [0, "⥿"], [5, "⦅"], [0, "⦆"], [4, "⦋"], [0, "⦌"], [0, "⦍"], [0, "⦎"], [0, "⦏"], [0, "⦐"], [0, "⦑"], [0, "⦒"], [0, "⦓"], [0, "⦔"], [0, "⦕"], [0, "⦖"], [3, "⦚"], [1, "⦜"], [0, "⦝"], [6, "⦤"], [0, "⦥"], [0, "⦦"], [0, "⦧"], [0, "⦨"], [0, "⦩"], [0, "⦪"], [0, "⦫"], [0, "⦬"], [0, "⦭"], [0, "⦮"], [0, "⦯"], [0, "⦰"], [0, "⦱"], [0, "⦲"], [0, "⦳"], [0, "⦴"], [0, "⦵"], [0, "⦶"], [0, "⦷"], [1, "⦹"], [1, "⦻"], [0, "⦼"], [1, "⦾"], [0, "⦿"], [0, "⧀"], [0, "⧁"], [0, "⧂"], [0, "⧃"], [0, "⧄"], [0, "⧅"], [3, "⧉"], [3, "⧍"], [0, "⧎"], [0, { v: "⧏", n: 824, o: "⧏̸" }], [0, { v: "⧐", n: 824, o: "⧐̸" }], [11, "⧜"], [0, "⧝"], [0, "⧞"], [4, "⧣"], [0, "⧤"], [0, "⧥"], [5, "⧫"], [8, "⧴"], [1, "⧶"], [9, "⨀"], [0, "⨁"], [0, "⨂"], [1, "⨄"], [1, "⨆"], [5, "⨌"], [0, "⨍"], [2, "⨐"], [0, "⨑"], [0, "⨒"], [0, "⨓"], [0, "⨔"], [0, "⨕"], [0, "⨖"], [0, "⨗"], [10, "⨢"], [0, "⨣"], [0, "⨤"], [0, "⨥"], [0, "⨦"], [0, "⨧"], [1, "⨩"], [0, "⨪"], [2, "⨭"], [0, "⨮"], [0, "⨯"], [0, "⨰"], [0, "⨱"], [1, "⨳"], [0, "⨴"], [0, "⨵"], [0, "⨶"], [0, "⨷"], [0, "⨸"], [0, "⨹"], [0, "⨺"], [0, "⨻"], [0, "⨼"], [2, "⨿"], [0, "⩀"], [1, "⩂"], [0, "⩃"], [0, "⩄"], [0, "⩅"], [0, "⩆"], [0, "⩇"], [0, "⩈"], [0, "⩉"], [0, "⩊"], [0, "⩋"], [0, "⩌"], [0, "⩍"], [2, "⩐"], [2, "⩓"], [0, "⩔"], [0, "⩕"], [0, "⩖"], [0, "⩗"], [0, "⩘"], [1, "⩚"], [0, "⩛"], [0, "⩜"], [0, "⩝"], [1, "⩟"], [6, "⩦"], [3, "⩪"], [2, { v: "⩭", n: 824, o: "⩭̸" }], [0, "⩮"], [0, "⩯"], [0, { v: "⩰", n: 824, o: "⩰̸" }], [0, "⩱"], [0, "⩲"], [0, "⩳"], [0, "⩴"], [0, "⩵"], [1, "⩷"], [0, "⩸"], [0, "⩹"], [0, "⩺"], [0, "⩻"], [0, "⩼"], [0, { v: "⩽", n: 824, o: "⩽̸" }], [0, { v: "⩾", n: 824, o: "⩾̸" }], [0, "⩿"], [0, "⪀"], [0, "⪁"], [0, "⪂"], [0, "⪃"], [0, "⪄"], [0, "⪅"], [0, "⪆"], [0, "⪇"], [0, "⪈"], [0, "⪉"], [0, "⪊"], [0, "⪋"], [0, "⪌"], [0, "⪍"], [0, "⪎"], [0, "⪏"], [0, "⪐"], [0, "⪑"], [0, "⪒"], [0, "⪓"], [0, "⪔"], [0, "⪕"], [0, "⪖"], [0, "⪗"], [0, "⪘"], [0, "⪙"], [0, "⪚"], [2, "⪝"], [0, "⪞"], [0, "⪟"], [0, "⪠"], [0, { v: "⪡", n: 824, o: "⪡̸" }], [0, { v: "⪢", n: 824, o: "⪢̸" }], [1, "⪤"], [0, "⪥"], [0, "⪦"], [0, "⪧"], [0, "⪨"], [0, "⪩"], [0, "⪪"], [0, "⪫"], [0, { v: "⪬", n: 65024, o: "⪬︀" }], [0, { v: "⪭", n: 65024, o: "⪭︀" }], [0, "⪮"], [0, { v: "⪯", n: 824, o: "⪯̸" }], [0, { v: "⪰", n: 824, o: "⪰̸" }], [2, "⪳"], [0, "⪴"], [0, "⪵"], [0, "⪶"], [0, "⪷"], [0, "⪸"], [0, "⪹"], [0, "⪺"], [0, "⪻"], [0, "⪼"], [0, "⪽"], [0, "⪾"], [0, "⪿"], [0, "⫀"], [0, "⫁"], [0, "⫂"], [0, "⫃"], [0, "⫄"], [0, { v: "⫅", n: 824, o: "⫅̸" }], [0, { v: "⫆", n: 824, o: "⫆̸" }], [0, "⫇"], [0, "⫈"], [2, { v: "⫋", n: 65024, o: "⫋︀" }], [0, { v: "⫌", n: 65024, o: "⫌︀" }], [2, "⫏"], [0, "⫐"], [0, "⫑"], [0, "⫒"], [0, "⫓"], [0, "⫔"], [0, "⫕"], [0, "⫖"], [0, "⫗"], [0, "⫘"], [0, "⫙"], [0, "⫚"], [0, "⫛"], [8, "⫤"], [1, "⫦"], [0, "⫧"], [0, "⫨"], [0, "⫩"], [1, "⫫"], [0, "⫬"], [0, "⫭"], [0, "⫮"], [0, "⫯"], [0, "⫰"], [0, "⫱"], [0, "⫲"], [0, "⫳"], [9, { v: "⫽", n: 8421, o: "⫽⃥" }], [44343, { n: new Map(/* @__PURE__ */ zv([[56476, "𝒜"], [1, "𝒞"], [0, "𝒟"], [2, "𝒢"], [2, "𝒥"], [0, "𝒦"], [2, "𝒩"], [0, "𝒪"], [0, "𝒫"], [0, "𝒬"], [1, "𝒮"], [0, "𝒯"], [0, "𝒰"], [0, "𝒱"], [0, "𝒲"], [0, "𝒳"], [0, "𝒴"], [0, "𝒵"], [0, "𝒶"], [0, "𝒷"], [0, "𝒸"], [0, "𝒹"], [1, "𝒻"], [1, "𝒽"], [0, "𝒾"], [0, "𝒿"], [0, "𝓀"], [0, "𝓁"], [0, "𝓂"], [0, "𝓃"], [1, "𝓅"], [0, "𝓆"], [0, "𝓇"], [0, "𝓈"], [0, "𝓉"], [0, "𝓊"], [0, "𝓋"], [0, "𝓌"], [0, "𝓍"], [0, "𝓎"], [0, "𝓏"], [52, "𝔄"], [0, "𝔅"], [1, "𝔇"], [0, "𝔈"], [0, "𝔉"], [0, "𝔊"], [2, "𝔍"], [0, "𝔎"], [0, "𝔏"], [0, "𝔐"], [0, "𝔑"], [0, "𝔒"], [0, "𝔓"], [0, "𝔔"], [1, "𝔖"], [0, "𝔗"], [0, "𝔘"], [0, "𝔙"], [0, "𝔚"], [0, "𝔛"], [0, "𝔜"], [1, "𝔞"], [0, "𝔟"], [0, "𝔠"], [0, "𝔡"], [0, "𝔢"], [0, "𝔣"], [0, "𝔤"], [0, "𝔥"], [0, "𝔦"], [0, "𝔧"], [0, "𝔨"], [0, "𝔩"], [0, "𝔪"], [0, "𝔫"], [0, "𝔬"], [0, "𝔭"], [0, "𝔮"], [0, "𝔯"], [0, "𝔰"], [0, "𝔱"], [0, "𝔲"], [0, "𝔳"], [0, "𝔴"], [0, "𝔵"], [0, "𝔶"], [0, "𝔷"], [0, "𝔸"], [0, "𝔹"], [1, "𝔻"], [0, "𝔼"], [0, "𝔽"], [0, "𝔾"], [1, "𝕀"], [0, "𝕁"], [0, "𝕂"], [0, "𝕃"], [0, "𝕄"], [1, "𝕆"], [3, "𝕊"], [0, "𝕋"], [0, "𝕌"], [0, "𝕍"], [0, "𝕎"], [0, "𝕏"], [0, "𝕐"], [1, "𝕒"], [0, "𝕓"], [0, "𝕔"], [0, "𝕕"], [0, "𝕖"], [0, "𝕗"], [0, "𝕘"], [0, "𝕙"], [0, "𝕚"], [0, "𝕛"], [0, "𝕜"], [0, "𝕝"], [0, "𝕞"], [0, "𝕟"], [0, "𝕠"], [0, "𝕡"], [0, "𝕢"], [0, "𝕣"], [0, "𝕤"], [0, "𝕥"], [0, "𝕦"], [0, "𝕧"], [0, "𝕨"], [0, "𝕩"], [0, "𝕪"], [0, "𝕫"]])) }], [8906, "ff"], [0, "fi"], [0, "fl"], [0, "ffi"], [0, "ffl"]])); +var Jy = {}; +(function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.escapeText = t.escapeAttribute = t.escapeUTF8 = t.escape = t.encodeXML = t.getCodePoint = t.xmlReplacer = void 0, t.xmlReplacer = /["&'<>$\x80-\uFFFF]/g; + var e = /* @__PURE__ */ new Map([ + [34, """], + [38, "&"], + [39, "'"], + [60, "<"], + [62, ">"] + ]); + t.getCodePoint = // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + String.prototype.codePointAt != null ? function(r, s) { + return r.codePointAt(s); + } : ( + // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + function(r, s) { + return (r.charCodeAt(s) & 64512) === 55296 ? (r.charCodeAt(s) - 55296) * 1024 + r.charCodeAt(s + 1) - 56320 + 65536 : r.charCodeAt(s); + } + ); + function n(r) { + for (var s = "", o = 0, a; (a = t.xmlReplacer.exec(r)) !== null; ) { + var l = a.index, u = r.charCodeAt(l), f = e.get(u); + f !== void 0 ? (s += r.substring(o, l) + f, o = l + 1) : (s += "".concat(r.substring(o, l), "&#x").concat((0, t.getCodePoint)(r, l).toString(16), ";"), o = t.xmlReplacer.lastIndex += +((u & 64512) === 55296)); + } + return s + r.substr(o); + } + t.encodeXML = n, t.escape = n; + function i(r, s) { + return function(a) { + for (var l, u = 0, f = ""; l = r.exec(a); ) + u !== l.index && (f += a.substring(u, l.index)), f += s.get(l[0].charCodeAt(0)), u = l.index + 1; + return f + a.substring(u); + }; + } + t.escapeUTF8 = i(/[&<>'"]/g, e), t.escapeAttribute = i(/["&\u00A0]/g, /* @__PURE__ */ new Map([ + [34, """], + [38, "&"], + [160, " "] + ])), t.escapeText = i(/[&<>\u00A0]/g, /* @__PURE__ */ new Map([ + [38, "&"], + [60, "<"], + [62, ">"], + [160, " "] + ])); +})(Jy); +var Wie = on && on.__importDefault || function(t) { + return t && t.__esModule ? t : { default: t }; +}; +Object.defineProperty(pf, "__esModule", { value: !0 }); +pf.encodeNonAsciiHTML = pf.encodeHTML = void 0; +var Hie = Wie(m5), GF = Jy, Qie = /[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g; +function Uie(t) { + return KF(Qie, t); +} +pf.encodeHTML = Uie; +function Zie(t) { + return KF(GF.xmlReplacer, t); +} +pf.encodeNonAsciiHTML = Zie; +function KF(t, e) { + for (var n = "", i = 0, r; (r = t.exec(e)) !== null; ) { + var s = r.index; + n += e.substring(i, s); + var o = e.charCodeAt(s), a = Hie.default.get(o); + if (typeof a == "object") { + if (s + 1 < e.length) { + var l = e.charCodeAt(s + 1), u = typeof a.n == "number" ? a.n === l ? a.o : void 0 : a.n.get(l); + if (u !== void 0) { + n += u, i = t.lastIndex += 1; + continue; + } + } + a = a.v; + } + if (a !== void 0) + n += a, i = s + 1; + else { + var f = (0, GF.getCodePoint)(e, s); + n += "&#x".concat(f.toString(16), ";"), i = t.lastIndex += +(f !== o); + } + } + return n + e.substr(i); +} +(function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.decodeXMLStrict = t.decodeHTML5Strict = t.decodeHTML4Strict = t.decodeHTML5 = t.decodeHTML4 = t.decodeHTMLAttribute = t.decodeHTMLStrict = t.decodeHTML = t.decodeXML = t.DecodingMode = t.EntityDecoder = t.encodeHTML5 = t.encodeHTML4 = t.encodeNonAsciiHTML = t.encodeHTML = t.escapeText = t.escapeAttribute = t.escapeUTF8 = t.escape = t.encodeXML = t.encode = t.decodeStrict = t.decode = t.EncodingMode = t.EntityLevel = void 0; + var e = a4, n = pf, i = Jy, r; + (function(h) { + h[h.XML = 0] = "XML", h[h.HTML = 1] = "HTML"; + })(r = t.EntityLevel || (t.EntityLevel = {})); + var s; + (function(h) { + h[h.UTF8 = 0] = "UTF8", h[h.ASCII = 1] = "ASCII", h[h.Extensive = 2] = "Extensive", h[h.Attribute = 3] = "Attribute", h[h.Text = 4] = "Text"; + })(s = t.EncodingMode || (t.EncodingMode = {})); + function o(h, m) { + m === void 0 && (m = r.XML); + var g = typeof m == "number" ? m : m.level; + if (g === r.HTML) { + var w = typeof m == "object" ? m.mode : void 0; + return (0, e.decodeHTML)(h, w); + } + return (0, e.decodeXML)(h); + } + t.decode = o; + function a(h, m) { + var g; + m === void 0 && (m = r.XML); + var w = typeof m == "number" ? { level: m } : m; + return (g = w.mode) !== null && g !== void 0 || (w.mode = e.DecodingMode.Strict), o(h, w); + } + t.decodeStrict = a; + function l(h, m) { + m === void 0 && (m = r.XML); + var g = typeof m == "number" ? { level: m } : m; + return g.mode === s.UTF8 ? (0, i.escapeUTF8)(h) : g.mode === s.Attribute ? (0, i.escapeAttribute)(h) : g.mode === s.Text ? (0, i.escapeText)(h) : g.level === r.HTML ? g.mode === s.ASCII ? (0, n.encodeNonAsciiHTML)(h) : (0, n.encodeHTML)(h) : (0, i.encodeXML)(h); + } + t.encode = l; + var u = Jy; + Object.defineProperty(t, "encodeXML", { enumerable: !0, get: function() { + return u.encodeXML; + } }), Object.defineProperty(t, "escape", { enumerable: !0, get: function() { + return u.escape; + } }), Object.defineProperty(t, "escapeUTF8", { enumerable: !0, get: function() { + return u.escapeUTF8; + } }), Object.defineProperty(t, "escapeAttribute", { enumerable: !0, get: function() { + return u.escapeAttribute; + } }), Object.defineProperty(t, "escapeText", { enumerable: !0, get: function() { + return u.escapeText; + } }); + var f = pf; + Object.defineProperty(t, "encodeHTML", { enumerable: !0, get: function() { + return f.encodeHTML; + } }), Object.defineProperty(t, "encodeNonAsciiHTML", { enumerable: !0, get: function() { + return f.encodeNonAsciiHTML; + } }), Object.defineProperty(t, "encodeHTML4", { enumerable: !0, get: function() { + return f.encodeHTML; + } }), Object.defineProperty(t, "encodeHTML5", { enumerable: !0, get: function() { + return f.encodeHTML; + } }); + var d = a4; + Object.defineProperty(t, "EntityDecoder", { enumerable: !0, get: function() { + return d.EntityDecoder; + } }), Object.defineProperty(t, "DecodingMode", { enumerable: !0, get: function() { + return d.DecodingMode; + } }), Object.defineProperty(t, "decodeXML", { enumerable: !0, get: function() { + return d.decodeXML; + } }), Object.defineProperty(t, "decodeHTML", { enumerable: !0, get: function() { + return d.decodeHTML; + } }), Object.defineProperty(t, "decodeHTMLStrict", { enumerable: !0, get: function() { + return d.decodeHTMLStrict; + } }), Object.defineProperty(t, "decodeHTMLAttribute", { enumerable: !0, get: function() { + return d.decodeHTMLAttribute; + } }), Object.defineProperty(t, "decodeHTML4", { enumerable: !0, get: function() { + return d.decodeHTML; + } }), Object.defineProperty(t, "decodeHTML5", { enumerable: !0, get: function() { + return d.decodeHTML; + } }), Object.defineProperty(t, "decodeHTML4Strict", { enumerable: !0, get: function() { + return d.decodeHTMLStrict; + } }), Object.defineProperty(t, "decodeHTML5Strict", { enumerable: !0, get: function() { + return d.decodeHTMLStrict; + } }), Object.defineProperty(t, "decodeXMLStrict", { enumerable: !0, get: function() { + return d.decodeXML; + } }); +})(XF); +var Wv = Nf; +function qie(t) { + const e = {}; + t = t || {}, e.src_Any = Wv.Any.source, e.src_Cc = Wv.Cc.source, e.src_Z = Wv.Z.source, e.src_P = Wv.P.source, e.src_ZPCc = [e.src_Z, e.src_P, e.src_Cc].join("|"), e.src_ZCc = [e.src_Z, e.src_Cc].join("|"); + const n = "[><|]"; + return e.src_pseudo_letter = "(?:(?!" + n + "|" + e.src_ZPCc + ")" + e.src_Any + ")", e.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", e.src_auth = "(?:(?:(?!" + e.src_ZCc + "|[@/\\[\\]()]).)+@)?", e.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?", e.src_host_terminator = "(?=$|" + n + "|" + e.src_ZPCc + ")(?!" + (t["---"] ? "-(?!--)|" : "-|") + "_|:\\d|\\.-|\\.(?!$|" + e.src_ZPCc + "))", e.src_path = "(?:[/?#](?:(?!" + e.src_ZCc + "|" + n + `|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!` + e.src_ZCc + "|\\]).)*\\]|\\((?:(?!" + e.src_ZCc + "|[)]).)*\\)|\\{(?:(?!" + e.src_ZCc + '|[}]).)*\\}|\\"(?:(?!' + e.src_ZCc + `|["]).)+\\"|\\'(?:(?!` + e.src_ZCc + "|[']).)+\\'|\\'(?=" + e.src_pseudo_letter + "|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!" + e.src_ZCc + "|[.]|$)|" + (t["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + // allow `,,,` in paths + ",(?!" + e.src_ZCc + "|$)|;(?!" + e.src_ZCc + "|$)|\\!+(?!" + e.src_ZCc + "|[!]|$)|\\?(?!" + e.src_ZCc + "|[?]|$))+|\\/)?", e.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*', e.src_xn = "xn--[a-z0-9\\-]{1,59}", e.src_domain_root = // Allow letters & digits (http://test1) + "(?:" + e.src_xn + "|" + e.src_pseudo_letter + "{1,63})", e.src_domain = "(?:" + e.src_xn + "|(?:" + e.src_pseudo_letter + ")|(?:" + e.src_pseudo_letter + "(?:-|" + e.src_pseudo_letter + "){0,61}" + e.src_pseudo_letter + "))", e.src_host = "(?:(?:(?:(?:" + e.src_domain + ")\\.)*" + e.src_domain + "))", e.tpl_host_fuzzy = "(?:" + e.src_ip4 + "|(?:(?:(?:" + e.src_domain + ")\\.)+(?:%TLDS%)))", e.tpl_host_no_ip_fuzzy = "(?:(?:(?:" + e.src_domain + ")\\.)+(?:%TLDS%))", e.src_host_strict = e.src_host + e.src_host_terminator, e.tpl_host_fuzzy_strict = e.tpl_host_fuzzy + e.src_host_terminator, e.src_host_port_strict = e.src_host + e.src_port + e.src_host_terminator, e.tpl_host_port_fuzzy_strict = e.tpl_host_fuzzy + e.src_port + e.src_host_terminator, e.tpl_host_port_no_ip_fuzzy_strict = e.tpl_host_no_ip_fuzzy + e.src_port + e.src_host_terminator, e.tpl_host_fuzzy_test = "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + e.src_ZPCc + "|>|$))", e.tpl_email_fuzzy = "(^|" + n + '|"|\\(|' + e.src_ZCc + ")(" + e.src_email_name + "@" + e.tpl_host_fuzzy_strict + ")", e.tpl_link_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation. + // but can start with > (markdown blockquote) + "(^|(?![.:/\\-_@])(?:[$+<=>^`||]|" + e.src_ZPCc + "))((?![$+<=>^`||])" + e.tpl_host_port_fuzzy_strict + e.src_path + ")", e.tpl_link_no_ip_fuzzy = // Fuzzy link can't be prepended with .:/\- and non punctuation. + // but can start with > (markdown blockquote) + "(^|(?![.:/\\-_@])(?:[$+<=>^`||]|" + e.src_ZPCc + "))((?![$+<=>^`||])" + e.tpl_host_port_no_ip_fuzzy_strict + e.src_path + ")", e; +} +function u4(t) { + return Array.prototype.slice.call(arguments, 1).forEach(function(n) { + n && Object.keys(n).forEach(function(i) { + t[i] = n[i]; + }); + }), t; +} +function Wk(t) { + return Object.prototype.toString.call(t); +} +function Yie(t) { + return Wk(t) === "[object String]"; +} +function Vie(t) { + return Wk(t) === "[object Object]"; +} +function Xie(t) { + return Wk(t) === "[object RegExp]"; +} +function kM(t) { + return Wk(t) === "[object Function]"; +} +function Gie(t) { + return t.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); +} +const JF = { + fuzzyLink: !0, + fuzzyEmail: !0, + fuzzyIP: !1 +}; +function Kie(t) { + return Object.keys(t || {}).reduce(function(e, n) { + return e || JF.hasOwnProperty(n); + }, !1); +} +const Jie = { + "http:": { + validate: function(t, e, n) { + const i = t.slice(e); + return n.re.http || (n.re.http = new RegExp( + "^\\/\\/" + n.re.src_auth + n.re.src_host_port_strict + n.re.src_path, + "i" + )), n.re.http.test(i) ? i.match(n.re.http)[0].length : 0; + } + }, + "https:": "http:", + "ftp:": "http:", + "//": { + validate: function(t, e, n) { + const i = t.slice(e); + return n.re.no_http || (n.re.no_http = new RegExp( + "^" + n.re.src_auth + // Don't allow single-level domains, because of false positives like '//test' + // with code comments + "(?:localhost|(?:(?:" + n.re.src_domain + ")\\.)+" + n.re.src_domain_root + ")" + n.re.src_port + n.re.src_host_terminator + n.re.src_path, + "i" + )), n.re.no_http.test(i) ? e >= 3 && t[e - 3] === ":" || e >= 3 && t[e - 3] === "/" ? 0 : i.match(n.re.no_http)[0].length : 0; + } + }, + "mailto:": { + validate: function(t, e, n) { + const i = t.slice(e); + return n.re.mailto || (n.re.mailto = new RegExp( + "^" + n.re.src_email_name + "@" + n.re.src_host_strict, + "i" + )), n.re.mailto.test(i) ? i.match(n.re.mailto)[0].length : 0; + } + } +}, ere = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]", tre = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|"); +function nre(t) { + t.__index__ = -1, t.__text_cache__ = ""; +} +function ire(t) { + return function(e, n) { + const i = e.slice(n); + return t.test(i) ? i.match(t)[0].length : 0; + }; +} +function xM() { + return function(t, e) { + e.normalize(t); + }; +} +function ew(t) { + const e = t.re = qie(t.__opts__), n = t.__tlds__.slice(); + t.onCompile(), t.__tlds_replaced__ || n.push(ere), n.push(e.src_xn), e.src_tlds = n.join("|"); + function i(a) { + return a.replace("%TLDS%", e.src_tlds); + } + e.email_fuzzy = RegExp(i(e.tpl_email_fuzzy), "i"), e.link_fuzzy = RegExp(i(e.tpl_link_fuzzy), "i"), e.link_no_ip_fuzzy = RegExp(i(e.tpl_link_no_ip_fuzzy), "i"), e.host_fuzzy_test = RegExp(i(e.tpl_host_fuzzy_test), "i"); + const r = []; + t.__compiled__ = {}; + function s(a, l) { + throw new Error('(LinkifyIt) Invalid schema "' + a + '": ' + l); + } + Object.keys(t.__schemas__).forEach(function(a) { + const l = t.__schemas__[a]; + if (l === null) + return; + const u = { validate: null, link: null }; + if (t.__compiled__[a] = u, Vie(l)) { + Xie(l.validate) ? u.validate = ire(l.validate) : kM(l.validate) ? u.validate = l.validate : s(a, l), kM(l.normalize) ? u.normalize = l.normalize : l.normalize ? s(a, l) : u.normalize = xM(); + return; + } + if (Yie(l)) { + r.push(a); + return; + } + s(a, l); + }), r.forEach(function(a) { + t.__compiled__[t.__schemas__[a]] && (t.__compiled__[a].validate = t.__compiled__[t.__schemas__[a]].validate, t.__compiled__[a].normalize = t.__compiled__[t.__schemas__[a]].normalize); + }), t.__compiled__[""] = { validate: null, normalize: xM() }; + const o = Object.keys(t.__compiled__).filter(function(a) { + return a.length > 0 && t.__compiled__[a]; + }).map(Gie).join("|"); + t.re.schema_test = RegExp("(^|(?!_)(?:[><|]|" + e.src_ZPCc + "))(" + o + ")", "i"), t.re.schema_search = RegExp("(^|(?!_)(?:[><|]|" + e.src_ZPCc + "))(" + o + ")", "ig"), t.re.schema_at_start = RegExp("^" + t.re.schema_search.source, "i"), t.re.pretest = RegExp( + "(" + t.re.schema_test.source + ")|(" + t.re.host_fuzzy_test.source + ")|@", + "i" + ), nre(t); +} +function rre(t, e) { + const n = t.__index__, i = t.__last_index__, r = t.__text_cache__.slice(n, i); + this.schema = t.__schema__.toLowerCase(), this.index = n + e, this.lastIndex = i + e, this.raw = r, this.text = r, this.url = r; +} +function c4(t, e) { + const n = new rre(t, e); + return t.__compiled__[n.schema].normalize(n, t), n; +} +function Ys(t, e) { + if (!(this instanceof Ys)) + return new Ys(t, e); + e || Kie(t) && (e = t, t = {}), this.__opts__ = u4({}, JF, e), this.__index__ = -1, this.__last_index__ = -1, this.__schema__ = "", this.__text_cache__ = "", this.__schemas__ = u4({}, Jie, t), this.__compiled__ = {}, this.__tlds__ = tre, this.__tlds_replaced__ = !1, this.re = {}, ew(this); +} +Ys.prototype.add = function(e, n) { + return this.__schemas__[e] = n, ew(this), this; +}; +Ys.prototype.set = function(e) { + return this.__opts__ = u4(this.__opts__, e), this; +}; +Ys.prototype.test = function(e) { + if (this.__text_cache__ = e, this.__index__ = -1, !e.length) + return !1; + let n, i, r, s, o, a, l, u, f; + if (this.re.schema_test.test(e)) { + for (l = this.re.schema_search, l.lastIndex = 0; (n = l.exec(e)) !== null; ) + if (s = this.testSchemaAt(e, n[2], l.lastIndex), s) { + this.__schema__ = n[2], this.__index__ = n.index + n[1].length, this.__last_index__ = n.index + n[0].length + s; + break; + } + } + return this.__opts__.fuzzyLink && this.__compiled__["http:"] && (u = e.search(this.re.host_fuzzy_test), u >= 0 && (this.__index__ < 0 || u < this.__index__) && (i = e.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null && (o = i.index + i[1].length, (this.__index__ < 0 || o < this.__index__) && (this.__schema__ = "", this.__index__ = o, this.__last_index__ = i.index + i[0].length))), this.__opts__.fuzzyEmail && this.__compiled__["mailto:"] && (f = e.indexOf("@"), f >= 0 && (r = e.match(this.re.email_fuzzy)) !== null && (o = r.index + r[1].length, a = r.index + r[0].length, (this.__index__ < 0 || o < this.__index__ || o === this.__index__ && a > this.__last_index__) && (this.__schema__ = "mailto:", this.__index__ = o, this.__last_index__ = a))), this.__index__ >= 0; +}; +Ys.prototype.pretest = function(e) { + return this.re.pretest.test(e); +}; +Ys.prototype.testSchemaAt = function(e, n, i) { + return this.__compiled__[n.toLowerCase()] ? this.__compiled__[n.toLowerCase()].validate(e, i, this) : 0; +}; +Ys.prototype.match = function(e) { + const n = []; + let i = 0; + this.__index__ >= 0 && this.__text_cache__ === e && (n.push(c4(this, i)), i = this.__last_index__); + let r = i ? e.slice(i) : e; + for (; this.test(r); ) + n.push(c4(this, i)), r = r.slice(this.__last_index__), i += this.__last_index__; + return n.length ? n : null; +}; +Ys.prototype.matchAtStart = function(e) { + if (this.__text_cache__ = e, this.__index__ = -1, !e.length) return null; + const n = this.re.schema_at_start.exec(e); + if (!n) return null; + const i = this.testSchemaAt(e, n[2], n[0].length); + return i ? (this.__schema__ = n[2], this.__index__ = n.index + n[1].length, this.__last_index__ = n.index + n[0].length + i, c4(this, 0)) : null; +}; +Ys.prototype.tlds = function(e, n) { + return e = Array.isArray(e) ? e : [e], n ? (this.__tlds__ = this.__tlds__.concat(e).sort().filter(function(i, r, s) { + return i !== s[r - 1]; + }).reverse(), ew(this), this) : (this.__tlds__ = e.slice(), this.__tlds_replaced__ = !0, ew(this), this); +}; +Ys.prototype.normalize = function(e) { + e.schema || (e.url = "http://" + e.url), e.schema === "mailto:" && !/^mailto:/i.test(e.url) && (e.url = "mailto:" + e.url); +}; +Ys.prototype.onCompile = function() { +}; +var sre = Ys; +const lh = 2147483647, ba = 36, g5 = 1, Kg = 26, ore = 38, are = 700, eB = 72, tB = 128, nB = "-", lre = /^xn--/, ure = /[^\0-\x7F]/, cre = /[\x2E\u3002\uFF0E\uFF61]/g, fre = { + overflow: "Overflow: input needs wider integers to process", + "not-basic": "Illegal input >= 0x80 (not a basic code point)", + "invalid-input": "Invalid input" +}, p3 = ba - g5, ya = Math.floor, m3 = String.fromCharCode; +function du(t) { + throw new RangeError(fre[t]); +} +function dre(t, e) { + const n = []; + let i = t.length; + for (; i--; ) + n[i] = e(t[i]); + return n; +} +function iB(t, e) { + const n = t.split("@"); + let i = ""; + n.length > 1 && (i = n[0] + "@", t = n[1]), t = t.replace(cre, "."); + const r = t.split("."), s = dre(r, e).join("."); + return i + s; +} +function v5(t) { + const e = []; + let n = 0; + const i = t.length; + for (; n < i; ) { + const r = t.charCodeAt(n++); + if (r >= 55296 && r <= 56319 && n < i) { + const s = t.charCodeAt(n++); + (s & 64512) == 56320 ? e.push(((r & 1023) << 10) + (s & 1023) + 65536) : (e.push(r), n--); + } else + e.push(r); + } + return e; +} +const rB = (t) => String.fromCodePoint(...t), hre = function(t) { + return t >= 48 && t < 58 ? 26 + (t - 48) : t >= 65 && t < 91 ? t - 65 : t >= 97 && t < 123 ? t - 97 : ba; +}, _M = function(t, e) { + return t + 22 + 75 * (t < 26) - ((e != 0) << 5); +}, sB = function(t, e, n) { + let i = 0; + for (t = n ? ya(t / are) : t >> 1, t += ya(t / e); t > p3 * Kg >> 1; i += ba) + t = ya(t / p3); + return ya(i + (p3 + 1) * t / (t + ore)); +}, b5 = function(t) { + const e = [], n = t.length; + let i = 0, r = tB, s = eB, o = t.lastIndexOf(nB); + o < 0 && (o = 0); + for (let a = 0; a < o; ++a) + t.charCodeAt(a) >= 128 && du("not-basic"), e.push(t.charCodeAt(a)); + for (let a = o > 0 ? o + 1 : 0; a < n; ) { + const l = i; + for (let f = 1, d = ba; ; d += ba) { + a >= n && du("invalid-input"); + const h = hre(t.charCodeAt(a++)); + h >= ba && du("invalid-input"), h > ya((lh - i) / f) && du("overflow"), i += h * f; + const m = d <= s ? g5 : d >= s + Kg ? Kg : d - s; + if (h < m) + break; + const g = ba - m; + f > ya(lh / g) && du("overflow"), f *= g; + } + const u = e.length + 1; + s = sB(i - l, u, l == 0), ya(i / u) > lh - r && du("overflow"), r += ya(i / u), i %= u, e.splice(i++, 0, r); + } + return String.fromCodePoint(...e); +}, y5 = function(t) { + const e = []; + t = v5(t); + const n = t.length; + let i = tB, r = 0, s = eB; + for (const l of t) + l < 128 && e.push(m3(l)); + const o = e.length; + let a = o; + for (o && e.push(nB); a < n; ) { + let l = lh; + for (const f of t) + f >= i && f < l && (l = f); + const u = a + 1; + l - i > ya((lh - r) / u) && du("overflow"), r += (l - i) * u, i = l; + for (const f of t) + if (f < i && ++r > lh && du("overflow"), f === i) { + let d = r; + for (let h = ba; ; h += ba) { + const m = h <= s ? g5 : h >= s + Kg ? Kg : h - s; + if (d < m) + break; + const g = d - m, w = ba - m; + e.push( + m3(_M(m + g % w, 0)) + ), d = ya(g / w); + } + e.push(m3(_M(d, 0))), s = sB(r, u, a === o), r = 0, ++a; + } + ++r, ++i; + } + return e.join(""); +}, oB = function(t) { + return iB(t, function(e) { + return lre.test(e) ? b5(e.slice(4).toLowerCase()) : e; + }); +}, aB = function(t) { + return iB(t, function(e) { + return ure.test(e) ? "xn--" + y5(e) : e; + }); +}, pre = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + version: "2.3.1", + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + ucs2: { + decode: v5, + encode: rB + }, + decode: b5, + encode: y5, + toASCII: aB, + toUnicode: oB +}, mre = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + decode: b5, + default: pre, + encode: y5, + toASCII: aB, + toUnicode: oB, + ucs2decode: v5, + ucs2encode: rB +}, Symbol.toStringTag, { value: "Module" })), gre = /* @__PURE__ */ Sk(mre); +var vre = s1, bre = Nf, lB = XF, yre = sre, uB = gre; +function cB(t) { + var e = /* @__PURE__ */ Object.create(null); + return t && Object.keys(t).forEach(function(n) { + if (n !== "default") { + var i = Object.getOwnPropertyDescriptor(t, n); + Object.defineProperty(e, n, i.get ? i : { + enumerable: !0, + get: function() { + return t[n]; + } + }); + } + }), e.default = t, Object.freeze(e); +} +var _u = /* @__PURE__ */ cB(vre), fB = /* @__PURE__ */ cB(bre); +function wre(t) { + return Object.prototype.toString.call(t); +} +function w5(t) { + return wre(t) === "[object String]"; +} +const kre = Object.prototype.hasOwnProperty; +function xre(t, e) { + return kre.call(t, e); +} +function Hk(t) { + return Array.prototype.slice.call(arguments, 1).forEach(function(n) { + if (n) { + if (typeof n != "object") + throw new TypeError(n + "must be object"); + Object.keys(n).forEach(function(i) { + t[i] = n[i]; + }); + } + }), t; +} +function dB(t, e, n) { + return [].concat(t.slice(0, e), n, t.slice(e + 1)); +} +function k5(t) { + return !(t >= 55296 && t <= 57343 || t >= 64976 && t <= 65007 || (t & 65535) === 65535 || (t & 65535) === 65534 || t >= 0 && t <= 8 || t === 11 || t >= 14 && t <= 31 || t >= 127 && t <= 159 || t > 1114111); +} +function tw(t) { + if (t > 65535) { + t -= 65536; + const e = 55296 + (t >> 10), n = 56320 + (t & 1023); + return String.fromCharCode(e, n); + } + return String.fromCharCode(t); +} +const hB = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g, _re = /&([a-z#][a-z0-9]{1,31});/gi, Ore = new RegExp(hB.source + "|" + _re.source, "gi"), Sre = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i; +function Cre(t, e) { + if (e.charCodeAt(0) === 35 && Sre.test(e)) { + const i = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10); + return k5(i) ? tw(i) : t; + } + const n = lB.decodeHTML(t); + return n !== t ? n : t; +} +function Ere(t) { + return t.indexOf("\\") < 0 ? t : t.replace(hB, "$1"); +} +function Jg(t) { + return t.indexOf("\\") < 0 && t.indexOf("&") < 0 ? t : t.replace(Ore, function(e, n, i) { + return n || Cre(e, i); + }); +} +const Tre = /[&<>"]/, $re = /[&<>"]/g, Mre = { + "&": "&", + "<": "<", + ">": ">", + '"': """ +}; +function Nre(t) { + return Mre[t]; +} +function Uu(t) { + return Tre.test(t) ? t.replace($re, Nre) : t; +} +const Are = /[.?*+^$[\]\\(){}|-]/g; +function Dre(t) { + return t.replace(Are, "\\$&"); +} +function mn(t) { + switch (t) { + case 9: + case 32: + return !0; + } + return !1; +} +function e0(t) { + if (t >= 8192 && t <= 8202) + return !0; + switch (t) { + case 9: + case 10: + case 11: + case 12: + case 13: + case 32: + case 160: + case 5760: + case 8239: + case 8287: + case 12288: + return !0; + } + return !1; +} +function t0(t) { + return fB.P.test(t); +} +function n0(t) { + switch (t) { + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 123: + case 124: + case 125: + case 126: + return !0; + default: + return !1; + } +} +function Qk(t) { + return t = t.trim().replace(/\s+/g, " "), "ẞ".toLowerCase() === "Ṿ" && (t = t.replace(/ẞ/g, "ß")), t.toLowerCase().toUpperCase(); +} +const Pre = { + mdurl: _u, + ucmicro: fB +}; +var Ire = /* @__PURE__ */ Object.freeze({ + __proto__: null, + arrayReplaceAt: dB, + assign: Hk, + escapeHtml: Uu, + escapeRE: Dre, + fromCodePoint: tw, + has: xre, + isMdAsciiPunct: n0, + isPunctChar: t0, + isSpace: mn, + isString: w5, + isValidEntityCode: k5, + isWhiteSpace: e0, + lib: Pre, + normalizeReference: Qk, + unescapeAll: Jg, + unescapeMd: Ere +}); +function Lre(t, e, n) { + let i, r, s, o; + const a = t.posMax, l = t.pos; + for (t.pos = e + 1, i = 1; t.pos < a; ) { + if (s = t.src.charCodeAt(t.pos), s === 93 && (i--, i === 0)) { + r = !0; + break; + } + if (o = t.pos, t.md.inline.skipToken(t), s === 91) { + if (o === t.pos - 1) + i++; + else if (n) + return t.pos = l, -1; + } + } + let u = -1; + return r && (u = t.pos), t.pos = l, u; +} +function Rre(t, e, n) { + let i, r = e; + const s = { + ok: !1, + pos: 0, + lines: 0, + str: "" + }; + if (t.charCodeAt(r) === 60) { + for (r++; r < n; ) { + if (i = t.charCodeAt(r), i === 10 || i === 60) + return s; + if (i === 62) + return s.pos = r + 1, s.str = Jg(t.slice(e + 1, r)), s.ok = !0, s; + if (i === 92 && r + 1 < n) { + r += 2; + continue; + } + r++; + } + return s; + } + let o = 0; + for (; r < n && (i = t.charCodeAt(r), !(i === 32 || i < 32 || i === 127)); ) { + if (i === 92 && r + 1 < n) { + if (t.charCodeAt(r + 1) === 32) + break; + r += 2; + continue; + } + if (i === 40 && (o++, o > 32)) + return s; + if (i === 41) { + if (o === 0) + break; + o--; + } + r++; + } + return e === r || o !== 0 || (s.str = Jg(t.slice(e, r)), s.pos = r, s.ok = !0), s; +} +function jre(t, e, n) { + let i, r, s = 0, o = e; + const a = { + ok: !1, + pos: 0, + lines: 0, + str: "" + }; + if (o >= n || (r = t.charCodeAt(o), r !== 34 && r !== 39 && r !== 40)) + return a; + for (o++, r === 40 && (r = 41); o < n; ) { + if (i = t.charCodeAt(o), i === r) + return a.pos = o + 1, a.lines = s, a.str = Jg(t.slice(e + 1, o)), a.ok = !0, a; + if (i === 40 && r === 41) + return a; + i === 10 ? s++ : i === 92 && o + 1 < n && (o++, t.charCodeAt(o) === 10 && s++), o++; + } + return a; +} +var Fre = /* @__PURE__ */ Object.freeze({ + __proto__: null, + parseLinkDestination: Rre, + parseLinkLabel: Lre, + parseLinkTitle: jre +}); +const ja = {}; +ja.code_inline = function(t, e, n, i, r) { + const s = t[e]; + return "" + Uu(s.content) + ""; +}; +ja.code_block = function(t, e, n, i, r) { + const s = t[e]; + return "" + Uu(t[e].content) + ` +`; +}; +ja.fence = function(t, e, n, i, r) { + const s = t[e], o = s.info ? Jg(s.info).trim() : ""; + let a = "", l = ""; + if (o) { + const f = o.split(/(\s+)/g); + a = f[0], l = f.slice(2).join(""); + } + let u; + if (n.highlight ? u = n.highlight(s.content, a, l) || Uu(s.content) : u = Uu(s.content), u.indexOf("${u} +`; + } + return `
    ${u}
    +`; +}; +ja.image = function(t, e, n, i, r) { + const s = t[e]; + return s.attrs[s.attrIndex("alt")][1] = r.renderInlineAsText(s.children, n, i), r.renderToken(t, e, n); +}; +ja.hardbreak = function(t, e, n) { + return n.xhtmlOut ? `
    +` : `
    +`; +}; +ja.softbreak = function(t, e, n) { + return n.breaks ? n.xhtmlOut ? `
    +` : `
    +` : ` +`; +}; +ja.text = function(t, e) { + return Uu(t[e].content); +}; +ja.html_block = function(t, e) { + return t[e].content; +}; +ja.html_inline = function(t, e) { + return t[e].content; +}; +function Kh() { + this.rules = Hk({}, ja); +} +Kh.prototype.renderAttrs = function(e) { + let n, i, r; + if (!e.attrs) + return ""; + for (r = "", n = 0, i = e.attrs.length; n < i; n++) + r += " " + Uu(e.attrs[n][0]) + '="' + Uu(e.attrs[n][1]) + '"'; + return r; +}; +Kh.prototype.renderToken = function(e, n, i) { + const r = e[n]; + let s = ""; + if (r.hidden) + return ""; + r.block && r.nesting !== -1 && n && e[n - 1].hidden && (s += ` +`), s += (r.nesting === -1 ? " +` : ">", s; +}; +Kh.prototype.renderInline = function(t, e, n) { + let i = ""; + const r = this.rules; + for (let s = 0, o = t.length; s < o; s++) { + const a = t[s].type; + typeof r[a] < "u" ? i += r[a](t, s, e, n, this) : i += this.renderToken(t, s, e); + } + return i; +}; +Kh.prototype.renderInlineAsText = function(t, e, n) { + let i = ""; + for (let r = 0, s = t.length; r < s; r++) + switch (t[r].type) { + case "text": + i += t[r].content; + break; + case "image": + i += this.renderInlineAsText(t[r].children, e, n); + break; + case "html_inline": + case "html_block": + i += t[r].content; + break; + case "softbreak": + case "hardbreak": + i += ` +`; + break; + } + return i; +}; +Kh.prototype.render = function(t, e, n) { + let i = ""; + const r = this.rules; + for (let s = 0, o = t.length; s < o; s++) { + const a = t[s].type; + a === "inline" ? i += this.renderInline(t[s].children, e, n) : typeof r[a] < "u" ? i += r[a](t, s, e, n, this) : i += this.renderToken(t, s, e, n); + } + return i; +}; +function xs() { + this.__rules__ = [], this.__cache__ = null; +} +xs.prototype.__find__ = function(t) { + for (let e = 0; e < this.__rules__.length; e++) + if (this.__rules__[e].name === t) + return e; + return -1; +}; +xs.prototype.__compile__ = function() { + const t = this, e = [""]; + t.__rules__.forEach(function(n) { + n.enabled && n.alt.forEach(function(i) { + e.indexOf(i) < 0 && e.push(i); + }); + }), t.__cache__ = {}, e.forEach(function(n) { + t.__cache__[n] = [], t.__rules__.forEach(function(i) { + i.enabled && (n && i.alt.indexOf(n) < 0 || t.__cache__[n].push(i.fn)); + }); + }); +}; +xs.prototype.at = function(t, e, n) { + const i = this.__find__(t), r = n || {}; + if (i === -1) + throw new Error("Parser rule not found: " + t); + this.__rules__[i].fn = e, this.__rules__[i].alt = r.alt || [], this.__cache__ = null; +}; +xs.prototype.before = function(t, e, n, i) { + const r = this.__find__(t), s = i || {}; + if (r === -1) + throw new Error("Parser rule not found: " + t); + this.__rules__.splice(r, 0, { + name: e, + enabled: !0, + fn: n, + alt: s.alt || [] + }), this.__cache__ = null; +}; +xs.prototype.after = function(t, e, n, i) { + const r = this.__find__(t), s = i || {}; + if (r === -1) + throw new Error("Parser rule not found: " + t); + this.__rules__.splice(r + 1, 0, { + name: e, + enabled: !0, + fn: n, + alt: s.alt || [] + }), this.__cache__ = null; +}; +xs.prototype.push = function(t, e, n) { + const i = n || {}; + this.__rules__.push({ + name: t, + enabled: !0, + fn: e, + alt: i.alt || [] + }), this.__cache__ = null; +}; +xs.prototype.enable = function(t, e) { + Array.isArray(t) || (t = [t]); + const n = []; + return t.forEach(function(i) { + const r = this.__find__(i); + if (r < 0) { + if (e) + return; + throw new Error("Rules manager: invalid rule name " + i); + } + this.__rules__[r].enabled = !0, n.push(i); + }, this), this.__cache__ = null, n; +}; +xs.prototype.enableOnly = function(t, e) { + Array.isArray(t) || (t = [t]), this.__rules__.forEach(function(n) { + n.enabled = !1; + }), this.enable(t, e); +}; +xs.prototype.disable = function(t, e) { + Array.isArray(t) || (t = [t]); + const n = []; + return t.forEach(function(i) { + const r = this.__find__(i); + if (r < 0) { + if (e) + return; + throw new Error("Rules manager: invalid rule name " + i); + } + this.__rules__[r].enabled = !1, n.push(i); + }, this), this.__cache__ = null, n; +}; +xs.prototype.getRules = function(t) { + return this.__cache__ === null && this.__compile__(), this.__cache__[t] || []; +}; +function Qo(t, e, n) { + this.type = t, this.tag = e, this.attrs = null, this.map = null, this.nesting = n, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1; +} +Qo.prototype.attrIndex = function(e) { + if (!this.attrs) + return -1; + const n = this.attrs; + for (let i = 0, r = n.length; i < r; i++) + if (n[i][0] === e) + return i; + return -1; +}; +Qo.prototype.attrPush = function(e) { + this.attrs ? this.attrs.push(e) : this.attrs = [e]; +}; +Qo.prototype.attrSet = function(e, n) { + const i = this.attrIndex(e), r = [e, n]; + i < 0 ? this.attrPush(r) : this.attrs[i] = r; +}; +Qo.prototype.attrGet = function(e) { + const n = this.attrIndex(e); + let i = null; + return n >= 0 && (i = this.attrs[n][1]), i; +}; +Qo.prototype.attrJoin = function(e, n) { + const i = this.attrIndex(e); + i < 0 ? this.attrPush([e, n]) : this.attrs[i][1] = this.attrs[i][1] + " " + n; +}; +function pB(t, e, n) { + this.src = t, this.env = n, this.tokens = [], this.inlineMode = !1, this.md = e; +} +pB.prototype.Token = Qo; +const Bre = /\r\n?|\n/g, zre = /\0/g; +function Wre(t) { + let e; + e = t.src.replace(Bre, ` +`), e = e.replace(zre, "�"), t.src = e; +} +function Hre(t) { + let e; + t.inlineMode ? (e = new t.Token("inline", "", 0), e.content = t.src, e.map = [0, 1], e.children = [], t.tokens.push(e)) : t.md.block.parse(t.src, t.md, t.env, t.tokens); +} +function Qre(t) { + const e = t.tokens; + for (let n = 0, i = e.length; n < i; n++) { + const r = e[n]; + r.type === "inline" && t.md.inline.parse(r.content, t.md, t.env, r.children); + } +} +function Ure(t) { + return /^\s]/i.test(t); +} +function Zre(t) { + return /^<\/a\s*>/i.test(t); +} +function qre(t) { + const e = t.tokens; + if (t.md.options.linkify) + for (let n = 0, i = e.length; n < i; n++) { + if (e[n].type !== "inline" || !t.md.linkify.pretest(e[n].content)) + continue; + let r = e[n].children, s = 0; + for (let o = r.length - 1; o >= 0; o--) { + const a = r[o]; + if (a.type === "link_close") { + for (o--; r[o].level !== a.level && r[o].type !== "link_open"; ) + o--; + continue; + } + if (a.type === "html_inline" && (Ure(a.content) && s > 0 && s--, Zre(a.content) && s++), !(s > 0) && a.type === "text" && t.md.linkify.test(a.content)) { + const l = a.content; + let u = t.md.linkify.match(l); + const f = []; + let d = a.level, h = 0; + u.length > 0 && u[0].index === 0 && o > 0 && r[o - 1].type === "text_special" && (u = u.slice(1)); + for (let m = 0; m < u.length; m++) { + const g = u[m].url, w = t.md.normalizeLink(g); + if (!t.md.validateLink(w)) + continue; + let x = u[m].text; + u[m].schema ? u[m].schema === "mailto:" && !/^mailto:/i.test(x) ? x = t.md.normalizeLinkText("mailto:" + x).replace(/^mailto:/, "") : x = t.md.normalizeLinkText(x) : x = t.md.normalizeLinkText("http://" + x).replace(/^http:\/\//, ""); + const _ = u[m].index; + if (_ > h) { + const M = new t.Token("text", "", 0); + M.content = l.slice(h, _), M.level = d, f.push(M); + } + const S = new t.Token("link_open", "a", 1); + S.attrs = [["href", w]], S.level = d++, S.markup = "linkify", S.info = "auto", f.push(S); + const C = new t.Token("text", "", 0); + C.content = x, C.level = d, f.push(C); + const E = new t.Token("link_close", "a", -1); + E.level = --d, E.markup = "linkify", E.info = "auto", f.push(E), h = u[m].lastIndex; + } + if (h < l.length) { + const m = new t.Token("text", "", 0); + m.content = l.slice(h), m.level = d, f.push(m); + } + e[n].children = r = dB(r, o, f); + } + } + } +} +const mB = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/, Yre = /\((c|tm|r)\)/i, Vre = /\((c|tm|r)\)/ig, Xre = { + c: "©", + r: "®", + tm: "™" +}; +function Gre(t, e) { + return Xre[e.toLowerCase()]; +} +function Kre(t) { + let e = 0; + for (let n = t.length - 1; n >= 0; n--) { + const i = t[n]; + i.type === "text" && !e && (i.content = i.content.replace(Vre, Gre)), i.type === "link_open" && i.info === "auto" && e--, i.type === "link_close" && i.info === "auto" && e++; + } +} +function Jre(t) { + let e = 0; + for (let n = t.length - 1; n >= 0; n--) { + const i = t[n]; + i.type === "text" && !e && mB.test(i.content) && (i.content = i.content.replace(/\+-/g, "±").replace(/\.{2,}/g, "…").replace(/([?!])…/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(/(^|[^-])---(?=[^-]|$)/mg, "$1—").replace(/(^|\s)--(?=\s|$)/mg, "$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg, "$1–")), i.type === "link_open" && i.info === "auto" && e--, i.type === "link_close" && i.info === "auto" && e++; + } +} +function ese(t) { + let e; + if (t.md.options.typographer) + for (e = t.tokens.length - 1; e >= 0; e--) + t.tokens[e].type === "inline" && (Yre.test(t.tokens[e].content) && Kre(t.tokens[e].children), mB.test(t.tokens[e].content) && Jre(t.tokens[e].children)); +} +const tse = /['"]/, OM = /['"]/g, SM = "’"; +function Hv(t, e, n) { + return t.slice(0, e) + n + t.slice(e + 1); +} +function nse(t, e) { + let n; + const i = []; + for (let r = 0; r < t.length; r++) { + const s = t[r], o = t[r].level; + for (n = i.length - 1; n >= 0 && !(i[n].level <= o); n--) + ; + if (i.length = n + 1, s.type !== "text") + continue; + let a = s.content, l = 0, u = a.length; + e: for (; l < u; ) { + OM.lastIndex = l; + const f = OM.exec(a); + if (!f) + break; + let d = !0, h = !0; + l = f.index + 1; + const m = f[0] === "'"; + let g = 32; + if (f.index - 1 >= 0) + g = a.charCodeAt(f.index - 1); + else + for (n = r - 1; n >= 0 && !(t[n].type === "softbreak" || t[n].type === "hardbreak"); n--) + if (t[n].content) { + g = t[n].content.charCodeAt(t[n].content.length - 1); + break; + } + let w = 32; + if (l < u) + w = a.charCodeAt(l); + else + for (n = r + 1; n < t.length && !(t[n].type === "softbreak" || t[n].type === "hardbreak"); n++) + if (t[n].content) { + w = t[n].content.charCodeAt(0); + break; + } + const x = n0(g) || t0(String.fromCharCode(g)), _ = n0(w) || t0(String.fromCharCode(w)), S = e0(g), C = e0(w); + if (C ? d = !1 : _ && (S || x || (d = !1)), S ? h = !1 : x && (C || _ || (h = !1)), w === 34 && f[0] === '"' && g >= 48 && g <= 57 && (h = d = !1), d && h && (d = x, h = _), !d && !h) { + m && (s.content = Hv(s.content, f.index, SM)); + continue; + } + if (h) + for (n = i.length - 1; n >= 0; n--) { + let E = i[n]; + if (i[n].level < o) + break; + if (E.single === m && i[n].level === o) { + E = i[n]; + let M, $; + m ? (M = e.md.options.quotes[2], $ = e.md.options.quotes[3]) : (M = e.md.options.quotes[0], $ = e.md.options.quotes[1]), s.content = Hv(s.content, f.index, $), t[E.token].content = Hv(t[E.token].content, E.pos, M), l += $.length - 1, E.token === r && (l += M.length - 1), a = s.content, u = a.length, i.length = n; + continue e; + } + } + d ? i.push({ + token: r, + pos: f.index, + single: m, + level: o + }) : h && m && (s.content = Hv(s.content, f.index, SM)); + } + } +} +function ise(t) { + if (t.md.options.typographer) + for (let e = t.tokens.length - 1; e >= 0; e--) + t.tokens[e].type !== "inline" || !tse.test(t.tokens[e].content) || nse(t.tokens[e].children, t); +} +function rse(t) { + let e, n; + const i = t.tokens, r = i.length; + for (let s = 0; s < r; s++) { + if (i[s].type !== "inline") continue; + const o = i[s].children, a = o.length; + for (e = 0; e < a; e++) + o[e].type === "text_special" && (o[e].type = "text"); + for (e = n = 0; e < a; e++) + o[e].type === "text" && e + 1 < a && o[e + 1].type === "text" ? o[e + 1].content = o[e].content + o[e + 1].content : (e !== n && (o[n] = o[e]), n++); + e !== n && (o.length = n); + } +} +const g3 = [ + ["normalize", Wre], + ["block", Hre], + ["inline", Qre], + ["linkify", qre], + ["replacements", ese], + ["smartquotes", ise], + // `text_join` finds `text_special` tokens (for escape sequences) + // and joins them with the rest of the text + ["text_join", rse] +]; +function x5() { + this.ruler = new xs(); + for (let t = 0; t < g3.length; t++) + this.ruler.push(g3[t][0], g3[t][1]); +} +x5.prototype.process = function(t) { + const e = this.ruler.getRules(""); + for (let n = 0, i = e.length; n < i; n++) + e[n](t); +}; +x5.prototype.State = pB; +function Fa(t, e, n, i) { + this.src = t, this.md = e, this.env = n, this.tokens = i, this.bMarks = [], this.eMarks = [], this.tShift = [], this.sCount = [], this.bsCount = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.ddIndent = -1, this.listIndent = -1, this.parentType = "root", this.level = 0; + const r = this.src; + for (let s = 0, o = 0, a = 0, l = 0, u = r.length, f = !1; o < u; o++) { + const d = r.charCodeAt(o); + if (!f) + if (mn(d)) { + a++, d === 9 ? l += 4 - l % 4 : l++; + continue; + } else + f = !0; + (d === 10 || o === u - 1) && (d !== 10 && o++, this.bMarks.push(s), this.eMarks.push(o), this.tShift.push(a), this.sCount.push(l), this.bsCount.push(0), f = !1, a = 0, l = 0, s = o + 1); + } + this.bMarks.push(r.length), this.eMarks.push(r.length), this.tShift.push(0), this.sCount.push(0), this.bsCount.push(0), this.lineMax = this.bMarks.length - 1; +} +Fa.prototype.push = function(t, e, n) { + const i = new Qo(t, e, n); + return i.block = !0, n < 0 && this.level--, i.level = this.level, n > 0 && this.level++, this.tokens.push(i), i; +}; +Fa.prototype.isEmpty = function(e) { + return this.bMarks[e] + this.tShift[e] >= this.eMarks[e]; +}; +Fa.prototype.skipEmptyLines = function(e) { + for (let n = this.lineMax; e < n && !(this.bMarks[e] + this.tShift[e] < this.eMarks[e]); e++) + ; + return e; +}; +Fa.prototype.skipSpaces = function(e) { + for (let n = this.src.length; e < n; e++) { + const i = this.src.charCodeAt(e); + if (!mn(i)) + break; + } + return e; +}; +Fa.prototype.skipSpacesBack = function(e, n) { + if (e <= n) + return e; + for (; e > n; ) + if (!mn(this.src.charCodeAt(--e))) + return e + 1; + return e; +}; +Fa.prototype.skipChars = function(e, n) { + for (let i = this.src.length; e < i && this.src.charCodeAt(e) === n; e++) + ; + return e; +}; +Fa.prototype.skipCharsBack = function(e, n, i) { + if (e <= i) + return e; + for (; e > i; ) + if (n !== this.src.charCodeAt(--e)) + return e + 1; + return e; +}; +Fa.prototype.getLines = function(e, n, i, r) { + if (e >= n) + return ""; + const s = new Array(n - e); + for (let o = 0, a = e; a < n; a++, o++) { + let l = 0; + const u = this.bMarks[a]; + let f = u, d; + for (a + 1 < n || r ? d = this.eMarks[a] + 1 : d = this.eMarks[a]; f < d && l < i; ) { + const h = this.src.charCodeAt(f); + if (mn(h)) + h === 9 ? l += 4 - (l + this.bsCount[a]) % 4 : l++; + else if (f - u < this.tShift[a]) + l++; + else + break; + f++; + } + l > i ? s[o] = new Array(l - i + 1).join(" ") + this.src.slice(f, d) : s[o] = this.src.slice(f, d); + } + return s.join(""); +}; +Fa.prototype.Token = Qo; +function v3(t, e) { + const n = t.bMarks[e] + t.tShift[e], i = t.eMarks[e]; + return t.src.slice(n, i); +} +function CM(t) { + const e = [], n = t.length; + let i = 0, r = t.charCodeAt(i), s = !1, o = 0, a = ""; + for (; i < n; ) + r === 124 && (s ? (a += t.substring(o, i - 1), o = i) : (e.push(a + t.substring(o, i)), a = "", o = i + 1)), s = r === 92, i++, r = t.charCodeAt(i); + return e.push(a + t.substring(o)), e; +} +function sse(t, e, n, i) { + if (e + 2 > n) + return !1; + let r = e + 1; + if (t.sCount[r] < t.blkIndent || t.sCount[r] - t.blkIndent >= 4) + return !1; + let s = t.bMarks[r] + t.tShift[r]; + if (s >= t.eMarks[r]) + return !1; + const o = t.src.charCodeAt(s++); + if (o !== 124 && o !== 45 && o !== 58 || s >= t.eMarks[r]) + return !1; + const a = t.src.charCodeAt(s++); + if (a !== 124 && a !== 45 && a !== 58 && !mn(a) || o === 45 && mn(a)) + return !1; + for (; s < t.eMarks[r]; ) { + const C = t.src.charCodeAt(s); + if (C !== 124 && C !== 45 && C !== 58 && !mn(C)) + return !1; + s++; + } + let l = v3(t, e + 1), u = l.split("|"); + const f = []; + for (let C = 0; C < u.length; C++) { + const E = u[C].trim(); + if (!E) { + if (C === 0 || C === u.length - 1) + continue; + return !1; + } + if (!/^:?-+:?$/.test(E)) + return !1; + E.charCodeAt(E.length - 1) === 58 ? f.push(E.charCodeAt(0) === 58 ? "center" : "right") : E.charCodeAt(0) === 58 ? f.push("left") : f.push(""); + } + if (l = v3(t, e).trim(), l.indexOf("|") === -1 || t.sCount[e] - t.blkIndent >= 4) + return !1; + u = CM(l), u.length && u[0] === "" && u.shift(), u.length && u[u.length - 1] === "" && u.pop(); + const d = u.length; + if (d === 0 || d !== f.length) + return !1; + if (i) + return !0; + const h = t.parentType; + t.parentType = "table"; + const m = t.md.block.ruler.getRules("blockquote"), g = t.push("table_open", "table", 1), w = [e, 0]; + g.map = w; + const x = t.push("thead_open", "thead", 1); + x.map = [e, e + 1]; + const _ = t.push("tr_open", "tr", 1); + _.map = [e, e + 1]; + for (let C = 0; C < u.length; C++) { + const E = t.push("th_open", "th", 1); + f[C] && (E.attrs = [["style", "text-align:" + f[C]]]); + const M = t.push("inline", "", 0); + M.content = u[C].trim(), M.children = [], t.push("th_close", "th", -1); + } + t.push("tr_close", "tr", -1), t.push("thead_close", "thead", -1); + let S; + for (r = e + 2; r < n && !(t.sCount[r] < t.blkIndent); r++) { + let C = !1; + for (let M = 0, $ = m.length; M < $; M++) + if (m[M](t, r, n, !0)) { + C = !0; + break; + } + if (C || (l = v3(t, r).trim(), !l) || t.sCount[r] - t.blkIndent >= 4) + break; + if (u = CM(l), u.length && u[0] === "" && u.shift(), u.length && u[u.length - 1] === "" && u.pop(), r === e + 2) { + const M = t.push("tbody_open", "tbody", 1); + M.map = S = [e + 2, 0]; + } + const E = t.push("tr_open", "tr", 1); + E.map = [r, r + 1]; + for (let M = 0; M < d; M++) { + const $ = t.push("td_open", "td", 1); + f[M] && ($.attrs = [["style", "text-align:" + f[M]]]); + const P = t.push("inline", "", 0); + P.content = u[M] ? u[M].trim() : "", P.children = [], t.push("td_close", "td", -1); + } + t.push("tr_close", "tr", -1); + } + return S && (t.push("tbody_close", "tbody", -1), S[1] = r), t.push("table_close", "table", -1), w[1] = r, t.parentType = h, t.line = r, !0; +} +function ose(t, e, n) { + if (t.sCount[e] - t.blkIndent < 4) + return !1; + let i = e + 1, r = i; + for (; i < n; ) { + if (t.isEmpty(i)) { + i++; + continue; + } + if (t.sCount[i] - t.blkIndent >= 4) { + i++, r = i; + continue; + } + break; + } + t.line = r; + const s = t.push("code_block", "code", 0); + return s.content = t.getLines(e, r, 4 + t.blkIndent, !1) + ` +`, s.map = [e, t.line], !0; +} +function ase(t, e, n, i) { + let r = t.bMarks[e] + t.tShift[e], s = t.eMarks[e]; + if (t.sCount[e] - t.blkIndent >= 4 || r + 3 > s) + return !1; + const o = t.src.charCodeAt(r); + if (o !== 126 && o !== 96) + return !1; + let a = r; + r = t.skipChars(r, o); + let l = r - a; + if (l < 3) + return !1; + const u = t.src.slice(a, r), f = t.src.slice(r, s); + if (o === 96 && f.indexOf(String.fromCharCode(o)) >= 0) + return !1; + if (i) + return !0; + let d = e, h = !1; + for (; d++, !(d >= n || (r = a = t.bMarks[d] + t.tShift[d], s = t.eMarks[d], r < s && t.sCount[d] < t.blkIndent)); ) + if (t.src.charCodeAt(r) === o && !(t.sCount[d] - t.blkIndent >= 4) && (r = t.skipChars(r, o), !(r - a < l) && (r = t.skipSpaces(r), !(r < s)))) { + h = !0; + break; + } + l = t.sCount[e], t.line = d + (h ? 1 : 0); + const m = t.push("fence", "code", 0); + return m.info = f, m.content = t.getLines(e + 1, d, l, !0), m.markup = u, m.map = [e, t.line], !0; +} +function lse(t, e, n, i) { + let r = t.bMarks[e] + t.tShift[e], s = t.eMarks[e]; + const o = t.lineMax; + if (t.sCount[e] - t.blkIndent >= 4 || t.src.charCodeAt(r) !== 62) + return !1; + if (i) + return !0; + const a = [], l = [], u = [], f = [], d = t.md.block.ruler.getRules("blockquote"), h = t.parentType; + t.parentType = "blockquote"; + let m = !1, g; + for (g = e; g < n; g++) { + const C = t.sCount[g] < t.blkIndent; + if (r = t.bMarks[g] + t.tShift[g], s = t.eMarks[g], r >= s) + break; + if (t.src.charCodeAt(r++) === 62 && !C) { + let M = t.sCount[g] + 1, $, P; + t.src.charCodeAt(r) === 32 ? (r++, M++, P = !1, $ = !0) : t.src.charCodeAt(r) === 9 ? ($ = !0, (t.bsCount[g] + M) % 4 === 3 ? (r++, M++, P = !1) : P = !0) : $ = !1; + let W = M; + for (a.push(t.bMarks[g]), t.bMarks[g] = r; r < s; ) { + const z = t.src.charCodeAt(r); + if (mn(z)) + z === 9 ? W += 4 - (W + t.bsCount[g] + (P ? 1 : 0)) % 4 : W++; + else + break; + r++; + } + m = r >= s, l.push(t.bsCount[g]), t.bsCount[g] = t.sCount[g] + 1 + ($ ? 1 : 0), u.push(t.sCount[g]), t.sCount[g] = W - M, f.push(t.tShift[g]), t.tShift[g] = r - t.bMarks[g]; + continue; + } + if (m) + break; + let E = !1; + for (let M = 0, $ = d.length; M < $; M++) + if (d[M](t, g, n, !0)) { + E = !0; + break; + } + if (E) { + t.lineMax = g, t.blkIndent !== 0 && (a.push(t.bMarks[g]), l.push(t.bsCount[g]), f.push(t.tShift[g]), u.push(t.sCount[g]), t.sCount[g] -= t.blkIndent); + break; + } + a.push(t.bMarks[g]), l.push(t.bsCount[g]), f.push(t.tShift[g]), u.push(t.sCount[g]), t.sCount[g] = -1; + } + const w = t.blkIndent; + t.blkIndent = 0; + const x = t.push("blockquote_open", "blockquote", 1); + x.markup = ">"; + const _ = [e, 0]; + x.map = _, t.md.block.tokenize(t, e, g); + const S = t.push("blockquote_close", "blockquote", -1); + S.markup = ">", t.lineMax = o, t.parentType = h, _[1] = t.line; + for (let C = 0; C < f.length; C++) + t.bMarks[C + e] = a[C], t.tShift[C + e] = f[C], t.sCount[C + e] = u[C], t.bsCount[C + e] = l[C]; + return t.blkIndent = w, !0; +} +function use(t, e, n, i) { + const r = t.eMarks[e]; + if (t.sCount[e] - t.blkIndent >= 4) + return !1; + let s = t.bMarks[e] + t.tShift[e]; + const o = t.src.charCodeAt(s++); + if (o !== 42 && o !== 45 && o !== 95) + return !1; + let a = 1; + for (; s < r; ) { + const u = t.src.charCodeAt(s++); + if (u !== o && !mn(u)) + return !1; + u === o && a++; + } + if (a < 3) + return !1; + if (i) + return !0; + t.line = e + 1; + const l = t.push("hr", "hr", 0); + return l.map = [e, t.line], l.markup = Array(a + 1).join(String.fromCharCode(o)), !0; +} +function EM(t, e) { + const n = t.eMarks[e]; + let i = t.bMarks[e] + t.tShift[e]; + const r = t.src.charCodeAt(i++); + if (r !== 42 && r !== 45 && r !== 43) + return -1; + if (i < n) { + const s = t.src.charCodeAt(i); + if (!mn(s)) + return -1; + } + return i; +} +function TM(t, e) { + const n = t.bMarks[e] + t.tShift[e], i = t.eMarks[e]; + let r = n; + if (r + 1 >= i) + return -1; + let s = t.src.charCodeAt(r++); + if (s < 48 || s > 57) + return -1; + for (; ; ) { + if (r >= i) + return -1; + if (s = t.src.charCodeAt(r++), s >= 48 && s <= 57) { + if (r - n >= 10) + return -1; + continue; + } + if (s === 41 || s === 46) + break; + return -1; + } + return r < i && (s = t.src.charCodeAt(r), !mn(s)) ? -1 : r; +} +function cse(t, e) { + const n = t.level + 2; + for (let i = e + 2, r = t.tokens.length - 2; i < r; i++) + t.tokens[i].level === n && t.tokens[i].type === "paragraph_open" && (t.tokens[i + 2].hidden = !0, t.tokens[i].hidden = !0, i += 2); +} +function fse(t, e, n, i) { + let r, s, o, a, l = e, u = !0; + if (t.sCount[l] - t.blkIndent >= 4 || t.listIndent >= 0 && t.sCount[l] - t.listIndent >= 4 && t.sCount[l] < t.blkIndent) + return !1; + let f = !1; + i && t.parentType === "paragraph" && t.sCount[l] >= t.blkIndent && (f = !0); + let d, h, m; + if ((m = TM(t, l)) >= 0) { + if (d = !0, o = t.bMarks[l] + t.tShift[l], h = Number(t.src.slice(o, m - 1)), f && h !== 1) return !1; + } else if ((m = EM(t, l)) >= 0) + d = !1; + else + return !1; + if (f && t.skipSpaces(m) >= t.eMarks[l]) + return !1; + if (i) + return !0; + const g = t.src.charCodeAt(m - 1), w = t.tokens.length; + d ? (a = t.push("ordered_list_open", "ol", 1), h !== 1 && (a.attrs = [["start", h]])) : a = t.push("bullet_list_open", "ul", 1); + const x = [l, 0]; + a.map = x, a.markup = String.fromCharCode(g); + let _ = !1; + const S = t.md.block.ruler.getRules("list"), C = t.parentType; + for (t.parentType = "list"; l < n; ) { + s = m, r = t.eMarks[l]; + const E = t.sCount[l] + m - (t.bMarks[l] + t.tShift[l]); + let M = E; + for (; s < r; ) { + const R = t.src.charCodeAt(s); + if (R === 9) + M += 4 - (M + t.bsCount[l]) % 4; + else if (R === 32) + M++; + else + break; + s++; + } + const $ = s; + let P; + $ >= r ? P = 1 : P = M - E, P > 4 && (P = 1); + const W = E + P; + a = t.push("list_item_open", "li", 1), a.markup = String.fromCharCode(g); + const z = [l, 0]; + a.map = z, d && (a.info = t.src.slice(o, m - 1)); + const Z = t.tight, L = t.tShift[l], Q = t.sCount[l], V = t.listIndent; + if (t.listIndent = t.blkIndent, t.blkIndent = W, t.tight = !0, t.tShift[l] = $ - t.bMarks[l], t.sCount[l] = M, $ >= r && t.isEmpty(l + 1) ? t.line = Math.min(t.line + 2, n) : t.md.block.tokenize(t, l, n, !0), (!t.tight || _) && (u = !1), _ = t.line - l > 1 && t.isEmpty(t.line - 1), t.blkIndent = t.listIndent, t.listIndent = V, t.tShift[l] = L, t.sCount[l] = Q, t.tight = Z, a = t.push("list_item_close", "li", -1), a.markup = String.fromCharCode(g), l = t.line, z[1] = l, l >= n || t.sCount[l] < t.blkIndent || t.sCount[l] - t.blkIndent >= 4) + break; + let H = !1; + for (let R = 0, q = S.length; R < q; R++) + if (S[R](t, l, n, !0)) { + H = !0; + break; + } + if (H) + break; + if (d) { + if (m = TM(t, l), m < 0) + break; + o = t.bMarks[l] + t.tShift[l]; + } else if (m = EM(t, l), m < 0) + break; + if (g !== t.src.charCodeAt(m - 1)) + break; + } + return d ? a = t.push("ordered_list_close", "ol", -1) : a = t.push("bullet_list_close", "ul", -1), a.markup = String.fromCharCode(g), x[1] = l, t.line = l, t.parentType = C, u && cse(t, w), !0; +} +function dse(t, e, n, i) { + let r = 0, s = t.bMarks[e] + t.tShift[e], o = t.eMarks[e], a = e + 1; + if (t.sCount[e] - t.blkIndent >= 4 || t.src.charCodeAt(s) !== 91) + return !1; + for (; ++s < o; ) + if (t.src.charCodeAt(s) === 93 && t.src.charCodeAt(s - 1) !== 92) { + if (s + 1 === o || t.src.charCodeAt(s + 1) !== 58) + return !1; + break; + } + const l = t.lineMax, u = t.md.block.ruler.getRules("reference"), f = t.parentType; + for (t.parentType = "reference"; a < l && !t.isEmpty(a); a++) { + if (t.sCount[a] - t.blkIndent > 3 || t.sCount[a] < 0) + continue; + let M = !1; + for (let $ = 0, P = u.length; $ < P; $++) + if (u[$](t, a, l, !0)) { + M = !0; + break; + } + if (M) + break; + } + const d = t.getLines(e, a, t.blkIndent, !1).trim(); + o = d.length; + let h = -1; + for (s = 1; s < o; s++) { + const M = d.charCodeAt(s); + if (M === 91) + return !1; + if (M === 93) { + h = s; + break; + } else M === 10 ? r++ : M === 92 && (s++, s < o && d.charCodeAt(s) === 10 && r++); + } + if (h < 0 || d.charCodeAt(h + 1) !== 58) + return !1; + for (s = h + 2; s < o; s++) { + const M = d.charCodeAt(s); + if (M === 10) + r++; + else if (!mn(M)) break; + } + const m = t.md.helpers.parseLinkDestination(d, s, o); + if (!m.ok) + return !1; + const g = t.md.normalizeLink(m.str); + if (!t.md.validateLink(g)) + return !1; + s = m.pos, r += m.lines; + const w = s, x = r, _ = s; + for (; s < o; s++) { + const M = d.charCodeAt(s); + if (M === 10) + r++; + else if (!mn(M)) break; + } + const S = t.md.helpers.parseLinkTitle(d, s, o); + let C; + for (s < o && _ !== s && S.ok ? (C = S.str, s = S.pos, r += S.lines) : (C = "", s = w, r = x); s < o; ) { + const M = d.charCodeAt(s); + if (!mn(M)) + break; + s++; + } + if (s < o && d.charCodeAt(s) !== 10 && C) + for (C = "", s = w, r = x; s < o; ) { + const M = d.charCodeAt(s); + if (!mn(M)) + break; + s++; + } + if (s < o && d.charCodeAt(s) !== 10) + return !1; + const E = Qk(d.slice(1, h)); + return E ? (i || (typeof t.env.references > "u" && (t.env.references = {}), typeof t.env.references[E] > "u" && (t.env.references[E] = { + title: C, + href: g + }), t.parentType = f, t.line = e + r + 1), !0) : !1; +} +var hse = ["address", "article", "aside", "base", "basefont", "blockquote", "body", "caption", "center", "col", "colgroup", "dd", "details", "dialog", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "section", "source", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul"]; +const pse = "[a-zA-Z_:][a-zA-Z0-9:._-]*", mse = "[^\"'=<>`\\x00-\\x20]+", gse = "'[^']*'", vse = '"[^"]*"', bse = "(?:" + mse + "|" + gse + "|" + vse + ")", yse = "(?:\\s+" + pse + "(?:\\s*=\\s*" + bse + ")?)", gB = "<[A-Za-z][A-Za-z0-9\\-]*" + yse + "*\\s*\\/?>", vB = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", wse = "|", kse = "<[?][\\s\\S]*?[?]>", xse = "]*>", _se = "", Ose = new RegExp("^(?:" + gB + "|" + vB + "|" + wse + "|" + kse + "|" + xse + "|" + _se + ")"), Sse = new RegExp("^(?:" + gB + "|" + vB + ")"), _d = [[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, !0], [/^/, !0], [/^<\?/, /\?>/, !0], [/^/, !0], [/^/, !0], [new RegExp("^|$))", "i"), /^$/, !0], [new RegExp(Sse.source + "\\s*$"), /^$/, !1]]; +function Cse(t, e, n, i) { + let r = t.bMarks[e] + t.tShift[e], s = t.eMarks[e]; + if (t.sCount[e] - t.blkIndent >= 4 || !t.md.options.html || t.src.charCodeAt(r) !== 60) + return !1; + let o = t.src.slice(r, s), a = 0; + for (; a < _d.length && !_d[a][0].test(o); a++) + ; + if (a === _d.length) + return !1; + if (i) + return _d[a][2]; + let l = e + 1; + if (!_d[a][1].test(o)) { + for (; l < n && !(t.sCount[l] < t.blkIndent); l++) + if (r = t.bMarks[l] + t.tShift[l], s = t.eMarks[l], o = t.src.slice(r, s), _d[a][1].test(o)) { + o.length !== 0 && l++; + break; + } + } + t.line = l; + const u = t.push("html_block", "", 0); + return u.map = [e, l], u.content = t.getLines(e, l, t.blkIndent, !0), !0; +} +function Ese(t, e, n, i) { + let r = t.bMarks[e] + t.tShift[e], s = t.eMarks[e]; + if (t.sCount[e] - t.blkIndent >= 4) + return !1; + let o = t.src.charCodeAt(r); + if (o !== 35 || r >= s) + return !1; + let a = 1; + for (o = t.src.charCodeAt(++r); o === 35 && r < s && a <= 6; ) + a++, o = t.src.charCodeAt(++r); + if (a > 6 || r < s && !mn(o)) + return !1; + if (i) + return !0; + s = t.skipSpacesBack(s, r); + const l = t.skipCharsBack(s, 35, r); + l > r && mn(t.src.charCodeAt(l - 1)) && (s = l), t.line = e + 1; + const u = t.push("heading_open", "h" + String(a), 1); + u.markup = "########".slice(0, a), u.map = [e, t.line]; + const f = t.push("inline", "", 0); + f.content = t.src.slice(r, s).trim(), f.map = [e, t.line], f.children = []; + const d = t.push("heading_close", "h" + String(a), -1); + return d.markup = "########".slice(0, a), !0; +} +function Tse(t, e, n) { + const i = t.md.block.ruler.getRules("paragraph"); + if (t.sCount[e] - t.blkIndent >= 4) + return !1; + const r = t.parentType; + t.parentType = "paragraph"; + let s = 0, o, a = e + 1; + for (; a < n && !t.isEmpty(a); a++) { + if (t.sCount[a] - t.blkIndent > 3) + continue; + if (t.sCount[a] >= t.blkIndent) { + let m = t.bMarks[a] + t.tShift[a]; + const g = t.eMarks[a]; + if (m < g && (o = t.src.charCodeAt(m), (o === 45 || o === 61) && (m = t.skipChars(m, o), m = t.skipSpaces(m), m >= g))) { + s = o === 61 ? 1 : 2; + break; + } + } + if (t.sCount[a] < 0) + continue; + let h = !1; + for (let m = 0, g = i.length; m < g; m++) + if (i[m](t, a, n, !0)) { + h = !0; + break; + } + if (h) + break; + } + if (!s) + return !1; + const l = t.getLines(e, a, t.blkIndent, !1).trim(); + t.line = a + 1; + const u = t.push("heading_open", "h" + String(s), 1); + u.markup = String.fromCharCode(o), u.map = [e, t.line]; + const f = t.push("inline", "", 0); + f.content = l, f.map = [e, t.line - 1], f.children = []; + const d = t.push("heading_close", "h" + String(s), -1); + return d.markup = String.fromCharCode(o), t.parentType = r, !0; +} +function $se(t, e, n) { + const i = t.md.block.ruler.getRules("paragraph"), r = t.parentType; + let s = e + 1; + for (t.parentType = "paragraph"; s < n && !t.isEmpty(s); s++) { + if (t.sCount[s] - t.blkIndent > 3 || t.sCount[s] < 0) + continue; + let u = !1; + for (let f = 0, d = i.length; f < d; f++) + if (i[f](t, s, n, !0)) { + u = !0; + break; + } + if (u) + break; + } + const o = t.getLines(e, s, t.blkIndent, !1).trim(); + t.line = s; + const a = t.push("paragraph_open", "p", 1); + a.map = [e, t.line]; + const l = t.push("inline", "", 0); + return l.content = o, l.map = [e, t.line], l.children = [], t.push("paragraph_close", "p", -1), t.parentType = r, !0; +} +const Qv = [ + // First 2 params - rule name & source. Secondary array - list of rules, + // which can be terminated by this one. + ["table", sse, ["paragraph", "reference"]], + ["code", ose], + ["fence", ase, ["paragraph", "reference", "blockquote", "list"]], + ["blockquote", lse, ["paragraph", "reference", "blockquote", "list"]], + ["hr", use, ["paragraph", "reference", "blockquote", "list"]], + ["list", fse, ["paragraph", "reference", "blockquote"]], + ["reference", dse], + ["html_block", Cse, ["paragraph", "reference", "blockquote"]], + ["heading", Ese, ["paragraph", "reference", "blockquote"]], + ["lheading", Tse], + ["paragraph", $se] +]; +function Uk() { + this.ruler = new xs(); + for (let t = 0; t < Qv.length; t++) + this.ruler.push(Qv[t][0], Qv[t][1], { + alt: (Qv[t][2] || []).slice() + }); +} +Uk.prototype.tokenize = function(t, e, n) { + const i = this.ruler.getRules(""), r = i.length, s = t.md.options.maxNesting; + let o = e, a = !1; + for (; o < n && (t.line = o = t.skipEmptyLines(o), !(o >= n || t.sCount[o] < t.blkIndent)); ) { + if (t.level >= s) { + t.line = n; + break; + } + const l = t.line; + let u = !1; + for (let f = 0; f < r; f++) + if (u = i[f](t, o, n, !1), u) { + if (l >= t.line) + throw new Error("block rule didn't increment state.line"); + break; + } + if (!u) throw new Error("none of the block rules matched"); + t.tight = !a, t.isEmpty(t.line - 1) && (a = !0), o = t.line, o < n && t.isEmpty(o) && (a = !0, o++, t.line = o); + } +}; +Uk.prototype.parse = function(t, e, n, i) { + if (!t) + return; + const r = new this.State(t, e, n, i); + this.tokenize(r, r.line, r.lineMax); +}; +Uk.prototype.State = Fa; +function o1(t, e, n, i) { + this.src = t, this.env = n, this.md = e, this.tokens = i, this.tokens_meta = Array(i.length), this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = {}, this.delimiters = [], this._prev_delimiters = [], this.backticks = {}, this.backticksScanned = !1, this.linkLevel = 0; +} +o1.prototype.pushPending = function() { + const t = new Qo("text", "", 0); + return t.content = this.pending, t.level = this.pendingLevel, this.tokens.push(t), this.pending = "", t; +}; +o1.prototype.push = function(t, e, n) { + this.pending && this.pushPending(); + const i = new Qo(t, e, n); + let r = null; + return n < 0 && (this.level--, this.delimiters = this._prev_delimiters.pop()), i.level = this.level, n > 0 && (this.level++, this._prev_delimiters.push(this.delimiters), this.delimiters = [], r = { + delimiters: this.delimiters + }), this.pendingLevel = this.level, this.tokens.push(i), this.tokens_meta.push(r), i; +}; +o1.prototype.scanDelims = function(t, e) { + let n, i, r = !0, s = !0; + const o = this.posMax, a = this.src.charCodeAt(t), l = t > 0 ? this.src.charCodeAt(t - 1) : 32; + let u = t; + for (; u < o && this.src.charCodeAt(u) === a; ) + u++; + const f = u - t, d = u < o ? this.src.charCodeAt(u) : 32, h = n0(l) || t0(String.fromCharCode(l)), m = n0(d) || t0(String.fromCharCode(d)), g = e0(l), w = e0(d); + return w ? r = !1 : m && (g || h || (r = !1)), g ? s = !1 : h && (w || m || (s = !1)), e ? (n = r, i = s) : (n = r && (!s || h), i = s && (!r || m)), { + can_open: n, + can_close: i, + length: f + }; +}; +o1.prototype.Token = Qo; +function Mse(t) { + switch (t) { + case 10: + case 33: + case 35: + case 36: + case 37: + case 38: + case 42: + case 43: + case 45: + case 58: + case 60: + case 61: + case 62: + case 64: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 123: + case 125: + case 126: + return !0; + default: + return !1; + } +} +function Nse(t, e) { + let n = t.pos; + for (; n < t.posMax && !Mse(t.src.charCodeAt(n)); ) + n++; + return n === t.pos ? !1 : (e || (t.pending += t.src.slice(t.pos, n)), t.pos = n, !0); +} +const Ase = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i; +function Dse(t, e) { + if (!t.md.options.linkify || t.linkLevel > 0) return !1; + const n = t.pos, i = t.posMax; + if (n + 3 > i || t.src.charCodeAt(n) !== 58 || t.src.charCodeAt(n + 1) !== 47 || t.src.charCodeAt(n + 2) !== 47) return !1; + const r = t.pending.match(Ase); + if (!r) return !1; + const s = r[1], o = t.md.linkify.matchAtStart(t.src.slice(n - s.length)); + if (!o) return !1; + let a = o.url; + if (a.length <= s.length) return !1; + a = a.replace(/\*+$/, ""); + const l = t.md.normalizeLink(a); + if (!t.md.validateLink(l)) return !1; + if (!e) { + t.pending = t.pending.slice(0, -s.length); + const u = t.push("link_open", "a", 1); + u.attrs = [["href", l]], u.markup = "linkify", u.info = "auto"; + const f = t.push("text", "", 0); + f.content = t.md.normalizeLinkText(a); + const d = t.push("link_close", "a", -1); + d.markup = "linkify", d.info = "auto"; + } + return t.pos += a.length - s.length, !0; +} +function Pse(t, e) { + let n = t.pos; + if (t.src.charCodeAt(n) !== 10) + return !1; + const i = t.pending.length - 1, r = t.posMax; + if (!e) + if (i >= 0 && t.pending.charCodeAt(i) === 32) + if (i >= 1 && t.pending.charCodeAt(i - 1) === 32) { + let s = i - 1; + for (; s >= 1 && t.pending.charCodeAt(s - 1) === 32; ) s--; + t.pending = t.pending.slice(0, s), t.push("hardbreak", "br", 0); + } else + t.pending = t.pending.slice(0, -1), t.push("softbreak", "br", 0); + else + t.push("softbreak", "br", 0); + for (n++; n < r && mn(t.src.charCodeAt(n)); ) + n++; + return t.pos = n, !0; +} +const _5 = []; +for (let t = 0; t < 256; t++) + _5.push(0); +"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t) { + _5[t.charCodeAt(0)] = 1; +}); +function Ise(t, e) { + let n = t.pos; + const i = t.posMax; + if (t.src.charCodeAt(n) !== 92 || (n++, n >= i)) return !1; + let r = t.src.charCodeAt(n); + if (r === 10) { + for (e || t.push("hardbreak", "br", 0), n++; n < i && (r = t.src.charCodeAt(n), !!mn(r)); ) + n++; + return t.pos = n, !0; + } + let s = t.src[n]; + if (r >= 55296 && r <= 56319 && n + 1 < i) { + const a = t.src.charCodeAt(n + 1); + a >= 56320 && a <= 57343 && (s += t.src[n + 1], n++); + } + const o = "\\" + s; + if (!e) { + const a = t.push("text_special", "", 0); + r < 256 && _5[r] !== 0 ? a.content = s : a.content = o, a.markup = o, a.info = "escape"; + } + return t.pos = n + 1, !0; +} +function Lse(t, e) { + let n = t.pos; + if (t.src.charCodeAt(n) !== 96) + return !1; + const r = n; + n++; + const s = t.posMax; + for (; n < s && t.src.charCodeAt(n) === 96; ) + n++; + const o = t.src.slice(r, n), a = o.length; + if (t.backticksScanned && (t.backticks[a] || 0) <= r) + return e || (t.pending += o), t.pos += a, !0; + let l = n, u; + for (; (u = t.src.indexOf("`", l)) !== -1; ) { + for (l = u + 1; l < s && t.src.charCodeAt(l) === 96; ) + l++; + const f = l - u; + if (f === a) { + if (!e) { + const d = t.push("code_inline", "code", 0); + d.markup = o, d.content = t.src.slice(n, u).replace(/\n/g, " ").replace(/^ (.+) $/, "$1"); + } + return t.pos = l, !0; + } + t.backticks[f] = u; + } + return t.backticksScanned = !0, e || (t.pending += o), t.pos += a, !0; +} +function Rse(t, e) { + const n = t.pos, i = t.src.charCodeAt(n); + if (e || i !== 126) + return !1; + const r = t.scanDelims(t.pos, !0); + let s = r.length; + const o = String.fromCharCode(i); + if (s < 2) + return !1; + let a; + s % 2 && (a = t.push("text", "", 0), a.content = o, s--); + for (let l = 0; l < s; l += 2) + a = t.push("text", "", 0), a.content = o + o, t.delimiters.push({ + marker: i, + length: 0, + // disable "rule of 3" length checks meant for emphasis + token: t.tokens.length - 1, + end: -1, + open: r.can_open, + close: r.can_close + }); + return t.pos += r.length, !0; +} +function $M(t, e) { + let n; + const i = [], r = e.length; + for (let s = 0; s < r; s++) { + const o = e[s]; + if (o.marker !== 126 || o.end === -1) + continue; + const a = e[o.end]; + n = t.tokens[o.token], n.type = "s_open", n.tag = "s", n.nesting = 1, n.markup = "~~", n.content = "", n = t.tokens[a.token], n.type = "s_close", n.tag = "s", n.nesting = -1, n.markup = "~~", n.content = "", t.tokens[a.token - 1].type === "text" && t.tokens[a.token - 1].content === "~" && i.push(a.token - 1); + } + for (; i.length; ) { + const s = i.pop(); + let o = s + 1; + for (; o < t.tokens.length && t.tokens[o].type === "s_close"; ) + o++; + o--, s !== o && (n = t.tokens[o], t.tokens[o] = t.tokens[s], t.tokens[s] = n); + } +} +function jse(t) { + const e = t.tokens_meta, n = t.tokens_meta.length; + $M(t, t.delimiters); + for (let i = 0; i < n; i++) + e[i] && e[i].delimiters && $M(t, e[i].delimiters); +} +var bB = { + tokenize: Rse, + postProcess: jse +}; +function Fse(t, e) { + const n = t.pos, i = t.src.charCodeAt(n); + if (e || i !== 95 && i !== 42) + return !1; + const r = t.scanDelims(t.pos, i === 42); + for (let s = 0; s < r.length; s++) { + const o = t.push("text", "", 0); + o.content = String.fromCharCode(i), t.delimiters.push({ + // Char code of the starting marker (number). + // + marker: i, + // Total length of these series of delimiters. + // + length: r.length, + // A position of the token this delimiter corresponds to. + // + token: t.tokens.length - 1, + // If this delimiter is matched as a valid opener, `end` will be + // equal to its position, otherwise it's `-1`. + // + end: -1, + // Boolean flags that determine if this delimiter could open or close + // an emphasis. + // + open: r.can_open, + close: r.can_close + }); + } + return t.pos += r.length, !0; +} +function MM(t, e) { + const n = e.length; + for (let i = n - 1; i >= 0; i--) { + const r = e[i]; + if (r.marker !== 95 && r.marker !== 42 || r.end === -1) + continue; + const s = e[r.end], o = i > 0 && e[i - 1].end === r.end + 1 && // check that first two markers match and adjacent + e[i - 1].marker === r.marker && e[i - 1].token === r.token - 1 && // check that last two markers are adjacent (we can safely assume they match) + e[r.end + 1].token === s.token + 1, a = String.fromCharCode(r.marker), l = t.tokens[r.token]; + l.type = o ? "strong_open" : "em_open", l.tag = o ? "strong" : "em", l.nesting = 1, l.markup = o ? a + a : a, l.content = ""; + const u = t.tokens[s.token]; + u.type = o ? "strong_close" : "em_close", u.tag = o ? "strong" : "em", u.nesting = -1, u.markup = o ? a + a : a, u.content = "", o && (t.tokens[e[i - 1].token].content = "", t.tokens[e[r.end + 1].token].content = "", i--); + } +} +function Bse(t) { + const e = t.tokens_meta, n = t.tokens_meta.length; + MM(t, t.delimiters); + for (let i = 0; i < n; i++) + e[i] && e[i].delimiters && MM(t, e[i].delimiters); +} +var yB = { + tokenize: Fse, + postProcess: Bse +}; +function zse(t, e) { + let n, i, r, s, o = "", a = "", l = t.pos, u = !0; + if (t.src.charCodeAt(t.pos) !== 91) + return !1; + const f = t.pos, d = t.posMax, h = t.pos + 1, m = t.md.helpers.parseLinkLabel(t, t.pos, !0); + if (m < 0) + return !1; + let g = m + 1; + if (g < d && t.src.charCodeAt(g) === 40) { + for (u = !1, g++; g < d && (n = t.src.charCodeAt(g), !(!mn(n) && n !== 10)); g++) + ; + if (g >= d) + return !1; + if (l = g, r = t.md.helpers.parseLinkDestination(t.src, g, t.posMax), r.ok) { + for (o = t.md.normalizeLink(r.str), t.md.validateLink(o) ? g = r.pos : o = "", l = g; g < d && (n = t.src.charCodeAt(g), !(!mn(n) && n !== 10)); g++) + ; + if (r = t.md.helpers.parseLinkTitle(t.src, g, t.posMax), g < d && l !== g && r.ok) + for (a = r.str, g = r.pos; g < d && (n = t.src.charCodeAt(g), !(!mn(n) && n !== 10)); g++) + ; + } + (g >= d || t.src.charCodeAt(g) !== 41) && (u = !0), g++; + } + if (u) { + if (typeof t.env.references > "u") + return !1; + if (g < d && t.src.charCodeAt(g) === 91 ? (l = g + 1, g = t.md.helpers.parseLinkLabel(t, g), g >= 0 ? i = t.src.slice(l, g++) : g = m + 1) : g = m + 1, i || (i = t.src.slice(h, m)), s = t.env.references[Qk(i)], !s) + return t.pos = f, !1; + o = s.href, a = s.title; + } + if (!e) { + t.pos = h, t.posMax = m; + const w = t.push("link_open", "a", 1), x = [["href", o]]; + w.attrs = x, a && x.push(["title", a]), t.linkLevel++, t.md.inline.tokenize(t), t.linkLevel--, t.push("link_close", "a", -1); + } + return t.pos = g, t.posMax = d, !0; +} +function Wse(t, e) { + let n, i, r, s, o, a, l, u, f = ""; + const d = t.pos, h = t.posMax; + if (t.src.charCodeAt(t.pos) !== 33 || t.src.charCodeAt(t.pos + 1) !== 91) + return !1; + const m = t.pos + 2, g = t.md.helpers.parseLinkLabel(t, t.pos + 1, !1); + if (g < 0) + return !1; + if (s = g + 1, s < h && t.src.charCodeAt(s) === 40) { + for (s++; s < h && (n = t.src.charCodeAt(s), !(!mn(n) && n !== 10)); s++) + ; + if (s >= h) + return !1; + for (u = s, a = t.md.helpers.parseLinkDestination(t.src, s, t.posMax), a.ok && (f = t.md.normalizeLink(a.str), t.md.validateLink(f) ? s = a.pos : f = ""), u = s; s < h && (n = t.src.charCodeAt(s), !(!mn(n) && n !== 10)); s++) + ; + if (a = t.md.helpers.parseLinkTitle(t.src, s, t.posMax), s < h && u !== s && a.ok) + for (l = a.str, s = a.pos; s < h && (n = t.src.charCodeAt(s), !(!mn(n) && n !== 10)); s++) + ; + else + l = ""; + if (s >= h || t.src.charCodeAt(s) !== 41) + return t.pos = d, !1; + s++; + } else { + if (typeof t.env.references > "u") + return !1; + if (s < h && t.src.charCodeAt(s) === 91 ? (u = s + 1, s = t.md.helpers.parseLinkLabel(t, s), s >= 0 ? r = t.src.slice(u, s++) : s = g + 1) : s = g + 1, r || (r = t.src.slice(m, g)), o = t.env.references[Qk(r)], !o) + return t.pos = d, !1; + f = o.href, l = o.title; + } + if (!e) { + i = t.src.slice(m, g); + const w = []; + t.md.inline.parse(i, t.md, t.env, w); + const x = t.push("image", "img", 0), _ = [["src", f], ["alt", ""]]; + x.attrs = _, x.children = w, x.content = i, l && _.push(["title", l]); + } + return t.pos = s, t.posMax = h, !0; +} +const Hse = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/, Qse = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/; +function Use(t, e) { + let n = t.pos; + if (t.src.charCodeAt(n) !== 60) + return !1; + const i = t.pos, r = t.posMax; + for (; ; ) { + if (++n >= r) return !1; + const o = t.src.charCodeAt(n); + if (o === 60) return !1; + if (o === 62) break; + } + const s = t.src.slice(i + 1, n); + if (Qse.test(s)) { + const o = t.md.normalizeLink(s); + if (!t.md.validateLink(o)) + return !1; + if (!e) { + const a = t.push("link_open", "a", 1); + a.attrs = [["href", o]], a.markup = "autolink", a.info = "auto"; + const l = t.push("text", "", 0); + l.content = t.md.normalizeLinkText(s); + const u = t.push("link_close", "a", -1); + u.markup = "autolink", u.info = "auto"; + } + return t.pos += s.length + 2, !0; + } + if (Hse.test(s)) { + const o = t.md.normalizeLink("mailto:" + s); + if (!t.md.validateLink(o)) + return !1; + if (!e) { + const a = t.push("link_open", "a", 1); + a.attrs = [["href", o]], a.markup = "autolink", a.info = "auto"; + const l = t.push("text", "", 0); + l.content = t.md.normalizeLinkText(s); + const u = t.push("link_close", "a", -1); + u.markup = "autolink", u.info = "auto"; + } + return t.pos += s.length + 2, !0; + } + return !1; +} +function Zse(t) { + return /^\s]/i.test(t); +} +function qse(t) { + return /^<\/a\s*>/i.test(t); +} +function Yse(t) { + const e = t | 32; + return e >= 97 && e <= 122; +} +function Vse(t, e) { + if (!t.md.options.html) + return !1; + const n = t.posMax, i = t.pos; + if (t.src.charCodeAt(i) !== 60 || i + 2 >= n) + return !1; + const r = t.src.charCodeAt(i + 1); + if (r !== 33 && r !== 63 && r !== 47 && !Yse(r)) + return !1; + const s = t.src.slice(i).match(Ose); + if (!s) + return !1; + if (!e) { + const o = t.push("html_inline", "", 0); + o.content = s[0], Zse(o.content) && t.linkLevel++, qse(o.content) && t.linkLevel--; + } + return t.pos += s[0].length, !0; +} +const Xse = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i, Gse = /^&([a-z][a-z0-9]{1,31});/i; +function Kse(t, e) { + const n = t.pos, i = t.posMax; + if (t.src.charCodeAt(n) !== 38 || n + 1 >= i) return !1; + if (t.src.charCodeAt(n + 1) === 35) { + const s = t.src.slice(n).match(Xse); + if (s) { + if (!e) { + const o = s[1][0].toLowerCase() === "x" ? parseInt(s[1].slice(1), 16) : parseInt(s[1], 10), a = t.push("text_special", "", 0); + a.content = k5(o) ? tw(o) : tw(65533), a.markup = s[0], a.info = "entity"; + } + return t.pos += s[0].length, !0; + } + } else { + const s = t.src.slice(n).match(Gse); + if (s) { + const o = lB.decodeHTML(s[0]); + if (o !== s[0]) { + if (!e) { + const a = t.push("text_special", "", 0); + a.content = o, a.markup = s[0], a.info = "entity"; + } + return t.pos += s[0].length, !0; + } + } + } + return !1; +} +function NM(t) { + const e = {}, n = t.length; + if (!n) return; + let i = 0, r = -2; + const s = []; + for (let o = 0; o < n; o++) { + const a = t[o]; + if (s.push(0), (t[i].marker !== a.marker || r !== a.token - 1) && (i = o), r = a.token, a.length = a.length || 0, !a.close) continue; + e.hasOwnProperty(a.marker) || (e[a.marker] = [-1, -1, -1, -1, -1, -1]); + const l = e[a.marker][(a.open ? 3 : 0) + a.length % 3]; + let u = i - s[i] - 1, f = u; + for (; u > l; u -= s[u] + 1) { + const d = t[u]; + if (d.marker === a.marker && d.open && d.end < 0) { + let h = !1; + if ((d.close || a.open) && (d.length + a.length) % 3 === 0 && (d.length % 3 !== 0 || a.length % 3 !== 0) && (h = !0), !h) { + const m = u > 0 && !t[u - 1].open ? s[u - 1] + 1 : 0; + s[o] = o - u + m, s[u] = m, a.open = !1, d.end = o, d.close = !1, f = -1, r = -2; + break; + } + } + } + f !== -1 && (e[a.marker][(a.open ? 3 : 0) + (a.length || 0) % 3] = f); + } +} +function Jse(t) { + const e = t.tokens_meta, n = t.tokens_meta.length; + NM(t.delimiters); + for (let i = 0; i < n; i++) + e[i] && e[i].delimiters && NM(e[i].delimiters); +} +function eoe(t) { + let e, n, i = 0; + const r = t.tokens, s = t.tokens.length; + for (e = n = 0; e < s; e++) + r[e].nesting < 0 && i--, r[e].level = i, r[e].nesting > 0 && i++, r[e].type === "text" && e + 1 < s && r[e + 1].type === "text" ? r[e + 1].content = r[e].content + r[e + 1].content : (e !== n && (r[n] = r[e]), n++); + e !== n && (r.length = n); +} +const b3 = [["text", Nse], ["linkify", Dse], ["newline", Pse], ["escape", Ise], ["backticks", Lse], ["strikethrough", bB.tokenize], ["emphasis", yB.tokenize], ["link", zse], ["image", Wse], ["autolink", Use], ["html_inline", Vse], ["entity", Kse]], y3 = [ + ["balance_pairs", Jse], + ["strikethrough", bB.postProcess], + ["emphasis", yB.postProcess], + // rules for pairs separate '**' into its own text tokens, which may be left unused, + // rule below merges unused segments back with the rest of the text + ["fragments_join", eoe] +]; +function a1() { + this.ruler = new xs(); + for (let t = 0; t < b3.length; t++) + this.ruler.push(b3[t][0], b3[t][1]); + this.ruler2 = new xs(); + for (let t = 0; t < y3.length; t++) + this.ruler2.push(y3[t][0], y3[t][1]); +} +a1.prototype.skipToken = function(t) { + const e = t.pos, n = this.ruler.getRules(""), i = n.length, r = t.md.options.maxNesting, s = t.cache; + if (typeof s[e] < "u") { + t.pos = s[e]; + return; + } + let o = !1; + if (t.level < r) { + for (let a = 0; a < i; a++) + if (t.level++, o = n[a](t, !0), t.level--, o) { + if (e >= t.pos) + throw new Error("inline rule didn't increment state.pos"); + break; + } + } else + t.pos = t.posMax; + o || t.pos++, s[e] = t.pos; +}; +a1.prototype.tokenize = function(t) { + const e = this.ruler.getRules(""), n = e.length, i = t.posMax, r = t.md.options.maxNesting; + for (; t.pos < i; ) { + const s = t.pos; + let o = !1; + if (t.level < r) { + for (let a = 0; a < n; a++) + if (o = e[a](t, !1), o) { + if (s >= t.pos) + throw new Error("inline rule didn't increment state.pos"); + break; + } + } + if (o) { + if (t.pos >= i) + break; + continue; + } + t.pending += t.src[t.pos++]; + } + t.pending && t.pushPending(); +}; +a1.prototype.parse = function(t, e, n, i) { + const r = new this.State(t, e, n, i); + this.tokenize(r); + const s = this.ruler2.getRules(""), o = s.length; + for (let a = 0; a < o; a++) + s[a](r); +}; +a1.prototype.State = o1; +var toe = { + options: { + // Enable HTML tags in source + html: !1, + // Use '/' to close single tags (
    ) + xhtmlOut: !1, + // Convert '\n' in paragraphs into
    + breaks: !1, + // CSS language prefix for fenced blocks + langPrefix: "language-", + // autoconvert URL-like texts to links + linkify: !1, + // Enable some language-neutral replacements + quotes beautification + typographer: !1, + // Double + single quotes replacement pairs, when typographer enabled, + // and smartquotes on. Could be either a String or an Array. + // + // For example, you can use '«»„“' for Russian, '„“‚‘' for German, + // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). + quotes: "“”‘’", + /* “”‘’ */ + // Highlighter function. Should return escaped HTML, + // or '' if the source string is not changed and should be escaped externaly. + // If result starts with ) + xhtmlOut: !1, + // Convert '\n' in paragraphs into
    + breaks: !1, + // CSS language prefix for fenced blocks + langPrefix: "language-", + // autoconvert URL-like texts to links + linkify: !1, + // Enable some language-neutral replacements + quotes beautification + typographer: !1, + // Double + single quotes replacement pairs, when typographer enabled, + // and smartquotes on. Could be either a String or an Array. + // + // For example, you can use '«»„“' for Russian, '„“‚‘' for German, + // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). + quotes: "“”‘’", + /* “”‘’ */ + // Highlighter function. Should return escaped HTML, + // or '' if the source string is not changed and should be escaped externaly. + // If result starts with ) + xhtmlOut: !0, + // Convert '\n' in paragraphs into
    + breaks: !1, + // CSS language prefix for fenced blocks + langPrefix: "language-", + // autoconvert URL-like texts to links + linkify: !1, + // Enable some language-neutral replacements + quotes beautification + typographer: !1, + // Double + single quotes replacement pairs, when typographer enabled, + // and smartquotes on. Could be either a String or an Array. + // + // For example, you can use '«»„“' for Russian, '„“‚‘' for German, + // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). + quotes: "“”‘’", + /* “”‘’ */ + // Highlighter function. Should return escaped HTML, + // or '' if the source string is not changed and should be escaped externaly. + // If result starts with = 0)) + try { + e.hostname = uB.toASCII(e.hostname); + } catch { + } + return _u.encode(_u.format(e)); +} +function uoe(t) { + const e = _u.parse(t, !0); + if (e.hostname && (!e.protocol || wB.indexOf(e.protocol) >= 0)) + try { + e.hostname = uB.toUnicode(e.hostname); + } catch { + } + return _u.decode(_u.format(e), _u.decode.defaultChars + "%"); +} +function mo(t, e) { + if (!(this instanceof mo)) + return new mo(t, e); + e || w5(t) || (e = t || {}, t = "default"), this.inline = new a1(), this.block = new Uk(), this.core = new x5(), this.renderer = new Kh(), this.linkify = new yre(), this.validateLink = aoe, this.normalizeLink = loe, this.normalizeLinkText = uoe, this.utils = Ire, this.helpers = Hk({}, Fre), this.options = {}, this.configure(t), e && this.set(e); +} +mo.prototype.set = function(t) { + return Hk(this.options, t), this; +}; +mo.prototype.configure = function(t) { + const e = this; + if (w5(t)) { + const n = t; + if (t = roe[n], !t) + throw new Error('Wrong `markdown-it` preset "' + n + '", check name'); + } + if (!t) + throw new Error("Wrong `markdown-it` preset, can't be empty"); + return t.options && e.set(t.options), t.components && Object.keys(t.components).forEach(function(n) { + t.components[n].rules && e[n].ruler.enableOnly(t.components[n].rules), t.components[n].rules2 && e[n].ruler2.enableOnly(t.components[n].rules2); + }), this; +}; +mo.prototype.enable = function(t, e) { + let n = []; + Array.isArray(t) || (t = [t]), ["core", "block", "inline"].forEach(function(r) { + n = n.concat(this[r].ruler.enable(t, !0)); + }, this), n = n.concat(this.inline.ruler2.enable(t, !0)); + const i = t.filter(function(r) { + return n.indexOf(r) < 0; + }); + if (i.length && !e) + throw new Error("MarkdownIt. Failed to enable unknown rule(s): " + i); + return this; +}; +mo.prototype.disable = function(t, e) { + let n = []; + Array.isArray(t) || (t = [t]), ["core", "block", "inline"].forEach(function(r) { + n = n.concat(this[r].ruler.disable(t, !0)); + }, this), n = n.concat(this.inline.ruler2.disable(t, !0)); + const i = t.filter(function(r) { + return n.indexOf(r) < 0; + }); + if (i.length && !e) + throw new Error("MarkdownIt. Failed to disable unknown rule(s): " + i); + return this; +}; +mo.prototype.use = function(t) { + const e = [this].concat(Array.prototype.slice.call(arguments, 1)); + return t.apply(t, e), this; +}; +mo.prototype.parse = function(t, e) { + if (typeof t != "string") + throw new Error("Input data should be a String"); + const n = new this.core.State(t, this, e); + return this.core.process(n), n.tokens; +}; +mo.prototype.render = function(t, e) { + return e = e || {}, this.renderer.render(this.parse(t, e), this.options, e); +}; +mo.prototype.parseInline = function(t, e) { + const n = new this.core.State(t, this, e); + return n.inlineMode = !0, this.core.process(n), n.tokens; +}; +mo.prototype.renderInline = function(t, e) { + return e = e || {}, this.renderer.render(this.parseInline(t, e), this.options, e); +}; +var kB = mo, f4 = { exports: {} }; +const coe = "2.0.0", xB = 256, foe = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ +9007199254740991, doe = 16, hoe = xB - 6, poe = [ + "major", + "premajor", + "minor", + "preminor", + "patch", + "prepatch", + "prerelease" +]; +var Zk = { + MAX_LENGTH: xB, + MAX_SAFE_COMPONENT_LENGTH: doe, + MAX_SAFE_BUILD_LENGTH: hoe, + MAX_SAFE_INTEGER: foe, + RELEASE_TYPES: poe, + SEMVER_SPEC_VERSION: coe, + FLAG_INCLUDE_PRERELEASE: 1, + FLAG_LOOSE: 2 +}; +const moe = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...t) => console.error("SEMVER", ...t) : () => { +}; +var qk = moe; +(function(t, e) { + const { + MAX_SAFE_COMPONENT_LENGTH: n, + MAX_SAFE_BUILD_LENGTH: i, + MAX_LENGTH: r + } = Zk, s = qk; + e = t.exports = {}; + const o = e.re = [], a = e.safeRe = [], l = e.src = [], u = e.safeSrc = [], f = e.t = {}; + let d = 0; + const h = "[a-zA-Z0-9-]", m = [ + ["\\s", 1], + ["\\d", r], + [h, i] + ], g = (x) => { + for (const [_, S] of m) + x = x.split(`${_}*`).join(`${_}{0,${S}}`).split(`${_}+`).join(`${_}{1,${S}}`); + return x; + }, w = (x, _, S) => { + const C = g(_), E = d++; + s(x, E, _), f[x] = E, l[E] = _, u[E] = C, o[E] = new RegExp(_, S ? "g" : void 0), a[E] = new RegExp(C, S ? "g" : void 0); + }; + w("NUMERICIDENTIFIER", "0|[1-9]\\d*"), w("NUMERICIDENTIFIERLOOSE", "\\d+"), w("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${h}*`), w("MAINVERSION", `(${l[f.NUMERICIDENTIFIER]})\\.(${l[f.NUMERICIDENTIFIER]})\\.(${l[f.NUMERICIDENTIFIER]})`), w("MAINVERSIONLOOSE", `(${l[f.NUMERICIDENTIFIERLOOSE]})\\.(${l[f.NUMERICIDENTIFIERLOOSE]})\\.(${l[f.NUMERICIDENTIFIERLOOSE]})`), w("PRERELEASEIDENTIFIER", `(?:${l[f.NONNUMERICIDENTIFIER]}|${l[f.NUMERICIDENTIFIER]})`), w("PRERELEASEIDENTIFIERLOOSE", `(?:${l[f.NONNUMERICIDENTIFIER]}|${l[f.NUMERICIDENTIFIERLOOSE]})`), w("PRERELEASE", `(?:-(${l[f.PRERELEASEIDENTIFIER]}(?:\\.${l[f.PRERELEASEIDENTIFIER]})*))`), w("PRERELEASELOOSE", `(?:-?(${l[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[f.PRERELEASEIDENTIFIERLOOSE]})*))`), w("BUILDIDENTIFIER", `${h}+`), w("BUILD", `(?:\\+(${l[f.BUILDIDENTIFIER]}(?:\\.${l[f.BUILDIDENTIFIER]})*))`), w("FULLPLAIN", `v?${l[f.MAINVERSION]}${l[f.PRERELEASE]}?${l[f.BUILD]}?`), w("FULL", `^${l[f.FULLPLAIN]}$`), w("LOOSEPLAIN", `[v=\\s]*${l[f.MAINVERSIONLOOSE]}${l[f.PRERELEASELOOSE]}?${l[f.BUILD]}?`), w("LOOSE", `^${l[f.LOOSEPLAIN]}$`), w("GTLT", "((?:<|>)?=?)"), w("XRANGEIDENTIFIERLOOSE", `${l[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), w("XRANGEIDENTIFIER", `${l[f.NUMERICIDENTIFIER]}|x|X|\\*`), w("XRANGEPLAIN", `[v=\\s]*(${l[f.XRANGEIDENTIFIER]})(?:\\.(${l[f.XRANGEIDENTIFIER]})(?:\\.(${l[f.XRANGEIDENTIFIER]})(?:${l[f.PRERELEASE]})?${l[f.BUILD]}?)?)?`), w("XRANGEPLAINLOOSE", `[v=\\s]*(${l[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[f.XRANGEIDENTIFIERLOOSE]})(?:${l[f.PRERELEASELOOSE]})?${l[f.BUILD]}?)?)?`), w("XRANGE", `^${l[f.GTLT]}\\s*${l[f.XRANGEPLAIN]}$`), w("XRANGELOOSE", `^${l[f.GTLT]}\\s*${l[f.XRANGEPLAINLOOSE]}$`), w("COERCEPLAIN", `(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`), w("COERCE", `${l[f.COERCEPLAIN]}(?:$|[^\\d])`), w("COERCEFULL", l[f.COERCEPLAIN] + `(?:${l[f.PRERELEASE]})?(?:${l[f.BUILD]})?(?:$|[^\\d])`), w("COERCERTL", l[f.COERCE], !0), w("COERCERTLFULL", l[f.COERCEFULL], !0), w("LONETILDE", "(?:~>?)"), w("TILDETRIM", `(\\s*)${l[f.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", w("TILDE", `^${l[f.LONETILDE]}${l[f.XRANGEPLAIN]}$`), w("TILDELOOSE", `^${l[f.LONETILDE]}${l[f.XRANGEPLAINLOOSE]}$`), w("LONECARET", "(?:\\^)"), w("CARETTRIM", `(\\s*)${l[f.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", w("CARET", `^${l[f.LONECARET]}${l[f.XRANGEPLAIN]}$`), w("CARETLOOSE", `^${l[f.LONECARET]}${l[f.XRANGEPLAINLOOSE]}$`), w("COMPARATORLOOSE", `^${l[f.GTLT]}\\s*(${l[f.LOOSEPLAIN]})$|^$`), w("COMPARATOR", `^${l[f.GTLT]}\\s*(${l[f.FULLPLAIN]})$|^$`), w("COMPARATORTRIM", `(\\s*)${l[f.GTLT]}\\s*(${l[f.LOOSEPLAIN]}|${l[f.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", w("HYPHENRANGE", `^\\s*(${l[f.XRANGEPLAIN]})\\s+-\\s+(${l[f.XRANGEPLAIN]})\\s*$`), w("HYPHENRANGELOOSE", `^\\s*(${l[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[f.XRANGEPLAINLOOSE]})\\s*$`), w("STAR", "(<|>)?=?\\s*\\*"), w("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), w("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$"); +})(f4, f4.exports); +var l1 = f4.exports; +const goe = Object.freeze({ loose: !0 }), voe = Object.freeze({}), boe = (t) => t ? typeof t != "object" ? goe : t : voe; +var O5 = boe; +const AM = /^[0-9]+$/, _B = (t, e) => { + if (typeof t == "number" && typeof e == "number") + return t === e ? 0 : t < e ? -1 : 1; + const n = AM.test(t), i = AM.test(e); + return n && i && (t = +t, e = +e), t === e ? 0 : n && !i ? -1 : i && !n ? 1 : t < e ? -1 : 1; +}, yoe = (t, e) => _B(e, t); +var OB = { + compareIdentifiers: _B, + rcompareIdentifiers: yoe +}; +const Uv = qk, { MAX_LENGTH: DM, MAX_SAFE_INTEGER: Zv } = Zk, { safeRe: qv, t: Yv } = l1, woe = O5, { compareIdentifiers: w3 } = OB; +let koe = class ua { + constructor(e, n) { + if (n = woe(n), e instanceof ua) { + if (e.loose === !!n.loose && e.includePrerelease === !!n.includePrerelease) + return e; + e = e.version; + } else if (typeof e != "string") + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`); + if (e.length > DM) + throw new TypeError( + `version is longer than ${DM} characters` + ); + Uv("SemVer", e, n), this.options = n, this.loose = !!n.loose, this.includePrerelease = !!n.includePrerelease; + const i = e.trim().match(n.loose ? qv[Yv.LOOSE] : qv[Yv.FULL]); + if (!i) + throw new TypeError(`Invalid Version: ${e}`); + if (this.raw = e, this.major = +i[1], this.minor = +i[2], this.patch = +i[3], this.major > Zv || this.major < 0) + throw new TypeError("Invalid major version"); + if (this.minor > Zv || this.minor < 0) + throw new TypeError("Invalid minor version"); + if (this.patch > Zv || this.patch < 0) + throw new TypeError("Invalid patch version"); + i[4] ? this.prerelease = i[4].split(".").map((r) => { + if (/^[0-9]+$/.test(r)) { + const s = +r; + if (s >= 0 && s < Zv) + return s; + } + return r; + }) : this.prerelease = [], this.build = i[5] ? i[5].split(".") : [], this.format(); + } + format() { + return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version; + } + toString() { + return this.version; + } + compare(e) { + if (Uv("SemVer.compare", this.version, this.options, e), !(e instanceof ua)) { + if (typeof e == "string" && e === this.version) + return 0; + e = new ua(e, this.options); + } + return e.version === this.version ? 0 : this.compareMain(e) || this.comparePre(e); + } + compareMain(e) { + return e instanceof ua || (e = new ua(e, this.options)), this.major < e.major ? -1 : this.major > e.major ? 1 : this.minor < e.minor ? -1 : this.minor > e.minor ? 1 : this.patch < e.patch ? -1 : this.patch > e.patch ? 1 : 0; + } + comparePre(e) { + if (e instanceof ua || (e = new ua(e, this.options)), this.prerelease.length && !e.prerelease.length) + return -1; + if (!this.prerelease.length && e.prerelease.length) + return 1; + if (!this.prerelease.length && !e.prerelease.length) + return 0; + let n = 0; + do { + const i = this.prerelease[n], r = e.prerelease[n]; + if (Uv("prerelease compare", n, i, r), i === void 0 && r === void 0) + return 0; + if (r === void 0) + return 1; + if (i === void 0) + return -1; + if (i === r) + continue; + return w3(i, r); + } while (++n); + } + compareBuild(e) { + e instanceof ua || (e = new ua(e, this.options)); + let n = 0; + do { + const i = this.build[n], r = e.build[n]; + if (Uv("build compare", n, i, r), i === void 0 && r === void 0) + return 0; + if (r === void 0) + return 1; + if (i === void 0) + return -1; + if (i === r) + continue; + return w3(i, r); + } while (++n); + } + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc(e, n, i) { + if (e.startsWith("pre")) { + if (!n && i === !1) + throw new Error("invalid increment argument: identifier is empty"); + if (n) { + const r = `-${n}`.match(this.options.loose ? qv[Yv.PRERELEASELOOSE] : qv[Yv.PRERELEASE]); + if (!r || r[1] !== n) + throw new Error(`invalid identifier: ${n}`); + } + } + switch (e) { + case "premajor": + this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", n, i); + break; + case "preminor": + this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", n, i); + break; + case "prepatch": + this.prerelease.length = 0, this.inc("patch", n, i), this.inc("pre", n, i); + break; + case "prerelease": + this.prerelease.length === 0 && this.inc("patch", n, i), this.inc("pre", n, i); + break; + case "release": + if (this.prerelease.length === 0) + throw new Error(`version ${this.raw} is not a prerelease`); + this.prerelease.length = 0; + break; + case "major": + (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = []; + break; + case "minor": + (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = []; + break; + case "patch": + this.prerelease.length === 0 && this.patch++, this.prerelease = []; + break; + case "pre": { + const r = Number(i) ? 1 : 0; + if (this.prerelease.length === 0) + this.prerelease = [r]; + else { + let s = this.prerelease.length; + for (; --s >= 0; ) + typeof this.prerelease[s] == "number" && (this.prerelease[s]++, s = -2); + if (s === -1) { + if (n === this.prerelease.join(".") && i === !1) + throw new Error("invalid increment argument: identifier already exists"); + this.prerelease.push(r); + } + } + if (n) { + let s = [n, r]; + i === !1 && (s = [n]), w3(this.prerelease[0], n) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = s) : this.prerelease = s; + } + break; + } + default: + throw new Error(`invalid increment argument: ${e}`); + } + return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this; + } +}; +var ss = koe; +const PM = ss, xoe = (t, e, n = !1) => { + if (t instanceof PM) + return t; + try { + return new PM(t, e); + } catch (i) { + if (!n) + return null; + throw i; + } +}; +var Jh = xoe; +const _oe = Jh, Ooe = (t, e) => { + const n = _oe(t, e); + return n ? n.version : null; +}; +var Soe = Ooe; +const Coe = Jh, Eoe = (t, e) => { + const n = Coe(t.trim().replace(/^[=v]+/, ""), e); + return n ? n.version : null; +}; +var Toe = Eoe; +const IM = ss, $oe = (t, e, n, i, r) => { + typeof n == "string" && (r = i, i = n, n = void 0); + try { + return new IM( + t instanceof IM ? t.version : t, + n + ).inc(e, i, r).version; + } catch { + return null; + } +}; +var Moe = $oe; +const LM = Jh, Noe = (t, e) => { + const n = LM(t, null, !0), i = LM(e, null, !0), r = n.compare(i); + if (r === 0) + return null; + const s = r > 0, o = s ? n : i, a = s ? i : n, l = !!o.prerelease.length; + if (!!a.prerelease.length && !l) { + if (!a.patch && !a.minor) + return "major"; + if (a.compareMain(o) === 0) + return a.minor && !a.patch ? "minor" : "patch"; + } + const f = l ? "pre" : ""; + return n.major !== i.major ? f + "major" : n.minor !== i.minor ? f + "minor" : n.patch !== i.patch ? f + "patch" : "prerelease"; +}; +var Aoe = Noe; +const Doe = ss, Poe = (t, e) => new Doe(t, e).major; +var Ioe = Poe; +const Loe = ss, Roe = (t, e) => new Loe(t, e).minor; +var joe = Roe; +const Foe = ss, Boe = (t, e) => new Foe(t, e).patch; +var zoe = Boe; +const Woe = Jh, Hoe = (t, e) => { + const n = Woe(t, e); + return n && n.prerelease.length ? n.prerelease : null; +}; +var Qoe = Hoe; +const RM = ss, Uoe = (t, e, n) => new RM(t, n).compare(new RM(e, n)); +var Uo = Uoe; +const Zoe = Uo, qoe = (t, e, n) => Zoe(e, t, n); +var Yoe = qoe; +const Voe = Uo, Xoe = (t, e) => Voe(t, e, !0); +var Goe = Xoe; +const jM = ss, Koe = (t, e, n) => { + const i = new jM(t, n), r = new jM(e, n); + return i.compare(r) || i.compareBuild(r); +}; +var S5 = Koe; +const Joe = S5, eae = (t, e) => t.sort((n, i) => Joe(n, i, e)); +var tae = eae; +const nae = S5, iae = (t, e) => t.sort((n, i) => nae(i, n, e)); +var rae = iae; +const sae = Uo, oae = (t, e, n) => sae(t, e, n) > 0; +var Yk = oae; +const aae = Uo, lae = (t, e, n) => aae(t, e, n) < 0; +var C5 = lae; +const uae = Uo, cae = (t, e, n) => uae(t, e, n) === 0; +var SB = cae; +const fae = Uo, dae = (t, e, n) => fae(t, e, n) !== 0; +var CB = dae; +const hae = Uo, pae = (t, e, n) => hae(t, e, n) >= 0; +var E5 = pae; +const mae = Uo, gae = (t, e, n) => mae(t, e, n) <= 0; +var T5 = gae; +const vae = SB, bae = CB, yae = Yk, wae = E5, kae = C5, xae = T5, _ae = (t, e, n, i) => { + switch (e) { + case "===": + return typeof t == "object" && (t = t.version), typeof n == "object" && (n = n.version), t === n; + case "!==": + return typeof t == "object" && (t = t.version), typeof n == "object" && (n = n.version), t !== n; + case "": + case "=": + case "==": + return vae(t, n, i); + case "!=": + return bae(t, n, i); + case ">": + return yae(t, n, i); + case ">=": + return wae(t, n, i); + case "<": + return kae(t, n, i); + case "<=": + return xae(t, n, i); + default: + throw new TypeError(`Invalid operator: ${e}`); + } +}; +var EB = _ae; +const Oae = ss, Sae = Jh, { safeRe: Vv, t: Xv } = l1, Cae = (t, e) => { + if (t instanceof Oae) + return t; + if (typeof t == "number" && (t = String(t)), typeof t != "string") + return null; + e = e || {}; + let n = null; + if (!e.rtl) + n = t.match(e.includePrerelease ? Vv[Xv.COERCEFULL] : Vv[Xv.COERCE]); + else { + const l = e.includePrerelease ? Vv[Xv.COERCERTLFULL] : Vv[Xv.COERCERTL]; + let u; + for (; (u = l.exec(t)) && (!n || n.index + n[0].length !== t.length); ) + (!n || u.index + u[0].length !== n.index + n[0].length) && (n = u), l.lastIndex = u.index + u[1].length + u[2].length; + l.lastIndex = -1; + } + if (n === null) + return null; + const i = n[2], r = n[3] || "0", s = n[4] || "0", o = e.includePrerelease && n[5] ? `-${n[5]}` : "", a = e.includePrerelease && n[6] ? `+${n[6]}` : ""; + return Sae(`${i}.${r}.${s}${o}${a}`, e); +}; +var Eae = Cae; +class Tae { + constructor() { + this.max = 1e3, this.map = /* @__PURE__ */ new Map(); + } + get(e) { + const n = this.map.get(e); + if (n !== void 0) + return this.map.delete(e), this.map.set(e, n), n; + } + delete(e) { + return this.map.delete(e); + } + set(e, n) { + if (!this.delete(e) && n !== void 0) { + if (this.map.size >= this.max) { + const r = this.map.keys().next().value; + this.delete(r); + } + this.map.set(e, n); + } + return this; + } +} +var $ae = Tae, k3, FM; +function Zo() { + if (FM) return k3; + FM = 1; + const t = /\s+/g; + class e { + constructor(R, q) { + if (q = r(q), R instanceof e) + return R.loose === !!q.loose && R.includePrerelease === !!q.includePrerelease ? R : new e(R.raw, q); + if (R instanceof s) + return this.raw = R.value, this.set = [[R]], this.formatted = void 0, this; + if (this.options = q, this.loose = !!q.loose, this.includePrerelease = !!q.includePrerelease, this.raw = R.trim().replace(t, " "), this.set = this.raw.split("||").map((Y) => this.parseRange(Y.trim())).filter((Y) => Y.length), !this.set.length) + throw new TypeError(`Invalid SemVer Range: ${this.raw}`); + if (this.set.length > 1) { + const Y = this.set[0]; + if (this.set = this.set.filter((K) => !w(K[0])), this.set.length === 0) + this.set = [Y]; + else if (this.set.length > 1) { + for (const K of this.set) + if (K.length === 1 && x(K[0])) { + this.set = [K]; + break; + } + } + } + this.formatted = void 0; + } + get range() { + if (this.formatted === void 0) { + this.formatted = ""; + for (let R = 0; R < this.set.length; R++) { + R > 0 && (this.formatted += "||"); + const q = this.set[R]; + for (let Y = 0; Y < q.length; Y++) + Y > 0 && (this.formatted += " "), this.formatted += q[Y].toString().trim(); + } + } + return this.formatted; + } + format() { + return this.range; + } + toString() { + return this.range; + } + parseRange(R) { + const Y = ((this.options.includePrerelease && m) | (this.options.loose && g)) + ":" + R, K = i.get(Y); + if (K) + return K; + const te = this.options.loose, se = te ? l[u.HYPHENRANGELOOSE] : l[u.HYPHENRANGE]; + R = R.replace(se, Q(this.options.includePrerelease)), o("hyphen replace", R), R = R.replace(l[u.COMPARATORTRIM], f), o("comparator trim", R), R = R.replace(l[u.TILDETRIM], d), o("tilde trim", R), R = R.replace(l[u.CARETTRIM], h), o("caret trim", R); + let ce = R.split(" ").map((le) => S(le, this.options)).join(" ").split(/\s+/).map((le) => L(le, this.options)); + te && (ce = ce.filter((le) => (o("loose invalid filter", le, this.options), !!le.match(l[u.COMPARATORLOOSE])))), o("range list", ce); + const U = /* @__PURE__ */ new Map(), F = ce.map((le) => new s(le, this.options)); + for (const le of F) { + if (w(le)) + return [le]; + U.set(le.value, le); + } + U.size > 1 && U.has("") && U.delete(""); + const oe = [...U.values()]; + return i.set(Y, oe), oe; + } + intersects(R, q) { + if (!(R instanceof e)) + throw new TypeError("a Range is required"); + return this.set.some((Y) => _(Y, q) && R.set.some((K) => _(K, q) && Y.every((te) => K.every((se) => te.intersects(se, q))))); + } + // if ANY of the sets match ALL of its comparators, then pass + test(R) { + if (!R) + return !1; + if (typeof R == "string") + try { + R = new a(R, this.options); + } catch { + return !1; + } + for (let q = 0; q < this.set.length; q++) + if (V(this.set[q], R, this.options)) + return !0; + return !1; + } + } + k3 = e; + const n = $ae, i = new n(), r = O5, s = Vk(), o = qk, a = ss, { + safeRe: l, + t: u, + comparatorTrimReplace: f, + tildeTrimReplace: d, + caretTrimReplace: h + } = l1, { FLAG_INCLUDE_PRERELEASE: m, FLAG_LOOSE: g } = Zk, w = (H) => H.value === "<0.0.0-0", x = (H) => H.value === "", _ = (H, R) => { + let q = !0; + const Y = H.slice(); + let K = Y.pop(); + for (; q && Y.length; ) + q = Y.every((te) => K.intersects(te, R)), K = Y.pop(); + return q; + }, S = (H, R) => (H = H.replace(l[u.BUILD], ""), o("comp", H, R), H = $(H, R), o("caret", H), H = E(H, R), o("tildes", H), H = W(H, R), o("xrange", H), H = Z(H, R), o("stars", H), H), C = (H) => !H || H.toLowerCase() === "x" || H === "*", E = (H, R) => H.trim().split(/\s+/).map((q) => M(q, R)).join(" "), M = (H, R) => { + const q = R.loose ? l[u.TILDELOOSE] : l[u.TILDE]; + return H.replace(q, (Y, K, te, se, ce) => { + o("tilde", H, Y, K, te, se, ce); + let U; + return C(K) ? U = "" : C(te) ? U = `>=${K}.0.0 <${+K + 1}.0.0-0` : C(se) ? U = `>=${K}.${te}.0 <${K}.${+te + 1}.0-0` : ce ? (o("replaceTilde pr", ce), U = `>=${K}.${te}.${se}-${ce} <${K}.${+te + 1}.0-0`) : U = `>=${K}.${te}.${se} <${K}.${+te + 1}.0-0`, o("tilde return", U), U; + }); + }, $ = (H, R) => H.trim().split(/\s+/).map((q) => P(q, R)).join(" "), P = (H, R) => { + o("caret", H, R); + const q = R.loose ? l[u.CARETLOOSE] : l[u.CARET], Y = R.includePrerelease ? "-0" : ""; + return H.replace(q, (K, te, se, ce, U) => { + o("caret", H, K, te, se, ce, U); + let F; + return C(te) ? F = "" : C(se) ? F = `>=${te}.0.0${Y} <${+te + 1}.0.0-0` : C(ce) ? te === "0" ? F = `>=${te}.${se}.0${Y} <${te}.${+se + 1}.0-0` : F = `>=${te}.${se}.0${Y} <${+te + 1}.0.0-0` : U ? (o("replaceCaret pr", U), te === "0" ? se === "0" ? F = `>=${te}.${se}.${ce}-${U} <${te}.${se}.${+ce + 1}-0` : F = `>=${te}.${se}.${ce}-${U} <${te}.${+se + 1}.0-0` : F = `>=${te}.${se}.${ce}-${U} <${+te + 1}.0.0-0`) : (o("no pr"), te === "0" ? se === "0" ? F = `>=${te}.${se}.${ce}${Y} <${te}.${se}.${+ce + 1}-0` : F = `>=${te}.${se}.${ce}${Y} <${te}.${+se + 1}.0-0` : F = `>=${te}.${se}.${ce} <${+te + 1}.0.0-0`), o("caret return", F), F; + }); + }, W = (H, R) => (o("replaceXRanges", H, R), H.split(/\s+/).map((q) => z(q, R)).join(" ")), z = (H, R) => { + H = H.trim(); + const q = R.loose ? l[u.XRANGELOOSE] : l[u.XRANGE]; + return H.replace(q, (Y, K, te, se, ce, U) => { + o("xRange", H, Y, K, te, se, ce, U); + const F = C(te), oe = F || C(se), le = oe || C(ce), pe = le; + return K === "=" && pe && (K = ""), U = R.includePrerelease ? "-0" : "", F ? K === ">" || K === "<" ? Y = "<0.0.0-0" : Y = "*" : K && pe ? (oe && (se = 0), ce = 0, K === ">" ? (K = ">=", oe ? (te = +te + 1, se = 0, ce = 0) : (se = +se + 1, ce = 0)) : K === "<=" && (K = "<", oe ? te = +te + 1 : se = +se + 1), K === "<" && (U = "-0"), Y = `${K + te}.${se}.${ce}${U}`) : oe ? Y = `>=${te}.0.0${U} <${+te + 1}.0.0-0` : le && (Y = `>=${te}.${se}.0${U} <${te}.${+se + 1}.0-0`), o("xRange return", Y), Y; + }); + }, Z = (H, R) => (o("replaceStars", H, R), H.trim().replace(l[u.STAR], "")), L = (H, R) => (o("replaceGTE0", H, R), H.trim().replace(l[R.includePrerelease ? u.GTE0PRE : u.GTE0], "")), Q = (H) => (R, q, Y, K, te, se, ce, U, F, oe, le, pe) => (C(Y) ? q = "" : C(K) ? q = `>=${Y}.0.0${H ? "-0" : ""}` : C(te) ? q = `>=${Y}.${K}.0${H ? "-0" : ""}` : se ? q = `>=${q}` : q = `>=${q}${H ? "-0" : ""}`, C(F) ? U = "" : C(oe) ? U = `<${+F + 1}.0.0-0` : C(le) ? U = `<${F}.${+oe + 1}.0-0` : pe ? U = `<=${F}.${oe}.${le}-${pe}` : H ? U = `<${F}.${oe}.${+le + 1}-0` : U = `<=${U}`, `${q} ${U}`.trim()), V = (H, R, q) => { + for (let Y = 0; Y < H.length; Y++) + if (!H[Y].test(R)) + return !1; + if (R.prerelease.length && !q.includePrerelease) { + for (let Y = 0; Y < H.length; Y++) + if (o(H[Y].semver), H[Y].semver !== s.ANY && H[Y].semver.prerelease.length > 0) { + const K = H[Y].semver; + if (K.major === R.major && K.minor === R.minor && K.patch === R.patch) + return !0; + } + return !1; + } + return !0; + }; + return k3; +} +var x3, BM; +function Vk() { + if (BM) return x3; + BM = 1; + const t = Symbol("SemVer ANY"); + class e { + static get ANY() { + return t; + } + constructor(f, d) { + if (d = n(d), f instanceof e) { + if (f.loose === !!d.loose) + return f; + f = f.value; + } + f = f.trim().split(/\s+/).join(" "), o("comparator", f, d), this.options = d, this.loose = !!d.loose, this.parse(f), this.semver === t ? this.value = "" : this.value = this.operator + this.semver.version, o("comp", this); + } + parse(f) { + const d = this.options.loose ? i[r.COMPARATORLOOSE] : i[r.COMPARATOR], h = f.match(d); + if (!h) + throw new TypeError(`Invalid comparator: ${f}`); + this.operator = h[1] !== void 0 ? h[1] : "", this.operator === "=" && (this.operator = ""), h[2] ? this.semver = new a(h[2], this.options.loose) : this.semver = t; + } + toString() { + return this.value; + } + test(f) { + if (o("Comparator.test", f, this.options.loose), this.semver === t || f === t) + return !0; + if (typeof f == "string") + try { + f = new a(f, this.options); + } catch { + return !1; + } + return s(f, this.operator, this.semver, this.options); + } + intersects(f, d) { + if (!(f instanceof e)) + throw new TypeError("a Comparator is required"); + return this.operator === "" ? this.value === "" ? !0 : new l(f.value, d).test(this.value) : f.operator === "" ? f.value === "" ? !0 : new l(this.value, d).test(f.semver) : (d = n(d), d.includePrerelease && (this.value === "<0.0.0-0" || f.value === "<0.0.0-0") || !d.includePrerelease && (this.value.startsWith("<0.0.0") || f.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && f.operator.startsWith(">") || this.operator.startsWith("<") && f.operator.startsWith("<") || this.semver.version === f.semver.version && this.operator.includes("=") && f.operator.includes("=") || s(this.semver, "<", f.semver, d) && this.operator.startsWith(">") && f.operator.startsWith("<") || s(this.semver, ">", f.semver, d) && this.operator.startsWith("<") && f.operator.startsWith(">"))); + } + } + x3 = e; + const n = O5, { safeRe: i, t: r } = l1, s = EB, o = qk, a = ss, l = Zo(); + return x3; +} +const Mae = Zo(), Nae = (t, e, n) => { + try { + e = new Mae(e, n); + } catch { + return !1; + } + return e.test(t); +}; +var Xk = Nae; +const Aae = Zo(), Dae = (t, e) => new Aae(t, e).set.map((n) => n.map((i) => i.value).join(" ").trim().split(" ")); +var Pae = Dae; +const Iae = ss, Lae = Zo(), Rae = (t, e, n) => { + let i = null, r = null, s = null; + try { + s = new Lae(e, n); + } catch { + return null; + } + return t.forEach((o) => { + s.test(o) && (!i || r.compare(o) === -1) && (i = o, r = new Iae(i, n)); + }), i; +}; +var jae = Rae; +const Fae = ss, Bae = Zo(), zae = (t, e, n) => { + let i = null, r = null, s = null; + try { + s = new Bae(e, n); + } catch { + return null; + } + return t.forEach((o) => { + s.test(o) && (!i || r.compare(o) === 1) && (i = o, r = new Fae(i, n)); + }), i; +}; +var Wae = zae; +const _3 = ss, Hae = Zo(), zM = Yk, Qae = (t, e) => { + t = new Hae(t, e); + let n = new _3("0.0.0"); + if (t.test(n) || (n = new _3("0.0.0-0"), t.test(n))) + return n; + n = null; + for (let i = 0; i < t.set.length; ++i) { + const r = t.set[i]; + let s = null; + r.forEach((o) => { + const a = new _3(o.semver.version); + switch (o.operator) { + case ">": + a.prerelease.length === 0 ? a.patch++ : a.prerelease.push(0), a.raw = a.format(); + case "": + case ">=": + (!s || zM(a, s)) && (s = a); + break; + case "<": + case "<=": + break; + default: + throw new Error(`Unexpected operation: ${o.operator}`); + } + }), s && (!n || zM(n, s)) && (n = s); + } + return n && t.test(n) ? n : null; +}; +var Uae = Qae; +const Zae = Zo(), qae = (t, e) => { + try { + return new Zae(t, e).range || "*"; + } catch { + return null; + } +}; +var Yae = qae; +const Vae = ss, TB = Vk(), { ANY: Xae } = TB, Gae = Zo(), Kae = Xk, WM = Yk, HM = C5, Jae = T5, ele = E5, tle = (t, e, n, i) => { + t = new Vae(t, i), e = new Gae(e, i); + let r, s, o, a, l; + switch (n) { + case ">": + r = WM, s = Jae, o = HM, a = ">", l = ">="; + break; + case "<": + r = HM, s = ele, o = WM, a = "<", l = "<="; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } + if (Kae(t, e, i)) + return !1; + for (let u = 0; u < e.set.length; ++u) { + const f = e.set[u]; + let d = null, h = null; + if (f.forEach((m) => { + m.semver === Xae && (m = new TB(">=0.0.0")), d = d || m, h = h || m, r(m.semver, d.semver, i) ? d = m : o(m.semver, h.semver, i) && (h = m); + }), d.operator === a || d.operator === l || (!h.operator || h.operator === a) && s(t, h.semver)) + return !1; + if (h.operator === l && o(t, h.semver)) + return !1; + } + return !0; +}; +var $5 = tle; +const nle = $5, ile = (t, e, n) => nle(t, e, ">", n); +var rle = ile; +const sle = $5, ole = (t, e, n) => sle(t, e, "<", n); +var ale = ole; +const QM = Zo(), lle = (t, e, n) => (t = new QM(t, n), e = new QM(e, n), t.intersects(e, n)); +var ule = lle; +const cle = Xk, fle = Uo; +var dle = (t, e, n) => { + const i = []; + let r = null, s = null; + const o = t.sort((f, d) => fle(f, d, n)); + for (const f of o) + cle(f, e, n) ? (s = f, r || (r = f)) : (s && i.push([r, s]), s = null, r = null); + r && i.push([r, null]); + const a = []; + for (const [f, d] of i) + f === d ? a.push(f) : !d && f === o[0] ? a.push("*") : d ? f === o[0] ? a.push(`<=${d}`) : a.push(`${f} - ${d}`) : a.push(`>=${f}`); + const l = a.join(" || "), u = typeof e.raw == "string" ? e.raw : String(e); + return l.length < u.length ? l : e; +}; +const UM = Zo(), M5 = Vk(), { ANY: O3 } = M5, sm = Xk, N5 = Uo, hle = (t, e, n = {}) => { + if (t === e) + return !0; + t = new UM(t, n), e = new UM(e, n); + let i = !1; + e: for (const r of t.set) { + for (const s of e.set) { + const o = mle(r, s, n); + if (i = i || o !== null, o) + continue e; + } + if (i) + return !1; + } + return !0; +}, ple = [new M5(">=0.0.0-0")], ZM = [new M5(">=0.0.0")], mle = (t, e, n) => { + if (t === e) + return !0; + if (t.length === 1 && t[0].semver === O3) { + if (e.length === 1 && e[0].semver === O3) + return !0; + n.includePrerelease ? t = ple : t = ZM; + } + if (e.length === 1 && e[0].semver === O3) { + if (n.includePrerelease) + return !0; + e = ZM; + } + const i = /* @__PURE__ */ new Set(); + let r, s; + for (const m of t) + m.operator === ">" || m.operator === ">=" ? r = qM(r, m, n) : m.operator === "<" || m.operator === "<=" ? s = YM(s, m, n) : i.add(m.semver); + if (i.size > 1) + return null; + let o; + if (r && s) { + if (o = N5(r.semver, s.semver, n), o > 0) + return null; + if (o === 0 && (r.operator !== ">=" || s.operator !== "<=")) + return null; + } + for (const m of i) { + if (r && !sm(m, String(r), n) || s && !sm(m, String(s), n)) + return null; + for (const g of e) + if (!sm(m, String(g), n)) + return !1; + return !0; + } + let a, l, u, f, d = s && !n.includePrerelease && s.semver.prerelease.length ? s.semver : !1, h = r && !n.includePrerelease && r.semver.prerelease.length ? r.semver : !1; + d && d.prerelease.length === 1 && s.operator === "<" && d.prerelease[0] === 0 && (d = !1); + for (const m of e) { + if (f = f || m.operator === ">" || m.operator === ">=", u = u || m.operator === "<" || m.operator === "<=", r) { + if (h && m.semver.prerelease && m.semver.prerelease.length && m.semver.major === h.major && m.semver.minor === h.minor && m.semver.patch === h.patch && (h = !1), m.operator === ">" || m.operator === ">=") { + if (a = qM(r, m, n), a === m && a !== r) + return !1; + } else if (r.operator === ">=" && !sm(r.semver, String(m), n)) + return !1; + } + if (s) { + if (d && m.semver.prerelease && m.semver.prerelease.length && m.semver.major === d.major && m.semver.minor === d.minor && m.semver.patch === d.patch && (d = !1), m.operator === "<" || m.operator === "<=") { + if (l = YM(s, m, n), l === m && l !== s) + return !1; + } else if (s.operator === "<=" && !sm(s.semver, String(m), n)) + return !1; + } + if (!m.operator && (s || r) && o !== 0) + return !1; + } + return !(r && u && !s && o !== 0 || s && f && !r && o !== 0 || h || d); +}, qM = (t, e, n) => { + if (!t) + return e; + const i = N5(t.semver, e.semver, n); + return i > 0 ? t : i < 0 || e.operator === ">" && t.operator === ">=" ? e : t; +}, YM = (t, e, n) => { + if (!t) + return e; + const i = N5(t.semver, e.semver, n); + return i < 0 ? t : i > 0 || e.operator === "<" && t.operator === "<=" ? e : t; +}; +var gle = hle; +const S3 = l1, VM = Zk, vle = ss, XM = OB, ble = Jh, yle = Soe, wle = Toe, kle = Moe, xle = Aoe, _le = Ioe, Ole = joe, Sle = zoe, Cle = Qoe, Ele = Uo, Tle = Yoe, $le = Goe, Mle = S5, Nle = tae, Ale = rae, Dle = Yk, Ple = C5, Ile = SB, Lle = CB, Rle = E5, jle = T5, Fle = EB, Ble = Eae, zle = Vk(), Wle = Zo(), Hle = Xk, Qle = Pae, Ule = jae, Zle = Wae, qle = Uae, Yle = Yae, Vle = $5, Xle = rle, Gle = ale, Kle = ule, Jle = dle, eue = gle; +var Gk = { + parse: ble, + valid: yle, + clean: wle, + inc: kle, + diff: xle, + major: _le, + minor: Ole, + patch: Sle, + prerelease: Cle, + compare: Ele, + rcompare: Tle, + compareLoose: $le, + compareBuild: Mle, + sort: Nle, + rsort: Ale, + gt: Dle, + lt: Ple, + eq: Ile, + neq: Lle, + gte: Rle, + lte: jle, + cmp: Fle, + coerce: Ble, + Comparator: zle, + Range: Wle, + satisfies: Hle, + toComparators: Qle, + maxSatisfying: Ule, + minSatisfying: Zle, + minVersion: qle, + validRange: Yle, + outside: Vle, + gtr: Xle, + ltr: Gle, + intersects: Kle, + simplifyRange: Jle, + subset: eue, + SemVer: vle, + re: S3.re, + src: S3.src, + tokens: S3.t, + SEMVER_SPEC_VERSION: VM.SEMVER_SPEC_VERSION, + RELEASE_TYPES: VM.RELEASE_TYPES, + compareIdentifiers: XM.compareIdentifiers, + rcompareIdentifiers: XM.rcompareIdentifiers +}; +const GM = Gk; +var tue = function(t = "", { ghostVersion: e = "4.0", type: n = "mobiledoc" } = {}) { + const i = GM.coerce(e); + return typeof t != "string" || (t || "").trim() === "" ? "" : GM.satisfies(i, "<4.x") ? n === "markdown" ? t.replace(/[^\w]/g, "").toLowerCase() : t.replace(/[<>&"?]/g, "").trim().replace(/[^\w]/g, "-").replace(/-{2,}/g, "-").toLowerCase() : encodeURIComponent( + t.trim().toLowerCase().replace(/[\][!"#$%&'()*+,./:;<=>?@\\^_{|}~]/g, "").replace(/\s+/g, "-").replace(/^-|-{2,}|-$/g, "") + ); +}, nue = { + slugify: tue +}, iue = nue, C3, KM; +function nw() { + if (KM) return C3; + KM = 1; + function t(u, f, d, h) { + const m = Number(u[f].meta.id + 1).toString(); + let g = ""; + return typeof h.docId == "string" && (g = `-${h.docId}-`), g + m; + } + function e(u, f) { + let d = Number(u[f].meta.id + 1).toString(); + return u[f].meta.subId > 0 && (d += `:${u[f].meta.subId}`), `[${d}]`; + } + function n(u, f, d, h, m) { + const g = m.rules.footnote_anchor_name(u, f, d, h, m), w = m.rules.footnote_caption(u, f, d, h, m); + let x = g; + return u[f].meta.subId > 0 && (x += `:${u[f].meta.subId}`), `${w}`; + } + function i(u, f, d) { + return (d.xhtmlOut ? `
    +` : `
    +`) + `
    +
      +`; + } + function r() { + return `
    +
    +`; + } + function s(u, f, d, h, m) { + let g = m.rules.footnote_anchor_name(u, f, d, h, m); + return u[f].meta.subId > 0 && (g += `:${u[f].meta.subId}`), `
  • `; + } + function o() { + return `
  • +`; + } + function a(u, f, d, h, m) { + let g = m.rules.footnote_anchor_name(u, f, d, h, m); + return u[f].meta.subId > 0 && (g += `:${u[f].meta.subId}`), ` ↩︎`; + } + function l(u) { + const f = u.helpers.parseLinkLabel, d = u.utils.isSpace; + u.renderer.rules.footnote_ref = n, u.renderer.rules.footnote_block_open = i, u.renderer.rules.footnote_block_close = r, u.renderer.rules.footnote_open = s, u.renderer.rules.footnote_close = o, u.renderer.rules.footnote_anchor = a, u.renderer.rules.footnote_caption = e, u.renderer.rules.footnote_anchor_name = t; + function h(x, _, S, C) { + const E = x.bMarks[_] + x.tShift[_], M = x.eMarks[_]; + if (E + 4 > M || x.src.charCodeAt(E) !== 91 || x.src.charCodeAt(E + 1) !== 94) return !1; + let $; + for ($ = E + 2; $ < M; $++) { + if (x.src.charCodeAt($) === 32) return !1; + if (x.src.charCodeAt($) === 93) + break; + } + if ($ === E + 2 || $ + 1 >= M || x.src.charCodeAt(++$) !== 58) return !1; + if (C) return !0; + $++, x.env.footnotes || (x.env.footnotes = {}), x.env.footnotes.refs || (x.env.footnotes.refs = {}); + const P = x.src.slice(E + 2, $ - 2); + x.env.footnotes.refs[`:${P}`] = -1; + const W = new x.Token("footnote_reference_open", "", 1); + W.meta = { + label: P + }, W.level = x.level++, x.tokens.push(W); + const z = x.bMarks[_], Z = x.tShift[_], L = x.sCount[_], Q = x.parentType, V = $, H = x.sCount[_] + $ - (x.bMarks[_] + x.tShift[_]); + let R = H; + for (; $ < M; ) { + const Y = x.src.charCodeAt($); + if (d(Y)) + Y === 9 ? R += 4 - R % 4 : R++; + else + break; + $++; + } + x.tShift[_] = $ - V, x.sCount[_] = R - H, x.bMarks[_] = V, x.blkIndent += 4, x.parentType = "footnote", x.sCount[_] < x.blkIndent && (x.sCount[_] += x.blkIndent), x.md.block.tokenize(x, _, S, !0), x.parentType = Q, x.blkIndent -= 4, x.tShift[_] = Z, x.sCount[_] = L, x.bMarks[_] = z; + const q = new x.Token("footnote_reference_close", "", -1); + return q.level = --x.level, x.tokens.push(q), !0; + } + function m(x, _) { + const S = x.posMax, C = x.pos; + if (C + 2 >= S || x.src.charCodeAt(C) !== 94 || x.src.charCodeAt(C + 1) !== 91) return !1; + const E = C + 2, M = f(x, C + 1); + if (M < 0) return !1; + if (!_) { + x.env.footnotes || (x.env.footnotes = {}), x.env.footnotes.list || (x.env.footnotes.list = []); + const $ = x.env.footnotes.list.length, P = []; + x.md.inline.parse(x.src.slice(E, M), x.md, x.env, P); + const W = x.push("footnote_ref", "", 0); + W.meta = { + id: $ + }, x.env.footnotes.list[$] = { + content: x.src.slice(E, M), + tokens: P + }; + } + return x.pos = M + 1, x.posMax = S, !0; + } + function g(x, _) { + const S = x.posMax, C = x.pos; + if (C + 3 > S || !x.env.footnotes || !x.env.footnotes.refs || x.src.charCodeAt(C) !== 91 || x.src.charCodeAt(C + 1) !== 94) return !1; + let E; + for (E = C + 2; E < S; E++) { + if (x.src.charCodeAt(E) === 32 || x.src.charCodeAt(E) === 10) return !1; + if (x.src.charCodeAt(E) === 93) + break; + } + if (E === C + 2 || E >= S) return !1; + E++; + const M = x.src.slice(C + 2, E - 1); + if (typeof x.env.footnotes.refs[`:${M}`] > "u") return !1; + if (!_) { + x.env.footnotes.list || (x.env.footnotes.list = []); + let $; + x.env.footnotes.refs[`:${M}`] < 0 ? ($ = x.env.footnotes.list.length, x.env.footnotes.list[$] = { + label: M, + count: 0 + }, x.env.footnotes.refs[`:${M}`] = $) : $ = x.env.footnotes.refs[`:${M}`]; + const P = x.env.footnotes.list[$].count; + x.env.footnotes.list[$].count++; + const W = x.push("footnote_ref", "", 0); + W.meta = { + id: $, + subId: P, + label: M + }; + } + return x.pos = E, x.posMax = S, !0; + } + function w(x) { + let _, S, C, E = !1; + const M = {}; + if (!x.env.footnotes || (x.tokens = x.tokens.filter(function(P) { + return P.type === "footnote_reference_open" ? (E = !0, S = [], C = P.meta.label, !1) : P.type === "footnote_reference_close" ? (E = !1, M[":" + C] = S, !1) : (E && S.push(P), !E); + }), !x.env.footnotes.list)) + return; + const $ = x.env.footnotes.list; + x.tokens.push(new x.Token("footnote_block_open", "", 1)); + for (let P = 0, W = $.length; P < W; P++) { + const z = new x.Token("footnote_open", "", 1); + if (z.meta = { + id: P, + label: $[P].label + }, x.tokens.push(z), $[P].tokens) { + _ = []; + const Q = new x.Token("paragraph_open", "p", 1); + Q.block = !0, _.push(Q); + const V = new x.Token("inline", "", 0); + V.children = $[P].tokens, V.content = $[P].content, _.push(V); + const H = new x.Token("paragraph_close", "p", -1); + H.block = !0, _.push(H); + } else $[P].label && (_ = M[`:${$[P].label}`]); + _ && (x.tokens = x.tokens.concat(_)); + let Z; + x.tokens[x.tokens.length - 1].type === "paragraph_close" ? Z = x.tokens.pop() : Z = null; + const L = $[P].count > 0 ? $[P].count : 1; + for (let Q = 0; Q < L; Q++) { + const V = new x.Token("footnote_anchor", "", 0); + V.meta = { + id: P, + subId: Q, + label: $[P].label + }, x.tokens.push(V); + } + Z && x.tokens.push(Z), x.tokens.push(new x.Token("footnote_close", "", -1)); + } + x.tokens.push(new x.Token("footnote_block_close", "", -1)); + } + u.block.ruler.before("reference", "footnote_def", h, { + alt: ["paragraph", "reference"] + }), u.inline.ruler.after("image", "footnote_inline", m), u.inline.ruler.after("footnote_inline", "footnote_ref", g), u.core.ruler.after("inline", "footnote_tail", w); + } + return C3 = l, C3; +} +var E3, JM; +function iw() { + return JM || (JM = 1, E3 = function(e) { + function n(i, r, s, o) { + var a, l, u, f, d = i.bMarks[r] + i.tShift[r], h = i.eMarks[r]; + if (a = i.src.charCodeAt(d), a !== 35 || d >= h) + return !1; + for (l = 1, a = i.src.charCodeAt(++d); a === 35 && d < h && l <= 6; ) + l++, a = i.src.charCodeAt(++d); + return l > 6 ? !1 : (o || (h = i.skipCharsBack(h, 32, d), u = i.skipCharsBack(h, 35, d), u > d && i.src.charCodeAt(u - 1) === 32 && (h = u), i.line = r + 1, f = i.push("heading_open", "h" + String(l), 1), f.markup = "########".slice(0, l), f.map = [r, i.line], f = i.push("inline", "", 0), f.content = i.src.slice(d, h).trim(), f.map = [r, i.line], f.children = [], f = i.push("heading_close", "h" + String(l), -1), f.markup = "########".slice(0, l)), !0); + } + e.block.ruler.at("heading", n, { + alt: ["paragraph", "reference", "blockquote"] + }); + }), E3; +} +var T3, e7; +function rw() { + if (e7) return T3; + e7 = 1; + function t(e) { + function n(r, s) { + const o = r.pos, a = r.src.charCodeAt(o); + if (s || a !== 61) + return !1; + const l = r.scanDelims(r.pos, !0); + let u = l.length; + const f = String.fromCharCode(a); + if (u < 2) + return !1; + if (u % 2) { + const d = r.push("text", "", 0); + d.content = f, u--; + } + for (let d = 0; d < u; d += 2) { + const h = r.push("text", "", 0); + h.content = f + f, !(!l.can_open && !l.can_close) && r.delimiters.push({ + marker: a, + length: 0, + // disable "rule of 3" length checks meant for emphasis + jump: d / 2, + // 1 delimiter = 2 characters + token: r.tokens.length - 1, + end: -1, + open: l.can_open, + close: l.can_close + }); + } + return r.pos += l.length, !0; + } + function i(r, s) { + const o = [], a = s.length; + for (let l = 0; l < a; l++) { + const u = s[l]; + if (u.marker !== 61 || u.end === -1) + continue; + const f = s[u.end], d = r.tokens[u.token]; + d.type = "mark_open", d.tag = "mark", d.nesting = 1, d.markup = "==", d.content = ""; + const h = r.tokens[f.token]; + h.type = "mark_close", h.tag = "mark", h.nesting = -1, h.markup = "==", h.content = "", r.tokens[f.token - 1].type === "text" && r.tokens[f.token - 1].content === "=" && o.push(f.token - 1); + } + for (; o.length; ) { + const l = o.pop(); + let u = l + 1; + for (; u < r.tokens.length && r.tokens[u].type === "mark_close"; ) + u++; + if (u--, l !== u) { + const f = r.tokens[u]; + r.tokens[u] = r.tokens[l], r.tokens[l] = f; + } + } + } + e.inline.ruler.before("emphasis", "mark", n), e.inline.ruler2.before("emphasis", "mark", function(r) { + let s; + const o = r.tokens_meta, a = (r.tokens_meta || []).length; + for (i(r, r.delimiters), s = 0; s < a; s++) + o[s] && o[s].delimiters && i(r, o[s].delimiters); + }); + } + return T3 = t, T3; +} +var Gv = { exports: {} }; +const rue = {}, sue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: rue +}, Symbol.toStringTag, { value: "Module" })), i0 = /* @__PURE__ */ Sk(sue); +var Kv = { exports: {} }, Jv = { exports: {} }, t7; +function oue() { + return t7 || (t7 = 1, typeof Object.create == "function" ? Jv.exports = function(e, n) { + n && (e.super_ = n, e.prototype = Object.create(n.prototype, { + constructor: { + value: e, + enumerable: !1, + writable: !0, + configurable: !0 + } + })); + } : Jv.exports = function(e, n) { + if (n) { + e.super_ = n; + var i = function() { + }; + i.prototype = n.prototype, e.prototype = new i(), e.prototype.constructor = e; + } + }), Jv.exports; +} +var eb = { exports: {} }, n7; +function aue() { + if (n7) return eb.exports; + n7 = 1; + var t = typeof Reflect == "object" ? Reflect : null, e = t && typeof t.apply == "function" ? t.apply : function(M, $, P) { + return Function.prototype.apply.call(M, $, P); + }, n; + t && typeof t.ownKeys == "function" ? n = t.ownKeys : Object.getOwnPropertySymbols ? n = function(M) { + return Object.getOwnPropertyNames(M).concat(Object.getOwnPropertySymbols(M)); + } : n = function(M) { + return Object.getOwnPropertyNames(M); + }; + function i(E) { + console && console.warn && console.warn(E); + } + var r = Number.isNaN || function(M) { + return M !== M; + }; + function s() { + s.init.call(this); + } + eb.exports = s, eb.exports.once = _, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0; + var o = 10; + function a(E) { + if (typeof E != "function") + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof E); + } + Object.defineProperty(s, "defaultMaxListeners", { + enumerable: !0, + get: function() { + return o; + }, + set: function(E) { + if (typeof E != "number" || E < 0 || r(E)) + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + E + "."); + o = E; + } + }), s.init = function() { + (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0; + }, s.prototype.setMaxListeners = function(M) { + if (typeof M != "number" || M < 0 || r(M)) + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + M + "."); + return this._maxListeners = M, this; + }; + function l(E) { + return E._maxListeners === void 0 ? s.defaultMaxListeners : E._maxListeners; + } + s.prototype.getMaxListeners = function() { + return l(this); + }, s.prototype.emit = function(M) { + for (var $ = [], P = 1; P < arguments.length; P++) $.push(arguments[P]); + var W = M === "error", z = this._events; + if (z !== void 0) + W = W && z.error === void 0; + else if (!W) + return !1; + if (W) { + var Z; + if ($.length > 0 && (Z = $[0]), Z instanceof Error) + throw Z; + var L = new Error("Unhandled error." + (Z ? " (" + Z.message + ")" : "")); + throw L.context = Z, L; + } + var Q = z[M]; + if (Q === void 0) + return !1; + if (typeof Q == "function") + e(Q, this, $); + else + for (var V = Q.length, H = g(Q, V), P = 0; P < V; ++P) + e(H[P], this, $); + return !0; + }; + function u(E, M, $, P) { + var W, z, Z; + if (a($), z = E._events, z === void 0 ? (z = E._events = /* @__PURE__ */ Object.create(null), E._eventsCount = 0) : (z.newListener !== void 0 && (E.emit( + "newListener", + M, + $.listener ? $.listener : $ + ), z = E._events), Z = z[M]), Z === void 0) + Z = z[M] = $, ++E._eventsCount; + else if (typeof Z == "function" ? Z = z[M] = P ? [$, Z] : [Z, $] : P ? Z.unshift($) : Z.push($), W = l(E), W > 0 && Z.length > W && !Z.warned) { + Z.warned = !0; + var L = new Error("Possible EventEmitter memory leak detected. " + Z.length + " " + String(M) + " listeners added. Use emitter.setMaxListeners() to increase limit"); + L.name = "MaxListenersExceededWarning", L.emitter = E, L.type = M, L.count = Z.length, i(L); + } + return E; + } + s.prototype.addListener = function(M, $) { + return u(this, M, $, !1); + }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(M, $) { + return u(this, M, $, !0); + }; + function f() { + if (!this.fired) + return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments); + } + function d(E, M, $) { + var P = { fired: !1, wrapFn: void 0, target: E, type: M, listener: $ }, W = f.bind(P); + return W.listener = $, P.wrapFn = W, W; + } + s.prototype.once = function(M, $) { + return a($), this.on(M, d(this, M, $)), this; + }, s.prototype.prependOnceListener = function(M, $) { + return a($), this.prependListener(M, d(this, M, $)), this; + }, s.prototype.removeListener = function(M, $) { + var P, W, z, Z, L; + if (a($), W = this._events, W === void 0) + return this; + if (P = W[M], P === void 0) + return this; + if (P === $ || P.listener === $) + --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete W[M], W.removeListener && this.emit("removeListener", M, P.listener || $)); + else if (typeof P != "function") { + for (z = -1, Z = P.length - 1; Z >= 0; Z--) + if (P[Z] === $ || P[Z].listener === $) { + L = P[Z].listener, z = Z; + break; + } + if (z < 0) + return this; + z === 0 ? P.shift() : w(P, z), P.length === 1 && (W[M] = P[0]), W.removeListener !== void 0 && this.emit("removeListener", M, L || $); + } + return this; + }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(M) { + var $, P, W; + if (P = this._events, P === void 0) + return this; + if (P.removeListener === void 0) + return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : P[M] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete P[M]), this; + if (arguments.length === 0) { + var z = Object.keys(P), Z; + for (W = 0; W < z.length; ++W) + Z = z[W], Z !== "removeListener" && this.removeAllListeners(Z); + return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this; + } + if ($ = P[M], typeof $ == "function") + this.removeListener(M, $); + else if ($ !== void 0) + for (W = $.length - 1; W >= 0; W--) + this.removeListener(M, $[W]); + return this; + }; + function h(E, M, $) { + var P = E._events; + if (P === void 0) + return []; + var W = P[M]; + return W === void 0 ? [] : typeof W == "function" ? $ ? [W.listener || W] : [W] : $ ? x(W) : g(W, W.length); + } + s.prototype.listeners = function(M) { + return h(this, M, !0); + }, s.prototype.rawListeners = function(M) { + return h(this, M, !1); + }, s.listenerCount = function(E, M) { + return typeof E.listenerCount == "function" ? E.listenerCount(M) : m.call(E, M); + }, s.prototype.listenerCount = m; + function m(E) { + var M = this._events; + if (M !== void 0) { + var $ = M[E]; + if (typeof $ == "function") + return 1; + if ($ !== void 0) + return $.length; + } + return 0; + } + s.prototype.eventNames = function() { + return this._eventsCount > 0 ? n(this._events) : []; + }; + function g(E, M) { + for (var $ = new Array(M), P = 0; P < M; ++P) + $[P] = E[P]; + return $; + } + function w(E, M) { + for (; M + 1 < E.length; M++) + E[M] = E[M + 1]; + E.pop(); + } + function x(E) { + for (var M = new Array(E.length), $ = 0; $ < M.length; ++$) + M[$] = E[$].listener || E[$]; + return M; + } + function _(E, M) { + return new Promise(function($, P) { + function W(Z) { + E.removeListener(M, z), P(Z); + } + function z() { + typeof E.removeListener == "function" && E.removeListener("error", W), $([].slice.call(arguments)); + } + C(E, M, z, { once: !0 }), M !== "error" && S(E, W, { once: !0 }); + }); + } + function S(E, M, $) { + typeof E.on == "function" && C(E, "error", M, $); + } + function C(E, M, $, P) { + if (typeof E.on == "function") + P.once ? E.once(M, $) : E.on(M, $); + else if (typeof E.addEventListener == "function") + E.addEventListener(M, function W(z) { + P.once && E.removeEventListener(M, W), $(z); + }); + else + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof E); + } + return eb.exports; +} +var i7; +function lue() { + if (i7) return Kv.exports; + i7 = 1; + var t = oue(), e = aue().EventEmitter; + Kv.exports = n, Kv.exports.default = n; + function n(l) { + if (!(this instanceof n)) + return new n(l); + e.call(this), l = l || {}, this.concurrency = l.concurrency || 1 / 0, this.timeout = l.timeout || 0, this.autostart = l.autostart || !1, this.results = l.results || null, this.pending = 0, this.session = 0, this.running = !1, this.jobs = [], this.timers = {}; + } + t(n, e); + var i = [ + "pop", + "shift", + "indexOf", + "lastIndexOf" + ]; + i.forEach(function(l) { + n.prototype[l] = function() { + return Array.prototype[l].apply(this.jobs, arguments); + }; + }), n.prototype.slice = function(l, u) { + return this.jobs = this.jobs.slice(l, u), this; + }, n.prototype.reverse = function() { + return this.jobs.reverse(), this; + }; + var r = [ + "push", + "unshift", + "splice" + ]; + r.forEach(function(l) { + n.prototype[l] = function() { + var u = Array.prototype[l].apply(this.jobs, arguments); + return this.autostart && this.start(), u; + }; + }), Object.defineProperty(n.prototype, "length", { + get: function() { + return this.pending + this.jobs.length; + } + }), n.prototype.start = function(l) { + if (l && o.call(this, l), this.running = !0, this.pending >= this.concurrency) + return; + if (this.jobs.length === 0) { + this.pending === 0 && a.call(this); + return; + } + var u = this, f = this.jobs.shift(), d = !0, h = this.session, m = null, g = !1, w = null, x = f.hasOwnProperty("timeout") ? f.timeout : this.timeout; + function _(C, E) { + d && u.session === h && (d = !1, u.pending--, m !== null && (delete u.timers[m], clearTimeout(m)), C ? u.emit("error", C, f) : g === !1 && (w !== null && (u.results[w] = Array.prototype.slice.call(arguments, 1)), u.emit("success", E, f)), u.session === h && (u.pending === 0 && u.jobs.length === 0 ? a.call(u) : u.running && u.start())); + } + x && (m = setTimeout(function() { + g = !0, u.listeners("timeout").length > 0 ? u.emit("timeout", _, f) : _(); + }, x), this.timers[m] = m), this.results && (w = this.results.length, this.results[w] = null), this.pending++, u.emit("start", f); + var S = f(_); + S && S.then && typeof S.then == "function" && S.then(function(C) { + return _(null, C); + }).catch(function(C) { + return _(C || !0); + }), this.running && this.jobs.length > 0 && this.start(); + }, n.prototype.stop = function() { + this.running = !1; + }, n.prototype.end = function(l) { + s.call(this), this.jobs.length = 0, this.pending = 0, a.call(this, l); + }; + function s() { + for (var l in this.timers) { + var u = this.timers[l]; + delete this.timers[l], clearTimeout(u); + } + } + function o(l) { + var u = this; + this.on("error", f), this.on("end", d); + function f(h) { + u.end(h); + } + function d(h) { + u.removeListener("error", f), u.removeListener("end", d), l(h, this.results); + } + } + function a(l) { + this.session++, this.running = !1, this.emit("end", l); + } + return Kv.exports; +} +var om = {}, am = {}, $3 = {}, r7; +function Xi() { + return r7 || (r7 = 1, function(t) { + Object.defineProperty(t, "__esModule", { value: !0 }), t.findBox = t.readUInt = t.readUInt32LE = t.readUInt32BE = t.readInt32LE = t.readUInt24LE = t.readUInt16LE = t.readUInt16BE = t.readInt16LE = t.toHexString = t.toUTF8String = void 0; + const e = new TextDecoder(), n = (w, x = 0, _ = w.length) => e.decode(w.slice(x, _)); + t.toUTF8String = n; + const i = (w, x = 0, _ = w.length) => w.slice(x, _).reduce((S, C) => S + ("0" + C.toString(16)).slice(-2), ""); + t.toHexString = i; + const r = (w, x = 0) => { + const _ = w[x] + w[x + 1] * 256; + return _ | (_ & 2 ** 15) * 131070; + }; + t.readInt16LE = r; + const s = (w, x = 0) => w[x] * 2 ** 8 + w[x + 1]; + t.readUInt16BE = s; + const o = (w, x = 0) => w[x] + w[x + 1] * 2 ** 8; + t.readUInt16LE = o; + const a = (w, x = 0) => w[x] + w[x + 1] * 2 ** 8 + w[x + 2] * 2 ** 16; + t.readUInt24LE = a; + const l = (w, x = 0) => w[x] + w[x + 1] * 2 ** 8 + w[x + 2] * 2 ** 16 + (w[x + 3] << 24); + t.readInt32LE = l; + const u = (w, x = 0) => w[x] * 2 ** 24 + w[x + 1] * 2 ** 16 + w[x + 2] * 2 ** 8 + w[x + 3]; + t.readUInt32BE = u; + const f = (w, x = 0) => w[x] + w[x + 1] * 2 ** 8 + w[x + 2] * 2 ** 16 + w[x + 3] * 2 ** 24; + t.readUInt32LE = f; + const d = { + readUInt16BE: t.readUInt16BE, + readUInt16LE: t.readUInt16LE, + readUInt32BE: t.readUInt32BE, + readUInt32LE: t.readUInt32LE + }; + function h(w, x, _, S) { + _ = _ || 0; + const C = S ? "BE" : "LE", E = "readUInt" + x + C; + return d[E](w, _); + } + t.readUInt = h; + function m(w, x) { + if (w.length - x < 4) + return; + const _ = (0, t.readUInt32BE)(w, x); + if (!(w.length - x < _)) + return { + name: (0, t.toUTF8String)(w, 4 + x, 8 + x), + offset: x, + size: _ + }; + } + function g(w, x, _) { + for (; _ < w.length; ) { + const S = m(w, _); + if (!S) + break; + if (S.name === x) + return S; + _ += S.size; + } + } + t.findBox = g; + }($3)), $3; +} +var s7; +function uue() { + if (s7) return am; + s7 = 1, Object.defineProperty(am, "__esModule", { value: !0 }), am.BMP = void 0; + const t = Xi(); + return am.BMP = { + validate: (e) => (0, t.toUTF8String)(e, 0, 2) === "BM", + calculate: (e) => ({ + height: Math.abs((0, t.readInt32LE)(e, 22)), + width: (0, t.readUInt32LE)(e, 18) + }) + }, am; +} +var lm = {}, um = {}, o7; +function $B() { + if (o7) return um; + o7 = 1, Object.defineProperty(um, "__esModule", { value: !0 }), um.ICO = void 0; + const t = Xi(), e = 1, n = 6, i = 16; + function r(o, a) { + const l = o[a]; + return l === 0 ? 256 : l; + } + function s(o, a) { + const l = n + a * i; + return { + height: r(o, l + 1), + width: r(o, l) + }; + } + return um.ICO = { + validate(o) { + const a = (0, t.readUInt16LE)(o, 0), l = (0, t.readUInt16LE)(o, 4); + return a !== 0 || l === 0 ? !1 : (0, t.readUInt16LE)(o, 2) === e; + }, + calculate(o) { + const a = (0, t.readUInt16LE)(o, 4), l = s(o, 0); + if (a === 1) + return l; + const u = [l]; + for (let f = 1; f < a; f += 1) + u.push(s(o, f)); + return { + height: l.height, + images: u, + width: l.width + }; + } + }, um; +} +var a7; +function cue() { + if (a7) return lm; + a7 = 1, Object.defineProperty(lm, "__esModule", { value: !0 }), lm.CUR = void 0; + const t = $B(), e = Xi(), n = 2; + return lm.CUR = { + validate(i) { + const r = (0, e.readUInt16LE)(i, 0), s = (0, e.readUInt16LE)(i, 4); + return r !== 0 || s === 0 ? !1 : (0, e.readUInt16LE)(i, 2) === n; + }, + calculate: (i) => t.ICO.calculate(i) + }, lm; +} +var cm = {}, l7; +function fue() { + if (l7) return cm; + l7 = 1, Object.defineProperty(cm, "__esModule", { value: !0 }), cm.DDS = void 0; + const t = Xi(); + return cm.DDS = { + validate: (e) => (0, t.readUInt32LE)(e, 0) === 542327876, + calculate: (e) => ({ + height: (0, t.readUInt32LE)(e, 12), + width: (0, t.readUInt32LE)(e, 16) + }) + }, cm; +} +var fm = {}, u7; +function due() { + if (u7) return fm; + u7 = 1, Object.defineProperty(fm, "__esModule", { value: !0 }), fm.GIF = void 0; + const t = Xi(), e = /^GIF8[79]a/; + return fm.GIF = { + validate: (n) => e.test((0, t.toUTF8String)(n, 0, 6)), + calculate: (n) => ({ + height: (0, t.readUInt16LE)(n, 8), + width: (0, t.readUInt16LE)(n, 6) + }) + }, fm; +} +var dm = {}, c7; +function hue() { + if (c7) return dm; + c7 = 1, Object.defineProperty(dm, "__esModule", { value: !0 }), dm.HEIF = void 0; + const t = Xi(), e = { + avif: "avif", + mif1: "heif", + msf1: "heif", + // hief-sequence + heic: "heic", + heix: "heic", + hevc: "heic", + // heic-sequence + hevx: "heic" + // heic-sequence + }; + return dm.HEIF = { + validate(n) { + const i = (0, t.toUTF8String)(n, 4, 8), r = (0, t.toUTF8String)(n, 8, 12); + return i === "ftyp" && r in e; + }, + calculate(n) { + const i = (0, t.findBox)(n, "meta", 0), r = i && (0, t.findBox)(n, "iprp", i.offset + 12), s = r && (0, t.findBox)(n, "ipco", r.offset + 8), o = s && (0, t.findBox)(n, "ispe", s.offset + 8); + if (o) + return { + height: (0, t.readUInt32BE)(n, o.offset + 16), + width: (0, t.readUInt32BE)(n, o.offset + 12), + type: (0, t.toUTF8String)(n, 8, 12) + }; + throw new TypeError("Invalid HEIF, no size found"); + } + }, dm; +} +var hm = {}, f7; +function pue() { + if (f7) return hm; + f7 = 1, Object.defineProperty(hm, "__esModule", { value: !0 }), hm.ICNS = void 0; + const t = Xi(), e = 8, n = 4, i = 4, r = { + ICON: 32, + "ICN#": 32, + // m => 16 x 16 + "icm#": 16, + icm4: 16, + icm8: 16, + // s => 16 x 16 + "ics#": 16, + ics4: 16, + ics8: 16, + is32: 16, + s8mk: 16, + icp4: 16, + // l => 32 x 32 + icl4: 32, + icl8: 32, + il32: 32, + l8mk: 32, + icp5: 32, + ic11: 32, + // h => 48 x 48 + ich4: 48, + ich8: 48, + ih32: 48, + h8mk: 48, + // . => 64 x 64 + icp6: 64, + ic12: 32, + // t => 128 x 128 + it32: 128, + t8mk: 128, + ic07: 128, + // . => 256 x 256 + ic08: 256, + ic13: 256, + // . => 512 x 512 + ic09: 512, + ic14: 512, + // . => 1024 x 1024 + ic10: 1024 + }; + function s(a, l) { + const u = l + i; + return [ + (0, t.toUTF8String)(a, l, u), + (0, t.readUInt32BE)(a, u) + ]; + } + function o(a) { + const l = r[a]; + return { width: l, height: l, type: a }; + } + return hm.ICNS = { + validate: (a) => (0, t.toUTF8String)(a, 0, 4) === "icns", + calculate(a) { + const l = a.length, u = (0, t.readUInt32BE)(a, n); + let f = e, d = s(a, f), h = o(d[0]); + if (f += d[1], f === u) + return h; + const m = { + height: h.height, + images: [h], + width: h.width + }; + for (; f < u && f < l; ) + d = s(a, f), h = o(d[0]), f += d[1], m.images.push(h); + return m; + } + }, hm; +} +var pm = {}, d7; +function mue() { + if (d7) return pm; + d7 = 1, Object.defineProperty(pm, "__esModule", { value: !0 }), pm.J2C = void 0; + const t = Xi(); + return pm.J2C = { + // TODO: this doesn't seem right. SIZ marker doesn't have to be right after the SOC + validate: (e) => (0, t.toHexString)(e, 0, 4) === "ff4fff51", + calculate: (e) => ({ + height: (0, t.readUInt32BE)(e, 12), + width: (0, t.readUInt32BE)(e, 8) + }) + }, pm; +} +var mm = {}, h7; +function gue() { + if (h7) return mm; + h7 = 1, Object.defineProperty(mm, "__esModule", { value: !0 }), mm.JP2 = void 0; + const t = Xi(); + return mm.JP2 = { + validate(e) { + if ((0, t.readUInt32BE)(e, 4) !== 1783636e3 || (0, t.readUInt32BE)(e, 0) < 1) + return !1; + const n = (0, t.findBox)(e, "ftyp", 0); + return n ? (0, t.readUInt32BE)(e, n.offset + 4) === 1718909296 : !1; + }, + calculate(e) { + const n = (0, t.findBox)(e, "jp2h", 0), i = n && (0, t.findBox)(e, "ihdr", n.offset + 8); + if (i) + return { + height: (0, t.readUInt32BE)(e, i.offset + 8), + width: (0, t.readUInt32BE)(e, i.offset + 12) + }; + throw new TypeError("Unsupported JPEG 2000 format"); + } + }, mm; +} +var gm = {}, p7; +function vue() { + if (p7) return gm; + p7 = 1, Object.defineProperty(gm, "__esModule", { value: !0 }), gm.JPG = void 0; + const t = Xi(), e = "45786966", n = 2, i = 6, r = 2, s = "4d4d", o = "4949", a = 12, l = 2; + function u(g) { + return (0, t.toHexString)(g, 2, 6) === e; + } + function f(g, w) { + return { + height: (0, t.readUInt16BE)(g, w), + width: (0, t.readUInt16BE)(g, w + 2) + }; + } + function d(g, w) { + const _ = i + 8, S = (0, t.readUInt)(g, 16, _, w); + for (let C = 0; C < S; C++) { + const E = _ + l + C * a, M = E + a; + if (E > g.length) + return; + const $ = g.slice(E, M); + if ((0, t.readUInt)($, 16, 0, w) === 274) + return (0, t.readUInt)($, 16, 2, w) !== 3 || (0, t.readUInt)($, 32, 4, w) !== 1 ? void 0 : (0, t.readUInt)($, 16, 8, w); + } + } + function h(g, w) { + const x = g.slice(n, w), _ = (0, t.toHexString)(x, i, i + r), S = _ === s; + if (S || _ === o) + return d(x, S); + } + function m(g, w) { + if (w > g.length) + throw new TypeError("Corrupt JPG, exceeded buffer limits"); + } + return gm.JPG = { + validate: (g) => (0, t.toHexString)(g, 0, 2) === "ffd8", + calculate(g) { + g = g.slice(4); + let w, x; + for (; g.length; ) { + const _ = (0, t.readUInt16BE)(g, 0); + if (g[_] !== 255) { + g = g.slice(1); + continue; + } + if (u(g) && (w = h(g, _)), m(g, _), x = g[_ + 1], x === 192 || x === 193 || x === 194) { + const S = f(g, _ + 5); + return w ? { + height: S.height, + orientation: w, + width: S.width + } : S; + } + g = g.slice(_ + 2); + } + throw new TypeError("Invalid JPG, no size found"); + } + }, gm; +} +var vm = {}, m7; +function bue() { + if (m7) return vm; + m7 = 1, Object.defineProperty(vm, "__esModule", { value: !0 }), vm.KTX = void 0; + const t = Xi(); + return vm.KTX = { + validate: (e) => { + const n = (0, t.toUTF8String)(e, 1, 7); + return ["KTX 11", "KTX 20"].includes(n); + }, + calculate: (e) => { + const n = e[5] === 49 ? "ktx" : "ktx2", i = n === "ktx" ? 36 : 20; + return { + height: (0, t.readUInt32LE)(e, i + 4), + width: (0, t.readUInt32LE)(e, i), + type: n + }; + } + }, vm; +} +var bm = {}, g7; +function yue() { + if (g7) return bm; + g7 = 1, Object.defineProperty(bm, "__esModule", { value: !0 }), bm.PNG = void 0; + const t = Xi(), e = `PNG\r + +`, n = "IHDR", i = "CgBI"; + return bm.PNG = { + validate(r) { + if (e === (0, t.toUTF8String)(r, 1, 8)) { + let s = (0, t.toUTF8String)(r, 12, 16); + if (s === i && (s = (0, t.toUTF8String)(r, 28, 32)), s !== n) + throw new TypeError("Invalid PNG"); + return !0; + } + return !1; + }, + calculate(r) { + return (0, t.toUTF8String)(r, 12, 16) === i ? { + height: (0, t.readUInt32BE)(r, 36), + width: (0, t.readUInt32BE)(r, 32) + } : { + height: (0, t.readUInt32BE)(r, 20), + width: (0, t.readUInt32BE)(r, 16) + }; + } + }, bm; +} +var ym = {}, v7; +function wue() { + if (v7) return ym; + v7 = 1, Object.defineProperty(ym, "__esModule", { value: !0 }), ym.PNM = void 0; + const t = Xi(), e = { + P1: "pbm/ascii", + P2: "pgm/ascii", + P3: "ppm/ascii", + P4: "pbm", + P5: "pgm", + P6: "ppm", + P7: "pam", + PF: "pfm" + }, n = { + default: (i) => { + let r = []; + for (; i.length > 0; ) { + const s = i.shift(); + if (s[0] !== "#") { + r = s.split(" "); + break; + } + } + if (r.length === 2) + return { + height: parseInt(r[1], 10), + width: parseInt(r[0], 10) + }; + throw new TypeError("Invalid PNM"); + }, + pam: (i) => { + const r = {}; + for (; i.length > 0; ) { + const s = i.shift(); + if (s.length > 16 || s.charCodeAt(0) > 128) + continue; + const [o, a] = s.split(" "); + if (o && a && (r[o.toLowerCase()] = parseInt(a, 10)), r.height && r.width) + break; + } + if (r.height && r.width) + return { + height: r.height, + width: r.width + }; + throw new TypeError("Invalid PAM"); + } + }; + return ym.PNM = { + validate: (i) => (0, t.toUTF8String)(i, 0, 2) in e, + calculate(i) { + const r = (0, t.toUTF8String)(i, 0, 2), s = e[r], o = (0, t.toUTF8String)(i, 3).split(/[\r\n]+/); + return (n[s] || n.default)(o); + } + }, ym; +} +var wm = {}, b7; +function kue() { + if (b7) return wm; + b7 = 1, Object.defineProperty(wm, "__esModule", { value: !0 }), wm.PSD = void 0; + const t = Xi(); + return wm.PSD = { + validate: (e) => (0, t.toUTF8String)(e, 0, 4) === "8BPS", + calculate: (e) => ({ + height: (0, t.readUInt32BE)(e, 14), + width: (0, t.readUInt32BE)(e, 18) + }) + }, wm; +} +var km = {}, y7; +function xue() { + if (y7) return km; + y7 = 1, Object.defineProperty(km, "__esModule", { value: !0 }), km.SVG = void 0; + const t = Xi(), e = /"']|"[^"]*"|'[^']*')*>/, n = { + height: /\sheight=(['"])([^%]+?)\1/, + root: e, + viewbox: /\sviewBox=(['"])(.+?)\1/i, + width: /\swidth=(['"])([^%]+?)\1/ + }, i = 2.54, r = { + in: 96, + cm: 96 / i, + em: 16, + ex: 8, + m: 96 / i * 100, + mm: 96 / i / 10, + pc: 96 / 72 / 12, + pt: 96 / 72, + px: 1 + }, s = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(r).join("|")})?$`); + function o(d) { + const h = s.exec(d); + if (h) + return Math.round(Number(h[1]) * (r[h[2]] || 1)); + } + function a(d) { + const h = d.split(" "); + return { + height: o(h[3]), + width: o(h[2]) + }; + } + function l(d) { + const h = d.match(n.width), m = d.match(n.height), g = d.match(n.viewbox); + return { + height: m && o(m[2]), + viewbox: g && a(g[2]), + width: h && o(h[2]) + }; + } + function u(d) { + return { + height: d.height, + width: d.width + }; + } + function f(d, h) { + const m = h.width / h.height; + return d.width ? { + height: Math.floor(d.width / m), + width: d.width + } : d.height ? { + height: d.height, + width: Math.floor(d.height * m) + } : { + height: h.height, + width: h.width + }; + } + return km.SVG = { + // Scan only the first kilo-byte to speed up the check on larger files + validate: (d) => e.test((0, t.toUTF8String)(d, 0, 1e3)), + calculate(d) { + const h = (0, t.toUTF8String)(d).match(n.root); + if (h) { + const m = l(h[0]); + if (m.width && m.height) + return u(m); + if (m.viewbox) + return f(m, m.viewbox); + } + throw new TypeError("Invalid SVG"); + } + }, km; +} +var xm = {}, w7; +function _ue() { + if (w7) return xm; + w7 = 1, Object.defineProperty(xm, "__esModule", { value: !0 }), xm.TGA = void 0; + const t = Xi(); + return xm.TGA = { + validate(e) { + return (0, t.readUInt16LE)(e, 0) === 0 && (0, t.readUInt16LE)(e, 4) === 0; + }, + calculate(e) { + return { + height: (0, t.readUInt16LE)(e, 14), + width: (0, t.readUInt16LE)(e, 12) + }; + } + }, xm; +} +var _m = {}, k7; +function Oue() { + if (k7) return _m; + k7 = 1, Object.defineProperty(_m, "__esModule", { value: !0 }), _m.TIFF = void 0; + const t = i0, e = Xi(); + function n(l, u, f) { + const d = (0, e.readUInt)(l, 32, 4, f); + let h = 1024; + const m = t.statSync(u).size; + d + h > m && (h = m - d - 10); + const g = new Uint8Array(h), w = t.openSync(u, "r"); + return t.readSync(w, g, 0, h, d), t.closeSync(w), g.slice(2); + } + function i(l, u) { + const f = (0, e.readUInt)(l, 16, 8, u); + return ((0, e.readUInt)(l, 16, 10, u) << 16) + f; + } + function r(l) { + if (l.length > 24) + return l.slice(12); + } + function s(l, u) { + const f = {}; + let d = l; + for (; d && d.length; ) { + const h = (0, e.readUInt)(d, 16, 0, u), m = (0, e.readUInt)(d, 16, 2, u), g = (0, e.readUInt)(d, 32, 4, u); + if (h === 0) + break; + g === 1 && (m === 3 || m === 4) && (f[h] = i(d, u)), d = r(d); + } + return f; + } + function o(l) { + const u = (0, e.toUTF8String)(l, 0, 2); + if (u === "II") + return "LE"; + if (u === "MM") + return "BE"; + } + const a = [ + // '492049', // currently not supported + "49492a00", + // Little endian + "4d4d002a" + // Big Endian + // '4d4d002a', // BigTIFF > 4GB. currently not supported + ]; + return _m.TIFF = { + validate: (l) => a.includes((0, e.toHexString)(l, 0, 4)), + calculate(l, u) { + if (!u) + throw new TypeError("Tiff doesn't support buffer"); + const f = o(l) === "BE", d = n(l, u, f), h = s(d, f), m = h[256], g = h[257]; + if (!m || !g) + throw new TypeError("Invalid Tiff. Missing tags"); + return { height: g, width: m }; + } + }, _m; +} +var Om = {}, x7; +function Sue() { + if (x7) return Om; + x7 = 1, Object.defineProperty(Om, "__esModule", { value: !0 }), Om.WEBP = void 0; + const t = Xi(); + function e(r) { + return { + height: 1 + (0, t.readUInt24LE)(r, 7), + width: 1 + (0, t.readUInt24LE)(r, 4) + }; + } + function n(r) { + return { + height: 1 + ((r[4] & 15) << 10 | r[3] << 2 | (r[2] & 192) >> 6), + width: 1 + ((r[2] & 63) << 8 | r[1]) + }; + } + function i(r) { + return { + height: (0, t.readInt16LE)(r, 8) & 16383, + width: (0, t.readInt16LE)(r, 6) & 16383 + }; + } + return Om.WEBP = { + validate(r) { + const s = (0, t.toUTF8String)(r, 0, 4) === "RIFF", o = (0, t.toUTF8String)(r, 8, 12) === "WEBP", a = (0, t.toUTF8String)(r, 12, 15) === "VP8"; + return s && o && a; + }, + calculate(r) { + const s = (0, t.toUTF8String)(r, 12, 16); + if (r = r.slice(20, 30), s === "VP8X") { + const a = r[0], l = (a & 192) === 0, u = (a & 1) === 0; + if (l && u) + return e(r); + throw new TypeError("Invalid WebP"); + } + if (s === "VP8 " && r[0] !== 47) + return i(r); + const o = (0, t.toHexString)(r, 3, 6); + if (s === "VP8L" && o !== "9d012a") + return n(r); + throw new TypeError("Invalid WebP"); + } + }, Om; +} +var _7; +function MB() { + if (_7) return om; + _7 = 1, Object.defineProperty(om, "__esModule", { value: !0 }), om.typeHandlers = void 0; + const t = uue(), e = cue(), n = fue(), i = due(), r = hue(), s = pue(), o = $B(), a = mue(), l = gue(), u = vue(), f = bue(), d = yue(), h = wue(), m = kue(), g = xue(), w = _ue(), x = Oue(), _ = Sue(); + return om.typeHandlers = { + bmp: t.BMP, + cur: e.CUR, + dds: n.DDS, + gif: i.GIF, + heif: r.HEIF, + icns: s.ICNS, + ico: o.ICO, + j2c: a.J2C, + jp2: l.JP2, + jpg: u.JPG, + ktx: f.KTX, + png: d.PNG, + pnm: h.PNM, + psd: m.PSD, + svg: g.SVG, + tga: w.TGA, + tiff: x.TIFF, + webp: _.WEBP + }, om; +} +var Sm = {}, O7; +function Cue() { + if (O7) return Sm; + O7 = 1, Object.defineProperty(Sm, "__esModule", { value: !0 }), Sm.detector = void 0; + const t = MB(), e = Object.keys(t.typeHandlers), n = { + 56: "psd", + 66: "bmp", + 68: "dds", + 71: "gif", + 73: "tiff", + 77: "tiff", + 82: "webp", + 105: "icns", + 137: "png", + 255: "jpg" + }; + function i(r) { + const s = r[0]; + if (s in n) { + const a = n[s]; + if (a && t.typeHandlers[a].validate(r)) + return a; + } + const o = (a) => t.typeHandlers[a].validate(r); + return e.find(o); + } + return Sm.detector = i, Sm; +} +var S7; +function Eue() { + return S7 || (S7 = 1, function(t, e) { + Object.defineProperty(e, "__esModule", { value: !0 }), e.types = e.setConcurrency = e.disableTypes = e.disableFS = e.imageSize = void 0; + const n = i0, i = i0, r = lue(), s = MB(), o = Cue(), a = 512 * 1024, l = new r.default({ concurrency: 100, autostart: !0 }), u = { + disabledFS: !1, + disabledTypes: [] + }; + function f(_, S) { + const C = (0, o.detector)(_); + if (typeof C < "u") { + if (u.disabledTypes.indexOf(C) > -1) + throw new TypeError("disabled file type: " + C); + if (C in s.typeHandlers) { + const E = s.typeHandlers[C].calculate(_, S); + if (E !== void 0) + return E.type = E.type ?? C, E; + } + } + throw new TypeError("unsupported file type: " + C + " (file: " + S + ")"); + } + async function d(_) { + const S = await n.promises.open(_, "r"); + try { + const { size: C } = await S.stat(); + if (C <= 0) + throw new Error("Empty file"); + const E = Math.min(C, a), M = new Uint8Array(E); + return await S.read(M, 0, E, 0), M; + } finally { + await S.close(); + } + } + function h(_) { + const S = n.openSync(_, "r"); + try { + const { size: C } = n.fstatSync(S); + if (C <= 0) + throw new Error("Empty file"); + const E = Math.min(C, a), M = new Uint8Array(E); + return n.readSync(S, M, 0, E, 0), M; + } finally { + n.closeSync(S); + } + } + t.exports = e = m, e.default = m; + function m(_, S) { + if (_ instanceof Uint8Array) + return f(_); + if (typeof _ != "string" || u.disabledFS) + throw new TypeError("invalid invocation. input should be a Uint8Array"); + const C = i.resolve(_); + if (typeof S == "function") + l.push(() => d(C).then((E) => process.nextTick(S, null, f(E, C))).catch(S)); + else { + const E = h(C); + return f(E, C); + } + } + e.imageSize = m; + const g = (_) => { + u.disabledFS = _; + }; + e.disableFS = g; + const w = (_) => { + u.disabledTypes = _; + }; + e.disableTypes = w; + const x = (_) => { + l.concurrency = _; + }; + e.setConcurrency = x, e.types = Object.keys(s.typeHandlers); + }(Gv, Gv.exports)), Gv.exports; +} +var M3, C7; +function sw() { + if (C7) return M3; + C7 = 1; + var t = Eue(), e = i0; + function n(i, r) { + var s = i.renderer.rules.image; + i.renderer.rules.image = function(o, a, l, u, f) { + var d = o[a]; + if (d.attrSet("loading", "lazy"), r && r.decoding === !0 && d.attrSet("decoding", "async"), r && r.base_path && r.image_size === !0) { + const h = d.attrGet("src"), m = e.join(r.base_path, h), g = t(m); + d.attrSet("width", g.width), d.attrSet("height", g.height); + } + return s(o, a, l, u, f); + }; + } + return M3 = n, M3; +} +var N3, E7; +function ow() { + if (E7) return N3; + E7 = 1; + const t = /\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g; + function e(i, r) { + const s = i.posMax, o = i.pos; + if (i.src.charCodeAt(o) !== 126 || r || o + 2 >= s) + return !1; + i.pos = o + 1; + let a = !1; + for (; i.pos < s; ) { + if (i.src.charCodeAt(i.pos) === 126) { + a = !0; + break; + } + i.md.inline.skipToken(i); + } + if (!a || o + 1 === i.pos) + return i.pos = o, !1; + const l = i.src.slice(o + 1, i.pos); + if (l.match(/(^|[^\\])(\\\\)*\s/)) + return i.pos = o, !1; + i.posMax = i.pos, i.pos = o + 1; + const u = i.push("sub_open", "sub", 1); + u.markup = "~"; + const f = i.push("text", "", 0); + f.content = l.replace(t, "$1"); + const d = i.push("sub_close", "sub", -1); + return d.markup = "~", i.pos = i.posMax + 1, i.posMax = s, !0; + } + function n(i) { + i.inline.ruler.after("emphasis", "sub", e); + } + return N3 = n, N3; +} +var A3, T7; +function aw() { + if (T7) return A3; + T7 = 1; + const t = /\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g; + function e(i, r) { + const s = i.posMax, o = i.pos; + if (i.src.charCodeAt(o) !== 94 || r || o + 2 >= s) + return !1; + i.pos = o + 1; + let a = !1; + for (; i.pos < s; ) { + if (i.src.charCodeAt(i.pos) === 94) { + a = !0; + break; + } + i.md.inline.skipToken(i); + } + if (!a || o + 1 === i.pos) + return i.pos = o, !1; + const l = i.src.slice(o + 1, i.pos); + if (l.match(/(^|[^\\])(\\\\)*\s/)) + return i.pos = o, !1; + i.posMax = i.pos, i.pos = o + 1; + const u = i.push("sup_open", "sup", 1); + u.markup = "^"; + const f = i.push("text", "", 0); + f.content = l.replace(t, "$1"); + const d = i.push("sup_close", "sup", -1); + return d.markup = "^", i.pos = i.posMax + 1, i.posMax = s, !0; + } + function n(i) { + i.inline.ruler.after("emphasis", "sup", e); + } + return A3 = n, A3; +} +const $7 = kB, M7 = Gk, { slugify: Tue } = iue, Od = {}, N7 = function({ ghostVersion: t } = {}) { + const e = function(n, i = {}) { + let r = Tue(n, { ghostVersion: t, type: "markdown" }); + return i[r] && (i[r] += 1, r += i[r]), r; + }; + return function(n) { + const i = n.renderer.rules.heading_open; + n.renderer.rules.heading_open = function(r, s, o, a, l) { + const u = {}; + r[s].attrs = r[s].attrs || []; + const f = r[s + 1].children.reduce(function(h, m) { + return h + m.content; + }, ""), d = e(f, u); + return r[s].attrs.push(["id", d]), i ? i.apply(this, arguments) : l.renderToken.apply(l, arguments); + }; + }; +}, $ue = function(t) { + const e = M7.coerce(t.ghostVersion || "4.0"); + if (M7.satisfies(e, "<4.x")) { + if (Od["<4.x"]) + return Od["<4.x"]; + const n = new $7({ html: !0, breaks: !0, linkify: !0 }).use(nw()).use(iw()).use(rw()).use(sw()).use(N7(t)).use(ow()).use(aw()); + return n.linkify.set({ + fuzzyLink: !1 + }), Od["<4.x"] = n, n; + } else { + if (Od.latest) + return Od.latest; + const n = new $7({ html: !0, breaks: !0, linkify: !0 }).use(nw()).use(iw()).use(rw()).use(sw()).use(N7(t)).use(ow()).use(aw()); + return n.linkify.set({ + fuzzyLink: !1 + }), Od.latest = n, n; + } +}; +var Mue = { + render: function(t, e = {}) { + return $ue(e).render(t); + } +}, Nue = Mue; +const Aue = /* @__PURE__ */ Gs(Nue); +function NB(t) { + var e, n, i = ""; + if (typeof t == "string" || typeof t == "number") i += t; + else if (typeof t == "object") if (Array.isArray(t)) { + var r = t.length; + for (e = 0; e < r; e++) t[e] && (n = NB(t[e])) && (i && (i += " "), i += n); + } else for (n in t) t[n] && (i && (i += " "), i += n); + return i; +} +function nt() { + for (var t, e, n = 0, i = "", r = arguments.length; n < r; n++) (t = arguments[n]) && (e = NB(t)) && (i && (i += " "), i += e); + return i; +} +class Af extends Error { +} +class Due extends Af { + constructor(e) { + super(`Invalid DateTime: ${e.toMessage()}`); + } +} +class Pue extends Af { + constructor(e) { + super(`Invalid Interval: ${e.toMessage()}`); + } +} +class Iue extends Af { + constructor(e) { + super(`Invalid Duration: ${e.toMessage()}`); + } +} +class Gd extends Af { +} +class AB extends Af { + constructor(e) { + super(`Invalid unit ${e}`); + } +} +class Sr extends Af { +} +class iu extends Af { + constructor() { + super("Zone is an abstract class"); + } +} +const Me = "numeric", jo = "short", Hs = "long", lw = { + year: Me, + month: Me, + day: Me +}, DB = { + year: Me, + month: jo, + day: Me +}, Lue = { + year: Me, + month: jo, + day: Me, + weekday: jo +}, PB = { + year: Me, + month: Hs, + day: Me +}, IB = { + year: Me, + month: Hs, + day: Me, + weekday: Hs +}, LB = { + hour: Me, + minute: Me +}, RB = { + hour: Me, + minute: Me, + second: Me +}, jB = { + hour: Me, + minute: Me, + second: Me, + timeZoneName: jo +}, FB = { + hour: Me, + minute: Me, + second: Me, + timeZoneName: Hs +}, BB = { + hour: Me, + minute: Me, + hourCycle: "h23" +}, zB = { + hour: Me, + minute: Me, + second: Me, + hourCycle: "h23" +}, WB = { + hour: Me, + minute: Me, + second: Me, + hourCycle: "h23", + timeZoneName: jo +}, HB = { + hour: Me, + minute: Me, + second: Me, + hourCycle: "h23", + timeZoneName: Hs +}, QB = { + year: Me, + month: Me, + day: Me, + hour: Me, + minute: Me +}, UB = { + year: Me, + month: Me, + day: Me, + hour: Me, + minute: Me, + second: Me +}, ZB = { + year: Me, + month: jo, + day: Me, + hour: Me, + minute: Me +}, qB = { + year: Me, + month: jo, + day: Me, + hour: Me, + minute: Me, + second: Me +}, Rue = { + year: Me, + month: jo, + day: Me, + weekday: jo, + hour: Me, + minute: Me +}, YB = { + year: Me, + month: Hs, + day: Me, + hour: Me, + minute: Me, + timeZoneName: jo +}, VB = { + year: Me, + month: Hs, + day: Me, + hour: Me, + minute: Me, + second: Me, + timeZoneName: jo +}, XB = { + year: Me, + month: Hs, + day: Me, + weekday: Hs, + hour: Me, + minute: Me, + timeZoneName: Hs +}, GB = { + year: Me, + month: Hs, + day: Me, + weekday: Hs, + hour: Me, + minute: Me, + second: Me, + timeZoneName: Hs +}; +class u1 { + /** + * The type of zone + * @abstract + * @type {string} + */ + get type() { + throw new iu(); + } + /** + * The name of this zone. + * @abstract + * @type {string} + */ + get name() { + throw new iu(); + } + /** + * The IANA name of this zone. + * Defaults to `name` if not overwritten by a subclass. + * @abstract + * @type {string} + */ + get ianaName() { + return this.name; + } + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + get isUniversal() { + throw new iu(); + } + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + offsetName(e, n) { + throw new iu(); + } + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(e, n) { + throw new iu(); + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + offset(e) { + throw new iu(); + } + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(e) { + throw new iu(); + } + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + get isValid() { + throw new iu(); + } +} +let D3 = null; +class Kk extends u1 { + /** + * Get a singleton instance of the local zone + * @return {SystemZone} + */ + static get instance() { + return D3 === null && (D3 = new Kk()), D3; + } + /** @override **/ + get type() { + return "system"; + } + /** @override **/ + get name() { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } + /** @override **/ + get isUniversal() { + return !1; + } + /** @override **/ + offsetName(e, { format: n, locale: i }) { + return oz(e, n, i); + } + /** @override **/ + formatOffset(e, n) { + return Og(this.offset(e), n); + } + /** @override **/ + offset(e) { + return -new Date(e).getTimezoneOffset(); + } + /** @override **/ + equals(e) { + return e.type === "system"; + } + /** @override **/ + get isValid() { + return !0; + } +} +let ty = {}; +function jue(t) { + return ty[t] || (ty[t] = new Intl.DateTimeFormat("en-US", { + hour12: !1, + timeZone: t, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + era: "short" + })), ty[t]; +} +const Fue = { + year: 0, + month: 1, + day: 2, + era: 3, + hour: 4, + minute: 5, + second: 6 +}; +function Bue(t, e) { + const n = t.format(e).replace(/\u200E/g, ""), i = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n), [, r, s, o, a, l, u, f] = i; + return [o, r, s, a, l, u, f]; +} +function zue(t, e) { + const n = t.formatToParts(e), i = []; + for (let r = 0; r < n.length; r++) { + const { type: s, value: o } = n[r], a = Fue[s]; + s === "era" ? i[a] = o : yt(a) || (i[a] = parseInt(o, 10)); + } + return i; +} +let tb = {}; +class xl extends u1 { + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + static create(e) { + return tb[e] || (tb[e] = new xl(e)), tb[e]; + } + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCache() { + tb = {}, ty = {}; + } + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead. + * @return {boolean} + */ + static isValidSpecifier(e) { + return this.isValidZone(e); + } + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + static isValidZone(e) { + if (!e) + return !1; + try { + return new Intl.DateTimeFormat("en-US", { timeZone: e }).format(), !0; + } catch { + return !1; + } + } + constructor(e) { + super(), this.zoneName = e, this.valid = xl.isValidZone(e); + } + /** + * The type of zone. `iana` for all instances of `IANAZone`. + * @override + * @type {string} + */ + get type() { + return "iana"; + } + /** + * The name of this zone (i.e. the IANA zone name). + * @override + * @type {string} + */ + get name() { + return this.zoneName; + } + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns false for all IANA zones. + * @override + * @type {boolean} + */ + get isUniversal() { + return !1; + } + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @override + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + offsetName(e, { format: n, locale: i }) { + return oz(e, n, i, this.name); + } + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(e, n) { + return Og(this.offset(e), n); + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @override + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + offset(e) { + const n = new Date(e); + if (isNaN(n)) return NaN; + const i = jue(this.name); + let [r, s, o, a, l, u, f] = i.formatToParts ? zue(i, n) : Bue(i, n); + a === "BC" && (r = -Math.abs(r) + 1); + const h = e2({ + year: r, + month: s, + day: o, + hour: l === 24 ? 0 : l, + minute: u, + second: f, + millisecond: 0 + }); + let m = +n; + const g = m % 1e3; + return m -= g >= 0 ? g : 1e3 + g, (h - m) / (60 * 1e3); + } + /** + * Return whether this Zone is equal to another zone + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(e) { + return e.type === "iana" && e.name === this.name; + } + /** + * Return whether this Zone is valid. + * @override + * @type {boolean} + */ + get isValid() { + return this.valid; + } +} +let A7 = {}; +function Wue(t, e = {}) { + const n = JSON.stringify([t, e]); + let i = A7[n]; + return i || (i = new Intl.ListFormat(t, e), A7[n] = i), i; +} +let d4 = {}; +function h4(t, e = {}) { + const n = JSON.stringify([t, e]); + let i = d4[n]; + return i || (i = new Intl.DateTimeFormat(t, e), d4[n] = i), i; +} +let p4 = {}; +function Hue(t, e = {}) { + const n = JSON.stringify([t, e]); + let i = p4[n]; + return i || (i = new Intl.NumberFormat(t, e), p4[n] = i), i; +} +let m4 = {}; +function Que(t, e = {}) { + const { base: n, ...i } = e, r = JSON.stringify([t, i]); + let s = m4[r]; + return s || (s = new Intl.RelativeTimeFormat(t, e), m4[r] = s), s; +} +let Km = null; +function Uue() { + return Km || (Km = new Intl.DateTimeFormat().resolvedOptions().locale, Km); +} +let D7 = {}; +function Zue(t) { + let e = D7[t]; + if (!e) { + const n = new Intl.Locale(t); + e = "getWeekInfo" in n ? n.getWeekInfo() : n.weekInfo, D7[t] = e; + } + return e; +} +function que(t) { + const e = t.indexOf("-x-"); + e !== -1 && (t = t.substring(0, e)); + const n = t.indexOf("-u-"); + if (n === -1) + return [t]; + { + let i, r; + try { + i = h4(t).resolvedOptions(), r = t; + } catch { + const l = t.substring(0, n); + i = h4(l).resolvedOptions(), r = l; + } + const { numberingSystem: s, calendar: o } = i; + return [r, s, o]; + } +} +function Yue(t, e, n) { + return (n || e) && (t.includes("-u-") || (t += "-u"), n && (t += `-ca-${n}`), e && (t += `-nu-${e}`)), t; +} +function Vue(t) { + const e = []; + for (let n = 1; n <= 12; n++) { + const i = ht.utc(2009, n, 1); + e.push(t(i)); + } + return e; +} +function Xue(t) { + const e = []; + for (let n = 1; n <= 7; n++) { + const i = ht.utc(2016, 11, 13 + n); + e.push(t(i)); + } + return e; +} +function nb(t, e, n, i) { + const r = t.listingMode(); + return r === "error" ? null : r === "en" ? n(e) : i(e); +} +function Gue(t) { + return t.numberingSystem && t.numberingSystem !== "latn" ? !1 : t.numberingSystem === "latn" || !t.locale || t.locale.startsWith("en") || new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem === "latn"; +} +class Kue { + constructor(e, n, i) { + this.padTo = i.padTo || 0, this.floor = i.floor || !1; + const { padTo: r, floor: s, ...o } = i; + if (!n || Object.keys(o).length > 0) { + const a = { useGrouping: !1, ...i }; + i.padTo > 0 && (a.minimumIntegerDigits = i.padTo), this.inf = Hue(e, a); + } + } + format(e) { + if (this.inf) { + const n = this.floor ? Math.floor(e) : e; + return this.inf.format(n); + } else { + const n = this.floor ? Math.floor(e) : L5(e, 3); + return yi(n, this.padTo); + } + } +} +class Jue { + constructor(e, n, i) { + this.opts = i, this.originalZone = void 0; + let r; + if (this.opts.timeZone) + this.dt = e; + else if (e.zone.type === "fixed") { + const o = -1 * (e.offset / 60), a = o >= 0 ? `Etc/GMT+${o}` : `Etc/GMT${o}`; + e.offset !== 0 && xl.create(a).valid ? (r = a, this.dt = e) : (r = "UTC", this.dt = e.offset === 0 ? e : e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone); + } else e.zone.type === "system" ? this.dt = e : e.zone.type === "iana" ? (this.dt = e, r = e.zone.name) : (r = "UTC", this.dt = e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone); + const s = { ...this.opts }; + s.timeZone = s.timeZone || r, this.dtf = h4(n, s); + } + format() { + return this.originalZone ? this.formatToParts().map(({ value: e }) => e).join("") : this.dtf.format(this.dt.toJSDate()); + } + formatToParts() { + const e = this.dtf.formatToParts(this.dt.toJSDate()); + return this.originalZone ? e.map((n) => { + if (n.type === "timeZoneName") { + const i = this.originalZone.offsetName(this.dt.ts, { + locale: this.dt.locale, + format: this.opts.timeZoneName + }); + return { + ...n, + value: i + }; + } else + return n; + }) : e; + } + resolvedOptions() { + return this.dtf.resolvedOptions(); + } +} +class ece { + constructor(e, n, i) { + this.opts = { style: "long", ...i }, !n && rz() && (this.rtf = Que(e, i)); + } + format(e, n) { + return this.rtf ? this.rtf.format(e, n) : _ce(n, e, this.opts.numeric, this.opts.style !== "long"); + } + formatToParts(e, n) { + return this.rtf ? this.rtf.formatToParts(e, n) : []; + } +} +const tce = { + firstDay: 1, + minimalDays: 4, + weekend: [6, 7] +}; +class Gt { + static fromOpts(e) { + return Gt.create( + e.locale, + e.numberingSystem, + e.outputCalendar, + e.weekSettings, + e.defaultToEN + ); + } + static create(e, n, i, r, s = !1) { + const o = e || ti.defaultLocale, a = o || (s ? "en-US" : Uue()), l = n || ti.defaultNumberingSystem, u = i || ti.defaultOutputCalendar, f = g4(r) || ti.defaultWeekSettings; + return new Gt(a, l, u, f, o); + } + static resetCache() { + Km = null, d4 = {}, p4 = {}, m4 = {}; + } + static fromObject({ locale: e, numberingSystem: n, outputCalendar: i, weekSettings: r } = {}) { + return Gt.create(e, n, i, r); + } + constructor(e, n, i, r, s) { + const [o, a, l] = que(e); + this.locale = o, this.numberingSystem = n || a || null, this.outputCalendar = i || l || null, this.weekSettings = r, this.intl = Yue(this.locale, this.numberingSystem, this.outputCalendar), this.weekdaysCache = { format: {}, standalone: {} }, this.monthsCache = { format: {}, standalone: {} }, this.meridiemCache = null, this.eraCache = {}, this.specifiedLocale = s, this.fastNumbersCached = null; + } + get fastNumbers() { + return this.fastNumbersCached == null && (this.fastNumbersCached = Gue(this)), this.fastNumbersCached; + } + listingMode() { + const e = this.isEnglish(), n = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + return e && n ? "en" : "intl"; + } + clone(e) { + return !e || Object.getOwnPropertyNames(e).length === 0 ? this : Gt.create( + e.locale || this.specifiedLocale, + e.numberingSystem || this.numberingSystem, + e.outputCalendar || this.outputCalendar, + g4(e.weekSettings) || this.weekSettings, + e.defaultToEN || !1 + ); + } + redefaultToEN(e = {}) { + return this.clone({ ...e, defaultToEN: !0 }); + } + redefaultToSystem(e = {}) { + return this.clone({ ...e, defaultToEN: !1 }); + } + months(e, n = !1) { + return nb(this, e, uz, () => { + const i = n ? { month: e, day: "numeric" } : { month: e }, r = n ? "format" : "standalone"; + return this.monthsCache[r][e] || (this.monthsCache[r][e] = Vue((s) => this.extract(s, i, "month"))), this.monthsCache[r][e]; + }); + } + weekdays(e, n = !1) { + return nb(this, e, dz, () => { + const i = n ? { weekday: e, year: "numeric", month: "long", day: "numeric" } : { weekday: e }, r = n ? "format" : "standalone"; + return this.weekdaysCache[r][e] || (this.weekdaysCache[r][e] = Xue( + (s) => this.extract(s, i, "weekday") + )), this.weekdaysCache[r][e]; + }); + } + meridiems() { + return nb( + this, + void 0, + () => hz, + () => { + if (!this.meridiemCache) { + const e = { hour: "numeric", hourCycle: "h12" }; + this.meridiemCache = [ht.utc(2016, 11, 13, 9), ht.utc(2016, 11, 13, 19)].map( + (n) => this.extract(n, e, "dayperiod") + ); + } + return this.meridiemCache; + } + ); + } + eras(e) { + return nb(this, e, pz, () => { + const n = { era: e }; + return this.eraCache[e] || (this.eraCache[e] = [ht.utc(-40, 1, 1), ht.utc(2017, 1, 1)].map( + (i) => this.extract(i, n, "era") + )), this.eraCache[e]; + }); + } + extract(e, n, i) { + const r = this.dtFormatter(e, n), s = r.formatToParts(), o = s.find((a) => a.type.toLowerCase() === i); + return o ? o.value : null; + } + numberFormatter(e = {}) { + return new Kue(this.intl, e.forceSimple || this.fastNumbers, e); + } + dtFormatter(e, n = {}) { + return new Jue(e, this.intl, n); + } + relFormatter(e = {}) { + return new ece(this.intl, this.isEnglish(), e); + } + listFormatter(e = {}) { + return Wue(this.intl, e); + } + isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); + } + getWeekSettings() { + return this.weekSettings ? this.weekSettings : sz() ? Zue(this.locale) : tce; + } + getStartOfWeek() { + return this.getWeekSettings().firstDay; + } + getMinDaysInFirstWeek() { + return this.getWeekSettings().minimalDays; + } + getWeekendDays() { + return this.getWeekSettings().weekend; + } + equals(e) { + return this.locale === e.locale && this.numberingSystem === e.numberingSystem && this.outputCalendar === e.outputCalendar; + } + toString() { + return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`; + } +} +let P3 = null; +class Gr extends u1 { + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + static get utcInstance() { + return P3 === null && (P3 = new Gr(0)), P3; + } + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + static instance(e) { + return e === 0 ? Gr.utcInstance : new Gr(e); + } + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + static parseSpecifier(e) { + if (e) { + const n = e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + if (n) + return new Gr(t2(n[1], n[2])); + } + return null; + } + constructor(e) { + super(), this.fixed = e; + } + /** + * The type of zone. `fixed` for all instances of `FixedOffsetZone`. + * @override + * @type {string} + */ + get type() { + return "fixed"; + } + /** + * The name of this zone. + * All fixed zones' names always start with "UTC" (plus optional offset) + * @override + * @type {string} + */ + get name() { + return this.fixed === 0 ? "UTC" : `UTC${Og(this.fixed, "narrow")}`; + } + /** + * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn` + * + * @override + * @type {string} + */ + get ianaName() { + return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Og(-this.fixed, "narrow")}`; + } + /** + * Returns the offset's common name at the specified timestamp. + * + * For fixed offset zones this equals to the zone name. + * @override + */ + offsetName() { + return this.name; + } + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(e, n) { + return Og(this.fixed, n); + } + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns true for all fixed offset zones. + * @override + * @type {boolean} + */ + get isUniversal() { + return !0; + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * + * For fixed offset zones, this is constant and does not depend on a timestamp. + * @override + * @return {number} + */ + offset() { + return this.fixed; + } + /** + * Return whether this Zone is equal to another zone (i.e. also fixed and same offset) + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(e) { + return e.type === "fixed" && e.fixed === this.fixed; + } + /** + * Return whether this Zone is valid: + * All fixed offset zones are valid. + * @override + * @type {boolean} + */ + get isValid() { + return !0; + } +} +class nce extends u1 { + constructor(e) { + super(), this.zoneName = e; + } + /** @override **/ + get type() { + return "invalid"; + } + /** @override **/ + get name() { + return this.zoneName; + } + /** @override **/ + get isUniversal() { + return !1; + } + /** @override **/ + offsetName() { + return null; + } + /** @override **/ + formatOffset() { + return ""; + } + /** @override **/ + offset() { + return NaN; + } + /** @override **/ + equals() { + return !1; + } + /** @override **/ + get isValid() { + return !1; + } +} +function vu(t, e) { + if (yt(t) || t === null) + return e; + if (t instanceof u1) + return t; + if (lce(t)) { + const n = t.toLowerCase(); + return n === "default" ? e : n === "local" || n === "system" ? Kk.instance : n === "utc" || n === "gmt" ? Gr.utcInstance : Gr.parseSpecifier(n) || xl.create(t); + } else return Du(t) ? Gr.instance(t) : typeof t == "object" && "offset" in t && typeof t.offset == "function" ? t : new nce(t); +} +const A5 = { + arab: "[٠-٩]", + arabext: "[۰-۹]", + bali: "[᭐-᭙]", + beng: "[০-৯]", + deva: "[०-९]", + fullwide: "[0-9]", + gujr: "[૦-૯]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[០-៩]", + knda: "[೦-೯]", + laoo: "[໐-໙]", + limb: "[᥆-᥏]", + mlym: "[൦-൯]", + mong: "[᠐-᠙]", + mymr: "[၀-၉]", + orya: "[୦-୯]", + tamldec: "[௦-௯]", + telu: "[౦-౯]", + thai: "[๐-๙]", + tibt: "[༠-༩]", + latn: "\\d" +}, P7 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] +}, ice = A5.hanidec.replace(/[\[|\]]/g, "").split(""); +function rce(t) { + let e = parseInt(t, 10); + if (isNaN(e)) { + e = ""; + for (let n = 0; n < t.length; n++) { + const i = t.charCodeAt(n); + if (t[n].search(A5.hanidec) !== -1) + e += ice.indexOf(t[n]); + else + for (const r in P7) { + const [s, o] = P7[r]; + i >= s && i <= o && (e += i - s); + } + } + return parseInt(e, 10); + } else + return e; +} +let Bd = {}; +function sce() { + Bd = {}; +} +function Mo({ numberingSystem: t }, e = "") { + const n = t || "latn"; + return Bd[n] || (Bd[n] = {}), Bd[n][e] || (Bd[n][e] = new RegExp(`${A5[n]}${e}`)), Bd[n][e]; +} +let I7 = () => Date.now(), L7 = "system", R7 = null, j7 = null, F7 = null, B7 = 60, z7, W7 = null; +class ti { + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + static get now() { + return I7; + } + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + static set now(e) { + I7 = e; + } + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * Use the value "system" to reset this value to the system's time zone. + * @type {string} + */ + static set defaultZone(e) { + L7 = e; + } + /** + * Get the default time zone object currently used to create DateTimes. Does not affect existing instances. + * The default value is the system's time zone (the one set on the machine that runs this code). + * @type {Zone} + */ + static get defaultZone() { + return vu(L7, Kk.instance); + } + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultLocale() { + return R7; + } + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultLocale(e) { + R7 = e; + } + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultNumberingSystem() { + return j7; + } + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultNumberingSystem(e) { + j7 = e; + } + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultOutputCalendar() { + return F7; + } + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultOutputCalendar(e) { + F7 = e; + } + /** + * @typedef {Object} WeekSettings + * @property {number} firstDay + * @property {number} minimalDays + * @property {number[]} weekend + */ + /** + * @return {WeekSettings|null} + */ + static get defaultWeekSettings() { + return W7; + } + /** + * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and + * how many days are required in the first week of a year. + * Does not affect existing instances. + * + * @param {WeekSettings|null} weekSettings + */ + static set defaultWeekSettings(e) { + W7 = g4(e); + } + /** + * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + */ + static get twoDigitCutoffYear() { + return B7; + } + /** + * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century + * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century + * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950 + * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50 + * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50 + */ + static set twoDigitCutoffYear(e) { + B7 = e % 100; + } + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static get throwOnInvalid() { + return z7; + } + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static set throwOnInvalid(e) { + z7 = e; + } + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCaches() { + Gt.resetCache(), xl.resetCache(), ht.resetCache(), sce(); + } +} +class Po { + constructor(e, n) { + this.reason = e, this.explanation = n; + } + toMessage() { + return this.explanation ? `${this.reason}: ${this.explanation}` : this.reason; + } +} +const KB = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], JB = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; +function ro(t, e) { + return new Po( + "unit out of range", + `you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid` + ); +} +function D5(t, e, n) { + const i = new Date(Date.UTC(t, e - 1, n)); + t < 100 && t >= 0 && i.setUTCFullYear(i.getUTCFullYear() - 1900); + const r = i.getUTCDay(); + return r === 0 ? 7 : r; +} +function ez(t, e, n) { + return n + (c1(t) ? JB : KB)[e - 1]; +} +function tz(t, e) { + const n = c1(t) ? JB : KB, i = n.findIndex((s) => s < e), r = e - n[i]; + return { month: i + 1, day: r }; +} +function P5(t, e) { + return (t - e + 7) % 7 + 1; +} +function uw(t, e = 4, n = 1) { + const { year: i, month: r, day: s } = t, o = ez(i, r, s), a = P5(D5(i, r, s), n); + let l = Math.floor((o - a + 14 - e) / 7), u; + return l < 1 ? (u = i - 1, l = r0(u, e, n)) : l > r0(i, e, n) ? (u = i + 1, l = 1) : u = i, { weekYear: u, weekNumber: l, weekday: a, ...n2(t) }; +} +function H7(t, e = 4, n = 1) { + const { weekYear: i, weekNumber: r, weekday: s } = t, o = P5(D5(i, 1, e), n), a = uh(i); + let l = r * 7 + s - o - 7 + e, u; + l < 1 ? (u = i - 1, l += uh(u)) : l > a ? (u = i + 1, l -= uh(i)) : u = i; + const { month: f, day: d } = tz(u, l); + return { year: u, month: f, day: d, ...n2(t) }; +} +function I3(t) { + const { year: e, month: n, day: i } = t, r = ez(e, n, i); + return { year: e, ordinal: r, ...n2(t) }; +} +function Q7(t) { + const { year: e, ordinal: n } = t, { month: i, day: r } = tz(e, n); + return { year: e, month: i, day: r, ...n2(t) }; +} +function U7(t, e) { + if (!yt(t.localWeekday) || !yt(t.localWeekNumber) || !yt(t.localWeekYear)) { + if (!yt(t.weekday) || !yt(t.weekNumber) || !yt(t.weekYear)) + throw new Gd( + "Cannot mix locale-based week fields with ISO-based week fields" + ); + return yt(t.localWeekday) || (t.weekday = t.localWeekday), yt(t.localWeekNumber) || (t.weekNumber = t.localWeekNumber), yt(t.localWeekYear) || (t.weekYear = t.localWeekYear), delete t.localWeekday, delete t.localWeekNumber, delete t.localWeekYear, { + minDaysInFirstWeek: e.getMinDaysInFirstWeek(), + startOfWeek: e.getStartOfWeek() + }; + } else + return { minDaysInFirstWeek: 4, startOfWeek: 1 }; +} +function oce(t, e = 4, n = 1) { + const i = Jk(t.weekYear), r = so( + t.weekNumber, + 1, + r0(t.weekYear, e, n) + ), s = so(t.weekday, 1, 7); + return i ? r ? s ? !1 : ro("weekday", t.weekday) : ro("week", t.weekNumber) : ro("weekYear", t.weekYear); +} +function ace(t) { + const e = Jk(t.year), n = so(t.ordinal, 1, uh(t.year)); + return e ? n ? !1 : ro("ordinal", t.ordinal) : ro("year", t.year); +} +function nz(t) { + const e = Jk(t.year), n = so(t.month, 1, 12), i = so(t.day, 1, cw(t.year, t.month)); + return e ? n ? i ? !1 : ro("day", t.day) : ro("month", t.month) : ro("year", t.year); +} +function iz(t) { + const { hour: e, minute: n, second: i, millisecond: r } = t, s = so(e, 0, 23) || e === 24 && n === 0 && i === 0 && r === 0, o = so(n, 0, 59), a = so(i, 0, 59), l = so(r, 0, 999); + return s ? o ? a ? l ? !1 : ro("millisecond", r) : ro("second", i) : ro("minute", n) : ro("hour", e); +} +function yt(t) { + return typeof t > "u"; +} +function Du(t) { + return typeof t == "number"; +} +function Jk(t) { + return typeof t == "number" && t % 1 === 0; +} +function lce(t) { + return typeof t == "string"; +} +function uce(t) { + return Object.prototype.toString.call(t) === "[object Date]"; +} +function rz() { + try { + return typeof Intl < "u" && !!Intl.RelativeTimeFormat; + } catch { + return !1; + } +} +function sz() { + try { + return typeof Intl < "u" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype); + } catch { + return !1; + } +} +function cce(t) { + return Array.isArray(t) ? t : [t]; +} +function Z7(t, e, n) { + if (t.length !== 0) + return t.reduce((i, r) => { + const s = [e(r), r]; + return i && n(i[0], s[0]) === i[0] ? i : s; + }, null)[1]; +} +function fce(t, e) { + return e.reduce((n, i) => (n[i] = t[i], n), {}); +} +function Ch(t, e) { + return Object.prototype.hasOwnProperty.call(t, e); +} +function g4(t) { + if (t == null) + return null; + if (typeof t != "object") + throw new Sr("Week settings must be an object"); + if (!so(t.firstDay, 1, 7) || !so(t.minimalDays, 1, 7) || !Array.isArray(t.weekend) || t.weekend.some((e) => !so(e, 1, 7))) + throw new Sr("Invalid week settings"); + return { + firstDay: t.firstDay, + minimalDays: t.minimalDays, + weekend: Array.from(t.weekend) + }; +} +function so(t, e, n) { + return Jk(t) && t >= e && t <= n; +} +function dce(t, e) { + return t - e * Math.floor(t / e); +} +function yi(t, e = 2) { + const n = t < 0; + let i; + return n ? i = "-" + ("" + -t).padStart(e, "0") : i = ("" + t).padStart(e, "0"), i; +} +function hu(t) { + if (!(yt(t) || t === null || t === "")) + return parseInt(t, 10); +} +function Ac(t) { + if (!(yt(t) || t === null || t === "")) + return parseFloat(t); +} +function I5(t) { + if (!(yt(t) || t === null || t === "")) { + const e = parseFloat("0." + t) * 1e3; + return Math.floor(e); + } +} +function L5(t, e, n = !1) { + const i = 10 ** e; + return (n ? Math.trunc : Math.round)(t * i) / i; +} +function c1(t) { + return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0); +} +function uh(t) { + return c1(t) ? 366 : 365; +} +function cw(t, e) { + const n = dce(e - 1, 12) + 1, i = t + (e - n) / 12; + return n === 2 ? c1(i) ? 29 : 28 : [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][n - 1]; +} +function e2(t) { + let e = Date.UTC( + t.year, + t.month - 1, + t.day, + t.hour, + t.minute, + t.second, + t.millisecond + ); + return t.year < 100 && t.year >= 0 && (e = new Date(e), e.setUTCFullYear(t.year, t.month - 1, t.day)), +e; +} +function q7(t, e, n) { + return -P5(D5(t, 1, e), n) + e - 1; +} +function r0(t, e = 4, n = 1) { + const i = q7(t, e, n), r = q7(t + 1, e, n); + return (uh(t) - i + r) / 7; +} +function v4(t) { + return t > 99 ? t : t > ti.twoDigitCutoffYear ? 1900 + t : 2e3 + t; +} +function oz(t, e, n, i = null) { + const r = new Date(t), s = { + hourCycle: "h23", + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + i && (s.timeZone = i); + const o = { timeZoneName: e, ...s }, a = new Intl.DateTimeFormat(n, o).formatToParts(r).find((l) => l.type.toLowerCase() === "timezonename"); + return a ? a.value : null; +} +function t2(t, e) { + let n = parseInt(t, 10); + Number.isNaN(n) && (n = 0); + const i = parseInt(e, 10) || 0, r = n < 0 || Object.is(n, -0) ? -i : i; + return n * 60 + r; +} +function az(t) { + const e = Number(t); + if (typeof t == "boolean" || t === "" || Number.isNaN(e)) + throw new Sr(`Invalid unit value ${t}`); + return e; +} +function fw(t, e) { + const n = {}; + for (const i in t) + if (Ch(t, i)) { + const r = t[i]; + if (r == null) continue; + n[e(i)] = az(r); + } + return n; +} +function Og(t, e) { + const n = Math.trunc(Math.abs(t / 60)), i = Math.trunc(Math.abs(t % 60)), r = t >= 0 ? "+" : "-"; + switch (e) { + case "short": + return `${r}${yi(n, 2)}:${yi(i, 2)}`; + case "narrow": + return `${r}${n}${i > 0 ? `:${i}` : ""}`; + case "techie": + return `${r}${yi(n, 2)}${yi(i, 2)}`; + default: + throw new RangeError(`Value format ${e} is out of range for property format`); + } +} +function n2(t) { + return fce(t, ["hour", "minute", "second", "millisecond"]); +} +const hce = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +], lz = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" +], pce = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; +function uz(t) { + switch (t) { + case "narrow": + return [...pce]; + case "short": + return [...lz]; + case "long": + return [...hce]; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + default: + return null; + } +} +const cz = [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday" +], fz = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], mce = ["M", "T", "W", "T", "F", "S", "S"]; +function dz(t) { + switch (t) { + case "narrow": + return [...mce]; + case "short": + return [...fz]; + case "long": + return [...cz]; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + default: + return null; + } +} +const hz = ["AM", "PM"], gce = ["Before Christ", "Anno Domini"], vce = ["BC", "AD"], bce = ["B", "A"]; +function pz(t) { + switch (t) { + case "narrow": + return [...bce]; + case "short": + return [...vce]; + case "long": + return [...gce]; + default: + return null; + } +} +function yce(t) { + return hz[t.hour < 12 ? 0 : 1]; +} +function wce(t, e) { + return dz(e)[t.weekday - 1]; +} +function kce(t, e) { + return uz(e)[t.month - 1]; +} +function xce(t, e) { + return pz(e)[t.year < 0 ? 0 : 1]; +} +function _ce(t, e, n = "always", i = !1) { + const r = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }, s = ["hours", "minutes", "seconds"].indexOf(t) === -1; + if (n === "auto" && s) { + const d = t === "days"; + switch (e) { + case 1: + return d ? "tomorrow" : `next ${r[t][0]}`; + case -1: + return d ? "yesterday" : `last ${r[t][0]}`; + case 0: + return d ? "today" : `this ${r[t][0]}`; + } + } + const o = Object.is(e, -0) || e < 0, a = Math.abs(e), l = a === 1, u = r[t], f = i ? l ? u[1] : u[2] || u[1] : l ? r[t][0] : t; + return o ? `${a} ${f} ago` : `in ${a} ${f}`; +} +function Y7(t, e) { + let n = ""; + for (const i of t) + i.literal ? n += i.val : n += e(i.val); + return n; +} +const Oce = { + D: lw, + DD: DB, + DDD: PB, + DDDD: IB, + t: LB, + tt: RB, + ttt: jB, + tttt: FB, + T: BB, + TT: zB, + TTT: WB, + TTTT: HB, + f: QB, + ff: ZB, + fff: YB, + ffff: XB, + F: UB, + FF: qB, + FFF: VB, + FFFF: GB +}; +class $r { + static create(e, n = {}) { + return new $r(e, n); + } + static parseFormat(e) { + let n = null, i = "", r = !1; + const s = []; + for (let o = 0; o < e.length; o++) { + const a = e.charAt(o); + a === "'" ? (i.length > 0 && s.push({ literal: r || /^\s+$/.test(i), val: i }), n = null, i = "", r = !r) : r || a === n ? i += a : (i.length > 0 && s.push({ literal: /^\s+$/.test(i), val: i }), i = a, n = a); + } + return i.length > 0 && s.push({ literal: r || /^\s+$/.test(i), val: i }), s; + } + static macroTokenToFormatOpts(e) { + return Oce[e]; + } + constructor(e, n) { + this.opts = n, this.loc = e, this.systemLoc = null; + } + formatWithSystemDefault(e, n) { + return this.systemLoc === null && (this.systemLoc = this.loc.redefaultToSystem()), this.systemLoc.dtFormatter(e, { ...this.opts, ...n }).format(); + } + dtFormatter(e, n = {}) { + return this.loc.dtFormatter(e, { ...this.opts, ...n }); + } + formatDateTime(e, n) { + return this.dtFormatter(e, n).format(); + } + formatDateTimeParts(e, n) { + return this.dtFormatter(e, n).formatToParts(); + } + formatInterval(e, n) { + return this.dtFormatter(e.start, n).dtf.formatRange(e.start.toJSDate(), e.end.toJSDate()); + } + resolvedOptions(e, n) { + return this.dtFormatter(e, n).resolvedOptions(); + } + num(e, n = 0) { + if (this.opts.forceSimple) + return yi(e, n); + const i = { ...this.opts }; + return n > 0 && (i.padTo = n), this.loc.numberFormatter(i).format(e); + } + formatDateTimeFromString(e, n) { + const i = this.loc.listingMode() === "en", r = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", s = (m, g) => this.loc.extract(e, m, g), o = (m) => e.isOffsetFixed && e.offset === 0 && m.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, m.format) : "", a = () => i ? yce(e) : s({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), l = (m, g) => i ? kce(e, m) : s(g ? { month: m } : { month: m, day: "numeric" }, "month"), u = (m, g) => i ? wce(e, m) : s( + g ? { weekday: m } : { weekday: m, month: "long", day: "numeric" }, + "weekday" + ), f = (m) => { + const g = $r.macroTokenToFormatOpts(m); + return g ? this.formatWithSystemDefault(e, g) : m; + }, d = (m) => i ? xce(e, m) : s({ era: m }, "era"), h = (m) => { + switch (m) { + case "S": + return this.num(e.millisecond); + case "u": + case "SSS": + return this.num(e.millisecond, 3); + case "s": + return this.num(e.second); + case "ss": + return this.num(e.second, 2); + case "uu": + return this.num(Math.floor(e.millisecond / 10), 2); + case "uuu": + return this.num(Math.floor(e.millisecond / 100)); + case "m": + return this.num(e.minute); + case "mm": + return this.num(e.minute, 2); + case "h": + return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12); + case "hh": + return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12, 2); + case "H": + return this.num(e.hour); + case "HH": + return this.num(e.hour, 2); + case "Z": + return o({ format: "narrow", allowZ: this.opts.allowZ }); + case "ZZ": + return o({ format: "short", allowZ: this.opts.allowZ }); + case "ZZZ": + return o({ format: "techie", allowZ: this.opts.allowZ }); + case "ZZZZ": + return e.zone.offsetName(e.ts, { format: "short", locale: this.loc.locale }); + case "ZZZZZ": + return e.zone.offsetName(e.ts, { format: "long", locale: this.loc.locale }); + case "z": + return e.zoneName; + case "a": + return a(); + case "d": + return r ? s({ day: "numeric" }, "day") : this.num(e.day); + case "dd": + return r ? s({ day: "2-digit" }, "day") : this.num(e.day, 2); + case "c": + return this.num(e.weekday); + case "ccc": + return u("short", !0); + case "cccc": + return u("long", !0); + case "ccccc": + return u("narrow", !0); + case "E": + return this.num(e.weekday); + case "EEE": + return u("short", !1); + case "EEEE": + return u("long", !1); + case "EEEEE": + return u("narrow", !1); + case "L": + return r ? s({ month: "numeric", day: "numeric" }, "month") : this.num(e.month); + case "LL": + return r ? s({ month: "2-digit", day: "numeric" }, "month") : this.num(e.month, 2); + case "LLL": + return l("short", !0); + case "LLLL": + return l("long", !0); + case "LLLLL": + return l("narrow", !0); + case "M": + return r ? s({ month: "numeric" }, "month") : this.num(e.month); + case "MM": + return r ? s({ month: "2-digit" }, "month") : this.num(e.month, 2); + case "MMM": + return l("short", !1); + case "MMMM": + return l("long", !1); + case "MMMMM": + return l("narrow", !1); + case "y": + return r ? s({ year: "numeric" }, "year") : this.num(e.year); + case "yy": + return r ? s({ year: "2-digit" }, "year") : this.num(e.year.toString().slice(-2), 2); + case "yyyy": + return r ? s({ year: "numeric" }, "year") : this.num(e.year, 4); + case "yyyyyy": + return r ? s({ year: "numeric" }, "year") : this.num(e.year, 6); + case "G": + return d("short"); + case "GG": + return d("long"); + case "GGGGG": + return d("narrow"); + case "kk": + return this.num(e.weekYear.toString().slice(-2), 2); + case "kkkk": + return this.num(e.weekYear, 4); + case "W": + return this.num(e.weekNumber); + case "WW": + return this.num(e.weekNumber, 2); + case "n": + return this.num(e.localWeekNumber); + case "nn": + return this.num(e.localWeekNumber, 2); + case "ii": + return this.num(e.localWeekYear.toString().slice(-2), 2); + case "iiii": + return this.num(e.localWeekYear, 4); + case "o": + return this.num(e.ordinal); + case "ooo": + return this.num(e.ordinal, 3); + case "q": + return this.num(e.quarter); + case "qq": + return this.num(e.quarter, 2); + case "X": + return this.num(Math.floor(e.ts / 1e3)); + case "x": + return this.num(e.ts); + default: + return f(m); + } + }; + return Y7($r.parseFormat(n), h); + } + formatDurationFromString(e, n) { + const i = (l) => { + switch (l[0]) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + return "hour"; + case "d": + return "day"; + case "w": + return "week"; + case "M": + return "month"; + case "y": + return "year"; + default: + return null; + } + }, r = (l) => (u) => { + const f = i(u); + return f ? this.num(l.get(f), u.length) : u; + }, s = $r.parseFormat(n), o = s.reduce( + (l, { literal: u, val: f }) => u ? l : l.concat(f), + [] + ), a = e.shiftTo(...o.map(i).filter((l) => l)); + return Y7(s, r(a)); + } +} +const mz = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; +function ep(...t) { + const e = t.reduce((n, i) => n + i.source, ""); + return RegExp(`^${e}$`); +} +function tp(...t) { + return (e) => t.reduce( + ([n, i, r], s) => { + const [o, a, l] = s(e, r); + return [{ ...n, ...o }, a || i, l]; + }, + [{}, null, 1] + ).slice(0, 2); +} +function np(t, ...e) { + if (t == null) + return [null, null]; + for (const [n, i] of e) { + const r = n.exec(t); + if (r) + return i(r); + } + return [null, null]; +} +function gz(...t) { + return (e, n) => { + const i = {}; + let r; + for (r = 0; r < t.length; r++) + i[t[r]] = hu(e[n + r]); + return [i, null, n + r]; + }; +} +const vz = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, Sce = `(?:${vz.source}?(?:\\[(${mz.source})\\])?)?`, R5 = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, bz = RegExp(`${R5.source}${Sce}`), j5 = RegExp(`(?:T${bz.source})?`), Cce = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Ece = /(\d{4})-?W(\d\d)(?:-?(\d))?/, Tce = /(\d{4})-?(\d{3})/, $ce = gz("weekYear", "weekNumber", "weekDay"), Mce = gz("year", "ordinal"), Nce = /(\d{4})-(\d\d)-(\d\d)/, yz = RegExp( + `${R5.source} ?(?:${vz.source}|(${mz.source}))?` +), Ace = RegExp(`(?: ${yz.source})?`); +function ch(t, e, n) { + const i = t[e]; + return yt(i) ? n : hu(i); +} +function Dce(t, e) { + return [{ + year: ch(t, e), + month: ch(t, e + 1, 1), + day: ch(t, e + 2, 1) + }, null, e + 3]; +} +function ip(t, e) { + return [{ + hours: ch(t, e, 0), + minutes: ch(t, e + 1, 0), + seconds: ch(t, e + 2, 0), + milliseconds: I5(t[e + 3]) + }, null, e + 4]; +} +function f1(t, e) { + const n = !t[e] && !t[e + 1], i = t2(t[e + 1], t[e + 2]), r = n ? null : Gr.instance(i); + return [{}, r, e + 3]; +} +function d1(t, e) { + const n = t[e] ? xl.create(t[e]) : null; + return [{}, n, e + 1]; +} +const Pce = RegExp(`^T?${R5.source}$`), Ice = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/; +function Lce(t) { + const [e, n, i, r, s, o, a, l, u] = t, f = e[0] === "-", d = l && l[0] === "-", h = (m, g = !1) => m !== void 0 && (g || m && f) ? -m : m; + return [ + { + years: h(Ac(n)), + months: h(Ac(i)), + weeks: h(Ac(r)), + days: h(Ac(s)), + hours: h(Ac(o)), + minutes: h(Ac(a)), + seconds: h(Ac(l), l === "-0"), + milliseconds: h(I5(u), d) + } + ]; +} +const Rce = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; +function F5(t, e, n, i, r, s, o) { + const a = { + year: e.length === 2 ? v4(hu(e)) : hu(e), + month: lz.indexOf(n) + 1, + day: hu(i), + hour: hu(r), + minute: hu(s) + }; + return o && (a.second = hu(o)), t && (a.weekday = t.length > 3 ? cz.indexOf(t) + 1 : fz.indexOf(t) + 1), a; +} +const jce = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; +function Fce(t) { + const [ + , + e, + n, + i, + r, + s, + o, + a, + l, + u, + f, + d + ] = t, h = F5(e, r, i, n, s, o, a); + let m; + return l ? m = Rce[l] : u ? m = 0 : m = t2(f, d), [h, new Gr(m)]; +} +function Bce(t) { + return t.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); +} +const zce = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, Wce = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, Hce = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; +function V7(t) { + const [, e, n, i, r, s, o, a] = t; + return [F5(e, r, i, n, s, o, a), Gr.utcInstance]; +} +function Qce(t) { + const [, e, n, i, r, s, o, a] = t; + return [F5(e, a, n, i, r, s, o), Gr.utcInstance]; +} +const Uce = ep(Cce, j5), Zce = ep(Ece, j5), qce = ep(Tce, j5), Yce = ep(bz), wz = tp( + Dce, + ip, + f1, + d1 +), Vce = tp( + $ce, + ip, + f1, + d1 +), Xce = tp( + Mce, + ip, + f1, + d1 +), Gce = tp( + ip, + f1, + d1 +); +function Kce(t) { + return np( + t, + [Uce, wz], + [Zce, Vce], + [qce, Xce], + [Yce, Gce] + ); +} +function Jce(t) { + return np(Bce(t), [jce, Fce]); +} +function efe(t) { + return np( + t, + [zce, V7], + [Wce, V7], + [Hce, Qce] + ); +} +function tfe(t) { + return np(t, [Ice, Lce]); +} +const nfe = tp(ip); +function ife(t) { + return np(t, [Pce, nfe]); +} +const rfe = ep(Nce, Ace), sfe = ep(yz), ofe = tp( + ip, + f1, + d1 +); +function afe(t) { + return np( + t, + [rfe, wz], + [sfe, ofe] + ); +} +const X7 = "Invalid Duration", kz = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1e3 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1e3 + }, + hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1e3 }, + minutes: { seconds: 60, milliseconds: 60 * 1e3 }, + seconds: { milliseconds: 1e3 } +}, lfe = { + years: { + quarters: 4, + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1e3 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + seconds: 91 * 24 * 60 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1e3 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1e3 + }, + ...kz +}, Ks = 146097 / 400, Sd = 146097 / 4800, ufe = { + years: { + quarters: 4, + months: 12, + weeks: Ks / 7, + days: Ks, + hours: Ks * 24, + minutes: Ks * 24 * 60, + seconds: Ks * 24 * 60 * 60, + milliseconds: Ks * 24 * 60 * 60 * 1e3 + }, + quarters: { + months: 3, + weeks: Ks / 28, + days: Ks / 4, + hours: Ks * 24 / 4, + minutes: Ks * 24 * 60 / 4, + seconds: Ks * 24 * 60 * 60 / 4, + milliseconds: Ks * 24 * 60 * 60 * 1e3 / 4 + }, + months: { + weeks: Sd / 7, + days: Sd, + hours: Sd * 24, + minutes: Sd * 24 * 60, + seconds: Sd * 24 * 60 * 60, + milliseconds: Sd * 24 * 60 * 60 * 1e3 + }, + ...kz +}, Zc = [ + "years", + "quarters", + "months", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds" +], cfe = Zc.slice(0).reverse(); +function ru(t, e, n = !1) { + const i = { + values: n ? e.values : { ...t.values, ...e.values || {} }, + loc: t.loc.clone(e.loc), + conversionAccuracy: e.conversionAccuracy || t.conversionAccuracy, + matrix: e.matrix || t.matrix + }; + return new Ht(i); +} +function xz(t, e) { + let n = e.milliseconds ?? 0; + for (const i of cfe.slice(1)) + e[i] && (n += e[i] * t[i].milliseconds); + return n; +} +function G7(t, e) { + const n = xz(t, e) < 0 ? -1 : 1; + Zc.reduceRight((i, r) => { + if (yt(e[r])) + return i; + if (i) { + const s = e[i] * n, o = t[r][i], a = Math.floor(s / o); + e[r] += a * n, e[i] -= a * o * n; + } + return r; + }, null), Zc.reduce((i, r) => { + if (yt(e[r])) + return i; + if (i) { + const s = e[i] % 1; + e[i] -= s, e[r] += s * t[i][r]; + } + return r; + }, null); +} +function ffe(t) { + const e = {}; + for (const [n, i] of Object.entries(t)) + i !== 0 && (e[n] = i); + return e; +} +class Ht { + /** + * @private + */ + constructor(e) { + const n = e.conversionAccuracy === "longterm" || !1; + let i = n ? ufe : lfe; + e.matrix && (i = e.matrix), this.values = e.values, this.loc = e.loc || Gt.create(), this.conversionAccuracy = n ? "longterm" : "casual", this.invalid = e.invalid || null, this.matrix = i, this.isLuxonDuration = !0; + } + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + static fromMillis(e, n) { + return Ht.fromObject({ milliseconds: e }, n); + } + /** + * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {Object} [opts=[]] - options for creating this Duration + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the custom conversion system to use + * @return {Duration} + */ + static fromObject(e, n = {}) { + if (e == null || typeof e != "object") + throw new Sr( + `Duration.fromObject: argument expected to be an object, got ${e === null ? "null" : typeof e}` + ); + return new Ht({ + values: fw(e, Ht.normalizeUnit), + loc: Gt.fromObject(n), + conversionAccuracy: n.conversionAccuracy, + matrix: n.matrix + }); + } + /** + * Create a Duration from DurationLike. + * + * @param {Object | number | Duration} durationLike + * One of: + * - object with keys like 'years' and 'hours'. + * - number representing milliseconds + * - Duration instance + * @return {Duration} + */ + static fromDurationLike(e) { + if (Du(e)) + return Ht.fromMillis(e); + if (Ht.isDuration(e)) + return e; + if (typeof e == "object") + return Ht.fromObject(e); + throw new Sr( + `Unknown duration argument ${e} of type ${typeof e}` + ); + } + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the preset conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + static fromISO(e, n) { + const [i] = tfe(e); + return i ? Ht.fromObject(i, n) : Ht.invalid("unparsable", `the input "${e}" can't be parsed as ISO 8601`); + } + /** + * Create a Duration from an ISO 8601 time string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } + * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @return {Duration} + */ + static fromISOTime(e, n) { + const [i] = ife(e); + return i ? Ht.fromObject(i, n) : Ht.invalid("unparsable", `the input "${e}" can't be parsed as ISO 8601`); + } + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + static invalid(e, n = null) { + if (!e) + throw new Sr("need to specify a reason the Duration is invalid"); + const i = e instanceof Po ? e : new Po(e, n); + if (ti.throwOnInvalid) + throw new Iue(i); + return new Ht({ invalid: i }); + } + /** + * @private + */ + static normalizeUnit(e) { + const n = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[e && e.toLowerCase()]; + if (!n) throw new AB(e); + return n; + } + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDuration(e) { + return e && e.isLuxonDuration || !1; + } + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `w` for weeks + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * Tokens can be escaped by wrapping with single quotes. + * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @return {string} + */ + toFormat(e, n = {}) { + const i = { + ...n, + floor: n.round !== !1 && n.floor !== !1 + }; + return this.isValid ? $r.create(this.loc, i).formatDurationFromString(this, e) : X7; + } + /** + * Returns a string representation of a Duration with all units included. + * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options + * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`. + * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor. + * @example + * ```js + * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 }) + * dur.toHuman() //=> '1 day, 5 hours, 6 minutes' + * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes' + * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min' + * ``` + */ + toHuman(e = {}) { + if (!this.isValid) return X7; + const n = Zc.map((i) => { + const r = this.values[i]; + return yt(r) ? null : this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...e, unit: i.slice(0, -1) }).format(r); + }).filter((i) => i); + return this.loc.listFormatter({ type: "conjunction", style: e.listStyle || "narrow", ...e }).format(n); + } + /** + * Returns a JavaScript object with this Duration's values. + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + toObject() { + return this.isValid ? { ...this.values } : {}; + } + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + toISO() { + if (!this.isValid) return null; + let e = "P"; + return this.years !== 0 && (e += this.years + "Y"), (this.months !== 0 || this.quarters !== 0) && (e += this.months + this.quarters * 3 + "M"), this.weeks !== 0 && (e += this.weeks + "W"), this.days !== 0 && (e += this.days + "D"), (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) && (e += "T"), this.hours !== 0 && (e += this.hours + "H"), this.minutes !== 0 && (e += this.minutes + "M"), (this.seconds !== 0 || this.milliseconds !== 0) && (e += L5(this.seconds + this.milliseconds / 1e3, 3) + "S"), e === "P" && (e += "T0S"), e; + } + /** + * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. + * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' + * @return {string} + */ + toISOTime(e = {}) { + if (!this.isValid) return null; + const n = this.toMillis(); + return n < 0 || n >= 864e5 ? null : (e = { + suppressMilliseconds: !1, + suppressSeconds: !1, + includePrefix: !1, + format: "extended", + ...e, + includeOffset: !1 + }, ht.fromMillis(n, { zone: "UTC" }).toISOTime(e)); + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + toString() { + return this.toISO(); + } + /** + * Returns a string representation of this Duration appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + return this.isValid ? `Duration { values: ${JSON.stringify(this.values)} }` : `Duration { Invalid, reason: ${this.invalidReason} }`; + } + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + toMillis() { + return this.isValid ? xz(this.matrix, this.values) : NaN; + } + /** + * Returns an milliseconds value of this Duration. Alias of {@link toMillis} + * @return {number} + */ + valueOf() { + return this.toMillis(); + } + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + plus(e) { + if (!this.isValid) return this; + const n = Ht.fromDurationLike(e), i = {}; + for (const r of Zc) + (Ch(n.values, r) || Ch(this.values, r)) && (i[r] = n.get(r) + this.get(r)); + return ru(this, { values: i }, !0); + } + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + minus(e) { + if (!this.isValid) return this; + const n = Ht.fromDurationLike(e); + return this.plus(n.negate()); + } + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + mapUnits(e) { + if (!this.isValid) return this; + const n = {}; + for (const i of Object.keys(this.values)) + n[i] = az(e(this.values[i], i)); + return ru(this, { values: n }, !0); + } + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3 + * @return {number} + */ + get(e) { + return this[Ht.normalizeUnit(e)]; + } + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + set(e) { + if (!this.isValid) return this; + const n = { ...this.values, ...fw(e, Ht.normalizeUnit) }; + return ru(this, { values: n }); + } + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + reconfigure({ locale: e, numberingSystem: n, conversionAccuracy: i, matrix: r } = {}) { + const o = { loc: this.loc.clone({ locale: e, numberingSystem: n }), matrix: r, conversionAccuracy: i }; + return ru(this, o); + } + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + as(e) { + return this.isValid ? this.shiftTo(e).get(e) : NaN; + } + /** + * Reduce this Duration to its canonical representation in its current units. + * Assuming the overall value of the Duration is positive, this means: + * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example) + * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise + * the overall value would be negative, see third example) + * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example) + * + * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 } + * @return {Duration} + */ + normalize() { + if (!this.isValid) return this; + const e = this.toObject(); + return G7(this.matrix, e), ru(this, { values: e }, !0); + } + /** + * Rescale units to its largest representation + * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 } + * @return {Duration} + */ + rescale() { + if (!this.isValid) return this; + const e = ffe(this.normalize().shiftToAll().toObject()); + return ru(this, { values: e }, !0); + } + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + shiftTo(...e) { + if (!this.isValid) return this; + if (e.length === 0) + return this; + e = e.map((o) => Ht.normalizeUnit(o)); + const n = {}, i = {}, r = this.toObject(); + let s; + for (const o of Zc) + if (e.indexOf(o) >= 0) { + s = o; + let a = 0; + for (const u in i) + a += this.matrix[u][o] * i[u], i[u] = 0; + Du(r[o]) && (a += r[o]); + const l = Math.trunc(a); + n[o] = l, i[o] = (a * 1e3 - l * 1e3) / 1e3; + } else Du(r[o]) && (i[o] = r[o]); + for (const o in i) + i[o] !== 0 && (n[s] += o === s ? i[o] : i[o] / this.matrix[s][o]); + return G7(this.matrix, n), ru(this, { values: n }, !0); + } + /** + * Shift this Duration to all available units. + * Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds") + * @return {Duration} + */ + shiftToAll() { + return this.isValid ? this.shiftTo( + "years", + "months", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds" + ) : this; + } + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + negate() { + if (!this.isValid) return this; + const e = {}; + for (const n of Object.keys(this.values)) + e[n] = this.values[n] === 0 ? 0 : -this.values[n]; + return ru(this, { values: e }, !0); + } + /** + * Get the years. + * @type {number} + */ + get years() { + return this.isValid ? this.values.years || 0 : NaN; + } + /** + * Get the quarters. + * @type {number} + */ + get quarters() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + /** + * Get the months. + * @type {number} + */ + get months() { + return this.isValid ? this.values.months || 0 : NaN; + } + /** + * Get the weeks + * @type {number} + */ + get weeks() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + /** + * Get the days. + * @type {number} + */ + get days() { + return this.isValid ? this.values.days || 0 : NaN; + } + /** + * Get the hours. + * @type {number} + */ + get hours() { + return this.isValid ? this.values.hours || 0 : NaN; + } + /** + * Get the minutes. + * @type {number} + */ + get minutes() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + /** + * Get the seconds. + * @return {number} + */ + get seconds() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + /** + * Get the milliseconds. + * @return {number} + */ + get milliseconds() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + get isValid() { + return this.invalid === null; + } + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + equals(e) { + if (!this.isValid || !e.isValid || !this.loc.equals(e.loc)) + return !1; + function n(i, r) { + return i === void 0 || i === 0 ? r === void 0 || r === 0 : i === r; + } + for (const i of Zc) + if (!n(this.values[i], e.values[i])) + return !1; + return !0; + } +} +const Cd = "Invalid Interval"; +function dfe(t, e) { + return !t || !t.isValid ? ei.invalid("missing or invalid start") : !e || !e.isValid ? ei.invalid("missing or invalid end") : e < t ? ei.invalid( + "end before start", + `The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}` + ) : null; +} +class ei { + /** + * @private + */ + constructor(e) { + this.s = e.start, this.e = e.end, this.invalid = e.invalid || null, this.isLuxonInterval = !0; + } + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + static invalid(e, n = null) { + if (!e) + throw new Sr("need to specify a reason the Interval is invalid"); + const i = e instanceof Po ? e : new Po(e, n); + if (ti.throwOnInvalid) + throw new Pue(i); + return new ei({ invalid: i }); + } + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + static fromDateTimes(e, n) { + const i = Cm(e), r = Cm(n), s = dfe(i, r); + return s ?? new ei({ + start: i, + end: r + }); + } + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static after(e, n) { + const i = Ht.fromDurationLike(n), r = Cm(e); + return ei.fromDateTimes(r, r.plus(i)); + } + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static before(e, n) { + const i = Ht.fromDurationLike(n), r = Cm(e); + return ei.fromDateTimes(r.minus(i), r); + } + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + static fromISO(e, n) { + const [i, r] = (e || "").split("/", 2); + if (i && r) { + let s, o; + try { + s = ht.fromISO(i, n), o = s.isValid; + } catch { + o = !1; + } + let a, l; + try { + a = ht.fromISO(r, n), l = a.isValid; + } catch { + l = !1; + } + if (o && l) + return ei.fromDateTimes(s, a); + if (o) { + const u = Ht.fromISO(r, n); + if (u.isValid) + return ei.after(s, u); + } else if (l) { + const u = Ht.fromISO(i, n); + if (u.isValid) + return ei.before(a, u); + } + } + return ei.invalid("unparsable", `the input "${e}" can't be parsed as ISO 8601`); + } + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isInterval(e) { + return e && e.isLuxonInterval || !1; + } + /** + * Returns the start of the Interval + * @type {DateTime} + */ + get start() { + return this.isValid ? this.s : null; + } + /** + * Returns the end of the Interval + * @type {DateTime} + */ + get end() { + return this.isValid ? this.e : null; + } + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + get isValid() { + return this.invalidReason === null; + } + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + length(e = "milliseconds") { + return this.isValid ? this.toDuration(e).get(e) : NaN; + } + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime + * @return {number} + */ + count(e = "milliseconds", n) { + if (!this.isValid) return NaN; + const i = this.start.startOf(e, n); + let r; + return n != null && n.useLocaleWeeks ? r = this.end.reconfigure({ locale: i.locale }) : r = this.end, r = r.startOf(e, n), Math.floor(r.diff(i, e).get(e)) + (r.valueOf() !== this.end.valueOf()); + } + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + hasSame(e) { + return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, e) : !1; + } + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isAfter(e) { + return this.isValid ? this.s > e : !1; + } + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isBefore(e) { + return this.isValid ? this.e <= e : !1; + } + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + contains(e) { + return this.isValid ? this.s <= e && this.e > e : !1; + } + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + set({ start: e, end: n } = {}) { + return this.isValid ? ei.fromDateTimes(e || this.s, n || this.e) : this; + } + /** + * Split this Interval at each of the specified DateTimes + * @param {...DateTime} dateTimes - the unit of time to count. + * @return {Array} + */ + splitAt(...e) { + if (!this.isValid) return []; + const n = e.map(Cm).filter((o) => this.contains(o)).sort((o, a) => o.toMillis() - a.toMillis()), i = []; + let { s: r } = this, s = 0; + for (; r < this.e; ) { + const o = n[s] || this.e, a = +o > +this.e ? this.e : o; + i.push(ei.fromDateTimes(r, a)), r = a, s += 1; + } + return i; + } + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {Array} + */ + splitBy(e) { + const n = Ht.fromDurationLike(e); + if (!this.isValid || !n.isValid || n.as("milliseconds") === 0) + return []; + let { s: i } = this, r = 1, s; + const o = []; + for (; i < this.e; ) { + const a = this.start.plus(n.mapUnits((l) => l * r)); + s = +a > +this.e ? this.e : a, o.push(ei.fromDateTimes(i, s)), i = s, r += 1; + } + return o; + } + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {Array} + */ + divideEqually(e) { + return this.isValid ? this.splitBy(this.length() / e).slice(0, e) : []; + } + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + overlaps(e) { + return this.e > e.s && this.s < e.e; + } + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + abutsStart(e) { + return this.isValid ? +this.e == +e.s : !1; + } + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + abutsEnd(e) { + return this.isValid ? +e.e == +this.s : !1; + } + /** + * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise. + * @param {Interval} other + * @return {boolean} + */ + engulfs(e) { + return this.isValid ? this.s <= e.s && this.e >= e.e : !1; + } + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + equals(e) { + return !this.isValid || !e.isValid ? !1 : this.s.equals(e.s) && this.e.equals(e.e); + } + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + intersection(e) { + if (!this.isValid) return this; + const n = this.s > e.s ? this.s : e.s, i = this.e < e.e ? this.e : e.e; + return n >= i ? null : ei.fromDateTimes(n, i); + } + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + union(e) { + if (!this.isValid) return this; + const n = this.s < e.s ? this.s : e.s, i = this.e > e.e ? this.e : e.e; + return ei.fromDateTimes(n, i); + } + /** + * Merge an array of Intervals into a equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * @param {Array} intervals + * @return {Array} + */ + static merge(e) { + const [n, i] = e.sort((r, s) => r.s - s.s).reduce( + ([r, s], o) => s ? s.overlaps(o) || s.abutsStart(o) ? [r, s.union(o)] : [r.concat([s]), o] : [r, o], + [[], null] + ); + return i && n.push(i), n; + } + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {Array} intervals + * @return {Array} + */ + static xor(e) { + let n = null, i = 0; + const r = [], s = e.map((l) => [ + { time: l.s, type: "s" }, + { time: l.e, type: "e" } + ]), o = Array.prototype.concat(...s), a = o.sort((l, u) => l.time - u.time); + for (const l of a) + i += l.type === "s" ? 1 : -1, i === 1 ? n = l.time : (n && +n != +l.time && r.push(ei.fromDateTimes(n, l.time)), n = null); + return ei.merge(r); + } + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {Array} + */ + difference(...e) { + return ei.xor([this].concat(e)).map((n) => this.intersection(n)).filter((n) => n && !n.isEmpty()); + } + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + toString() { + return this.isValid ? `[${this.s.toISO()} – ${this.e.toISO()})` : Cd; + } + /** + * Returns a string representation of this Interval appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + return this.isValid ? `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }` : `Interval { Invalid, reason: ${this.invalidReason} }`; + } + /** + * Returns a localized string representing this Interval. Accepts the same options as the + * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as + * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method + * is browser-specific, but in general it will return an appropriate representation of the + * Interval in the assigned locale. Defaults to the system's locale if no locale has been + * specified. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or + * Intl.DateTimeFormat constructor options. + * @param {Object} opts - Options to override the configuration of the start DateTime. + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022 + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p + * @return {string} + */ + toLocaleString(e = lw, n = {}) { + return this.isValid ? $r.create(this.s.loc.clone(n), e).formatInterval(this) : Cd; + } + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */ + toISO(e) { + return this.isValid ? `${this.s.toISO(e)}/${this.e.toISO(e)}` : Cd; + } + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + toISODate() { + return this.isValid ? `${this.s.toISODate()}/${this.e.toISODate()}` : Cd; + } + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */ + toISOTime(e) { + return this.isValid ? `${this.s.toISOTime(e)}/${this.e.toISOTime(e)}` : Cd; + } + /** + * Returns a string representation of this Interval formatted according to the specified format + * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible + * formatting tool. + * @param {string} dateFormat - The format string. This string formats the start and end time. + * See {@link DateTime#toFormat} for details. + * @param {Object} opts - Options. + * @param {string} [opts.separator = ' – '] - A separator to place between the start and end + * representations. + * @return {string} + */ + toFormat(e, { separator: n = " – " } = {}) { + return this.isValid ? `${this.s.toFormat(e)}${n}${this.e.toFormat(e)}` : Cd; + } + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + toDuration(e, n) { + return this.isValid ? this.e.diff(this.s, e, n) : Ht.invalid(this.invalidReason); + } + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + mapEndpoints(e) { + return ei.fromDateTimes(e(this.s), e(this.e)); + } +} +class ib { + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + static hasDST(e = ti.defaultZone) { + const n = ht.now().setZone(e).set({ month: 12 }); + return !e.isUniversal && n.offset !== n.set({ month: 6 }).offset; + } + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + static isValidIANAZone(e) { + return xl.isValidZone(e); + } + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone#isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + static normalizeZone(e) { + return vu(e, ti.defaultZone); + } + /** + * Get the weekday on which the week starts according to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} the start of the week, 1 for Monday through 7 for Sunday + */ + static getStartOfWeek({ locale: e = null, locObj: n = null } = {}) { + return (n || Gt.create(e)).getStartOfWeek(); + } + /** + * Get the minimum number of days necessary in a week before it is considered part of the next year according + * to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} + */ + static getMinimumDaysInFirstWeek({ locale: e = null, locObj: n = null } = {}) { + return (n || Gt.create(e)).getMinDaysInFirstWeek(); + } + /** + * Get the weekdays, which are considered the weekend according to the given locale + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday + */ + static getWeekendWeekdays({ locale: e = null, locObj: n = null } = {}) { + return (n || Gt.create(e)).getWeekendDays().slice(); + } + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {Array} + */ + static months(e = "long", { locale: n = null, numberingSystem: i = null, locObj: r = null, outputCalendar: s = "gregory" } = {}) { + return (r || Gt.create(n, i, s)).months(e); + } + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link Info#months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {Array} + */ + static monthsFormat(e = "long", { locale: n = null, numberingSystem: i = null, locObj: r = null, outputCalendar: s = "gregory" } = {}) { + return (r || Gt.create(n, i, s)).months(e, !0); + } + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {Array} + */ + static weekdays(e = "long", { locale: n = null, numberingSystem: i = null, locObj: r = null } = {}) { + return (r || Gt.create(n, i, null)).weekdays(e); + } + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link Info#weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @return {Array} + */ + static weekdaysFormat(e = "long", { locale: n = null, numberingSystem: i = null, locObj: r = null } = {}) { + return (r || Gt.create(n, i, null)).weekdays(e, !0); + } + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {Array} + */ + static meridiems({ locale: e = null } = {}) { + return Gt.create(e).meridiems(); + } + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {Array} + */ + static eras(e = "short", { locale: n = null } = {}) { + return Gt.create(n, null, "gregory").eras(e); + } + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. + * Keys: + * * `relative`: whether this environment supports relative time formatting + * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale + * @example Info.features() //=> { relative: false, localeWeek: true } + * @return {Object} + */ + static features() { + return { relative: rz(), localeWeek: sz() }; + } +} +function K7(t, e) { + const n = (r) => r.toUTC(0, { keepLocalTime: !0 }).startOf("day").valueOf(), i = n(e) - n(t); + return Math.floor(Ht.fromMillis(i).as("days")); +} +function hfe(t, e, n) { + const i = [ + ["years", (l, u) => u.year - l.year], + ["quarters", (l, u) => u.quarter - l.quarter + (u.year - l.year) * 4], + ["months", (l, u) => u.month - l.month + (u.year - l.year) * 12], + [ + "weeks", + (l, u) => { + const f = K7(l, u); + return (f - f % 7) / 7; + } + ], + ["days", K7] + ], r = {}, s = t; + let o, a; + for (const [l, u] of i) + n.indexOf(l) >= 0 && (o = l, r[l] = u(t, e), a = s.plus(r), a > e ? (r[l]--, t = s.plus(r), t > e && (a = t, r[l]--, t = s.plus(r))) : t = a); + return [t, r, a, o]; +} +function pfe(t, e, n, i) { + let [r, s, o, a] = hfe(t, e, n); + const l = e - r, u = n.filter( + (d) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(d) >= 0 + ); + u.length === 0 && (o < e && (o = r.plus({ [a]: 1 })), o !== r && (s[a] = (s[a] || 0) + l / (o - r))); + const f = Ht.fromObject(s, i); + return u.length > 0 ? Ht.fromMillis(l, i).shiftTo(...u).plus(f) : f; +} +const mfe = "missing Intl.DateTimeFormat.formatToParts support"; +function Vt(t, e = (n) => n) { + return { regex: t, deser: ([n]) => e(rce(n)) }; +} +const gfe = " ", _z = `[ ${gfe}]`, Oz = new RegExp(_z, "g"); +function vfe(t) { + return t.replace(/\./g, "\\.?").replace(Oz, _z); +} +function J7(t) { + return t.replace(/\./g, "").replace(Oz, " ").toLowerCase(); +} +function No(t, e) { + return t === null ? null : { + regex: RegExp(t.map(vfe).join("|")), + deser: ([n]) => t.findIndex((i) => J7(n) === J7(i)) + e + }; +} +function eN(t, e) { + return { regex: t, deser: ([, n, i]) => t2(n, i), groups: e }; +} +function rb(t) { + return { regex: t, deser: ([e]) => e }; +} +function bfe(t) { + return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); +} +function yfe(t, e) { + const n = Mo(e), i = Mo(e, "{2}"), r = Mo(e, "{3}"), s = Mo(e, "{4}"), o = Mo(e, "{6}"), a = Mo(e, "{1,2}"), l = Mo(e, "{1,3}"), u = Mo(e, "{1,6}"), f = Mo(e, "{1,9}"), d = Mo(e, "{2,4}"), h = Mo(e, "{4,6}"), m = (x) => ({ regex: RegExp(bfe(x.val)), deser: ([_]) => _, literal: !0 }), w = ((x) => { + if (t.literal) + return m(x); + switch (x.val) { + case "G": + return No(e.eras("short"), 0); + case "GG": + return No(e.eras("long"), 0); + case "y": + return Vt(u); + case "yy": + return Vt(d, v4); + case "yyyy": + return Vt(s); + case "yyyyy": + return Vt(h); + case "yyyyyy": + return Vt(o); + case "M": + return Vt(a); + case "MM": + return Vt(i); + case "MMM": + return No(e.months("short", !0), 1); + case "MMMM": + return No(e.months("long", !0), 1); + case "L": + return Vt(a); + case "LL": + return Vt(i); + case "LLL": + return No(e.months("short", !1), 1); + case "LLLL": + return No(e.months("long", !1), 1); + case "d": + return Vt(a); + case "dd": + return Vt(i); + case "o": + return Vt(l); + case "ooo": + return Vt(r); + case "HH": + return Vt(i); + case "H": + return Vt(a); + case "hh": + return Vt(i); + case "h": + return Vt(a); + case "mm": + return Vt(i); + case "m": + return Vt(a); + case "q": + return Vt(a); + case "qq": + return Vt(i); + case "s": + return Vt(a); + case "ss": + return Vt(i); + case "S": + return Vt(l); + case "SSS": + return Vt(r); + case "u": + return rb(f); + case "uu": + return rb(a); + case "uuu": + return Vt(n); + case "a": + return No(e.meridiems(), 0); + case "kkkk": + return Vt(s); + case "kk": + return Vt(d, v4); + case "W": + return Vt(a); + case "WW": + return Vt(i); + case "E": + case "c": + return Vt(n); + case "EEE": + return No(e.weekdays("short", !1), 1); + case "EEEE": + return No(e.weekdays("long", !1), 1); + case "ccc": + return No(e.weekdays("short", !0), 1); + case "cccc": + return No(e.weekdays("long", !0), 1); + case "Z": + case "ZZ": + return eN(new RegExp(`([+-]${a.source})(?::(${i.source}))?`), 2); + case "ZZZ": + return eN(new RegExp(`([+-]${a.source})(${i.source})?`), 2); + case "z": + return rb(/[a-z_+-/]{1,256}?/i); + case " ": + return rb(/[^\S\n\r]/); + default: + return m(x); + } + })(t) || { + invalidReason: mfe + }; + return w.token = t, w; +} +const wfe = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour12: { + numeric: "h", + "2-digit": "hh" + }, + hour24: { + numeric: "H", + "2-digit": "HH" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + }, + timeZoneName: { + long: "ZZZZZ", + short: "ZZZ" + } +}; +function kfe(t, e, n) { + const { type: i, value: r } = t; + if (i === "literal") { + const l = /^\s+$/.test(r); + return { + literal: !l, + val: l ? " " : r + }; + } + const s = e[i]; + let o = i; + i === "hour" && (e.hour12 != null ? o = e.hour12 ? "hour12" : "hour24" : e.hourCycle != null ? e.hourCycle === "h11" || e.hourCycle === "h12" ? o = "hour12" : o = "hour24" : o = n.hour12 ? "hour12" : "hour24"); + let a = wfe[o]; + if (typeof a == "object" && (a = a[s]), a) + return { + literal: !1, + val: a + }; +} +function xfe(t) { + return [`^${t.map((n) => n.regex).reduce((n, i) => `${n}(${i.source})`, "")}$`, t]; +} +function _fe(t, e, n) { + const i = t.match(e); + if (i) { + const r = {}; + let s = 1; + for (const o in n) + if (Ch(n, o)) { + const a = n[o], l = a.groups ? a.groups + 1 : 1; + !a.literal && a.token && (r[a.token.val[0]] = a.deser(i.slice(s, s + l))), s += l; + } + return [i, r]; + } else + return [i, {}]; +} +function Ofe(t) { + const e = (s) => { + switch (s) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + case "H": + return "hour"; + case "d": + return "day"; + case "o": + return "ordinal"; + case "L": + case "M": + return "month"; + case "y": + return "year"; + case "E": + case "c": + return "weekday"; + case "W": + return "weekNumber"; + case "k": + return "weekYear"; + case "q": + return "quarter"; + default: + return null; + } + }; + let n = null, i; + return yt(t.z) || (n = xl.create(t.z)), yt(t.Z) || (n || (n = new Gr(t.Z)), i = t.Z), yt(t.q) || (t.M = (t.q - 1) * 3 + 1), yt(t.h) || (t.h < 12 && t.a === 1 ? t.h += 12 : t.h === 12 && t.a === 0 && (t.h = 0)), t.G === 0 && t.y && (t.y = -t.y), yt(t.u) || (t.S = I5(t.u)), [Object.keys(t).reduce((s, o) => { + const a = e(o); + return a && (s[a] = t[o]), s; + }, {}), n, i]; +} +let L3 = null; +function Sfe() { + return L3 || (L3 = ht.fromMillis(1555555555555)), L3; +} +function Cfe(t, e) { + if (t.literal) + return t; + const n = $r.macroTokenToFormatOpts(t.val), i = Tz(n, e); + return i == null || i.includes(void 0) ? t : i; +} +function Sz(t, e) { + return Array.prototype.concat(...t.map((n) => Cfe(n, e))); +} +class Cz { + constructor(e, n) { + if (this.locale = e, this.format = n, this.tokens = Sz($r.parseFormat(n), e), this.units = this.tokens.map((i) => yfe(i, e)), this.disqualifyingUnit = this.units.find((i) => i.invalidReason), !this.disqualifyingUnit) { + const [i, r] = xfe(this.units); + this.regex = RegExp(i, "i"), this.handlers = r; + } + } + explainFromTokens(e) { + if (this.isValid) { + const [n, i] = _fe(e, this.regex, this.handlers), [r, s, o] = i ? Ofe(i) : [null, null, void 0]; + if (Ch(i, "a") && Ch(i, "H")) + throw new Gd( + "Can't include meridiem when specifying 24-hour format" + ); + return { + input: e, + tokens: this.tokens, + regex: this.regex, + rawMatches: n, + matches: i, + result: r, + zone: s, + specificOffset: o + }; + } else + return { input: e, tokens: this.tokens, invalidReason: this.invalidReason }; + } + get isValid() { + return !this.disqualifyingUnit; + } + get invalidReason() { + return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null; + } +} +function Ez(t, e, n) { + return new Cz(t, n).explainFromTokens(e); +} +function Efe(t, e, n) { + const { result: i, zone: r, specificOffset: s, invalidReason: o } = Ez(t, e, n); + return [i, r, s, o]; +} +function Tz(t, e) { + if (!t) + return null; + const i = $r.create(e, t).dtFormatter(Sfe()), r = i.formatToParts(), s = i.resolvedOptions(); + return r.map((o) => kfe(o, t, s)); +} +const R3 = "Invalid DateTime", tN = 864e13; +function Jm(t) { + return new Po("unsupported zone", `the zone "${t.name}" is not supported`); +} +function j3(t) { + return t.weekData === null && (t.weekData = uw(t.c)), t.weekData; +} +function F3(t) { + return t.localWeekData === null && (t.localWeekData = uw( + t.c, + t.loc.getMinDaysInFirstWeek(), + t.loc.getStartOfWeek() + )), t.localWeekData; +} +function Dc(t, e) { + const n = { + ts: t.ts, + zone: t.zone, + c: t.c, + o: t.o, + loc: t.loc, + invalid: t.invalid + }; + return new ht({ ...n, ...e, old: n }); +} +function $z(t, e, n) { + let i = t - e * 60 * 1e3; + const r = n.offset(i); + if (e === r) + return [i, e]; + i -= (r - e) * 60 * 1e3; + const s = n.offset(i); + return r === s ? [i, r] : [t - Math.min(r, s) * 60 * 1e3, Math.max(r, s)]; +} +function sb(t, e) { + t += e * 60 * 1e3; + const n = new Date(t); + return { + year: n.getUTCFullYear(), + month: n.getUTCMonth() + 1, + day: n.getUTCDate(), + hour: n.getUTCHours(), + minute: n.getUTCMinutes(), + second: n.getUTCSeconds(), + millisecond: n.getUTCMilliseconds() + }; +} +function ny(t, e, n) { + return $z(e2(t), e, n); +} +function nN(t, e) { + const n = t.o, i = t.c.year + Math.trunc(e.years), r = t.c.month + Math.trunc(e.months) + Math.trunc(e.quarters) * 3, s = { + ...t.c, + year: i, + month: r, + day: Math.min(t.c.day, cw(i, r)) + Math.trunc(e.days) + Math.trunc(e.weeks) * 7 + }, o = Ht.fromObject({ + years: e.years - Math.trunc(e.years), + quarters: e.quarters - Math.trunc(e.quarters), + months: e.months - Math.trunc(e.months), + weeks: e.weeks - Math.trunc(e.weeks), + days: e.days - Math.trunc(e.days), + hours: e.hours, + minutes: e.minutes, + seconds: e.seconds, + milliseconds: e.milliseconds + }).as("milliseconds"), a = e2(s); + let [l, u] = $z(a, n, t.zone); + return o !== 0 && (l += o, u = t.zone.offset(l)), { ts: l, o: u }; +} +function Ed(t, e, n, i, r, s) { + const { setZone: o, zone: a } = n; + if (t && Object.keys(t).length !== 0 || e) { + const l = e || a, u = ht.fromObject(t, { + ...n, + zone: l, + specificOffset: s + }); + return o ? u : u.setZone(a); + } else + return ht.invalid( + new Po("unparsable", `the input "${r}" can't be parsed as ${i}`) + ); +} +function ob(t, e, n = !0) { + return t.isValid ? $r.create(Gt.create("en-US"), { + allowZ: n, + forceSimple: !0 + }).formatDateTimeFromString(t, e) : null; +} +function B3(t, e) { + const n = t.c.year > 9999 || t.c.year < 0; + let i = ""; + return n && t.c.year >= 0 && (i += "+"), i += yi(t.c.year, n ? 6 : 4), e ? (i += "-", i += yi(t.c.month), i += "-", i += yi(t.c.day)) : (i += yi(t.c.month), i += yi(t.c.day)), i; +} +function iN(t, e, n, i, r, s) { + let o = yi(t.c.hour); + return e ? (o += ":", o += yi(t.c.minute), (t.c.millisecond !== 0 || t.c.second !== 0 || !n) && (o += ":")) : o += yi(t.c.minute), (t.c.millisecond !== 0 || t.c.second !== 0 || !n) && (o += yi(t.c.second), (t.c.millisecond !== 0 || !i) && (o += ".", o += yi(t.c.millisecond, 3))), r && (t.isOffsetFixed && t.offset === 0 && !s ? o += "Z" : t.o < 0 ? (o += "-", o += yi(Math.trunc(-t.o / 60)), o += ":", o += yi(Math.trunc(-t.o % 60))) : (o += "+", o += yi(Math.trunc(t.o / 60)), o += ":", o += yi(Math.trunc(t.o % 60)))), s && (o += "[" + t.zone.ianaName + "]"), o; +} +const Mz = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}, Tfe = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}, $fe = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 +}, Nz = ["year", "month", "day", "hour", "minute", "second", "millisecond"], Mfe = [ + "weekYear", + "weekNumber", + "weekday", + "hour", + "minute", + "second", + "millisecond" +], Nfe = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; +function Afe(t) { + const e = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[t.toLowerCase()]; + if (!e) throw new AB(t); + return e; +} +function rN(t) { + switch (t.toLowerCase()) { + case "localweekday": + case "localweekdays": + return "localWeekday"; + case "localweeknumber": + case "localweeknumbers": + return "localWeekNumber"; + case "localweekyear": + case "localweekyears": + return "localWeekYear"; + default: + return Afe(t); + } +} +function Dfe(t) { + return ry[t] || (iy === void 0 && (iy = ti.now()), ry[t] = t.offset(iy)), ry[t]; +} +function sN(t, e) { + const n = vu(e.zone, ti.defaultZone); + if (!n.isValid) + return ht.invalid(Jm(n)); + const i = Gt.fromObject(e); + let r, s; + if (yt(t.year)) + r = ti.now(); + else { + for (const l of Nz) + yt(t[l]) && (t[l] = Mz[l]); + const o = nz(t) || iz(t); + if (o) + return ht.invalid(o); + const a = Dfe(n); + [r, s] = ny(t, a, n); + } + return new ht({ ts: r, zone: n, loc: i, o: s }); +} +function oN(t, e, n) { + const i = yt(n.round) ? !0 : n.round, r = (o, a) => (o = L5(o, i || n.calendary ? 0 : 2, !0), e.loc.clone(n).relFormatter(n).format(o, a)), s = (o) => n.calendary ? e.hasSame(t, o) ? 0 : e.startOf(o).diff(t.startOf(o), o).get(o) : e.diff(t, o).get(o); + if (n.unit) + return r(s(n.unit), n.unit); + for (const o of n.units) { + const a = s(o); + if (Math.abs(a) >= 1) + return r(a, o); + } + return r(t > e ? -0 : 0, n.units[n.units.length - 1]); +} +function aN(t) { + let e = {}, n; + return t.length > 0 && typeof t[t.length - 1] == "object" ? (e = t[t.length - 1], n = Array.from(t).slice(0, t.length - 1)) : n = Array.from(t), [e, n]; +} +let iy, ry = {}; +class ht { + /** + * @access private + */ + constructor(e) { + const n = e.zone || ti.defaultZone; + let i = e.invalid || (Number.isNaN(e.ts) ? new Po("invalid input") : null) || (n.isValid ? null : Jm(n)); + this.ts = yt(e.ts) ? ti.now() : e.ts; + let r = null, s = null; + if (!i) + if (e.old && e.old.ts === this.ts && e.old.zone.equals(n)) + [r, s] = [e.old.c, e.old.o]; + else { + const a = Du(e.o) && !e.old ? e.o : n.offset(this.ts); + r = sb(this.ts, a), i = Number.isNaN(r.year) ? new Po("invalid input") : null, r = i ? null : r, s = i ? null : a; + } + this._zone = n, this.loc = e.loc || Gt.create(), this.invalid = i, this.weekData = null, this.localWeekData = null, this.c = r, this.o = s, this.isLuxonDateTime = !0; + } + // CONSTRUCT + /** + * Create a DateTime for the current instant, in the system's time zone. + * + * Use Settings to override these default values if needed. + * @example DateTime.now().toISO() //~> now in the ISO format + * @return {DateTime} + */ + static now() { + return new ht({}); + } + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month, 1-indexed + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + static local() { + const [e, n] = aN(arguments), [i, r, s, o, a, l, u] = n; + return sN({ year: i, month: r, day: s, hour: o, minute: a, second: l, millisecond: u }, e); + } + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @param {Object} options - configuration options for the DateTime + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale + * @return {DateTime} + */ + static utc() { + const [e, n] = aN(arguments), [i, r, s, o, a, l, u] = n; + return e.zone = Gr.utcInstance, sN({ year: i, month: r, day: s, hour: o, minute: a, second: l, millisecond: u }, e); + } + /** + * Create a DateTime from a JavaScript Date object. Uses the default zone. + * @param {Date} date - a JavaScript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + static fromJSDate(e, n = {}) { + const i = uce(e) ? e.valueOf() : NaN; + if (Number.isNaN(i)) + return ht.invalid("invalid input"); + const r = vu(n.zone, ti.defaultZone); + return r.isValid ? new ht({ + ts: i, + zone: r, + loc: Gt.fromObject(n) + }) : ht.invalid(Jm(r)); + } + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromMillis(e, n = {}) { + if (Du(e)) + return e < -tN || e > tN ? ht.invalid("Timestamp out of range") : new ht({ + ts: e, + zone: vu(n.zone, ti.defaultZone), + loc: Gt.fromObject(n) + }); + throw new Sr( + `fromMillis requires a numerical input, but received a ${typeof e} with value ${e}` + ); + } + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromSeconds(e, n = {}) { + if (Du(e)) + return new ht({ + ts: e * 1e3, + zone: vu(n.zone, ti.defaultZone), + loc: Gt.fromObject(n) + }); + throw new Sr("fromSeconds requires a numerical input"); + } + /** + * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.localWeekYear - a week year, according to the locale + * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale + * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {Object} opts - options for creating this DateTime + * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26' + * @return {DateTime} + */ + static fromObject(e, n = {}) { + e = e || {}; + const i = vu(n.zone, ti.defaultZone); + if (!i.isValid) + return ht.invalid(Jm(i)); + const r = Gt.fromObject(n), s = fw(e, rN), { minDaysInFirstWeek: o, startOfWeek: a } = U7(s, r), l = ti.now(), u = yt(n.specificOffset) ? i.offset(l) : n.specificOffset, f = !yt(s.ordinal), d = !yt(s.year), h = !yt(s.month) || !yt(s.day), m = d || h, g = s.weekYear || s.weekNumber; + if ((m || f) && g) + throw new Gd( + "Can't mix weekYear/weekNumber units with year/month/day or ordinals" + ); + if (h && f) + throw new Gd("Can't mix ordinal dates with month/day"); + const w = g || s.weekday && !m; + let x, _, S = sb(l, u); + w ? (x = Mfe, _ = Tfe, S = uw(S, o, a)) : f ? (x = Nfe, _ = $fe, S = I3(S)) : (x = Nz, _ = Mz); + let C = !1; + for (const Z of x) { + const L = s[Z]; + yt(L) ? C ? s[Z] = _[Z] : s[Z] = S[Z] : C = !0; + } + const E = w ? oce(s, o, a) : f ? ace(s) : nz(s), M = E || iz(s); + if (M) + return ht.invalid(M); + const $ = w ? H7(s, o, a) : f ? Q7(s) : s, [P, W] = ny($, u, i), z = new ht({ + ts: P, + zone: i, + o: W, + loc: r + }); + return s.weekday && m && e.weekday !== z.weekday ? ht.invalid( + "mismatched weekday", + `you can't specify both a weekday of ${s.weekday} and a date of ${z.toISO()}` + ) : z.isValid ? z : ht.invalid(z.invalid); + } + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + static fromISO(e, n = {}) { + const [i, r] = Kce(e); + return Ed(i, r, n, "ISO 8601", e); + } + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + static fromRFC2822(e, n = {}) { + const [i, r] = Jce(e); + return Ed(i, r, n, "RFC 2822", e); + } + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + static fromHTTP(e, n = {}) { + const [i, r] = efe(e); + return Ed(i, r, n, "HTTP", n); + } + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromFormat(e, n, i = {}) { + if (yt(e) || yt(n)) + throw new Sr("fromFormat requires an input string and a format"); + const { locale: r = null, numberingSystem: s = null } = i, o = Gt.fromOpts({ + locale: r, + numberingSystem: s, + defaultToEN: !0 + }), [a, l, u, f] = Efe(o, e, n); + return f ? ht.invalid(f) : Ed(a, l, i, `format ${n}`, e, u); + } + /** + * @deprecated use fromFormat instead + */ + static fromString(e, n, i = {}) { + return ht.fromFormat(e, n, i); + } + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + static fromSQL(e, n = {}) { + const [i, r] = afe(e); + return Ed(i, r, n, "SQL", e); + } + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent. + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + static invalid(e, n = null) { + if (!e) + throw new Sr("need to specify a reason the DateTime is invalid"); + const i = e instanceof Po ? e : new Po(e, n); + if (ti.throwOnInvalid) + throw new Due(i); + return new ht({ invalid: i }); + } + /** + * Check if an object is an instance of DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDateTime(e) { + return e && e.isLuxonDateTime || !1; + } + /** + * Produce the format string for a set of options + * @param formatOpts + * @param localeOpts + * @returns {string} + */ + static parseFormatForOpts(e, n = {}) { + const i = Tz(e, Gt.fromObject(n)); + return i ? i.map((r) => r ? r.val : null).join("") : null; + } + /** + * Produce the the fully expanded format token for the locale + * Does NOT quote characters, so quoted tokens will not round trip correctly + * @param fmt + * @param localeOpts + * @returns {string} + */ + static expandFormat(e, n = {}) { + return Sz($r.parseFormat(e), Gt.fromObject(n)).map((r) => r.val).join(""); + } + static resetCache() { + iy = void 0, ry = {}; + } + // INFO + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + get(e) { + return this[e]; + } + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + get isValid() { + return this.invalid === null; + } + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + get outputCalendar() { + return this.isValid ? this.loc.outputCalendar : null; + } + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + get zone() { + return this._zone; + } + /** + * Get the name of the time zone. + * @type {string} + */ + get zoneName() { + return this.isValid ? this.zone.name : null; + } + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + get year() { + return this.isValid ? this.c.year : NaN; + } + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + get quarter() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + get month() { + return this.isValid ? this.c.month : NaN; + } + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + get day() { + return this.isValid ? this.c.day : NaN; + } + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + get hour() { + return this.isValid ? this.c.hour : NaN; + } + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + get minute() { + return this.isValid ? this.c.minute : NaN; + } + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + get second() { + return this.isValid ? this.c.second : NaN; + } + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + get millisecond() { + return this.isValid ? this.c.millisecond : NaN; + } + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 12, 31).weekYear //=> 2015 + * @type {number} + */ + get weekYear() { + return this.isValid ? j3(this).weekYear : NaN; + } + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + get weekNumber() { + return this.isValid ? j3(this).weekNumber : NaN; + } + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + get weekday() { + return this.isValid ? j3(this).weekday : NaN; + } + /** + * Returns true if this date is on a weekend according to the locale, false otherwise + * @returns {boolean} + */ + get isWeekend() { + return this.isValid && this.loc.getWeekendDays().includes(this.weekday); + } + /** + * Get the day of the week according to the locale. + * 1 is the first day of the week and 7 is the last day of the week. + * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1, + * @returns {number} + */ + get localWeekday() { + return this.isValid ? F3(this).weekday : NaN; + } + /** + * Get the week number of the week year according to the locale. Different locales assign week numbers differently, + * because the week can start on different days of the week (see localWeekday) and because a different number of days + * is required for a week to count as the first week of a year. + * @returns {number} + */ + get localWeekNumber() { + return this.isValid ? F3(this).weekNumber : NaN; + } + /** + * Get the week year according to the locale. Different locales assign week numbers (and therefor week years) + * differently, see localWeekNumber. + * @returns {number} + */ + get localWeekYear() { + return this.isValid ? F3(this).weekYear : NaN; + } + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + get ordinal() { + return this.isValid ? I3(this.c).ordinal : NaN; + } + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + get monthShort() { + return this.isValid ? ib.months("short", { locObj: this.loc })[this.month - 1] : null; + } + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + get monthLong() { + return this.isValid ? ib.months("long", { locObj: this.loc })[this.month - 1] : null; + } + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + get weekdayShort() { + return this.isValid ? ib.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null; + } + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + get weekdayLong() { + return this.isValid ? ib.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null; + } + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.now().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + get offset() { + return this.isValid ? +this.o : NaN; + } + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameShort() { + return this.isValid ? this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }) : null; + } + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameLong() { + return this.isValid ? this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }) : null; + } + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + get isOffsetFixed() { + return this.isValid ? this.zone.isUniversal : null; + } + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + get isInDST() { + return this.isOffsetFixed ? !1 : this.offset > this.set({ month: 1, day: 1 }).offset || this.offset > this.set({ month: 5 }).offset; + } + /** + * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC + * in this DateTime's zone. During DST changes local time can be ambiguous, for example + * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`. + * This method will return both possible DateTimes if this DateTime's local time is ambiguous. + * @returns {DateTime[]} + */ + getPossibleOffsets() { + if (!this.isValid || this.isOffsetFixed) + return [this]; + const e = 864e5, n = 6e4, i = e2(this.c), r = this.zone.offset(i - e), s = this.zone.offset(i + e), o = this.zone.offset(i - r * n), a = this.zone.offset(i - s * n); + if (o === a) + return [this]; + const l = i - o * n, u = i - a * n, f = sb(l, o), d = sb(u, a); + return f.hour === d.hour && f.minute === d.minute && f.second === d.second && f.millisecond === d.millisecond ? [Dc(this, { ts: l }), Dc(this, { ts: u })] : [this]; + } + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + get isInLeapYear() { + return c1(this.year); + } + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + get daysInMonth() { + return cw(this.year, this.month); + } + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + get daysInYear() { + return this.isValid ? uh(this.year) : NaN; + } + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + get weeksInWeekYear() { + return this.isValid ? r0(this.weekYear) : NaN; + } + /** + * Returns the number of weeks in this DateTime's local week year + * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52 + * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53 + * @type {number} + */ + get weeksInLocalWeekYear() { + return this.isValid ? r0( + this.localWeekYear, + this.loc.getMinDaysInFirstWeek(), + this.loc.getStartOfWeek() + ) : NaN; + } + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + resolvedLocaleOptions(e = {}) { + const { locale: n, numberingSystem: i, calendar: r } = $r.create( + this.loc.clone(e), + e + ).resolvedOptions(this); + return { locale: n, numberingSystem: i, outputCalendar: r }; + } + // TRANSFORM + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link DateTime#setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + toUTC(e = 0, n = {}) { + return this.setZone(Gr.instance(e), n); + } + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + toLocal() { + return this.setZone(ti.defaultZone); + } + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + setZone(e, { keepLocalTime: n = !1, keepCalendarTime: i = !1 } = {}) { + if (e = vu(e, ti.defaultZone), e.equals(this.zone)) + return this; + if (e.isValid) { + let r = this.ts; + if (n || i) { + const s = e.offset(this.ts), o = this.toObject(); + [r] = ny(o, s, e); + } + return Dc(this, { ts: r, zone: e }); + } else + return ht.invalid(Jm(e)); + } + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + reconfigure({ locale: e, numberingSystem: n, outputCalendar: i } = {}) { + const r = this.loc.clone({ locale: e, numberingSystem: n, outputCalendar: i }); + return Dc(this, { loc: r }); + } + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + setLocale(e) { + return this.reconfigure({ locale: e }); + } + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. + * + * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`. + * They cannot be mixed with ISO-week units like `weekday`. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + set(e) { + if (!this.isValid) return this; + const n = fw(e, rN), { minDaysInFirstWeek: i, startOfWeek: r } = U7(n, this.loc), s = !yt(n.weekYear) || !yt(n.weekNumber) || !yt(n.weekday), o = !yt(n.ordinal), a = !yt(n.year), l = !yt(n.month) || !yt(n.day), u = a || l, f = n.weekYear || n.weekNumber; + if ((u || o) && f) + throw new Gd( + "Can't mix weekYear/weekNumber units with year/month/day or ordinals" + ); + if (l && o) + throw new Gd("Can't mix ordinal dates with month/day"); + let d; + s ? d = H7( + { ...uw(this.c, i, r), ...n }, + i, + r + ) : yt(n.ordinal) ? (d = { ...this.toObject(), ...n }, yt(n.day) && (d.day = Math.min(cw(d.year, d.month), d.day))) : d = Q7({ ...I3(this.c), ...n }); + const [h, m] = ny(d, this.o, this.zone); + return Dc(this, { ts: h, o: m }); + } + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.now().plus(123) //~> in 123 milliseconds + * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + plus(e) { + if (!this.isValid) return this; + const n = Ht.fromDurationLike(e); + return Dc(this, nN(this, n)); + } + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link DateTime#plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + minus(e) { + if (!this.isValid) return this; + const n = Ht.fromDurationLike(e).negate(); + return Dc(this, nN(this, n)); + } + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + startOf(e, { useLocaleWeeks: n = !1 } = {}) { + if (!this.isValid) return this; + const i = {}, r = Ht.normalizeUnit(e); + switch (r) { + case "years": + i.month = 1; + case "quarters": + case "months": + i.day = 1; + case "weeks": + case "days": + i.hour = 0; + case "hours": + i.minute = 0; + case "minutes": + i.second = 0; + case "seconds": + i.millisecond = 0; + break; + } + if (r === "weeks") + if (n) { + const s = this.loc.getStartOfWeek(), { weekday: o } = this; + o < s && (i.weekNumber = this.weekNumber - 1), i.weekday = s; + } else + i.weekday = 1; + if (r === "quarters") { + const s = Math.ceil(this.month / 3); + i.month = (s - 1) * 3 + 1; + } + return this.set(i); + } + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + endOf(e, n) { + return this.isValid ? this.plus({ [e]: 1 }).startOf(e, n).minus(1) : this; + } + // OUTPUT + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + toFormat(e, n = {}) { + return this.isValid ? $r.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this, e) : R3; + } + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toLocaleString(); //=> 4/20/2017 + * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' + * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' + * @return {string} + */ + toLocaleString(e = lw, n = {}) { + return this.isValid ? $r.create(this.loc.clone(n), e).formatDateTime(this) : R3; + } + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.now().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + toLocaleParts(e = {}) { + return this.isValid ? $r.create(this.loc.clone(e), e).formatDateTimeParts(this) : []; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=false] - add the time zone format extension + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @return {string} + */ + toISO({ + format: e = "extended", + suppressSeconds: n = !1, + suppressMilliseconds: i = !1, + includeOffset: r = !0, + extendedZone: s = !1 + } = {}) { + if (!this.isValid) + return null; + const o = e === "extended"; + let a = B3(this, o); + return a += "T", a += iN(this, o, n, i, r, s), a; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @return {string} + */ + toISODate({ format: e = "extended" } = {}) { + return this.isValid ? B3(this, e === "extended") : null; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + toISOWeekDate() { + return ob(this, "kkkk-'W'WW-c"); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=true] - add the time zone format extension + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' + * @return {string} + */ + toISOTime({ + suppressMilliseconds: e = !1, + suppressSeconds: n = !1, + includeOffset: i = !0, + includePrefix: r = !1, + extendedZone: s = !1, + format: o = "extended" + } = {}) { + return this.isValid ? (r ? "T" : "") + iN( + this, + o === "extended", + n, + e, + i, + s + ) : null; + } + /** + * Returns an RFC 2822-compatible string representation of this DateTime + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + toRFC2822() { + return ob(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", !1); + } + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + toHTTP() { + return ob(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string} + */ + toSQLDate() { + return this.isValid ? B3(this, !0) : null; + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + toSQLTime({ includeOffset: e = !0, includeZone: n = !1, includeOffsetSpace: i = !0 } = {}) { + let r = "HH:mm:ss.SSS"; + return (n || e) && (i && (r += " "), n ? r += "z" : e && (r += "ZZ")), ob(this, r, !0); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + toSQL(e = {}) { + return this.isValid ? `${this.toSQLDate()} ${this.toSQLTime(e)}` : null; + } + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + toString() { + return this.isValid ? this.toISO() : R3; + } + /** + * Returns a string representation of this DateTime appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + return this.isValid ? `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }` : `DateTime { Invalid, reason: ${this.invalidReason} }`; + } + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} + * @return {number} + */ + valueOf() { + return this.toMillis(); + } + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + toMillis() { + return this.isValid ? this.ts : NaN; + } + /** + * Returns the epoch seconds of this DateTime. + * @return {number} + */ + toSeconds() { + return this.isValid ? this.ts / 1e3 : NaN; + } + /** + * Returns the epoch seconds (as a whole number) of this DateTime. + * @return {number} + */ + toUnixInteger() { + return this.isValid ? Math.floor(this.ts / 1e3) : NaN; + } + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + toBSON() { + return this.toJSDate(); + } + /** + * Returns a JavaScript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + toObject(e = {}) { + if (!this.isValid) return {}; + const n = { ...this.c }; + return e.includeConfig && (n.outputCalendar = this.outputCalendar, n.numberingSystem = this.loc.numberingSystem, n.locale = this.loc.locale), n; + } + /** + * Returns a JavaScript Date equivalent to this DateTime. + * @return {Date} + */ + toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } + // COMPARE + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + diff(e, n = "milliseconds", i = {}) { + if (!this.isValid || !e.isValid) + return Ht.invalid("created by diffing an invalid DateTime"); + const r = { locale: this.locale, numberingSystem: this.numberingSystem, ...i }, s = cce(n).map(Ht.normalizeUnit), o = e.valueOf() > this.valueOf(), a = o ? this : e, l = o ? e : this, u = pfe(a, l, s, r); + return o ? u.negate() : u; + } + /** + * Return the difference between this DateTime and right now. + * See {@link DateTime#diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + diffNow(e = "milliseconds", n = {}) { + return this.diff(ht.now(), e, n); + } + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval} + */ + until(e) { + return this.isValid ? ei.fromDateTimes(this, e) : this; + } + /** + * Return whether this DateTime is in the same unit of time as another DateTime. + * Higher-order units must also be identical for this function to return `true`. + * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed. + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used + * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day + * @return {boolean} + */ + hasSame(e, n, i) { + if (!this.isValid) return !1; + const r = e.valueOf(), s = this.setZone(e.zone, { keepLocalTime: !0 }); + return s.startOf(n, i) <= r && r <= s.endOf(n, i); + } + /** + * Equality check + * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + equals(e) { + return this.isValid && e.isValid && this.valueOf() === e.valueOf() && this.zone.equals(e.zone) && this.loc.equals(e.loc); + } + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds down by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + toRelative(e = {}) { + if (!this.isValid) return null; + const n = e.base || ht.fromObject({}, { zone: this.zone }), i = e.padding ? this < n ? -e.padding : e.padding : 0; + let r = ["years", "months", "days", "hours", "minutes", "seconds"], s = e.unit; + return Array.isArray(e.unit) && (r = e.unit, s = void 0), oN(n, this.plus(i), { + ...e, + numeric: "always", + units: r, + unit: s + }); + } + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + toRelativeCalendar(e = {}) { + return this.isValid ? oN(e.base || ht.fromObject({}, { zone: this.zone }), this, { + ...e, + numeric: "auto", + units: ["years", "months", "days"], + calendary: !0 + }) : null; + } + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + static min(...e) { + if (!e.every(ht.isDateTime)) + throw new Sr("min requires all arguments be DateTimes"); + return Z7(e, (n) => n.valueOf(), Math.min); + } + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + static max(...e) { + if (!e.every(ht.isDateTime)) + throw new Sr("max requires all arguments be DateTimes"); + return Z7(e, (n) => n.valueOf(), Math.max); + } + // MISC + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + static fromFormatExplain(e, n, i = {}) { + const { locale: r = null, numberingSystem: s = null } = i, o = Gt.fromOpts({ + locale: r, + numberingSystem: s, + defaultToEN: !0 + }); + return Ez(o, e, n); + } + /** + * @deprecated use fromFormatExplain instead + */ + static fromStringExplain(e, n, i = {}) { + return ht.fromFormatExplain(e, n, i); + } + /** + * Build a parser for `fmt` using the given locale. This parser can be passed + * to {@link DateTime.fromFormatParser} to a parse a date in this format. This + * can be used to optimize cases where many dates need to be parsed in a + * specific format. + * + * @param {String} fmt - the format the string is expected to be in (see + * description) + * @param {Object} options - options used to set locale and numberingSystem + * for parser + * @returns {TokenParser} - opaque object to be used + */ + static buildFormatParser(e, n = {}) { + const { locale: i = null, numberingSystem: r = null } = n, s = Gt.fromOpts({ + locale: i, + numberingSystem: r, + defaultToEN: !0 + }); + return new Cz(s, e); + } + /** + * Create a DateTime from an input string and format parser. + * + * The format parser must have been created with the same locale as this call. + * + * @param {String} text - the string to parse + * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser} + * @param {Object} opts - options taken by fromFormat() + * @returns {DateTime} + */ + static fromFormatParser(e, n, i = {}) { + if (yt(e) || yt(n)) + throw new Sr( + "fromFormatParser requires an input string and a format parser" + ); + const { locale: r = null, numberingSystem: s = null } = i, o = Gt.fromOpts({ + locale: r, + numberingSystem: s, + defaultToEN: !0 + }); + if (!o.equals(n.locale)) + throw new Sr( + `fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}` + ); + const { result: a, zone: l, specificOffset: u, invalidReason: f } = n.explainFromTokens(e); + return f ? ht.invalid(f) : Ed( + a, + l, + i, + `format ${n.format}`, + e, + u + ); + } + // FORMAT PRESETS + /** + * {@link DateTime#toLocaleString} format like 10/14/1983 + * @type {Object} + */ + static get DATE_SHORT() { + return lw; + } + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + static get DATE_MED() { + return DB; + } + /** + * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' + * @type {Object} + */ + static get DATE_MED_WITH_WEEKDAY() { + return Lue; + } + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + static get DATE_FULL() { + return PB; + } + /** + * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + static get DATE_HUGE() { + return IB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_SIMPLE() { + return LB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SECONDS() { + return RB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SHORT_OFFSET() { + return jB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_LONG_OFFSET() { + return FB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + static get TIME_24_SIMPLE() { + return BB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SECONDS() { + return zB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SHORT_OFFSET() { + return WB; + } + /** + * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_LONG_OFFSET() { + return HB; + } + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT() { + return QB; + } + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT_WITH_SECONDS() { + return UB; + } + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED() { + return ZB; + } + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_SECONDS() { + return qB; + } + /** + * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_WEEKDAY() { + return Rue; + } + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL() { + return YB; + } + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL_WITH_SECONDS() { + return VB; + } + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE() { + return XB; + } + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE_WITH_SECONDS() { + return GB; + } +} +function Cm(t) { + if (ht.isDateTime(t)) + return t; + if (t && t.valueOf && Du(t.valueOf())) + return ht.fromJSDate(t); + if (t && typeof t == "object") + return ht.fromObject(t); + throw new Sr( + `Unknown datetime argument: ${t}, of type ${typeof t}` + ); +} +var Pfe = typeof on == "object" && on && on.Object === Object && on, Az = Pfe, Ife = Az, Lfe = typeof self == "object" && self && self.Object === Object && self, Rfe = Ife || Lfe || Function("return this")(), qo = Rfe, jfe = qo, Ffe = jfe.Symbol, rp = Ffe; +function Bfe(t, e) { + var n = -1, i = t.length; + for (e || (e = Array(i)); ++n < i; ) + e[n] = t[n]; + return e; +} +var Dz = Bfe, lN = rp, Pz = Object.prototype, zfe = Pz.hasOwnProperty, Wfe = Pz.toString, Em = lN ? lN.toStringTag : void 0; +function Hfe(t) { + var e = zfe.call(t, Em), n = t[Em]; + try { + t[Em] = void 0; + var i = !0; + } catch { + } + var r = Wfe.call(t); + return i && (e ? t[Em] = n : delete t[Em]), r; +} +var Qfe = Hfe, Ufe = Object.prototype, Zfe = Ufe.toString; +function qfe(t) { + return Zfe.call(t); +} +var Yfe = qfe, uN = rp, Vfe = Qfe, Xfe = Yfe, Gfe = "[object Null]", Kfe = "[object Undefined]", cN = uN ? uN.toStringTag : void 0; +function Jfe(t) { + return t == null ? t === void 0 ? Kfe : Gfe : cN && cN in Object(t) ? Vfe(t) : Xfe(t); +} +var sp = Jfe; +function ede(t) { + var e = typeof t; + return t != null && (e == "object" || e == "function"); +} +var Ll = ede, tde = sp, nde = Ll, ide = "[object AsyncFunction]", rde = "[object Function]", sde = "[object GeneratorFunction]", ode = "[object Proxy]"; +function ade(t) { + if (!nde(t)) + return !1; + var e = tde(t); + return e == rde || e == sde || e == ide || e == ode; +} +var Iz = ade, lde = qo, ude = lde["__core-js_shared__"], cde = ude, z3 = cde, fN = function() { + var t = /[^.]+$/.exec(z3 && z3.keys && z3.keys.IE_PROTO || ""); + return t ? "Symbol(src)_1." + t : ""; +}(); +function fde(t) { + return !!fN && fN in t; +} +var dde = fde, hde = Function.prototype, pde = hde.toString; +function mde(t) { + if (t != null) { + try { + return pde.call(t); + } catch { + } + try { + return t + ""; + } catch { + } + } + return ""; +} +var Lz = mde, gde = Iz, vde = dde, bde = Ll, yde = Lz, wde = /[\\^$.*+?()[\]{}|]/g, kde = /^\[object .+?Constructor\]$/, xde = Function.prototype, _de = Object.prototype, Ode = xde.toString, Sde = _de.hasOwnProperty, Cde = RegExp( + "^" + Ode.call(Sde).replace(wde, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" +); +function Ede(t) { + if (!bde(t) || vde(t)) + return !1; + var e = gde(t) ? Cde : kde; + return e.test(yde(t)); +} +var Tde = Ede; +function $de(t, e) { + return t == null ? void 0 : t[e]; +} +var Mde = $de, Nde = Tde, Ade = Mde; +function Dde(t, e) { + var n = Ade(t, e); + return Nde(n) ? n : void 0; +} +var Df = Dde, Pde = Df, Ide = qo, Lde = Pde(Ide, "DataView"), Rde = Lde, jde = Df, Fde = qo, Bde = jde(Fde, "Map"), B5 = Bde, zde = Df, Wde = qo, Hde = zde(Wde, "Promise"), Qde = Hde, Ude = Df, Zde = qo, qde = Ude(Zde, "Set"), Yde = qde, Vde = Df, Xde = qo, Gde = Vde(Xde, "WeakMap"), Kde = Gde, b4 = Rde, y4 = B5, w4 = Qde, k4 = Yde, x4 = Kde, Rz = sp, op = Lz, dN = "[object Map]", Jde = "[object Object]", hN = "[object Promise]", pN = "[object Set]", mN = "[object WeakMap]", gN = "[object DataView]", ehe = op(b4), the = op(y4), nhe = op(w4), ihe = op(k4), rhe = op(x4), Rc = Rz; +(b4 && Rc(new b4(new ArrayBuffer(1))) != gN || y4 && Rc(new y4()) != dN || w4 && Rc(w4.resolve()) != hN || k4 && Rc(new k4()) != pN || x4 && Rc(new x4()) != mN) && (Rc = function(t) { + var e = Rz(t), n = e == Jde ? t.constructor : void 0, i = n ? op(n) : ""; + if (i) + switch (i) { + case ehe: + return gN; + case the: + return dN; + case nhe: + return hN; + case ihe: + return pN; + case rhe: + return mN; + } + return e; +}); +var i2 = Rc, she = 9007199254740991; +function ohe(t) { + return typeof t == "number" && t > -1 && t % 1 == 0 && t <= she; +} +var z5 = ohe, ahe = Iz, lhe = z5; +function uhe(t) { + return t != null && lhe(t.length) && !ahe(t); +} +var W5 = uhe, che = Array.isArray, Rl = che; +function fhe(t) { + return t != null && typeof t == "object"; +} +var Pf = fhe, dhe = sp, hhe = Rl, phe = Pf, mhe = "[object String]"; +function ghe(t) { + return typeof t == "string" || !hhe(t) && phe(t) && dhe(t) == mhe; +} +var vhe = ghe; +function bhe(t) { + for (var e, n = []; !(e = t.next()).done; ) + n.push(e.value); + return n; +} +var yhe = bhe; +function whe(t) { + var e = -1, n = Array(t.size); + return t.forEach(function(i, r) { + n[++e] = [r, i]; + }), n; +} +var khe = whe; +function xhe(t) { + var e = -1, n = Array(t.size); + return t.forEach(function(i) { + n[++e] = i; + }), n; +} +var _he = xhe; +function Ohe(t) { + return t.split(""); +} +var She = Ohe, Che = "\\ud800-\\udfff", Ehe = "\\u0300-\\u036f", The = "\\ufe20-\\ufe2f", $he = "\\u20d0-\\u20ff", Mhe = Ehe + The + $he, Nhe = "\\ufe0e\\ufe0f", Ahe = "\\u200d", Dhe = RegExp("[" + Ahe + Che + Mhe + Nhe + "]"); +function Phe(t) { + return Dhe.test(t); +} +var Ihe = Phe, jz = "\\ud800-\\udfff", Lhe = "\\u0300-\\u036f", Rhe = "\\ufe20-\\ufe2f", jhe = "\\u20d0-\\u20ff", Fhe = Lhe + Rhe + jhe, Bhe = "\\ufe0e\\ufe0f", zhe = "[" + jz + "]", _4 = "[" + Fhe + "]", O4 = "\\ud83c[\\udffb-\\udfff]", Whe = "(?:" + _4 + "|" + O4 + ")", Fz = "[^" + jz + "]", Bz = "(?:\\ud83c[\\udde6-\\uddff]){2}", zz = "[\\ud800-\\udbff][\\udc00-\\udfff]", Hhe = "\\u200d", Wz = Whe + "?", Hz = "[" + Bhe + "]?", Qhe = "(?:" + Hhe + "(?:" + [Fz, Bz, zz].join("|") + ")" + Hz + Wz + ")*", Uhe = Hz + Wz + Qhe, Zhe = "(?:" + [Fz + _4 + "?", _4, Bz, zz, zhe].join("|") + ")", qhe = RegExp(O4 + "(?=" + O4 + ")|" + Zhe + Uhe, "g"); +function Yhe(t) { + return t.match(qhe) || []; +} +var Vhe = Yhe, Xhe = She, Ghe = Ihe, Khe = Vhe; +function Jhe(t) { + return Ghe(t) ? Khe(t) : Xhe(t); +} +var epe = Jhe; +function tpe(t, e) { + for (var n = -1, i = t == null ? 0 : t.length, r = Array(i); ++n < i; ) + r[n] = e(t[n], n, t); + return r; +} +var Qz = tpe, npe = Qz; +function ipe(t, e) { + return npe(e, function(n) { + return t[n]; + }); +} +var rpe = ipe; +function spe(t, e) { + for (var n = -1, i = Array(t); ++n < t; ) + i[n] = e(n); + return i; +} +var ope = spe, ape = sp, lpe = Pf, upe = "[object Arguments]"; +function cpe(t) { + return lpe(t) && ape(t) == upe; +} +var fpe = cpe, vN = fpe, dpe = Pf, Uz = Object.prototype, hpe = Uz.hasOwnProperty, ppe = Uz.propertyIsEnumerable, mpe = vN(/* @__PURE__ */ function() { + return arguments; +}()) ? vN : function(t) { + return dpe(t) && hpe.call(t, "callee") && !ppe.call(t, "callee"); +}, H5 = mpe, dw = { exports: {} }; +function gpe() { + return !1; +} +var vpe = gpe; +dw.exports; +(function(t, e) { + var n = qo, i = vpe, r = e && !e.nodeType && e, s = r && !0 && t && !t.nodeType && t, o = s && s.exports === r, a = o ? n.Buffer : void 0, l = a ? a.isBuffer : void 0, u = l || i; + t.exports = u; +})(dw, dw.exports); +var Zz = dw.exports, bpe = 9007199254740991, ype = /^(?:0|[1-9]\d*)$/; +function wpe(t, e) { + var n = typeof t; + return e = e ?? bpe, !!e && (n == "number" || n != "symbol" && ype.test(t)) && t > -1 && t % 1 == 0 && t < e; +} +var Q5 = wpe, kpe = sp, xpe = z5, _pe = Pf, Ope = "[object Arguments]", Spe = "[object Array]", Cpe = "[object Boolean]", Epe = "[object Date]", Tpe = "[object Error]", $pe = "[object Function]", Mpe = "[object Map]", Npe = "[object Number]", Ape = "[object Object]", Dpe = "[object RegExp]", Ppe = "[object Set]", Ipe = "[object String]", Lpe = "[object WeakMap]", Rpe = "[object ArrayBuffer]", jpe = "[object DataView]", Fpe = "[object Float32Array]", Bpe = "[object Float64Array]", zpe = "[object Int8Array]", Wpe = "[object Int16Array]", Hpe = "[object Int32Array]", Qpe = "[object Uint8Array]", Upe = "[object Uint8ClampedArray]", Zpe = "[object Uint16Array]", qpe = "[object Uint32Array]", xn = {}; +xn[Fpe] = xn[Bpe] = xn[zpe] = xn[Wpe] = xn[Hpe] = xn[Qpe] = xn[Upe] = xn[Zpe] = xn[qpe] = !0; +xn[Ope] = xn[Spe] = xn[Rpe] = xn[Cpe] = xn[jpe] = xn[Epe] = xn[Tpe] = xn[$pe] = xn[Mpe] = xn[Npe] = xn[Ape] = xn[Dpe] = xn[Ppe] = xn[Ipe] = xn[Lpe] = !1; +function Ype(t) { + return _pe(t) && xpe(t.length) && !!xn[kpe(t)]; +} +var Vpe = Ype; +function Xpe(t) { + return function(e) { + return t(e); + }; +} +var U5 = Xpe, hw = { exports: {} }; +hw.exports; +(function(t, e) { + var n = Az, i = e && !e.nodeType && e, r = i && !0 && t && !t.nodeType && t, s = r && r.exports === i, o = s && n.process, a = function() { + try { + var l = r && r.require && r.require("util").types; + return l || o && o.binding && o.binding("util"); + } catch { + } + }(); + t.exports = a; +})(hw, hw.exports); +var Z5 = hw.exports, Gpe = Vpe, Kpe = U5, bN = Z5, yN = bN && bN.isTypedArray, Jpe = yN ? Kpe(yN) : Gpe, eme = Jpe, tme = ope, nme = H5, ime = Rl, rme = Zz, sme = Q5, ome = eme, ame = Object.prototype, lme = ame.hasOwnProperty; +function ume(t, e) { + var n = ime(t), i = !n && nme(t), r = !n && !i && rme(t), s = !n && !i && !r && ome(t), o = n || i || r || s, a = o ? tme(t.length, String) : [], l = a.length; + for (var u in t) + (e || lme.call(t, u)) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode. + (u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + r && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + s && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties. + sme(u, l))) && a.push(u); + return a; +} +var qz = ume, cme = Object.prototype; +function fme(t) { + var e = t && t.constructor, n = typeof e == "function" && e.prototype || cme; + return t === n; +} +var q5 = fme; +function dme(t, e) { + return function(n) { + return t(e(n)); + }; +} +var Yz = dme, hme = Yz, pme = hme(Object.keys, Object), mme = pme, gme = q5, vme = mme, bme = Object.prototype, yme = bme.hasOwnProperty; +function wme(t) { + if (!gme(t)) + return vme(t); + var e = []; + for (var n in Object(t)) + yme.call(t, n) && n != "constructor" && e.push(n); + return e; +} +var kme = wme, xme = qz, _me = kme, Ome = W5; +function Sme(t) { + return Ome(t) ? xme(t) : _me(t); +} +var r2 = Sme, Cme = rpe, Eme = r2; +function Tme(t) { + return t == null ? [] : Cme(t, Eme(t)); +} +var $me = Tme, wN = rp, Mme = Dz, Nme = i2, Ame = W5, Dme = vhe, Pme = yhe, Ime = khe, Lme = _he, Rme = epe, jme = $me, Fme = "[object Map]", Bme = "[object Set]", W3 = wN ? wN.iterator : void 0; +function zme(t) { + if (!t) + return []; + if (Ame(t)) + return Dme(t) ? Rme(t) : Mme(t); + if (W3 && t[W3]) + return Pme(t[W3]()); + var e = Nme(t), n = e == Fme ? Ime : e == Bme ? Lme : jme; + return n(t); +} +var Wme = zme; +const Hme = /* @__PURE__ */ Gs(Wme); +function Qme() { + this.__data__ = [], this.size = 0; +} +var Ume = Qme; +function Zme(t, e) { + return t === e || t !== t && e !== e; +} +var Vz = Zme, qme = Vz; +function Yme(t, e) { + for (var n = t.length; n--; ) + if (qme(t[n][0], e)) + return n; + return -1; +} +var s2 = Yme, Vme = s2, Xme = Array.prototype, Gme = Xme.splice; +function Kme(t) { + var e = this.__data__, n = Vme(e, t); + if (n < 0) + return !1; + var i = e.length - 1; + return n == i ? e.pop() : Gme.call(e, n, 1), --this.size, !0; +} +var Jme = Kme, ege = s2; +function tge(t) { + var e = this.__data__, n = ege(e, t); + return n < 0 ? void 0 : e[n][1]; +} +var nge = tge, ige = s2; +function rge(t) { + return ige(this.__data__, t) > -1; +} +var sge = rge, oge = s2; +function age(t, e) { + var n = this.__data__, i = oge(n, t); + return i < 0 ? (++this.size, n.push([t, e])) : n[i][1] = e, this; +} +var lge = age, uge = Ume, cge = Jme, fge = nge, dge = sge, hge = lge; +function ap(t) { + var e = -1, n = t == null ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var i = t[e]; + this.set(i[0], i[1]); + } +} +ap.prototype.clear = uge; +ap.prototype.delete = cge; +ap.prototype.get = fge; +ap.prototype.has = dge; +ap.prototype.set = hge; +var o2 = ap, pge = o2; +function mge() { + this.__data__ = new pge(), this.size = 0; +} +var gge = mge; +function vge(t) { + var e = this.__data__, n = e.delete(t); + return this.size = e.size, n; +} +var bge = vge; +function yge(t) { + return this.__data__.get(t); +} +var wge = yge; +function kge(t) { + return this.__data__.has(t); +} +var xge = kge, _ge = Df, Oge = _ge(Object, "create"), a2 = Oge, kN = a2; +function Sge() { + this.__data__ = kN ? kN(null) : {}, this.size = 0; +} +var Cge = Sge; +function Ege(t) { + var e = this.has(t) && delete this.__data__[t]; + return this.size -= e ? 1 : 0, e; +} +var Tge = Ege, $ge = a2, Mge = "__lodash_hash_undefined__", Nge = Object.prototype, Age = Nge.hasOwnProperty; +function Dge(t) { + var e = this.__data__; + if ($ge) { + var n = e[t]; + return n === Mge ? void 0 : n; + } + return Age.call(e, t) ? e[t] : void 0; +} +var Pge = Dge, Ige = a2, Lge = Object.prototype, Rge = Lge.hasOwnProperty; +function jge(t) { + var e = this.__data__; + return Ige ? e[t] !== void 0 : Rge.call(e, t); +} +var Fge = jge, Bge = a2, zge = "__lodash_hash_undefined__"; +function Wge(t, e) { + var n = this.__data__; + return this.size += this.has(t) ? 0 : 1, n[t] = Bge && e === void 0 ? zge : e, this; +} +var Hge = Wge, Qge = Cge, Uge = Tge, Zge = Pge, qge = Fge, Yge = Hge; +function lp(t) { + var e = -1, n = t == null ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var i = t[e]; + this.set(i[0], i[1]); + } +} +lp.prototype.clear = Qge; +lp.prototype.delete = Uge; +lp.prototype.get = Zge; +lp.prototype.has = qge; +lp.prototype.set = Yge; +var Vge = lp, xN = Vge, Xge = o2, Gge = B5; +function Kge() { + this.size = 0, this.__data__ = { + hash: new xN(), + map: new (Gge || Xge)(), + string: new xN() + }; +} +var Jge = Kge; +function e0e(t) { + var e = typeof t; + return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null; +} +var t0e = e0e, n0e = t0e; +function i0e(t, e) { + var n = t.__data__; + return n0e(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map; +} +var l2 = i0e, r0e = l2; +function s0e(t) { + var e = r0e(this, t).delete(t); + return this.size -= e ? 1 : 0, e; +} +var o0e = s0e, a0e = l2; +function l0e(t) { + return a0e(this, t).get(t); +} +var u0e = l0e, c0e = l2; +function f0e(t) { + return c0e(this, t).has(t); +} +var d0e = f0e, h0e = l2; +function p0e(t, e) { + var n = h0e(this, t), i = n.size; + return n.set(t, e), this.size += n.size == i ? 0 : 1, this; +} +var m0e = p0e, g0e = Jge, v0e = o0e, b0e = u0e, y0e = d0e, w0e = m0e; +function up(t) { + var e = -1, n = t == null ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var i = t[e]; + this.set(i[0], i[1]); + } +} +up.prototype.clear = g0e; +up.prototype.delete = v0e; +up.prototype.get = b0e; +up.prototype.has = y0e; +up.prototype.set = w0e; +var Xz = up, k0e = o2, x0e = B5, _0e = Xz, O0e = 200; +function S0e(t, e) { + var n = this.__data__; + if (n instanceof k0e) { + var i = n.__data__; + if (!x0e || i.length < O0e - 1) + return i.push([t, e]), this.size = ++n.size, this; + n = this.__data__ = new _0e(i); + } + return n.set(t, e), this.size = n.size, this; +} +var C0e = S0e, E0e = o2, T0e = gge, $0e = bge, M0e = wge, N0e = xge, A0e = C0e; +function cp(t) { + var e = this.__data__ = new E0e(t); + this.size = e.size; +} +cp.prototype.clear = T0e; +cp.prototype.delete = $0e; +cp.prototype.get = M0e; +cp.prototype.has = N0e; +cp.prototype.set = A0e; +var D0e = cp; +function P0e(t, e) { + for (var n = -1, i = t == null ? 0 : t.length; ++n < i && e(t[n], n, t) !== !1; ) + ; + return t; +} +var I0e = P0e, L0e = Df, R0e = function() { + try { + var t = L0e(Object, "defineProperty"); + return t({}, "", {}), t; + } catch { + } +}(), Gz = R0e, _N = Gz; +function j0e(t, e, n) { + e == "__proto__" && _N ? _N(t, e, { + configurable: !0, + enumerable: !0, + value: n, + writable: !0 + }) : t[e] = n; +} +var Kz = j0e, F0e = Kz, B0e = Vz, z0e = Object.prototype, W0e = z0e.hasOwnProperty; +function H0e(t, e, n) { + var i = t[e]; + (!(W0e.call(t, e) && B0e(i, n)) || n === void 0 && !(e in t)) && F0e(t, e, n); +} +var Y5 = H0e, Q0e = Y5, U0e = Kz; +function Z0e(t, e, n, i) { + var r = !n; + n || (n = {}); + for (var s = -1, o = e.length; ++s < o; ) { + var a = e[s], l = i ? i(n[a], t[a], a, n, t) : void 0; + l === void 0 && (l = t[a]), r ? U0e(n, a, l) : Q0e(n, a, l); + } + return n; +} +var u2 = Z0e, q0e = u2, Y0e = r2; +function V0e(t, e) { + return t && q0e(e, Y0e(e), t); +} +var X0e = V0e; +function G0e(t) { + var e = []; + if (t != null) + for (var n in Object(t)) + e.push(n); + return e; +} +var K0e = G0e, J0e = Ll, e1e = q5, t1e = K0e, n1e = Object.prototype, i1e = n1e.hasOwnProperty; +function r1e(t) { + if (!J0e(t)) + return t1e(t); + var e = e1e(t), n = []; + for (var i in t) + i == "constructor" && (e || !i1e.call(t, i)) || n.push(i); + return n; +} +var s1e = r1e, o1e = qz, a1e = s1e, l1e = W5; +function u1e(t) { + return l1e(t) ? o1e(t, !0) : a1e(t); +} +var V5 = u1e, c1e = u2, f1e = V5; +function d1e(t, e) { + return t && c1e(e, f1e(e), t); +} +var h1e = d1e, pw = { exports: {} }; +pw.exports; +(function(t, e) { + var n = qo, i = e && !e.nodeType && e, r = i && !0 && t && !t.nodeType && t, s = r && r.exports === i, o = s ? n.Buffer : void 0, a = o ? o.allocUnsafe : void 0; + function l(u, f) { + if (f) + return u.slice(); + var d = u.length, h = a ? a(d) : new u.constructor(d); + return u.copy(h), h; + } + t.exports = l; +})(pw, pw.exports); +var p1e = pw.exports; +function m1e(t, e) { + for (var n = -1, i = t == null ? 0 : t.length, r = 0, s = []; ++n < i; ) { + var o = t[n]; + e(o, n, t) && (s[r++] = o); + } + return s; +} +var g1e = m1e; +function v1e() { + return []; +} +var Jz = v1e, b1e = g1e, y1e = Jz, w1e = Object.prototype, k1e = w1e.propertyIsEnumerable, ON = Object.getOwnPropertySymbols, x1e = ON ? function(t) { + return t == null ? [] : (t = Object(t), b1e(ON(t), function(e) { + return k1e.call(t, e); + })); +} : y1e, X5 = x1e, _1e = u2, O1e = X5; +function S1e(t, e) { + return _1e(t, O1e(t), e); +} +var C1e = S1e; +function E1e(t, e) { + for (var n = -1, i = e.length, r = t.length; ++n < i; ) + t[r + n] = e[n]; + return t; +} +var G5 = E1e, T1e = Yz, $1e = T1e(Object.getPrototypeOf, Object), eW = $1e, M1e = G5, N1e = eW, A1e = X5, D1e = Jz, P1e = Object.getOwnPropertySymbols, I1e = P1e ? function(t) { + for (var e = []; t; ) + M1e(e, A1e(t)), t = N1e(t); + return e; +} : D1e, tW = I1e, L1e = u2, R1e = tW; +function j1e(t, e) { + return L1e(t, R1e(t), e); +} +var F1e = j1e, B1e = G5, z1e = Rl; +function W1e(t, e, n) { + var i = e(t); + return z1e(t) ? i : B1e(i, n(t)); +} +var nW = W1e, H1e = nW, Q1e = X5, U1e = r2; +function Z1e(t) { + return H1e(t, U1e, Q1e); +} +var q1e = Z1e, Y1e = nW, V1e = tW, X1e = V5; +function G1e(t) { + return Y1e(t, X1e, V1e); +} +var K1e = G1e, J1e = Object.prototype, eve = J1e.hasOwnProperty; +function tve(t) { + var e = t.length, n = new t.constructor(e); + return e && typeof t[0] == "string" && eve.call(t, "index") && (n.index = t.index, n.input = t.input), n; +} +var nve = tve, ive = qo, rve = ive.Uint8Array, sve = rve, SN = sve; +function ove(t) { + var e = new t.constructor(t.byteLength); + return new SN(e).set(new SN(t)), e; +} +var K5 = ove, ave = K5; +function lve(t, e) { + var n = e ? ave(t.buffer) : t.buffer; + return new t.constructor(n, t.byteOffset, t.byteLength); +} +var uve = lve, cve = /\w*$/; +function fve(t) { + var e = new t.constructor(t.source, cve.exec(t)); + return e.lastIndex = t.lastIndex, e; +} +var dve = fve, CN = rp, EN = CN ? CN.prototype : void 0, TN = EN ? EN.valueOf : void 0; +function hve(t) { + return TN ? Object(TN.call(t)) : {}; +} +var pve = hve, mve = K5; +function gve(t, e) { + var n = e ? mve(t.buffer) : t.buffer; + return new t.constructor(n, t.byteOffset, t.length); +} +var vve = gve, bve = K5, yve = uve, wve = dve, kve = pve, xve = vve, _ve = "[object Boolean]", Ove = "[object Date]", Sve = "[object Map]", Cve = "[object Number]", Eve = "[object RegExp]", Tve = "[object Set]", $ve = "[object String]", Mve = "[object Symbol]", Nve = "[object ArrayBuffer]", Ave = "[object DataView]", Dve = "[object Float32Array]", Pve = "[object Float64Array]", Ive = "[object Int8Array]", Lve = "[object Int16Array]", Rve = "[object Int32Array]", jve = "[object Uint8Array]", Fve = "[object Uint8ClampedArray]", Bve = "[object Uint16Array]", zve = "[object Uint32Array]"; +function Wve(t, e, n) { + var i = t.constructor; + switch (e) { + case Nve: + return bve(t); + case _ve: + case Ove: + return new i(+t); + case Ave: + return yve(t, n); + case Dve: + case Pve: + case Ive: + case Lve: + case Rve: + case jve: + case Fve: + case Bve: + case zve: + return xve(t, n); + case Sve: + return new i(); + case Cve: + case $ve: + return new i(t); + case Eve: + return wve(t); + case Tve: + return new i(); + case Mve: + return kve(t); + } +} +var Hve = Wve, Qve = Ll, $N = Object.create, Uve = /* @__PURE__ */ function() { + function t() { + } + return function(e) { + if (!Qve(e)) + return {}; + if ($N) + return $N(e); + t.prototype = e; + var n = new t(); + return t.prototype = void 0, n; + }; +}(), Zve = Uve, qve = Zve, Yve = eW, Vve = q5; +function Xve(t) { + return typeof t.constructor == "function" && !Vve(t) ? qve(Yve(t)) : {}; +} +var Gve = Xve, Kve = i2, Jve = Pf, ebe = "[object Map]"; +function tbe(t) { + return Jve(t) && Kve(t) == ebe; +} +var nbe = tbe, ibe = nbe, rbe = U5, MN = Z5, NN = MN && MN.isMap, sbe = NN ? rbe(NN) : ibe, obe = sbe, abe = i2, lbe = Pf, ube = "[object Set]"; +function cbe(t) { + return lbe(t) && abe(t) == ube; +} +var fbe = cbe, dbe = fbe, hbe = U5, AN = Z5, DN = AN && AN.isSet, pbe = DN ? hbe(DN) : dbe, mbe = pbe, gbe = D0e, vbe = I0e, bbe = Y5, ybe = X0e, wbe = h1e, kbe = p1e, xbe = Dz, _be = C1e, Obe = F1e, Sbe = q1e, Cbe = K1e, Ebe = i2, Tbe = nve, $be = Hve, Mbe = Gve, Nbe = Rl, Abe = Zz, Dbe = obe, Pbe = Ll, Ibe = mbe, Lbe = r2, Rbe = V5, jbe = 1, Fbe = 2, Bbe = 4, iW = "[object Arguments]", zbe = "[object Array]", Wbe = "[object Boolean]", Hbe = "[object Date]", Qbe = "[object Error]", rW = "[object Function]", Ube = "[object GeneratorFunction]", Zbe = "[object Map]", qbe = "[object Number]", sW = "[object Object]", Ybe = "[object RegExp]", Vbe = "[object Set]", Xbe = "[object String]", Gbe = "[object Symbol]", Kbe = "[object WeakMap]", Jbe = "[object ArrayBuffer]", eye = "[object DataView]", tye = "[object Float32Array]", nye = "[object Float64Array]", iye = "[object Int8Array]", rye = "[object Int16Array]", sye = "[object Int32Array]", oye = "[object Uint8Array]", aye = "[object Uint8ClampedArray]", lye = "[object Uint16Array]", uye = "[object Uint32Array]", ln = {}; +ln[iW] = ln[zbe] = ln[Jbe] = ln[eye] = ln[Wbe] = ln[Hbe] = ln[tye] = ln[nye] = ln[iye] = ln[rye] = ln[sye] = ln[Zbe] = ln[qbe] = ln[sW] = ln[Ybe] = ln[Vbe] = ln[Xbe] = ln[Gbe] = ln[oye] = ln[aye] = ln[lye] = ln[uye] = !0; +ln[Qbe] = ln[rW] = ln[Kbe] = !1; +function sy(t, e, n, i, r, s) { + var o, a = e & jbe, l = e & Fbe, u = e & Bbe; + if (n && (o = r ? n(t, i, r, s) : n(t)), o !== void 0) + return o; + if (!Pbe(t)) + return t; + var f = Nbe(t); + if (f) { + if (o = Tbe(t), !a) + return xbe(t, o); + } else { + var d = Ebe(t), h = d == rW || d == Ube; + if (Abe(t)) + return kbe(t, a); + if (d == sW || d == iW || h && !r) { + if (o = l || h ? {} : Mbe(t), !a) + return l ? Obe(t, wbe(o, t)) : _be(t, ybe(o, t)); + } else { + if (!ln[d]) + return r ? t : {}; + o = $be(t, d, a); + } + } + s || (s = new gbe()); + var m = s.get(t); + if (m) + return m; + s.set(t, o), Ibe(t) ? t.forEach(function(x) { + o.add(sy(x, e, n, x, t, s)); + }) : Dbe(t) && t.forEach(function(x, _) { + o.set(_, sy(x, e, n, _, t, s)); + }); + var g = u ? l ? Cbe : Sbe : l ? Rbe : Lbe, w = f ? void 0 : g(t); + return vbe(w || t, function(x, _) { + w && (_ = x, x = t[_]), bbe(o, _, sy(x, e, n, _, t, s)); + }), o; +} +var cye = sy, fye = cye, dye = 1, hye = 4; +function pye(t) { + return fye(t, dye | hye); +} +var mye = pye; +const PN = /* @__PURE__ */ Gs(mye); +var Ba = {}, jl = {}, J5 = {}, Gi = {}, et = N; +let mw = /* @__PURE__ */ new Map(); +function IN(t) { + for (; t != null; ) { + if (t.nodeType === Node.TEXT_NODE) return t; + t = t.firstChild; + } + return null; +} +function LN(t) { + let e = t.parentNode; + if (e == null) throw Error("Should never happen"); + return [e, Array.from(e.childNodes).indexOf(t)]; +} +function oW(t) { + let e = {}; + t = t.split(";"); + for (let n of t) if (n !== "") { + let [i, r] = n.split(/:([^]+)/); + i && r && (e[i.trim()] = r.trim()); + } + return e; +} +function gw(t) { + let e = mw.get(t); + return e === void 0 && (e = oW(t), mw.set(t, e)), e; +} +function gye(t) { + let e = ""; + for (let n in t) n && (e += `${n}: ${t[n]};`); + return e; +} +function Td(t, e) { + let n = gw("getStyle" in t ? t.getStyle() : t.style); + e = Object.entries(e).reduce((r, [s, o]) => (o instanceof Function ? r[s] = o(n[s]) : o === null ? delete r[s] : r[s] = o, r), { ...n }); + let i = gye(e); + t.setStyle(i), mw.set(i, e); +} +function vye(t) { + for (; t !== null && !et.$isRootOrShadowRoot(t); ) { + let e = t.getLatest(), n = t.getParent(); + e.getChildrenSize() === 0 && t.remove(!0), t = n; + } +} +function H3(t, e, n, i, r = null) { + if (e.length !== 0) { + var s = e[0], o = /* @__PURE__ */ new Map(), a = []; + s = et.$isElementNode(s) ? s : s.getParentOrThrow(), s.isInline() && (s = s.getParentOrThrow()); + for (var l = !1; s !== null; ) { + var u = s.getPreviousSibling(); + if (u !== null) { + s = u, l = !0; + break; + } + if (s = s.getParentOrThrow(), et.$isRootOrShadowRoot(s)) break; + } + u = /* @__PURE__ */ new Set(); + for (var f = 0; f < n; f++) { + var d = e[f]; + et.$isElementNode(d) && d.getChildrenSize() === 0 && u.add(d.getKey()); + } + var h = /* @__PURE__ */ new Set(); + for (f = 0; f < n; f++) { + d = e[f]; + var m = d.getParent(); + if (m !== null && m.isInline() && (m = m.getParent()), m !== null && et.$isLeafNode(d) && !h.has(d.getKey())) { + if (d = m.getKey(), o.get(d) === void 0) { + let g = i(); + g.setFormat(m.getFormatType()), g.setIndent(m.getIndent()), a.push(g), o.set(d, g), m.getChildren().forEach((w) => { + g.append(w), h.add(w.getKey()), et.$isElementNode(w) && w.getChildrenKeys().forEach((x) => h.add(x)); + }), vye(m); + } + } else if (u.has(d.getKey())) { + if (!et.$isElementNode(d)) throw Error("Expected node in emptyElements to be an ElementNode"); + m = i(), m.setFormat(d.getFormatType()), m.setIndent(d.getIndent()), a.push(m), d.remove(!0); + } + } + if (r !== null) for (e = 0; e < a.length; e++) r.append(a[e]); + if (e = null, et.$isRootOrShadowRoot(s)) if (l) if (r !== null) s.insertAfter(r); + else for (r = a.length - 1; 0 <= r; r--) s.insertAfter(a[r]); + else if (l = s.getFirstChild(), et.$isElementNode(l) && (s = l), l === null) if (r) s.append(r); + else for (r = 0; r < a.length; r++) l = a[r], s.append(l), e = l; + else if (r !== null) l.insertBefore(r); + else for (s = 0; s < a.length; s++) r = a[s], l.insertBefore(r), e = r; + else if (r) s.insertAfter(r); + else for (r = a.length - 1; 0 <= r; r--) l = a[r], s.insertAfter(l), e = l; + a = et.$getPreviousSelection(), et.$isRangeSelection(a) && a.anchor.getNode().isAttached() && a.focus.getNode().isAttached() ? et.$setSelection(a.clone()) : e !== null ? e.selectEnd() : t.dirty = !0; + } +} +function aW(t, e, n, i) { + t.modify(e ? "extend" : "move", n, i); +} +function lW(t) { + return t = t.anchor.getNode(), (et.$isRootNode(t) ? t : t.getParentOrThrow()).getDirection() === "rtl"; +} +function Q3(t) { + if (et.$isDecoratorNode(t) || !et.$isElementNode(t) || et.$isRootOrShadowRoot(t)) return !1; + var e = t.getFirstChild(); + return e = e === null || et.$isLineBreakNode(e) || et.$isTextNode(e) || e.isInline(), !t.isInline() && t.canBeEmpty() !== !1 && e; +} +Gi.$addNodeStyle = function(t) { + t = t.getStyle(); + let e = oW(t); + mw.set(t, e); +}; +Gi.$cloneWithProperties = function(t) { + let e = t.constructor.clone(t); + return e.__parent = t.__parent, e.__next = t.__next, e.__prev = t.__prev, et.$isElementNode(t) && et.$isElementNode(e) ? (e.__first = t.__first, e.__last = t.__last, e.__size = t.__size, e.__format = t.__format, e.__indent = t.__indent, e.__dir = t.__dir, e) : (et.$isTextNode(t) && et.$isTextNode(e) && (e.__format = t.__format, e.__style = t.__style, e.__mode = t.__mode, e.__detail = t.__detail), e); +}; +Gi.$getSelectionStyleValueForProperty = function(t, e, n = "") { + let i = null, r = t.getNodes(); + var s = t.anchor, o = t.focus, a = t.isBackward(); + let l = a ? o.offset : s.offset; + if (s = a ? o.getNode() : s.getNode(), t.isCollapsed() && t.style !== "" && (t = gw(t.style), t !== null && e in t)) return t[e]; + for (t = 0; t < r.length; t++) { + var u = r[t]; + if ((t === 0 || l !== 0 || !u.is(s)) && et.$isTextNode(u)) { + if (o = e, a = n, u = u.getStyle(), u = gw(u), o = u !== null && u[o] || a, i === null) i = o; + else if (i !== o) { + i = ""; + break; + } + } + } + return i === null ? n : i; +}; +Gi.$isAtNodeEnd = function(t) { + if (t.type === "text") return t.offset === t.getNode().getTextContentSize(); + let e = t.getNode(); + if (!et.$isElementNode(e)) throw Error("isAtNodeEnd: node must be a TextNode or ElementNode"); + return t.offset === e.getChildrenSize(); +}; +Gi.$isParentElementRTL = lW; +Gi.$moveCaretSelection = aW; +Gi.$moveCharacter = function(t, e, n) { + let i = lW(t); + aW(t, e, n ? !i : i, "character"); +}; +Gi.$patchStyleText = function(t, e) { + var n = t.getNodes(), i = n.length, r = t.getStartEndPoints(); + if (r !== null) { + var [s, o] = r; + --i, r = n[0]; + var a = n[i]; + if (t.isCollapsed() && et.$isRangeSelection(t)) Td(t, e); + else { + var l = r.getTextContent().length, u = o.offset, f = s.offset, d = s.isBefore(o), h = d ? f : u; + t = d ? u : f; + var m = d ? s.type : o.type, g = d ? o.type : s.type; + if (d = d ? o.key : s.key, et.$isTextNode(r) && h === l) { + let w = r.getNextSibling(); + et.$isTextNode(w) && (h = f = 0, r = w); + } + if (n.length === 1) et.$isTextNode(r) && r.canHaveFormat() && (h = m === "element" ? 0 : f > u ? u : f, t = g === "element" ? l : f > u ? f : u, h !== t && (h === 0 && t === l ? (Td(r, e), r.select(h, t)) : (n = r.splitText(h, t), n = h === 0 ? n[0] : n[1], Td(n, e), n.select(0, t - h)))); + else for (et.$isTextNode(r) && h < r.getTextContentSize() && r.canHaveFormat() && (h !== 0 && (r = r.splitText(h)[1], h = 0, s.set(r.getKey(), h, "text")), Td(r, e)), et.$isTextNode(a) && a.canHaveFormat() && (h = a.getTextContent().length, a.__key !== d && t !== 0 && (t = h), t !== h && ([a] = a.splitText(t)), t === 0 && g !== "element" || Td(a, e)), t = 1; t < i; t++) h = n[t], g = h.getKey(), et.$isTextNode(h) && h.canHaveFormat() && g !== r.getKey() && g !== a.getKey() && !h.isToken() && Td(h, e); + } + } +}; +Gi.$selectAll = function(t) { + let e = t.anchor; + t = t.focus; + var n = e.getNode().getTopLevelElementOrThrow().getParentOrThrow(); + let i = n.getFirstDescendant(); + n = n.getLastDescendant(); + let r = "element", s = "element", o = 0; + et.$isTextNode(i) ? r = "text" : et.$isElementNode(i) || i === null || (i = i.getParentOrThrow()), et.$isTextNode(n) ? (s = "text", o = n.getTextContentSize()) : et.$isElementNode(n) || n === null || (n = n.getParentOrThrow()), i && n && (e.set(i.getKey(), 0, r), t.set(n.getKey(), o, s)); +}; +Gi.$setBlocksType = function(t, e) { + if (t !== null) { + var n = t.getStartEndPoints(); + if (n = n ? n[0] : null, n !== null && n.key === "root") e = e(), t = et.$getRoot(), (n = t.getFirstChild()) ? n.replace(e, !0) : t.append(e); + else { + if (t = t.getNodes(), n !== null) { + for (n = n.getNode(); n !== null && n.getParent() !== null && !Q3(n); ) n = n.getParentOrThrow(); + n = Q3(n) ? n : null; + } else n = !1; + for (n && t.indexOf(n) === -1 && t.push(n), n = 0; n < t.length; n++) { + let i = t[n]; + if (!Q3(i)) continue; + if (!et.$isElementNode(i)) throw Error("Expected block node to be an ElementNode"); + let r = e(); + r.setFormat(i.getFormatType()), r.setIndent(i.getIndent()), i.replace(r, !0); + } + } + } +}; +Gi.$shouldOverrideDefaultCharacterSelection = function(t, e) { + return t = et.$getAdjacentNode(t.focus, e), et.$isDecoratorNode(t) && !t.isIsolated() || et.$isElementNode(t) && !t.isInline() && !t.canBeEmpty(); +}; +Gi.$sliceSelectedTextNodeContent = function(t, e) { + var n = t.getStartEndPoints(); + if (e.isSelected(t) && !e.isSegmented() && !e.isToken() && n !== null) { + let [a, l] = n; + n = t.isBackward(); + var i = a.getNode(), r = l.getNode(), s = e.is(i), o = e.is(r); + if (s || o) { + let [u, f] = et.$getCharacterOffsets(t); + t = i.is(r), s = e.is(n ? r : i), r = e.is(n ? i : r), i = 0, o = void 0, t ? (i = u > f ? f : u, o = u > f ? u : f) : s ? (i = n ? f : u, o = void 0) : r && (n = n ? u : f, i = 0, o = n), e.__text = e.__text.slice(i, o); + } + } + return e; +}; +Gi.$wrapNodes = function(t, e, n = null) { + var i = t.getStartEndPoints(), r = i ? i[0] : null; + i = t.getNodes(); + let s = i.length; + if (r !== null && (s === 0 || s === 1 && r.type === "element" && r.getNode().getChildrenSize() === 0)) { + t = r.type === "text" ? r.getNode().getParentOrThrow() : r.getNode(), i = t.getChildren(); + let a = e(); + a.setFormat(t.getFormatType()), a.setIndent(t.getIndent()), i.forEach((l) => a.append(l)), n && (a = n.append(a)), t.replace(a); + } else { + r = null; + var o = []; + for (let a = 0; a < s; a++) { + let l = i[a]; + et.$isRootOrShadowRoot(l) ? (H3(t, o, o.length, e, n), o = [], r = l) : r === null || r !== null && et.$hasAncestor(l, r) ? o.push(l) : (H3(t, o, o.length, e, n), o = [l]); + } + H3(t, o, o.length, e, n); + } +}; +Gi.createDOMRange = function(t, e, n, i, r) { + let s = e.getKey(), o = i.getKey(), a = document.createRange(), l = t.getElementByKey(s); + if (t = t.getElementByKey(o), et.$isTextNode(e) && (l = IN(l)), et.$isTextNode(i) && (t = IN(t)), e === void 0 || i === void 0 || l === null || t === null) return null; + l.nodeName === "BR" && ([l, n] = LN(l)), t.nodeName === "BR" && ([t, r] = LN(t)), e = l.firstChild, l === t && e != null && e.nodeName === "BR" && n === 0 && r === 0 && (r = 1); + try { + a.setStart(l, n), a.setEnd(t, r); + } catch { + return null; + } + return !a.collapsed || n === r && s === o || (a.setStart(t, r), a.setEnd( + l, + n + )), a; +}; +Gi.createRectsFromDOMRange = function(t, e) { + var n = t.getRootElement(); + if (n === null) return []; + t = n.getBoundingClientRect(), n = getComputedStyle(n), n = parseFloat(n.paddingLeft) + parseFloat(n.paddingRight), e = Array.from(e.getClientRects()); + let i = e.length; + e.sort((s, o) => { + let a = s.top - o.top; + return 3 >= Math.abs(a) ? s.left - o.left : a; + }); + let r; + for (let s = 0; s < i; s++) { + let o = e[s], a = o.width + n === t.width; + r && r.top <= o.top && r.top + r.height > o.top && r.left + r.width > o.left || a ? (e.splice(s--, 1), i--) : r = o; + } + return e; +}; +Gi.getStyleObjectFromCSS = gw; +Gi.trimTextContentFromAnchor = function(t, e, n) { + let i = e.getNode(); + if (et.$isElementNode(i)) { + var r = i.getDescendantByIndex(e.offset); + r !== null && (i = r); + } + for (; 0 < n && i !== null; ) { + et.$isElementNode(i) && (r = i.getLastDescendant(), r !== null && (i = r)); + var s = i.getPreviousSibling(), o = 0; + if (s === null) { + r = i.getParentOrThrow(); + for (var a = r.getPreviousSibling(); a === null; ) { + if (r = r.getParent(), r === null) { + s = null; + break; + } + a = r.getPreviousSibling(); + } + r !== null && (o = r.isInline() ? 0 : 2, s = a); + } + if (a = i.getTextContent(), a === "" && et.$isElementNode(i) && !i.isInline() && (a = ` + +`), r = a.length, !et.$isTextNode(i) || n >= r) a = i.getParent(), i.remove(), a == null || a.getChildrenSize() !== 0 || et.$isRootNode(a) || a.remove(), n -= r + o, i = s; + else { + let l = i.getKey(); + o = t.getEditorState().read(() => { + const f = et.$getNodeByKey(l); + return et.$isTextNode(f) && f.isSimpleText() ? f.getTextContent() : null; + }), s = r - n; + let u = a.slice(0, s); + o !== null && o !== a ? (n = et.$getPreviousSelection(), r = i, i.isSimpleText() ? i.setTextContent(o) : (r = et.$createTextNode(o), i.replace(r)), et.$isRangeSelection(n) && n.isCollapsed() && (n = n.anchor.offset, r.select(n, n))) : i.isSimpleText() ? (o = e.key === l, a = e.offset, a < n && (a = r), n = o ? a - n : 0, r = o ? a : s, o && n === 0 ? ([n] = i.splitText(n, r), n.remove()) : ([, n] = i.splitText(n, r), n.remove())) : (n = et.$createTextNode(u), i.replace(n)), n = 0; + } + } +}; +const bye = Gi; +var Ri = bye, oi = {}, uW = Ri, Pn = N; +function yye(t) { + let e = new URLSearchParams(); + e.append("code", t); + for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]); + throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`); +} +function cW(...t) { + return () => { + t.forEach((e) => e()); + }; +} +let wye = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }; +function fW(t, e, n) { + function i() { + if (o === null) throw Error("Unexpected null rootDOMNode"); + if (a === null) throw Error("Unexpected null parentDOMNode"); + let { left: h, top: m } = o.getBoundingClientRect(); + var g = a; + let w = uW.createRectsFromDOMRange(t, e); + f.isConnected || g.append(f), g = !1; + for (let S = 0; S < w.length; S++) { + var x = w[S]; + let C = u[S] || document.createElement("div"), E = C.style; + E.position !== "absolute" && (E.position = "absolute", g = !0); + var _ = `${x.left - h}px`; + E.left !== _ && (E.left = _, g = !0), _ = `${x.top - m}px`, E.top !== _ && (C.style.top = _, g = !0), _ = `${x.width}px`, E.width !== _ && (C.style.width = _, g = !0), x = `${x.height}px`, E.height !== x && (C.style.height = x, g = !0), C.parentNode !== f && (f.append(C), g = !0), u[S] = C; + } + for (; u.length > w.length; ) u.pop(); + g && n(u); + } + function r() { + o = a = null, l !== null && l.disconnect(), l = null, f.remove(); + for (let h of u) h.remove(); + u = []; + } + function s() { + let h = t.getRootElement(); + if (h === null) return r(); + let m = h.parentElement; + if (!(m instanceof HTMLElement)) return r(); + r(), o = h, a = m, l = new MutationObserver((g) => { + let w = t.getRootElement(), x = w && w.parentElement; + if (w !== o || x !== a) return s(); + for (let _ of g) if (!f.contains(_.target)) return i(); + }), l.observe(m, wye), i(); + } + let o = null, a = null, l = null, u = [], f = document.createElement("div"), d = t.registerRootListener(s); + return () => { + d(), r(); + }; +} +function dW(t, e) { + for (let n of e) if (t.type.startsWith(n)) return !0; + return !1; +} +let hW = (t, e) => { + for (; t !== Pn.$getRoot() && t != null; ) { + if (e(t)) return t; + t = t.getParent(); + } + return null; +}; +oi.$splitNode = Pn.$splitNode; +oi.isHTMLAnchorElement = Pn.isHTMLAnchorElement; +oi.isHTMLElement = Pn.isHTMLElement; +oi.$dfs = function(t, e) { + let n = []; + t = (t || Pn.$getRoot()).getLatest(), e = e || (Pn.$isElementNode(t) ? t.getLastDescendant() : t); + for (var i = t, r = 0; (i = i.getParent()) !== null; ) r++; + for (i = r; t !== null && !t.is(e); ) if (n.push({ depth: i, node: t }), Pn.$isElementNode(t) && 0 < t.getChildrenSize()) t = t.getFirstChild(), i++; + else for (r = null; r === null && t !== null; ) r = t.getNextSibling(), r === null ? (t = t.getParent(), i--) : t = r; + return t !== null && t.is(e) && n.push({ depth: i, node: t }), n; +}; +oi.$filter = function(t, e) { + let n = []; + for (let i = 0; i < t.length; i++) { + let r = e(t[i]); + r !== null && n.push(r); + } + return n; +}; +oi.$findMatchingParent = hW; +oi.$getNearestBlockElementAncestorOrThrow = function(t) { + let e = hW(t, (n) => Pn.$isElementNode(n) && !n.isInline()); + return Pn.$isElementNode(e) || yye(4, t.__key), e; +}; +oi.$getNearestNodeOfType = function(t, e) { + for (; t != null; ) { + if (t instanceof e) return t; + t = t.getParent(); + } + return null; +}; +oi.$insertFirst = function(t, e) { + let n = t.getFirstChild(); + n !== null ? n.insertBefore(e) : t.append(e); +}; +oi.$insertNodeToNearestRoot = function(t) { + var e = Pn.$getSelection() || Pn.$getPreviousSelection(); + if (Pn.$isRangeSelection(e)) { + var { focus: n } = e; + if (e = n.getNode(), n = n.offset, Pn.$isRootOrShadowRoot(e)) n = e.getChildAtIndex(n), n == null ? e.append(t) : n.insertBefore(t), t.selectNext(); + else { + let i, r; + Pn.$isTextNode(e) ? (i = e.getParentOrThrow(), r = e.getIndexWithinParent(), 0 < n && (r += 1, e.splitText(n))) : (i = e, r = n), [, e] = Pn.$splitNode(i, r), e.insertBefore(t), e.selectStart(); + } + } else e != null ? (e = e.getNodes(), e[e.length - 1].getTopLevelElementOrThrow().insertAfter(t)) : Pn.$getRoot().append(t), e = Pn.$createParagraphNode(), t.insertAfter(e), e.select(); + return t.getLatest(); +}; +oi.$restoreEditorState = function(t, e) { + let n = /* @__PURE__ */ new Map(), i = t._pendingEditorState; + for (let [r, s] of e._nodeMap) { + let o = uW.$cloneWithProperties(s); + if (Pn.$isTextNode(o)) { + if (!Pn.$isTextNode(s)) throw Error("Expected node be a TextNode"); + o.__text = s.__text; + } + n.set(r, o); + } + i && (i._nodeMap = n), t._dirtyType = 2, t = e._selection, Pn.$setSelection(t === null ? null : t.clone()); +}; +oi.$wrapNodeInElement = function(t, e) { + return e = e(), t.replace(e), e.append(t), e; +}; +oi.addClassNamesToElement = function(t, ...e) { + e.forEach((n) => { + typeof n == "string" && (n = n.split(" ").filter((i) => i !== ""), t.classList.add(...n)); + }); +}; +oi.isMimeType = dW; +oi.markSelection = function(t, e) { + function n(l) { + l.read(() => { + var u = Pn.$getSelection(); + if (Pn.$isRangeSelection(u)) { + var { anchor: f, focus: d } = u; + u = f.getNode(); + var h = u.getKey(), m = f.offset, g = d.getNode(), w = g.getKey(), x = d.offset, _ = t.getElementByKey(h), S = t.getElementByKey(w); + if (h = i === null || _ === null || m !== r || h !== i.getKey() || u !== i && (!(i instanceof Pn.TextNode) || u.updateDOM(i, _, t._config)), w = s === null || S === null || x !== o || w !== s.getKey() || g !== s && (!(s instanceof Pn.TextNode) || g.updateDOM(s, S, t._config)), h || w) { + _ = t.getElementByKey(f.getNode().getKey()); + var C = t.getElementByKey(d.getNode().getKey()); + if (_ !== null && C !== null && _.tagName === "SPAN" && C.tagName === "SPAN") { + if (w = document.createRange(), d.isBefore(f) ? (h = C, S = d.offset, C = _, _ = f.offset) : (h = _, S = f.offset, _ = d.offset), h = h.firstChild, h === null || (C = C.firstChild, C === null)) throw Error("Expected text node to be first child of span"); + w.setStart(h, S), w.setEnd(C, _), a(), a = fW(t, w, (E) => { + for (let M of E) { + let $ = M.style; + $.background !== "Highlight" && ($.background = "Highlight"), $.color !== "HighlightText" && ($.color = "HighlightText"), $.zIndex !== "-1" && ($.zIndex = "-1"), $.pointerEvents !== "none" && ($.pointerEvents = "none"), $.marginTop !== "-1.5px" && ($.marginTop = "-1.5px"), $.paddingTop !== "4px" && ($.paddingTop = "4px"), $.paddingBottom !== "0px" && ($.paddingBottom = "0px"); + } + e !== void 0 && e(E); + }); + } + } + i = u, r = m, s = g, o = x; + } else o = s = r = i = null, a(), a = () => { + }; + }); + } + let i = null, r = null, s = null, o = null, a = () => { + }; + return n(t.getEditorState()), cW(t.registerUpdateListener(({ editorState: l }) => n(l)), a, () => { + a(); + }); +}; +oi.mediaFileReader = function(t, e) { + let n = t[Symbol.iterator](); + return new Promise((i, r) => { + let s = [], o = () => { + const { done: a, value: l } = n.next(); + if (a) return i(s); + const u = new FileReader(); + u.addEventListener("error", r), u.addEventListener("load", () => { + const f = u.result; + typeof f == "string" && s.push({ file: l, result: f }), o(); + }), dW(l, e) ? u.readAsDataURL(l) : o(); + }; + o(); + }); +}; +oi.mergeRegister = cW; +oi.objectKlassEquals = function(t, e) { + return t !== null ? Object.getPrototypeOf(t).constructor.name === e.name : !1; +}; +oi.positionNodeOnRange = fW; +oi.registerNestedElementResolver = function(t, e, n, i) { + return t.registerNodeTransform(e, (r) => { + e: { + for (var s = r.getChildren(), o = 0; o < s.length; o++) if (s[o] instanceof e) { + s = null; + break e; + } + for (s = r; s !== null; ) if (o = s, s = s.getParent(), s instanceof e) { + s = { child: o, parent: s }; + break e; + } + s = null; + } + if (s !== null) { + const { child: a, parent: l } = s; + if (a.is(r)) { + if (i(l, r), r = a.getNextSiblings(), s = r.length, l.insertAfter(a), s !== 0) { + o = n(l), a.insertAfter(o); + for (let u = 0; u < s; u++) o.append(r[u]); + } + l.canBeEmpty() || l.getChildrenSize() !== 0 || l.remove(); + } + } + }); +}; +oi.removeClassNamesFromElement = function(t, ...e) { + e.forEach((n) => { + typeof n == "string" && t.classList.remove(...n.split(" ")); + }); +}; +const kye = oi; +var lt = kye, RN = Ri, xye = lt, Kd = N; +function pW(t, e, n, i = null) { + let r = i !== null ? e.isSelected(i) : !0, s = Kd.$isElementNode(e) && e.excludeFromCopy("html"); + var o = e; + i !== null && (o = RN.$cloneWithProperties(e), o = Kd.$isTextNode(o) && i !== null ? RN.$sliceSelectedTextNodeContent(i, o) : o); + let a = Kd.$isElementNode(o) ? o.getChildren() : []; + var l = t._nodes.get(o.getType()); + l = l && l.exportDOM !== void 0 ? l.exportDOM(t, o) : o.exportDOM(t); + let { element: u, after: f } = l; + if (!u) return !1; + l = document.createDocumentFragment(); + for (let d = 0; d < a.length; d++) { + let h = a[d], m = pW(t, h, l, i); + !r && Kd.$isElementNode(e) && m && e.extractWithChild(h, i, "html") && (r = !0); + } + return r && !s ? (xye.isHTMLElement(u) && u.append(l), n.append(u), f && (t = f.call(o, u)) && u.replaceWith(t)) : n.append(l), r; +} +let mW = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]); +function gW(t, e, n = /* @__PURE__ */ new Map(), i) { + let r = []; + if (mW.has(t.nodeName)) return r; + let s = null; + var o, { nodeName: a } = t, l = e._htmlConversions.get(a.toLowerCase()); + if (a = null, l !== void 0) for (o of l) l = o(t), l !== null && (a === null || (a.priority || 0) < (l.priority || 0)) && (a = l); + if (a = (o = a !== null ? a.conversion : null) ? o(t) : null, o = null, a !== null) { + if (o = a.after, l = a.node, s = Array.isArray(l) ? l[l.length - 1] : l, s !== null) { + for (var [, u] of n) if (s = u(s, i), !s) break; + s && r.push(...Array.isArray(l) ? l : [s]); + } + a.forChild != null && n.set(t.nodeName, a.forChild); + } + for (t = t.childNodes, i = [], u = 0; u < t.length; u++) i.push(...gW(t[u], e, new Map(n), s)); + return o != null && (i = o(i)), s == null ? r = r.concat(i) : Kd.$isElementNode(s) && s.append(...i), r; +} +J5.$generateHtmlFromNodes = function(t, e) { + if (typeof document > "u" || typeof window > "u" && typeof on.window > "u") throw Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function."); + let n = document.createElement("div"), i = Kd.$getRoot().getChildren(); + for (let r = 0; r < i.length; r++) pW(t, i[r], n, e); + return n.innerHTML; +}; +J5.$generateNodesFromDOM = function(t, e) { + e = e.body ? e.body.childNodes : []; + let n = []; + for (let r = 0; r < e.length; r++) { + var i = e[r]; + mW.has(i.nodeName) || (i = gW(i, t), i !== null && (n = n.concat(i))); + } + return n; +}; +const _ye = J5; +var Rn = _ye, vW = Rn, S4 = Ri, Oye = lt, wi = N; +function jN(t) { + let e = new URLSearchParams(); + e.append("code", t); + for (let n = 1; n < arguments.length; n++) e.append("v", arguments[n]); + throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`); +} +let bW = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u"; +function yW(t) { + let e = wi.$getSelection(); + if (e == null) throw Error("Expected valid LexicalSelection"); + return wi.$isRangeSelection(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : vW.$generateHtmlFromNodes(t, e); +} +function wW(t) { + let e = wi.$getSelection(); + if (e == null) throw Error("Expected valid LexicalSelection"); + return wi.$isRangeSelection(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(xW(t, e)); +} +function C4(t, e, n) { + t.dispatchCommand(wi.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, { nodes: e, selection: n }) || n.insertNodes(e); +} +function kW(t, e, n, i = []) { + let r = e !== null ? n.isSelected(e) : !0, s = wi.$isElementNode(n) && n.excludeFromCopy("html"); + var o = n; + if (e !== null) { + var a = S4.$cloneWithProperties(n); + o = a = wi.$isTextNode(a) && e !== null ? S4.$sliceSelectedTextNodeContent(e, a) : a; + } + let l = wi.$isElementNode(o) ? o.getChildren() : []; + var u = o; + a = u.exportJSON(); + var f = u.constructor; + for (a.type !== f.getType() && jN(58, f.name), wi.$isElementNode(u) && (Array.isArray(a.children) || jN(59, f.name)), wi.$isTextNode(o) && (o = o.__text, 0 < o.length ? a.text = o : r = !1), o = 0; o < l.length; o++) u = l[o], f = kW(t, e, u, a.children), !r && wi.$isElementNode(n) && f && n.extractWithChild(u, e, "clone") && (r = !0); + if (r && !s) i.push(a); + else if (Array.isArray(a.children)) for (t = 0; t < a.children.length; t++) i.push(a.children[t]); + return r; +} +function xW(t, e) { + let n = [], i = wi.$getRoot().getChildren(); + for (let r = 0; r < i.length; r++) kW(t, e, i[r], n); + return { namespace: t._config.namespace, nodes: n }; +} +function _W(t) { + let e = []; + for (let n = 0; n < t.length; n++) { + let i = wi.$parseSerializedNode(t[n]); + wi.$isTextNode(i) && S4.$addNodeStyle(i), e.push(i); + } + return e; +} +let $d = null; +function FN(t, e) { + var n = bW ? (t._window || window).getSelection() : null; + if (!n) return !1; + var i = n.anchorNode; + if (n = n.focusNode, i !== null && n !== null && !wi.isSelectionWithinEditor(t, i, n) || (e.preventDefault(), e = e.clipboardData, i = wi.$getSelection(), e === null || i === null)) return !1; + n = yW(t), t = wW(t); + let r = ""; + return i !== null && (r = i.getTextContent()), n !== null && e.setData("text/html", n), t !== null && e.setData("application/x-lexical-editor", t), e.setData("text/plain", r), !0; +} +jl.$generateJSONFromSelectedNodes = xW; +jl.$generateNodesFromSerializedNodes = _W; +jl.$getHtmlContent = yW; +jl.$getLexicalContent = wW; +jl.$insertDataTransferForPlainText = function(t, e) { + t = t.getData("text/plain") || t.getData("text/uri-list"), t != null && e.insertRawText(t); +}; +jl.$insertDataTransferForRichText = function(t, e, n) { + var i = t.getData("application/x-lexical-editor"); + if (i) try { + let s = JSON.parse(i); + if (s.namespace === n._config.namespace && Array.isArray(s.nodes)) { + let o = _W(s.nodes); + return C4(n, o, e); + } + } catch { + } + if (i = t.getData("text/html")) try { + var r = new DOMParser().parseFromString(i, "text/html"); + let s = vW.$generateNodesFromDOM(n, r); + return C4(n, s, e); + } catch { + } + if (t = t.getData("text/plain") || t.getData("text/uri-list"), t != null) if (wi.$isRangeSelection(e)) for (t = t.split(/(\r?\n|\t)/), t[t.length - 1] === "" && t.pop(), n = 0; n < t.length; n++) r = t[n], r === ` +` || r === `\r +` ? e.insertParagraph() : r === " " ? e.insertNodes([wi.$createTabNode()]) : e.insertText(r); + else e.insertRawText(t); +}; +jl.$insertGeneratedNodes = C4; +jl.copyToClipboard = async function(t, e) { + if ($d !== null) return !1; + if (e !== null) return new Promise((o) => { + t.update(() => { + o(FN(t, e)); + }); + }); + var n = t.getRootElement(); + let i = t._window == null ? window.document : t._window.document, r = bW ? (t._window || window).getSelection() : null; + if (n === null || r === null) return !1; + let s = i.createElement("span"); + return s.style.cssText = "position: fixed; top: -1000px;", s.append(i.createTextNode("#")), n.append(s), n = new Range(), n.setStart(s, 0), n.setEnd(s, 1), r.removeAllRanges(), r.addRange(n), new Promise((o) => { + let a = t.registerCommand(wi.COPY_COMMAND, (l) => (Oye.objectKlassEquals(l, ClipboardEvent) && (a(), $d !== null && (window.clearTimeout($d), $d = null), o(FN(t, l))), !0), wi.COMMAND_PRIORITY_CRITICAL); + $d = window.setTimeout(() => { + a(), $d = null, o(!1); + }, 50), i.execCommand("copy"), s.remove(); + }); +}; +const Sye = jl; +var mf = Sye, vw = mf, ab = Ri, wa = lt, ue = N; +function BN(t, e) { + return typeof document.caretRangeFromPoint < "u" ? (t = document.caretRangeFromPoint(t, e), t === null ? null : { node: t.startContainer, offset: t.startOffset }) : document.caretPositionFromPoint !== "undefined" ? (t = document.caretPositionFromPoint(t, e), t === null ? null : { node: t.offsetNode, offset: t.offset }) : null; +} +let fp = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Cye = fp && "documentMode" in document ? document.documentMode : null, Eye = fp && "InputEvent" in window && !Cye ? "getTargetRanges" in new window.InputEvent("input") : !1, Tye = fp && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), $ye = fp && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, Mye = fp && /^(?=.*Chrome).*/i.test(navigator.userAgent), Nye = fp && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !Mye, E4 = ue.createCommand("DRAG_DROP_PASTE_FILE"), eE = class OW extends ue.ElementNode { + static getType() { + return "quote"; + } + static clone(e) { + return new OW(e.__key); + } + constructor(e) { + super(e); + } + createDOM(e) { + let n = document.createElement("blockquote"); + return wa.addClassNamesToElement(n, e.theme.quote), n; + } + updateDOM() { + return !1; + } + static importDOM() { + return { blockquote: () => ({ conversion: Aye, priority: 0 }) }; + } + exportDOM(e) { + if ({ element: e } = super.exportDOM(e), e && wa.isHTMLElement(e)) { + this.isEmpty() && e.append(document.createElement("br")); + var n = this.getFormatType(); + e.style.textAlign = n, (n = this.getDirection()) && (e.dir = n); + } + return { element: e }; + } + static importJSON(e) { + let n = tE(); + return n.setFormat(e.format), n.setIndent(e.indent), n.setDirection(e.direction), n; + } + exportJSON() { + return { ...super.exportJSON(), type: "quote" }; + } + insertNewAfter(e, n) { + e = ue.$createParagraphNode(); + let i = this.getDirection(); + return e.setDirection(i), this.insertAfter(e, n), e; + } + collapseAtStart() { + let e = ue.$createParagraphNode(); + return this.getChildren().forEach((n) => e.append(n)), this.replace(e), !0; + } +}; +function tE() { + return ue.$applyNodeReplacement(new eE()); +} +let nE = class SW extends ue.ElementNode { + static getType() { + return "heading"; + } + static clone(e) { + return new SW(e.__tag, e.__key); + } + constructor(e, n) { + super(n), this.__tag = e; + } + getTag() { + return this.__tag; + } + createDOM(e) { + let n = this.__tag, i = document.createElement(n); + return e = e.theme.heading, e !== void 0 && wa.addClassNamesToElement(i, e[n]), i; + } + updateDOM() { + return !1; + } + static importDOM() { + return { h1: () => ({ conversion: Md, priority: 0 }), h2: () => ({ conversion: Md, priority: 0 }), h3: () => ({ conversion: Md, priority: 0 }), h4: () => ({ conversion: Md, priority: 0 }), h5: () => ({ + conversion: Md, + priority: 0 + }), h6: () => ({ conversion: Md, priority: 0 }), p: (e) => (e = e.firstChild, e !== null && zN(e) ? { conversion: () => ({ node: null }), priority: 3 } : null), span: (e) => zN(e) ? { conversion: () => ({ node: Jd("h1") }), priority: 3 } : null }; + } + exportDOM(e) { + if ({ element: e } = super.exportDOM(e), e && wa.isHTMLElement(e)) { + this.isEmpty() && e.append(document.createElement("br")); + var n = this.getFormatType(); + e.style.textAlign = n, (n = this.getDirection()) && (e.dir = n); + } + return { element: e }; + } + static importJSON(e) { + let n = Jd(e.tag); + return n.setFormat(e.format), n.setIndent(e.indent), n.setDirection(e.direction), n; + } + exportJSON() { + return { ...super.exportJSON(), tag: this.getTag(), type: "heading", version: 1 }; + } + insertNewAfter(e, n = !0) { + let i = e ? e.anchor.offset : 0, r = i !== this.getTextContentSize() && e ? Jd(this.getTag()) : ue.$createParagraphNode(), s = this.getDirection(); + return r.setDirection(s), this.insertAfter(r, n), i === 0 && !this.isEmpty() && e && (e = ue.$createParagraphNode(), e.select(), this.replace(e, !0)), r; + } + collapseAtStart() { + let e = this.isEmpty() ? ue.$createParagraphNode() : Jd(this.getTag()); + return this.getChildren().forEach((n) => e.append(n)), this.replace(e), !0; + } + extractWithChild() { + return !0; + } +}; +function zN(t) { + return t.nodeName.toLowerCase() === "span" ? t.style.fontSize === "26pt" : !1; +} +function Md(t) { + let e = t.nodeName.toLowerCase(), n = null; + return (e === "h1" || e === "h2" || e === "h3" || e === "h4" || e === "h5" || e === "h6") && (n = Jd(e), t.style !== null && n.setFormat(t.style.textAlign)), { node: n }; +} +function Aye(t) { + let e = tE(); + return t.style !== null && e.setFormat(t.style.textAlign), { node: e }; +} +function Jd(t) { + return ue.$applyNodeReplacement(new nE(t)); +} +function Dye(t, e) { + t.preventDefault(), e.update(() => { + let n = ue.$getSelection(), i = t instanceof InputEvent || t instanceof KeyboardEvent ? null : t.clipboardData; + i != null && n !== null && vw.$insertDataTransferForRichText(i, n, e); + }, { tag: "paste" }); +} +async function Pye(t, e) { + await vw.copyToClipboard(e, wa.objectKlassEquals(t, ClipboardEvent) ? t : null), e.update(() => { + let n = ue.$getSelection(); + ue.$isRangeSelection(n) ? n.removeText() : ue.$isNodeSelection(n) && n.getNodes().forEach((i) => i.remove()); + }); +} +function eg(t) { + let e = null; + if (t instanceof DragEvent ? e = t.dataTransfer : t instanceof ClipboardEvent && (e = t.clipboardData), e === null) return [!1, [], !1]; + var n = e.types; + return t = n.includes("Files"), n = n.includes("text/html") || n.includes("text/plain"), [t, Array.from(e.files), n]; +} +function WN(t) { + var e = ue.$getSelection(); + if (!ue.$isRangeSelection(e)) return !1; + let n = /* @__PURE__ */ new Set(); + e = e.getNodes(); + for (let s = 0; s < e.length; s++) { + var i = e[s], r = i.getKey(); + n.has(r) || (i = wa.$getNearestBlockElementAncestorOrThrow(i), r = i.getKey(), i.canIndent() && !n.has(r) && (n.add(r), t(i))); + } + return 0 < n.size; +} +function lb(t) { + return t = ue.$getNearestNodeFromDOMNode(t), ue.$isDecoratorNode(t); +} +Ba.$createHeadingNode = Jd; +Ba.$createQuoteNode = tE; +Ba.$isHeadingNode = function(t) { + return t instanceof nE; +}; +Ba.$isQuoteNode = function(t) { + return t instanceof eE; +}; +Ba.DRAG_DROP_PASTE = E4; +Ba.HeadingNode = nE; +Ba.QuoteNode = eE; +Ba.eventFiles = eg; +Ba.registerRichText = function(t) { + return wa.mergeRegister( + t.registerCommand(ue.CLICK_COMMAND, () => { + const e = ue.$getSelection(); + return ue.$isNodeSelection(e) ? (e.clear(), !0) : !1; + }, 0), + t.registerCommand(ue.DELETE_CHARACTER_COMMAND, (e) => { + const n = ue.$getSelection(); + return ue.$isRangeSelection(n) ? (n.deleteCharacter(e), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.DELETE_WORD_COMMAND, (e) => { + const n = ue.$getSelection(); + return ue.$isRangeSelection(n) ? (n.deleteWord(e), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.DELETE_LINE_COMMAND, (e) => { + const n = ue.$getSelection(); + return ue.$isRangeSelection(n) ? (n.deleteLine(e), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.CONTROLLED_TEXT_INSERTION_COMMAND, (e) => { + const n = ue.$getSelection(); + if (typeof e == "string") n !== null && n.insertText(e); + else { + if (n === null) return !1; + const i = e.dataTransfer; + i != null ? vw.$insertDataTransferForRichText(i, n, t) : ue.$isRangeSelection(n) && (e = e.data) && n.insertText(e); + } + return !0; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand( + ue.REMOVE_TEXT_COMMAND, + () => { + const e = ue.$getSelection(); + return ue.$isRangeSelection(e) ? (e.removeText(), !0) : !1; + }, + ue.COMMAND_PRIORITY_EDITOR + ), + t.registerCommand(ue.FORMAT_TEXT_COMMAND, (e) => { + const n = ue.$getSelection(); + return ue.$isRangeSelection(n) ? (n.formatText(e), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.FORMAT_ELEMENT_COMMAND, (e) => { + var n = ue.$getSelection(); + if (!ue.$isRangeSelection(n) && !ue.$isNodeSelection(n)) return !1; + n = n.getNodes(); + for (const i of n) n = wa.$findMatchingParent(i, (r) => ue.$isElementNode(r) && !r.isInline()), n !== null && n.setFormat(e); + return !0; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.INSERT_LINE_BREAK_COMMAND, (e) => { + const n = ue.$getSelection(); + return ue.$isRangeSelection(n) ? (n.insertLineBreak(e), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.INSERT_PARAGRAPH_COMMAND, () => { + const e = ue.$getSelection(); + return ue.$isRangeSelection(e) ? (e.insertParagraph(), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.INSERT_TAB_COMMAND, () => (ue.$insertNodes([ue.$createTabNode()]), !0), ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.INDENT_CONTENT_COMMAND, () => WN((e) => { + const n = e.getIndent(); + e.setIndent(n + 1); + }), ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.OUTDENT_CONTENT_COMMAND, () => WN((e) => { + const n = e.getIndent(); + 0 < n && e.setIndent(n - 1); + }), ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_ARROW_UP_COMMAND, (e) => { + var n = ue.$getSelection(); + if (ue.$isNodeSelection(n) && !lb(e.target)) { + if (e = n.getNodes(), 0 < e.length) return e[0].selectPrevious(), !0; + } else if (ue.$isRangeSelection(n) && (n = ue.$getAdjacentNode(n.focus, !0), !e.shiftKey && ue.$isDecoratorNode(n) && !n.isIsolated() && !n.isInline())) return n.selectPrevious(), e.preventDefault(), !0; + return !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_ARROW_DOWN_COMMAND, (e) => { + var n = ue.$getSelection(); + if (ue.$isNodeSelection(n)) { + if (e = n.getNodes(), 0 < e.length) return e[0].selectNext(0, 0), !0; + } else if (ue.$isRangeSelection(n)) { + let i = n.focus; + if (i.key === "root" && i.offset === ue.$getRoot().getChildrenSize()) return e.preventDefault(), !0; + if (n = ue.$getAdjacentNode(n.focus, !1), !e.shiftKey && ue.$isDecoratorNode(n) && !n.isIsolated() && !n.isInline()) return n.selectNext(), e.preventDefault(), !0; + } + return !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_ARROW_LEFT_COMMAND, (e) => { + const n = ue.$getSelection(); + if (ue.$isNodeSelection(n)) { + var i = n.getNodes(); + if (0 < i.length) return e.preventDefault(), i[0].selectPrevious(), !0; + } + return ue.$isRangeSelection(n) && ab.$shouldOverrideDefaultCharacterSelection(n, !0) ? (i = e.shiftKey, e.preventDefault(), ab.$moveCharacter(n, i, !0), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_ARROW_RIGHT_COMMAND, (e) => { + const n = ue.$getSelection(); + if (ue.$isNodeSelection(n) && !lb(e.target)) { + var i = n.getNodes(); + if (0 < i.length) return e.preventDefault(), i[0].selectNext(0, 0), !0; + } + return ue.$isRangeSelection(n) ? (i = e.shiftKey, ab.$shouldOverrideDefaultCharacterSelection(n, !1) ? (e.preventDefault(), ab.$moveCharacter(n, i, !1), !0) : !1) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_BACKSPACE_COMMAND, (e) => { + if (lb(e.target)) return !1; + const n = ue.$getSelection(); + if (!ue.$isRangeSelection(n)) return !1; + e.preventDefault(), { anchor: e } = n; + const i = e.getNode(); + return n.isCollapsed() && e.offset === 0 && !ue.$isRootNode(i) && 0 < wa.$getNearestBlockElementAncestorOrThrow(i).getIndent() ? t.dispatchCommand(ue.OUTDENT_CONTENT_COMMAND, void 0) : t.dispatchCommand(ue.DELETE_CHARACTER_COMMAND, !0); + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_DELETE_COMMAND, (e) => { + if (lb(e.target)) return !1; + const n = ue.$getSelection(); + return ue.$isRangeSelection(n) ? (e.preventDefault(), t.dispatchCommand(ue.DELETE_CHARACTER_COMMAND, !1)) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_ENTER_COMMAND, (e) => { + const n = ue.$getSelection(); + if (!ue.$isRangeSelection(n)) return !1; + if (e !== null) { + if (($ye || Tye || Nye) && Eye) return !1; + if (e.preventDefault(), e.shiftKey) return t.dispatchCommand(ue.INSERT_LINE_BREAK_COMMAND, !1); + } + return t.dispatchCommand(ue.INSERT_PARAGRAPH_COMMAND, void 0); + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.KEY_ESCAPE_COMMAND, () => { + const e = ue.$getSelection(); + return ue.$isRangeSelection(e) ? (t.blur(), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.DROP_COMMAND, (e) => { + const [, n] = eg(e); + if (0 < n.length) { + var i = BN(e.clientX, e.clientY); + if (i !== null) { + const { offset: s, node: o } = i; + var r = ue.$getNearestNodeFromDOMNode(o); + if (r !== null) { + if (i = ue.$createRangeSelection(), ue.$isTextNode(r)) i.anchor.set(r.getKey(), s, "text"), i.focus.set(r.getKey(), s, "text"); + else { + const a = r.getParentOrThrow().getKey(); + r = r.getIndexWithinParent() + 1, i.anchor.set(a, r, "element"), i.focus.set(a, r, "element"); + } + i = ue.$normalizeSelection__EXPERIMENTAL(i), ue.$setSelection(i); + } + t.dispatchCommand(E4, n); + } + return e.preventDefault(), !0; + } + return e = ue.$getSelection(), !!ue.$isRangeSelection(e); + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.DRAGSTART_COMMAND, (e) => { + [e] = eg(e); + const n = ue.$getSelection(); + return !(e && !ue.$isRangeSelection(n)); + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.DRAGOVER_COMMAND, (e) => { + var [n] = eg(e); + const i = ue.$getSelection(); + return n && !ue.$isRangeSelection(i) ? !1 : (n = BN(e.clientX, e.clientY), n !== null && (n = ue.$getNearestNodeFromDOMNode(n.node), ue.$isDecoratorNode(n) && e.preventDefault()), !0); + }, ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.SELECT_ALL_COMMAND, () => (ue.$selectAll(), !0), ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.COPY_COMMAND, (e) => (vw.copyToClipboard(t, wa.objectKlassEquals(e, ClipboardEvent) ? e : null), !0), ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.CUT_COMMAND, (e) => (Pye(e, t), !0), ue.COMMAND_PRIORITY_EDITOR), + t.registerCommand(ue.PASTE_COMMAND, (e) => { + const [, n, i] = eg(e); + return 0 < n.length && !i ? (t.dispatchCommand(E4, n), !0) : ue.isSelectionCapturedInDecoratorInput(e.target) ? !1 : ue.$getSelection() !== null ? (Dye(e, t), !0) : !1; + }, ue.COMMAND_PRIORITY_EDITOR) + ); +}; +const Iye = Ba; +var rn = Iye; +class iE extends N.DecoratorNode { +} +function qc(t) { + return t instanceof iE; +} +function Lye(t, e) { + const n = `__${e}`, i = `${n}Editor`, r = t[i] || t[n]; + if (!r) + return ""; + if (typeof r == "string") + return r; + if (typeof r == "number") + return r.toString(); + if (typeof r.getEditorState == "function") { + let s = ""; + return r.getEditorState().read(() => { + s = N.$getRoot().getTextContent(); + }), s; + } + return ""; +} +function Ir(t) { + return { + element: t.createElement("span"), + type: "inner" + }; +} +const lo = "status:free,status:-free", CW = "status:-free", EW = "status:free", Yc = "", Rye = { + web: { + nonMember: !0, + memberSegment: lo + }, + email: { + memberSegment: lo + } +}; +function Fc(t) { + return t == null; +} +function bw() { + return JSON.parse(JSON.stringify(Rye)); +} +function rE(t) { + return !Object.prototype.hasOwnProperty.call(t, "web") || !Object.prototype.hasOwnProperty.call(t, "email") || !Object.prototype.hasOwnProperty.call(t.web, "nonMember") || Fc(t.web.memberSegment) || Fc(t.email.memberSegment); +} +function TW(t) { + return rE(t) ? t.showOnEmail === !1 || t.showOnWeb === !1 || t.emailOnly === !0 || t.segment !== "" : t.web.nonMember === !1 || t.web.memberSegment !== lo || t.email.memberSegment !== lo; +} +function sE(t) { + if (!t || !rE(t)) + return t; + const e = JSON.parse(JSON.stringify(t)); + return e.web ?? (e.web = {}), e.email ?? (e.email = {}), Fc(t.showOnWeb) && Fc(t.emailOnly) ? e.web = bw().web : Fc(t.emailOnly) ? (e.web.nonMember = t.showOnWeb, e.web.memberSegment = t.showOnWeb ? lo : Yc) : (e.web.nonMember = !t.emailOnly, e.web.memberSegment = t.emailOnly ? Yc : lo), Fc(t.showOnEmail) && Fc(t.emailOnly) ? e.email = bw().email : t.showOnEmail === !1 || t.segment === "status:-free+status:-paid" ? e.email.memberSegment = Yc : t.segment === "status:free" ? e.email.memberSegment = EW : t.segment === "status:paid" || t.segment === "status:-free" ? e.email.memberSegment = CW : t.segment || (e.email.memberSegment = lo), e; +} +function s0(t, e, n) { + const i = t.element.ownerDocument, r = jye(t); + return e = sE(e), n.target === "email" ? e.email.memberSegment === Yc ? Ir(i) : e.email.memberSegment === lo ? t : Fye(i, r, e.email) : e.web.nonMember === !1 && e.web.memberSegment === Yc ? Ir(i) : e.web.nonMember !== !0 || e.web.memberSegment !== lo ? Bye(i, r, e.web) : t; +} +function jye({ + element: t, + type: e +}) { + return e === "inner" ? t.innerHTML : e === "value" ? "value" in t ? t.value : "" : t.outerHTML; +} +function Fye(t, e, n) { + const { + memberSegment: i + } = n, r = t.createElement("div"); + return r.innerHTML = e, r.setAttribute("data-gh-segment", i), r.classList.add("kg-visibility-wrapper"), { + element: r, + type: "html" + }; +} +function Bye(t, e, n) { + const { + nonMember: i, + memberSegment: r + } = n, s = ` +${e} +`, o = t.createElement("textarea"); + return o.value = s, { + element: o, + type: "value" + }; +} +var zye = /* @__PURE__ */ Object.freeze({ + __proto__: null, + ALL_MEMBERS_SEGMENT: lo, + FREE_MEMBERS_SEGMENT: EW, + NO_MEMBERS_SEGMENT: Yc, + PAID_MEMBERS_SEGMENT: CW, + buildDefaultVisibility: bw, + isOldVisibilityFormat: rE, + isVisibilityRestricted: TW, + migrateOldVisibilityFormat: sE, + renderWithVisibility: s0 +}); +function Wye(t, e) { + if (!t) + throw new Error({ + message: '[generateDecoratorNode] A unique "nodeType" should be provided' + }); + e.forEach((n) => { + if (!("name" in n) || !("default" in n)) + throw new Error({ + message: '[generateDecoratorNode] Properties should have both "name" and "default" attributes.' + }); + if (n.urlType && !["url", "html", "markdown"].includes(n.urlType)) + throw new Error({ + message: '[generateDecoratorNode] "urlType" should be either "url", "html" or "markdown"' + }); + if ("wordCount" in n && typeof n.wordCount != "boolean") + throw new Error({ + message: '[generateDecoratorNode] "wordCount" should be of boolean type.' + }); + }); +} +function Yn({ + nodeType: t, + properties: e = [], + defaultRenderFn: n, + version: i = 1, + hasVisibility: r = !1 +}) { + Wye(t, e), e = e.map((o) => ({ + ...o, + privateName: `__${o.name}` + })), r && e.push({ + name: "visibility", + get default() { + return bw(); + }, + privateName: "__visibility" + }); + class s extends iE { + constructor(a = {}, l) { + super(l), e.forEach((u) => { + typeof u.default == "boolean" ? this[u.privateName] = a[u.name] ?? u.default : this[u.privateName] = a[u.name] || u.default; + }); + } + /** + * Returns the node's unique type + * @extends DecoratorNode + * @see https://lexical.dev/docs/concepts/nodes#extending-decoratornode + * @returns {string} + */ + static getType() { + return t; + } + /** + * Creates a copy of an existing node with all its properties + * @extends DecoratorNode + * @see https://lexical.dev/docs/concepts/nodes#extending-decoratornode + */ + static clone(a) { + return new this(a.getDataset(), a.__key); + } + /** + * Returns default values for any properties, allowing our editor code + * to detect when a property has been changed + */ + static getPropertyDefaults() { + return e.reduce((a, l) => (a[l.name] = l.default, a), {}); + } + /** + * Transforms URLs contained in the payload to relative paths (`__GHOST_URL__/relative/path/`), + * so that URLs to be changed without having to update the database + * @see https://github.com/TryGhost/SDK/tree/main/packages/url-utils + */ + static get urlTransformMap() { + let a = {}; + return e.forEach((l) => { + l.urlType && (l.urlPath ? a[l.urlPath] = l.urlType : a[l.name] = l.urlType); + }), a; + } + /** + * Convenience method to get all properties of the node + * @returns {Object} - The node's properties + */ + getDataset() { + const a = this.getLatest(); + let l = {}; + return e.forEach((u) => { + l[u.name] = a[u.privateName]; + }), l; + } + /** + * Converts JSON to a Lexical node + * @see https://lexical.dev/docs/concepts/serialization#lexicalnodeimportjson + * @extends DecoratorNode + * @param {Object} serializedNode - Lexical's representation of the node, in JSON format + */ + static importJSON(a) { + const l = {}; + return a.visibility = sE(a.visibility), e.forEach((u) => { + l[u.name] = a[u.name]; + }), new this(l); + } + /** + * Serializes a Lexical node to JSON. The JSON content is then saved to the database. + * @extends DecoratorNode + * @see https://lexical.dev/docs/concepts/serialization#lexicalnodeexportjson + */ + exportJSON() { + return { + type: t, + version: i, + ...e.reduce((l, u) => (l[u.name] = this[u.name], l), {}) + }; + } + exportDOM(a = {}) { + var f; + const l = this.__version || i; + if ((f = a.nodeRenderers) != null && f[t]) { + const d = a.nodeRenderers[t]; + if (typeof d == "object") { + const h = d[l]; + if (!h) + throw new Error(`[generateDecoratorNode] ${t}: options.nodeRenderers['${t}'] for version ${l} is required`); + return h(this, a); + } else + return d(this, a); + } + if (typeof n == "object") { + const d = n[l]; + if (!d) + throw new Error(`[generateDecoratorNode] ${t}: "defaultRenderFn" for version ${l} is required`); + return d(this, a); + } + if (!n) + throw new Error(`[generateDecoratorNode] ${t}: "defaultRenderFn" is required`); + return n(this, a); + } + /* c8 ignore start */ + /** + * Inserts node in the DOM. Required when extending the DecoratorNode. + * @extends DecoratorNode + * @see https://lexical.dev/docs/concepts/nodes#extending-decoratornode + */ + createDOM() { + return document.createElement("div"); + } + /** + * Required when extending the DecoratorNode + * @extends DecoratorNode + * @see https://lexical.dev/docs/concepts/nodes#extending-decoratornode + */ + updateDOM() { + return !1; + } + /** + * Defines whether a node is a top-level block. + * @see https://lexical.dev/docs/api/classes/lexical.DecoratorNode#isinline + */ + isInline() { + return !1; + } + /* c8 ignore stop */ + /** + * Defines whether a node has dynamic data that needs to be fetched from the server when rendering + */ + hasDynamicData() { + return !1; + } + /** + * Defines whether a node has an edit mode in the editor UI + */ + hasEditMode() { + return !0; + } + /* + * Returns the text content of the node, used by the editor to calculate the word count + * This method filters out properties without `wordCount: true` + */ + getTextContent() { + const a = this.getLatest(), u = e.filter((f) => !!f.wordCount).map((f) => Lye(a, f.name)).filter(Boolean).join(` +`); + return u ? `${u} + +` : ""; + } + /** + * Returns true/false for whether the node's visibility property + * is active or not. Always false if a node has no visibility property + * @returns {boolean} + */ + getIsVisibilityActive() { + if (!e.some((u) => u.name === "visibility")) + return !1; + const l = this.getLatest().__visibility; + return TW(l); + } + } + return e.forEach((o) => { + Object.defineProperty(s.prototype, o.name, { + get: function() { + return this.getLatest()[o.privateName]; + }, + set: function(a) { + const l = this.getWritable(); + l[o.privateName] = a; + } + }); + }), s; +} +function $W(t) { + return function(n, i = {}) { + return mi(n, { + createDocument: (s) => { + const o = t.ownerDocument.implementation.createHTMLDocument(); + return o.body.innerHTML = s, o; + }, + ...i + }); + }; +} +function Io(t, { + selector: e = "figcaption" +} = {}) { + const n = $W(t); + let i; + const r = Array.from(t.querySelectorAll(e)); + return r.length && r.forEach((s) => { + const o = n(s.innerHTML); + i = i ? `${i} / ${o}` : o; + }), i; +} +function yw(t) { + const e = {}; + if (t.src && (e.src = t.src), t.width ? e.width = t.width : t.dataset && t.dataset.width && (e.width = parseInt(t.dataset.width, 10)), t.height ? e.height = t.height : t.dataset && t.dataset.height && (e.height = parseInt(t.dataset.height, 10)), !t.width && !t.height && t.getAttribute("data-image-dimensions")) { + const [, n, i] = /^(\d*)x(\d*)$/gi.exec(t.getAttribute("data-image-dimensions")); + e.width = parseInt(n, 10), e.height = parseInt(i, 10); + } + if (t.alt && (e.alt = t.alt), t.title && (e.title = t.title), t.parentNode.tagName === "A") { + const n = t.parentNode.href; + n !== e.src && (e.href = n); + } + return e; +} +function Hye(t) { + return { + img: () => ({ + conversion(e) { + if (e.tagName === "IMG") { + const { + src: n, + width: i, + height: r, + alt: s, + title: o, + href: a + } = yw(e); + return { + node: new t({ + alt: s, + src: n, + title: o, + width: i, + height: r, + href: a + }) + }; + } + return null; + }, + priority: 1 + }), + figure: (e) => { + const n = e.querySelector("img"); + return n ? { + conversion(i) { + const r = i.className.match(/kg-width-(wide|full)/), s = i.className.match(/graf--layout(FillWidth|OutsetCenter)/); + if (!n) + return null; + const o = yw(n); + r ? o.cardWidth = r[1] : s && (o.cardWidth = s[1] === "FillWidth" ? "full" : "wide"), o.caption = Io(i); + const { + src: a, + width: l, + height: u, + alt: f, + title: d, + caption: h, + cardWidth: m, + href: g + } = o; + return { + node: new t({ + alt: f, + src: a, + title: d, + width: l, + height: u, + caption: h, + cardWidth: m, + href: g + }) + }; + }, + priority: 0 + // since we are generically parsing figure elements, we want this to run after others (like the gallery) + } : null; + } + }; +} +const oE = function(t, e) { + const n = Object.values(e).map(({ + width: r + }) => r).sort((r, s) => r - s), i = n.filter((r) => r <= t.width); + return t.width > i[i.length - 1] && t.width < n[n.length - 1] && i.push(t.width), i; +}, gf = function(t, e = "") { + const n = e.replace(/\/$/, ""), i = t.replace(n, ""); + return /^(\/.*|__GHOST_URL__)\/?content\/images\//.test(i); +}, MW = function(t) { + return /images\.unsplash\.com/.test(t); +}, NW = function({ + src: t, + width: e, + options: n +}) { + if (!n.imageOptimization || n.imageOptimization.srcsets === !1 || !e || !n.imageOptimization.contentImageSizes || gf(t, n.siteUrl) && n.canTransformImage && !n.canTransformImage(t)) + return; + const i = oE({ + width: e + }, n.imageOptimization.contentImageSizes); + if (gf(t, n.siteUrl)) { + const [, r, s] = t.match(/(.*\/content\/images)\/(.*)/), o = []; + if (i.forEach((a) => { + a === e ? o.push(`${t} ${a}w`) : a <= e && o.push(`${r}/size/w${a}/${s} ${a}w`); + }), o.length) + return o.join(", "); + } + if (MW(t)) { + const r = new URL(t), s = []; + return i.forEach((o) => { + r.searchParams.set("w", o), s.push(`${r.href} ${o}w`); + }), s.join(", "); + } +}, AW = function(t, e, n) { + if (!t || !["IMG", "SOURCE"].includes(t.tagName) || !t.getAttribute("src") || !e) + return; + const { + src: i, + width: r + } = e, s = NW({ + src: i, + width: r, + options: n + }); + s && t.setAttribute("srcset", s); +}, Eh = function(t, { + width: e, + height: n +} = {}) { + const { + width: i, + height: r + } = t, s = i / r; + if (e) { + const o = Math.round(e / s); + return { + width: e, + height: o + }; + } + if (n) + return { + width: Math.round(n * s), + height: n + }; +}; +function Vn(t) { + if (!t.createDocument && t.dom && (t.createDocument = function() { + return t.dom.window.document; + }), !t.createDocument) { + let e = typeof window < "u" && window.document; + if (!e) + throw new Error("Must be passed a `createDocument` function as an option when used in a non-browser environment"); + t.createDocument = function() { + return e; + }; + } +} +function Qye(t, e = {}) { + var l; + Vn(e); + const n = e.createDocument(); + if (!t.src || t.src.trim() === "") + return Ir(n); + const i = n.createElement("figure"); + let r = "kg-card kg-image-card"; + t.cardWidth !== "regular" && (r += ` kg-width-${t.cardWidth}`), t.caption && (r += " kg-card-hascaption"), i.setAttribute("class", r); + const s = n.createElement("img"); + s.setAttribute("src", t.src), s.setAttribute("class", "kg-image"), s.setAttribute("alt", t.alt), s.setAttribute("loading", "lazy"), t.title && s.setAttribute("title", t.title), t.width && t.height && (s.setAttribute("width", t.width), s.setAttribute("height", t.height)); + const { + canTransformImage: o + } = e, { + defaultMaxWidth: a + } = e.imageOptimization || {}; + if (a && t.width > a && gf(t.src, e.siteUrl) && o && o(t.src)) { + const u = { + width: t.width, + height: t.height + }, { + width: f, + height: d + } = Eh(u, { + width: a + }); + s.setAttribute("width", f), s.setAttribute("height", d); + } + if (e.target !== "email") { + const u = { + src: t.src, + width: t.width, + height: t.height + }; + AW(s, u, e), s.getAttribute("srcset") && t.width && t.width >= 720 && ((!t.cardWidth || t.cardWidth === "regular") && s.setAttribute("sizes", "(min-width: 720px) 720px"), t.cardWidth === "wide" && t.width >= 1200 && s.setAttribute("sizes", "(min-width: 1200px) 1200px")); + } + if (e.target === "email" && t.width && t.height) { + let u = { + width: t.width, + height: t.height + }; + if (t.width >= 600 && (u = Eh(u, { + width: 600 + })), s.setAttribute("width", u.width), s.setAttribute("height", u.height), gf(t.src, e.siteUrl) && ((l = e.canTransformImage) != null && l.call(e, t.src))) { + const d = oE(t, e.imageOptimization.contentImageSizes).find((h) => h >= 1200); + if (!(!d || d === t.width)) { + const [, h, m] = t.src.match(/(.*\/content\/images)\/(.*)/); + s.setAttribute("src", `${h}/size/w${d}/${m}`); + } + } + } + if (t.href) { + const u = n.createElement("a"); + u.setAttribute("href", t.href), u.appendChild(s), i.appendChild(u); + } else + i.appendChild(s); + if (t.caption) { + const u = n.createElement("figcaption"); + u.innerHTML = t.caption, i.appendChild(u); + } + return { + element: i + }; +} +let h1 = class extends Yn({ + nodeType: "image", + properties: [{ + name: "src", + default: "", + urlType: "url" + }, { + name: "caption", + default: "", + urlType: "html", + wordCount: !0 + }, { + name: "title", + default: "" + }, { + name: "alt", + default: "" + }, { + name: "cardWidth", + default: "regular" + }, { + name: "width", + default: null + }, { + name: "height", + default: null + }, { + name: "href", + default: "", + urlType: "url" + }], + defaultRenderFn: Qye +}) { + /* @override */ + exportJSON() { + const { + src: e, + width: n, + height: i, + title: r, + alt: s, + caption: o, + cardWidth: a, + href: l + } = this; + return { + type: "image", + version: 1, + src: e && e.startsWith("data:") ? "" : e, + width: n, + height: i, + title: r, + alt: s, + caption: o, + cardWidth: a, + href: l + }; + } + static importDOM() { + return Hye(this); + } + hasEditMode() { + return !1; + } +}; +const Uye = (t) => new h1(t); +function Zye(t) { + return t instanceof h1; +} +function qye(t) { + return { + figure: (e) => { + const n = e.querySelector("pre"); + return e.tagName === "FIGURE" && n ? { + conversion(i) { + let r = n.querySelector("code"), s = i.querySelector("figcaption"); + if (!r || !s) + return null; + let o = { + code: r.textContent, + caption: Io(i) + }, a = n.getAttribute("class") || "", l = r.getAttribute("class") || "", u = /lang(?:uage)?-(.*?)(?:\s|$)/i, f = a.match(u) || l.match(u); + return f && (o.language = f[1].toLowerCase()), { + node: new t(o) + }; + }, + priority: 2 + // falls back to pre if no caption + } : null; + }, + pre: () => ({ + conversion(e) { + if (e.tagName === "PRE") { + let [n] = e.children; + if (n && n.tagName === "CODE") { + let i = { + code: n.textContent + }, r = e.getAttribute("class") || "", s = n.getAttribute("class") || "", o = /lang(?:uage)?-(.*?)(?:\s|$)/i, a = r.match(o) || s.match(o); + return a && (i.language = a[1].toLowerCase()), { + node: new t(i) + }; + } + } + return null; + }, + priority: 1 + }) + }; +} +function Yye(t, e = {}) { + Vn(e); + const n = e.createDocument(); + if (!t.code || t.code.trim() === "") + return Ir(n); + const i = n.createElement("pre"), r = n.createElement("code"); + if (t.language && r.setAttribute("class", `language-${t.language}`), r.appendChild(n.createTextNode(t.code)), i.appendChild(r), t.caption) { + let s = n.createElement("figure"); + s.setAttribute("class", "kg-card kg-code-card"), s.appendChild(i); + let o = n.createElement("figcaption"); + return o.innerHTML = t.caption, s.appendChild(o), { + element: s + }; + } else + return { + element: i + }; +} +let p1 = class extends Yn({ + nodeType: "codeblock", + properties: [{ + name: "code", + default: "", + wordCount: !0 + }, { + name: "language", + default: "" + }, { + name: "caption", + default: "", + urlType: "html", + wordCount: !0 + }], + defaultRenderFn: Yye +}) { + static importDOM() { + return qye(this); + } + isEmpty() { + return !this.__code; + } +}; +function Vye(t) { + return new p1(t); +} +function Xye(t) { + return t instanceof p1; +} +function Gye(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = Aue.render(t.markdown || "", e), r = n.createElement("div"); + return r.innerHTML = i, { + element: r, + type: "inner" + }; +} +let m1 = class extends Yn({ + nodeType: "markdown", + properties: [{ + name: "markdown", + default: "", + urlType: "markdown", + wordCount: !0 + }], + defaultRenderFn: Gye +}) { + isEmpty() { + return !this.__markdown; + } +}; +function Kye(t) { + return new m1(t); +} +function Jye(t) { + return t instanceof m1; +} +function ewe(t) { + return { + figure: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-video-card"); + return e.tagName === "FIGURE" && n ? { + conversion(r) { + const s = r.querySelector(".kg-video-container video"), o = r.querySelector(".kg-video-duration"), a = s && s.src, l = s && s.width, u = s && s.height, f = o && o.innerHTML.trim(), d = Io(r); + if (!a) + return null; + const h = { + src: a, + loop: !!s.loop, + cardWidth: twe(s) + }; + if (f) { + const [g, w] = f.split(":"); + try { + h.duration = parseInt(g) * 60 + parseInt(w); + } catch { + } + } + return r.dataset.kgThumbnail && (h.thumbnailSrc = r.dataset.kgThumbnail), r.dataset.kgCustomThumbnail && (h.customThumbnailSrc = r.dataset.kgCustomThumbnail), d && (h.caption = d), l && (h.width = l), u && (h.height = u), { + node: new t(h) + }; + }, + priority: 1 + } : null; + } + }; +} +function twe(t) { + return t.classList.contains("kg-width-full") ? "full" : t.classList.contains("kg-width-wide") ? "wide" : "regular"; +} +function nwe(t, e = {}) { + Vn(e); + const n = e.createDocument(); + if (!t.src || t.src.trim() === "") + return Ir(n); + const i = swe(t).join(" "), r = e.target === "email" ? rwe({ + node: t, + options: e, + cardClasses: i + }) : iwe({ + node: t, + cardClasses: i + }), s = n.createElement("div"); + return s.innerHTML = r.trim(), { + element: s.firstElementChild + }; +} +function iwe({ + node: t, + cardClasses: e +}) { + const n = t.width, i = t.height, r = `https://img.spacergif.org/v1/${n}x${i}/0a/spacer.png`, s = t.loop ? "loop autoplay muted" : "", o = t.customThumbnailSrc || t.thumbnailSrc, a = t.loop ? " kg-video-hide" : ""; + return ` +
    +
    + +
    + +
    +
    +
    + + + 0:00 +
    + /${t.formattedDuration} +
    + + + + + +
    +
    +
    + ${t.caption ? `
    ${t.caption}
    ` : ""} +
    + `; +} +function rwe({ + node: t, + options: e, + cardClasses: n +}) { + const i = t.customThumbnailSrc || t.thumbnailSrc, r = 600, s = t.width / t.height, o = Math.round(r / 4), a = Math.round(r / s), l = `https://img.spacergif.org/v1/${o}x${a}/0a/spacer.png`, u = Math.round(r / 2 - 39), f = Math.round(a / 2 - 39), d = Math.round(r / 2 - 11), h = Math.round(a / 2 - 17); + return ` +
    + + + + + + + + +
    + + +
    +
     
    +
    + + + + + ${t.caption ? `
    ${t.caption}
    ` : ""} +
    + `; +} +function swe(t) { + let e = ["kg-card kg-video-card"]; + return t.cardWidth && e.push(`kg-width-${t.cardWidth}`), t.caption && e.push("kg-card-hascaption"), e; +} +let g1 = class extends Yn({ + nodeType: "video", + properties: [{ + name: "src", + default: "", + urlType: "url" + }, { + name: "caption", + default: "", + urlType: "html", + wordCount: !0 + }, { + name: "fileName", + default: "" + }, { + name: "mimeType", + default: "" + }, { + name: "width", + default: null + }, { + name: "height", + default: null + }, { + name: "duration", + default: 0 + }, { + name: "thumbnailSrc", + default: "", + urlType: "url" + }, { + name: "customThumbnailSrc", + default: "", + urlType: "url" + }, { + name: "thumbnailWidth", + default: null + }, { + name: "thumbnailHeight", + default: null + }, { + name: "cardWidth", + default: "regular" + }, { + name: "loop", + default: !1 + }], + defaultRenderFn: nwe +}) { + /* override */ + exportJSON() { + const { + src: e, + caption: n, + fileName: i, + mimeType: r, + width: s, + height: o, + duration: a, + thumbnailSrc: l, + customThumbnailSrc: u, + thumbnailWidth: f, + thumbnailHeight: d, + cardWidth: h, + loop: m + } = this; + return { + type: "video", + version: 1, + src: e && e.startsWith("data:") ? "" : e, + caption: n, + fileName: i, + mimeType: r, + width: s, + height: o, + duration: a, + thumbnailSrc: l, + customThumbnailSrc: u, + thumbnailWidth: f, + thumbnailHeight: d, + cardWidth: h, + loop: m + }; + } + static importDOM() { + return ewe(this); + } + get formattedDuration() { + const e = Math.floor(this.duration / 60), n = Math.floor(this.duration - e * 60), i = String(n).padStart(2, "0"); + return `${e}:${i}`; + } +}; +const owe = (t) => new g1(t); +function awe(t) { + return t instanceof g1; +} +function lwe(t) { + return { + div: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-audio-card"); + return e.tagName === "DIV" && n ? { + conversion(r) { + const s = r == null ? void 0 : r.querySelector(".kg-audio-title"), o = r == null ? void 0 : r.querySelector(".kg-audio-player-container audio"), a = r == null ? void 0 : r.querySelector(".kg-audio-duration"), l = r == null ? void 0 : r.querySelector(".kg-audio-thumbnail"), u = s && s.innerHTML.trim(), f = o && o.src, d = l && l.src, h = a && a.innerHTML.trim(), m = { + src: f, + title: u + }; + if (d && (m.thumbnailSrc = d), h) { + const [w, x = 0] = h.split(":"); + try { + m.duration = parseInt(w) * 60 + parseInt(x); + } catch { + } + } + return { + node: new t(m) + }; + }, + priority: 1 + } : null; + } + }; +} +function uwe(t, e = {}) { + Vn(e); + const n = e.createDocument(); + if (!t.src || t.src.trim() === "") + return Ir(n); + const i = dwe(t), r = hwe(t); + return e.target === "email" ? fwe(t, n, e, i, r) : cwe(t, n, i, r); +} +function cwe(t, e, n, i) { + const r = e.createElement("div"); + r.setAttribute("class", "kg-card kg-audio-card"); + const s = e.createElement("img"); + s.src = t.thumbnailSrc, s.alt = "audio-thumbnail", s.setAttribute("class", n), r.appendChild(s); + const o = e.createElement("div"); + o.setAttribute("class", i); + const a = e.createElementNS("http://www.w3.org/2000/svg", "svg"); + a.setAttribute("width", "24"), a.setAttribute("height", "24"), a.setAttribute("fill", "none"); + const l = e.createElementNS("http://www.w3.org/2000/svg", "path"); + l.setAttribute("fill-rule", "evenodd"), l.setAttribute("clip-rule", "evenodd"), l.setAttribute("d", "M7.5 15.33a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm-2.25.75a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0ZM15 13.83a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm-2.25.75a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0Z"), a.appendChild(l); + const u = e.createElementNS("http://www.w3.org/2000/svg", "path"); + u.setAttribute("fill-rule", "evenodd"), u.setAttribute("clip-rule", "evenodd"), u.setAttribute("d", "M14.486 6.81A2.25 2.25 0 0 1 17.25 9v5.579a.75.75 0 0 1-1.5 0v-5.58a.75.75 0 0 0-.932-.727.755.755 0 0 1-.059.013l-4.465.744a.75.75 0 0 0-.544.72v6.33a.75.75 0 0 1-1.5 0v-6.33a2.25 2.25 0 0 1 1.763-2.194l4.473-.746Z"), a.appendChild(u); + const f = e.createElementNS("http://www.w3.org/2000/svg", "path"); + f.setAttribute("fill-rule", "evenodd"), f.setAttribute("clip-rule", "evenodd"), f.setAttribute("d", "M3 1.5a.75.75 0 0 0-.75.75v19.5a.75.75 0 0 0 .75.75h18a.75.75 0 0 0 .75-.75V5.133a.75.75 0 0 0-.225-.535l-.002-.002-3-2.883A.75.75 0 0 0 18 1.5H3ZM1.409.659A2.25 2.25 0 0 1 3 0h15a2.25 2.25 0 0 1 1.568.637l.003.002 3 2.883a2.25 2.25 0 0 1 .679 1.61V21.75A2.25 2.25 0 0 1 21 24H3a2.25 2.25 0 0 1-2.25-2.25V2.25c0-.597.237-1.169.659-1.591Z"), a.appendChild(f), o.appendChild(a), r.appendChild(o); + const d = e.createElement("div"); + d.setAttribute("class", "kg-audio-player-container"); + const h = e.createElement("audio"); + h.setAttribute("src", t.src), h.setAttribute("preload", "metadata"), d.appendChild(h); + const m = e.createElement("div"); + m.setAttribute("class", "kg-audio-title"), m.textContent = t.title, d.appendChild(m); + const g = e.createElement("div"); + g.setAttribute("class", "kg-audio-player"); + const w = e.createElement("button"); + w.setAttribute("class", "kg-audio-play-icon"), w.setAttribute("aria-label", "Play audio"); + const x = e.createElementNS("http://www.w3.org/2000/svg", "svg"); + x.setAttribute("viewBox", "0 0 24 24"); + const _ = e.createElementNS("http://www.w3.org/2000/svg", "path"); + _.setAttribute("d", "M23.14 10.608 2.253.164A1.559 1.559 0 0 0 0 1.557v20.887a1.558 1.558 0 0 0 2.253 1.392L23.14 13.393a1.557 1.557 0 0 0 0-2.785Z"), x.appendChild(_), w.appendChild(x), g.appendChild(w); + const S = e.createElement("button"); + S.setAttribute("class", "kg-audio-pause-icon kg-audio-hide"), S.setAttribute("aria-label", "Pause audio"); + const C = e.createElementNS("http://www.w3.org/2000/svg", "svg"); + C.setAttribute("viewBox", "0 0 24 24"); + const E = e.createElementNS("http://www.w3.org/2000/svg", "rect"); + E.setAttribute("x", "3"), E.setAttribute("y", "1"), E.setAttribute("width", "7"), E.setAttribute("height", "22"), E.setAttribute("rx", "1.5"), E.setAttribute("ry", "1.5"), C.appendChild(E); + const M = e.createElementNS("http://www.w3.org/2000/svg", "rect"); + M.setAttribute("x", "14"), M.setAttribute("y", "1"), M.setAttribute("width", "7"), M.setAttribute("height", "22"), M.setAttribute("rx", "1.5"), M.setAttribute("ry", "1.5"), C.appendChild(M), S.appendChild(C), g.appendChild(S); + const $ = e.createElement("span"); + $.setAttribute("class", "kg-audio-current-time"), $.textContent = "0:00", g.appendChild($); + const P = e.createElement("div"); + P.setAttribute("class", "kg-audio-time"), P.textContent = "/"; + const W = e.createElement("span"); + W.setAttribute("class", "kg-audio-duration"), W.textContent = t.duration, P.appendChild(W), g.appendChild(P); + const z = e.createElement("input"); + z.setAttribute("type", "range"), z.setAttribute("class", "kg-audio-seek-slider"), z.setAttribute("max", "100"), z.setAttribute("value", "0"), g.appendChild(z); + const Z = e.createElement("button"); + Z.setAttribute("class", "kg-audio-playback-rate"), Z.setAttribute("aria-label", "Adjust playback speed"), Z.innerHTML = "1×", g.appendChild(Z); + const L = e.createElement("button"); + L.setAttribute("class", "kg-audio-unmute-icon"), L.setAttribute("aria-label", "Unmute"); + const Q = e.createElementNS("http://www.w3.org/2000/svg", "svg"); + Q.setAttribute("viewBox", "0 0 24 24"); + const V = e.createElementNS("http://www.w3.org/2000/svg", "path"); + V.setAttribute("d", "M15.189 2.021a9.728 9.728 0 0 0-7.924 4.85.249.249 0 0 1-.221.133H5.25a3 3 0 0 0-3 3v2a3 3 0 0 0 3 3h1.794a.249.249 0 0 1 .221.133 9.73 9.73 0 0 0 7.924 4.85h.06a1 1 0 0 0 1-1V3.02a1 1 0 0 0-1.06-.998Z"), Q.appendChild(V), L.appendChild(Q), g.appendChild(L); + const H = e.createElement("button"); + H.setAttribute("class", "kg-audio-mute-icon kg-audio-hide"), H.setAttribute("aria-label", "Mute"); + const R = e.createElementNS("http://www.w3.org/2000/svg", "svg"); + R.setAttribute("viewBox", "0 0 24 24"); + const q = e.createElementNS("http://www.w3.org/2000/svg", "path"); + q.setAttribute("d", "M16.177 4.3a.248.248 0 0 0 .073-.176v-1.1a1 1 0 0 0-1.061-1 9.728 9.728 0 0 0-7.924 4.85.249.249 0 0 1-.221.133H5.25a3 3 0 0 0-3 3v2a3 3 0 0 0 3 3h.114a.251.251 0 0 0 .177-.073ZM23.707 1.706A1 1 0 0 0 22.293.292l-22 22a1 1 0 0 0 0 1.414l.009.009a1 1 0 0 0 1.405-.009l6.63-6.631A.251.251 0 0 1 8.515 17a.245.245 0 0 1 .177.075 10.081 10.081 0 0 0 6.5 2.92 1 1 0 0 0 1.061-1V9.266a.247.247 0 0 1 .073-.176Z"), R.appendChild(q), H.appendChild(R), g.appendChild(H); + const Y = e.createElement("input"); + return Y.setAttribute("type", "range"), Y.setAttribute("class", "kg-audio-volume-slider"), Y.setAttribute("max", "100"), Y.setAttribute("value", "100"), g.appendChild(Y), d.appendChild(g), r.appendChild(d), { + element: r + }; +} +function fwe(t, e, n, i, r) { + const s = ` + + + + +
    + + + + + +
    + + ${t.thumbnailSrc ? ` + + ` : ` + + `} + + + + + + + + + + +
    + ${t.title} +
    + + + + + +
    + + + ${pwe(t.duration)} • Click to play audio +
    +
    +
    +
    + `, o = e.createElement("div"); + return o.innerHTML = s.trim(), { + element: o.firstElementChild + }; +} +function dwe(t) { + let e = "kg-audio-thumbnail"; + return t.thumbnailSrc || (e += " kg-audio-hide"), e; +} +function hwe(t) { + let e = "kg-audio-thumbnail placeholder"; + return t.thumbnailSrc && (e += " kg-audio-hide"), e; +} +function pwe(t = 200) { + const e = Math.floor(t / 60), n = Math.floor(t - e * 60), i = String(n).padStart(2, "0"); + return `${e}:${i}`; +} +let v1 = class extends Yn({ + nodeType: "audio", + properties: [{ + name: "duration", + default: 0 + }, { + name: "mimeType", + default: "" + }, { + name: "src", + default: "", + urlType: "url" + }, { + name: "title", + default: "" + }, { + name: "thumbnailSrc", + default: "" + }], + defaultRenderFn: uwe +}) { + static importDOM() { + return lwe(this); + } +}; +const mwe = (t) => new v1(t); +function gwe(t) { + return t instanceof v1; +} +function DW(t, e) { + for (let n = 0; n < t.childNodes.length; n++) { + let i = t.childNodes[n]; + if (i.nodeType === 1 && !e.includes(i.tagName)) { + for (; i.firstChild; ) + t.insertBefore(i.firstChild, i); + t.removeChild(i), n -= 1; + } else i.nodeType === 1 && DW(i, e); + } +} +function vwe(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = n.createElement("div"); + if ((!t.backgroundColor || !t.backgroundColor.match(/^[a-zA-Z\d-]+$/)) && (t.backgroundColor = "white"), i.classList.add("kg-card", "kg-callout-card", `kg-callout-card-${t.backgroundColor}`), t.calloutEmoji) { + const a = n.createElement("div"); + a.classList.add("kg-callout-emoji"), a.textContent = t.calloutEmoji, i.appendChild(a); + } + const r = n.createElement("div"); + r.classList.add("kg-callout-text"); + const s = n.createElement("div"); + return s.innerHTML = t.calloutText, DW(s, ["A", "STRONG", "EM", "B", "I", "BR", "CODE", "MARK", "S", "DEL", "U", "SUP", "SUB"]), r.innerHTML = s.innerHTML, i.appendChild(r), { + element: i + }; +} +const bwe = (t) => { + var n, i; + const e = (i = (n = t.classList) == null ? void 0 : n.value) == null ? void 0 : i.match(/kg-callout-card-(\w+)/); + return e && e[1]; +}; +function ywe(t) { + return { + div: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-callout-card"); + return e.tagName === "DIV" && n ? { + conversion(r) { + const s = r == null ? void 0 : r.querySelector(".kg-callout-text"), o = r == null ? void 0 : r.querySelector(".kg-callout-emoji"), a = bwe(r), l = { + calloutText: s && s.innerHTML.trim() || "", + calloutEmoji: o && o.innerHTML.trim() || "", + backgroundColor: a + }; + return { + node: new t(l) + }; + }, + priority: 1 + } : null; + } + }; +} +let b1 = class extends Yn({ + nodeType: "callout", + properties: [{ + name: "calloutText", + default: "", + wordCount: !0 + }, { + name: "calloutEmoji", + default: "💡" + }, { + name: "backgroundColor", + default: "blue" + }], + defaultRenderFn: vwe +}) { + /* override */ + constructor({ + calloutText: e, + calloutEmoji: n, + backgroundColor: i + } = {}, r) { + super(r), this.__calloutText = e || "", this.__calloutEmoji = n !== void 0 ? n : "💡", this.__backgroundColor = i || "blue"; + } + static importDOM() { + return ywe(this); + } +}; +function wwe(t) { + return t instanceof b1; +} +const kwe = (t) => new b1(t), eh = (t) => t.showButton && t.buttonUrl && t.buttonText, tg = (t, e) => eh(t) ? `${e}` : e; +function xwe(t) { + (!t.buttonColor || !t.buttonColor.match(/^[a-zA-Z\d-]+|#([a-fA-F\d]{3}|[a-fA-F\d]{6})$/)) && (t.buttonColor = "accent"); + const e = t.buttonColor === "accent" ? "kg-style-accent" : "", n = t.buttonColor === "accent" ? `style="color: ${t.buttonTextColor};"` : `style="background-color: ${t.buttonColor}; color: ${t.buttonTextColor};"`; + return ` +
    + ${t.hasSponsorLabel ? ` +
    +
    + ${t.sponsorLabel} +
    +
    + ` : ""} +
    + ${t.imageUrl ? ` +
    + ${tg(t, `CTA Image`)} +
    + ` : ""} + ${t.textValue || t.showButton ? ` +
    + ${t.textValue ? ` +
    + ${t.textValue} +
    + ` : ""} + ${eh(t) ? ` + + ${t.buttonText} + + ` : ""} +
    + ` : ""} +
    +
    + `; +} +function _we(t, e = {}) { + var s, o, a, l, u, f, d, h; + let n = t.buttonColor === "accent" ? `color: ${t.buttonTextColor};` : `background-color: ${t.buttonColor}; color: ${t.buttonTextColor};`, i = n; + ((s = e == null ? void 0 : e.feature) != null && s.emailCustomization || (o = e == null ? void 0 : e.feature) != null && o.emailCustomizationAlpha) && ((a = e == null ? void 0 : e.design) == null ? void 0 : a.buttonStyle) === "outline" && // accent buttons are fully handled by main template CSS + t.buttonColor !== "accent" && (n = ` + border: 1px solid ${t.buttonColor}; + background-color: transparent; + color: ${t.buttonColor}; + `, i = ` + background-color: transparent; + color: ${t.buttonColor}; + `); + let r; + if (t.imageUrl && t.imageWidth && t.imageHeight && (r = { + width: t.imageWidth, + height: t.imageHeight + }, t.imageWidth >= 560 && (r = Eh(r, { + width: 560 + }))), t.layout === "minimal" && t.imageUrl && gf(t.imageUrl, e.siteUrl) && (l = e.canTransformImage) != null && l.call(e, t.imageUrl)) { + const [, m, g] = t.imageUrl.match(/(.*\/content\/images)\/(.*)/), w = ((f = (u = e == null ? void 0 : e.imageOptimization) == null ? void 0 : u.internalImageSizes) == null ? void 0 : f["email-cta-minimal-image"]) || { + width: 256, + height: 256 + }; + t.imageUrl = `${m}/size/w${w.width}h${w.height}/${g}`; + } + if ((d = e.feature) != null && d.emailCustomization || (h = e.feature) != null && h.emailCustomizationAlpha) { + const m = () => t.layout === "minimal" ? ` + + + + + ${t.imageUrl ? ` + + ` : ""} + + +
    + ${tg(t, `CTA Image`)} + + + ${t.textValue ? ` + + + + ` : ""} + ${eh(t) ? ` + + + + ` : ""} +
    + ${t.textValue} +
    + + + + +
    + + ${t.buttonText} + +
    +
    +
    + + + ` : ` + + + + ${t.imageUrl ? ` + + + + ` : ""} + + + + ${eh(t) ? ` + + + + ` : ""} +
    + + + + +
    + ${tg(t, `CTA Image`)} +
    +
    + ${t.textValue} +
    + + + + +
    + + ${t.buttonText} + +
    +
    + + + `; + return ` + + ${t.hasSponsorLabel ? ` + + + + ` : ""} + ${m()} +
    + + + + +
    + ${t.sponsorLabel} +
    +
    + `; + } else { + const m = () => t.layout === "minimal" ? ` + + + + + ${t.imageUrl ? ` + + ` : ""} + + +
    + ${tg(t, `CTA Image`)} + + + ${t.textValue ? ` + + + + ` : ""} + ${eh(t) ? ` + + + + ` : ""} +
    + ${t.textValue} +
    + + + + +
    + + ${t.buttonText} + +
    +
    +
    + + + ` : ` + + + + ${t.imageUrl ? ` + + + + ` : ""} + + + + ${eh(t) ? ` + + + + ` : ""} +
    + + + + +
    + ${tg(t, `CTA Image`)} +
    +
    + ${t.textValue} +
    + + + + +
    + + ${t.buttonText} + +
    +
    + + + `; + return ` + + ${t.hasSponsorLabel ? ` + + + + ` : ""} + ${m()} +
    + + + + +
    + ${t.sponsorLabel} +
    +
    + `; + } +} +function Owe(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = { + layout: t.layout, + alignment: t.alignment, + textValue: t.textValue, + showButton: t.showButton, + showDividers: t.showDividers, + buttonText: t.buttonText, + buttonUrl: t.buttonUrl, + buttonColor: t.buttonColor, + buttonTextColor: t.buttonTextColor, + hasSponsorLabel: t.hasSponsorLabel, + backgroundColor: t.backgroundColor, + sponsorLabel: t.sponsorLabel, + imageUrl: t.imageUrl, + imageWidth: t.imageWidth, + imageHeight: t.imageHeight, + linkColor: t.linkColor + }; + if ((!i.backgroundColor || !i.backgroundColor.match(/^[a-zA-Z\d-]+|#([a-fA-F\d]{3}|[a-fA-F\d]{6})$/)) && (i.backgroundColor = "white"), e.target === "email") { + const a = e.createDocument().createElement("div"); + return a.innerHTML = _we(i, e), s0({ + element: a.firstElementChild + }, t.visibility, e); + } + const r = n.createElement("div"); + if (i.hasSponsorLabel) { + const a = $W(r)(i.sponsorLabel, { + firstChildInnerContent: !0 + }); + i.sponsorLabel = a; + } + const s = xwe(i); + return r.innerHTML = s == null ? void 0 : s.trim(), s0({ + element: r.firstElementChild + }, t.visibility, e); +} +const Vc = (t) => { + if (t === "transparent") + return t; + try { + const [e, n, i] = t.match(/\d+/g), r = parseInt(e, 10).toString(16).padStart(2, "0"), s = parseInt(n, 10).toString(16).padStart(2, "0"), o = parseInt(i, 10).toString(16).padStart(2, "0"); + return `#${r}${s}${o}`; + } catch { + return null; + } +}; +function Swe(t) { + return { + div: (e) => { + var i; + return ((i = e.classList) == null ? void 0 : i.contains("kg-cta-card")) ? { + conversion(r) { + const s = r, o = s.getAttribute("data-layout") || "minimal", a = s.getAttribute("data-alignment") || "left", l = r.querySelector(".kg-cta-text"), u = r.querySelector(".kg-cta-button"), f = (u == null ? void 0 : u.style) || {}, d = f.backgroundColor || "#000000", h = f.color || "#ffffff", m = r.querySelector(".kg-cta-sponsor-label"), g = s.className.match(/kg-cta-bg-(\w+)/), w = g ? g[1] : "grey", x = s.classList.contains("kg-cta-has-dividers"), _ = r.querySelector(".kg-cta-image-container"), S = _ == null ? void 0 : _.querySelector("img"); + let C = { + imageUrl: "", + imageWidth: null, + imageHeight: null + }; + if (S) { + const { + src: $, + width: P, + height: W + } = yw(S); + C.imageUrl = $, C.imageWidth = P || null, C.imageHeight = W || null; + } + m && (m.innerHTML = `

    ${m.innerHTML.trim()}

    `); + const E = { + layout: o, + alignment: a, + textValue: l.textContent.trim() || "", + showButton: !!u, + showDividers: x, + buttonText: (u == null ? void 0 : u.textContent.trim()) || "", + buttonUrl: u == null ? void 0 : u.getAttribute("href"), + buttonColor: Vc(d), + buttonTextColor: Vc(h), + hasSponsorLabel: !!m, + sponsorLabel: (m == null ? void 0 : m.innerHTML) || "", + backgroundColor: w, + imageUrl: C.imageUrl, + imageWidth: C.imageWidth, + imageHeight: C.imageHeight + }; + return { + node: new t(E) + }; + }, + priority: 1 + } : null; + } + }; +} +let y1 = class extends Yn({ + nodeType: "call-to-action", + hasVisibility: !0, + properties: [ + { + name: "layout", + default: "minimal" + }, + { + name: "alignment", + default: "left" + }, + { + name: "textValue", + default: "", + wordCount: !0 + }, + { + name: "showButton", + default: !0 + }, + { + name: "showDividers", + default: !0 + }, + { + name: "buttonText", + default: "Learn more" + }, + { + name: "buttonUrl", + default: "" + }, + { + name: "buttonColor", + default: "#000000" + }, + // Where colour is customisable, we should use hex values + { + name: "buttonTextColor", + default: "#ffffff" + }, + { + name: "hasSponsorLabel", + default: !0 + }, + { + name: "sponsorLabel", + default: '

    SPONSORED

    ' + }, + { + name: "backgroundColor", + default: "grey" + }, + // Since this is one of a few fixed options, we stick to colour names. + { + name: "linkColor", + default: "text" + }, + { + name: "imageUrl", + default: "" + }, + { + name: "imageWidth", + default: null + }, + { + name: "imageHeight", + default: null + } + ], + defaultRenderFn: Owe +}) { + static importDOM() { + return Swe(this); + } +}; +const Cwe = (t) => new y1(t), Ewe = (t) => t instanceof y1; +class Twe { + constructor(e) { + this.NodeClass = e; + } + get DOMConversionMap() { + const e = this; + return { + blockquote: () => ({ + conversion(n) { + var r; + const i = (r = n.classList) == null ? void 0 : r.contains("kg-blockquote-alt"); + return n.tagName === "BLOCKQUOTE" && i ? { + node: new e.NodeClass() + } : null; + }, + priority: 0 + }) + }; + } +} +let w1 = class extends N.ElementNode { + static getType() { + return "aside"; + } + static clone(e) { + return new this(e.__key); + } + static get urlTransformMap() { + return {}; + } + constructor(e) { + super(e); + } + static importJSON(e) { + const n = new this(); + return n.setFormat(e.format), n.setIndent(e.indent), n.setDirection(e.direction), n; + } + exportJSON() { + return { + ...super.exportJSON(), + type: "aside", + version: 1 + }; + } + static importDOM() { + return new Twe(this).DOMConversionMap; + } + /* c8 ignore start */ + createDOM() { + return document.createElement("div"); + } + updateDOM() { + return !1; + } + isInline() { + return !1; + } + extractWithChild() { + return !0; + } + /* c8 ignore stop */ +}; +function $we() { + return new w1(); +} +function Mwe(t) { + return t instanceof w1; +} +function Nwe(t, e = {}) { + return Vn(e), { + element: e.createDocument().createElement("hr") + }; +} +function Awe(t) { + return { + hr: () => ({ + conversion() { + return { + node: new t() + }; + }, + priority: 0 + }) + }; +} +let k1 = class extends Yn({ + nodeType: "horizontalrule", + defaultRenderFn: Nwe +}) { + static importDOM() { + return Awe(this); + } + getTextContent() { + return `--- + +`; + } + hasEditMode() { + return !1; + } +}; +function Dwe() { + return new k1(); +} +function Pwe(t) { + return t instanceof k1; +} +function Iwe(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = t.html; + if (!i) + return Ir(n); + const r = ` + +${i} + +`, s = n.createElement("textarea"); + return s.value = r, t.visibility ? s0({ + element: s, + type: "value" + }, t.visibility, e) : { + element: s, + type: "value" + }; +} +function Lwe(t) { + return { + "#comment": (e) => e.nodeType === 8 && e.nodeValue.trim().match(/^kg-card-begin:\s?html$/) ? { + conversion(n) { + let i = [], r = n.nextSibling; + for (; r && !Rwe(r); ) { + let a = r; + i.push(a.outerHTML), r = a.nextSibling, a.remove(); + } + let s = { + html: i.join(` +`).trim() + }; + return { + node: new t(s) + }; + }, + priority: 0 + } : null, + table: (e) => e.nodeType === 1 && e.tagName === "TABLE" && e.parentNode.tagName !== "TABLE" ? { + conversion(n) { + const i = { + html: n.outerHTML + }; + return { + node: new t(i) + }; + }, + priority: 0 + } : null + }; +} +function Rwe(t) { + return t && t.nodeType === 8 && t.nodeValue.trim().match(/^kg-card-end:\s?html$/); +} +let x1 = class extends Yn({ + nodeType: "html", + hasVisibility: !0, + properties: [{ + name: "html", + default: "", + urlType: "html", + wordCount: !0 + }], + defaultRenderFn: Iwe +}) { + static importDOM() { + return Lwe(this); + } + isEmpty() { + return !this.__html; + } +}; +function jwe(t) { + return new x1(t); +} +function Fwe(t) { + return t instanceof x1; +} +function Bwe(t) { + return { + div: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-toggle-card"); + return e.tagName === "DIV" && n ? { + conversion(r) { + const o = r.querySelector(".kg-toggle-heading-text").textContent, l = r.querySelector(".kg-toggle-content").textContent, u = { + heading: o, + content: l + }; + return { + node: new t(u) + }; + }, + priority: 1 + } : null; + } + }; +} +const PW = function(t, ...e) { + return typeof t == "string" ? t.replace(/\n\s+/g, "").trim() : t.reduce((i, r, s) => i + r + (e[s] || ""), "").replace(/\n\s+/g, "").trim(); +}, fh = PW; +var zwe = /* @__PURE__ */ Object.freeze({ + __proto__: null, + html: fh, + oneline: PW +}); +function Wwe({ + node: t +}) { + return ` +
    +
    +

    ${t.heading}

    + +
    +
    ${t.content}
    +
    + `; +} +function Hwe({ + node: t +}, e = {}) { + var n, i; + return (n = e.feature) != null && n.emailCustomization || (i = e.feature) != null && i.emailCustomizationAlpha ? fh` + + + + + + + + + +
    +

    ${t.heading}

    +
    + ${t.content} +
    + ` : ` +
    +

    ${t.heading}

    +
    ${t.content}
    +
    + `; +} +function Qwe(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = e.target === "email" ? Hwe({ + node: t + }, e) : Wwe({ + node: t + }), r = n.createElement("div"); + return r.innerHTML = i.trim(), { + element: r.firstElementChild + }; +} +let _1 = class extends Yn({ + nodeType: "toggle", + properties: [{ + name: "heading", + default: "", + urlType: "html", + wordCount: !0 + }, { + name: "content", + default: "", + urlType: "html", + wordCount: !0 + }], + defaultRenderFn: Qwe +}) { + static importDOM() { + return Bwe(this); + } +}; +const Uwe = (t) => new _1(t); +function Zwe(t) { + return t instanceof _1; +} +function qwe(t) { + return { + div: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-button-card"); + return e.tagName === "DIV" && n ? { + conversion(r) { + const s = e.className.match(/kg-align-(left|center)/); + let o; + s && (o = s[1]); + const a = r == null ? void 0 : r.querySelector(".kg-btn"), l = a.getAttribute("href"), f = { + buttonText: a.textContent, + alignment: o, + buttonUrl: l + }; + return { + node: new t(f) + }; + }, + priority: 1 + } : null; + } + }; +} +function Ywe({ + alignment: t = "", + color: e = "accent", + text: n = "", + url: i = "" +} = {}) { + const r = nt("btn", e === "accent" && "btn-accent"); + return fh` + + + + + + +
    + ${n} +
    + `; +} +function Vwe(t, e = {}) { + Vn(e); + const n = e.createDocument(); + return !t.buttonUrl || t.buttonUrl.trim() === "" ? Ir(n) : e.target === "email" ? Gwe(t, e, n) : Xwe(t, n); +} +function Xwe(t, e) { + const n = Kwe(t), i = e.createElement("div"); + i.setAttribute("class", n); + const r = e.createElement("a"); + return r.setAttribute("href", t.buttonUrl), r.setAttribute("class", "kg-btn kg-btn-accent"), r.textContent = t.buttonText || "Button Title", i.appendChild(r), { + element: i + }; +} +function Gwe(t, e, n) { + var o, a; + const { + buttonUrl: i, + buttonText: r + } = t; + let s; + if ((o = e.feature) != null && o.emailCustomization) { + s = fh` + + + + +
    + + + + +
    + ${r} +
    +
    `; + const l = n.createElement("p"); + return l.innerHTML = s, { + element: l + }; + } else if ((a = e.feature) != null && a.emailCustomizationAlpha) { + const l = Ywe({ + alignment: t.alignment, + color: "accent", + url: i, + text: r + }); + s = fh` + + + + + + +
    + ${l} +
    + `; + const u = n.createElement("div"); + return u.innerHTML = s, { + element: u, + type: "inner" + }; + } else { + s = fh` +
    + + + + +
    + ${r} +
    +
    + `; + const l = n.createElement("p"); + return l.innerHTML = s, { + element: l + }; + } +} +function Kwe(t) { + let e = ["kg-card kg-button-card"]; + return t.alignment && e.push(`kg-align-${t.alignment}`), e.join(" "); +} +let O1 = class extends Yn({ + nodeType: "button", + properties: [{ + name: "buttonText", + default: "" + }, { + name: "alignment", + default: "center" + }, { + name: "buttonUrl", + default: "", + urlType: "url" + }], + defaultRenderFn: Vwe +}) { + static importDOM() { + return qwe(this); + } +}; +const Jwe = (t) => new O1(t); +function eke(t) { + return t instanceof O1; +} +function tke(t) { + return { + figure: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-bookmark-card"); + return e.tagName === "FIGURE" && n ? { + conversion(r) { + var w, x, _, S, C, E, M, $; + const s = (w = r == null ? void 0 : r.querySelector(".kg-bookmark-container")) == null ? void 0 : w.getAttribute("href"), o = (x = r == null ? void 0 : r.querySelector(".kg-bookmark-icon")) == null ? void 0 : x.src, a = (_ = r == null ? void 0 : r.querySelector(".kg-bookmark-title")) == null ? void 0 : _.textContent, l = (S = r == null ? void 0 : r.querySelector(".kg-bookmark-description")) == null ? void 0 : S.textContent, u = (C = r == null ? void 0 : r.querySelector(".kg-bookmark-publisher")) == null ? void 0 : C.textContent, f = (E = r == null ? void 0 : r.querySelector(".kg-bookmark-author")) == null ? void 0 : E.textContent, d = (M = r == null ? void 0 : r.querySelector(".kg-bookmark-thumbnail img")) == null ? void 0 : M.src, h = ($ = r == null ? void 0 : r.querySelector("figure.kg-bookmark-card figcaption")) == null ? void 0 : $.textContent, m = { + url: s, + metadata: { + icon: o, + title: a, + description: l, + author: u, + publisher: f, + thumbnail: d + }, + caption: h + }; + return { + node: new t(m) + }; + }, + priority: 1 + } : null; + }, + div: (e) => e.nodeType === 1 && e.tagName === "DIV" && e.className.match(/graf--mixtapeEmbed/) ? { + conversion(n) { + const i = n.querySelector(".markup--mixtapeEmbed-anchor"), r = i.querySelector(".markup--mixtapeEmbed-strong"), s = i.querySelector(".markup--mixtapeEmbed-em"), o = n.querySelector(".mixtapeImage"); + n.querySelector("br").remove(); + const a = i.getAttribute("href"); + let l = "", u = "", f = ""; + r && r.innerHTML && (l = r.innerHTML.trim(), i.removeChild(r)), s && s.innerHTML && (u = s.innerHTML.trim(), i.removeChild(s)); + let d = i.innerHTML.trim(); + o && o.style["background-image"] && (f = o.style["background-image"].match(/url\(([^)]*?)\)/)[1]); + let h = { + url: a, + metadata: { + title: l, + description: u, + publisher: d, + thumbnail: f + } + }; + return { + node: new t(h) + }; + }, + priority: 1 + } : null + }; +} +function Di(t) { + return t.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); +} +function HN(t, e, n) { + if (t.length <= n) + return Di(t); + if (t && t.length > n) { + let i = ""; + return t.length > n && t.length <= e ? i = '' : t.length > e && (i = "…"), Di(t.substring(0, n - 1)) + '' + Di(t.substring(n - 1, e - 1)) + "" + i; + } else + return Di(t ?? ""); +} +function nke(t, e = {}) { + Vn(e); + const n = e.createDocument(); + return !t.url || t.url.trim() === "" ? Ir(n) : e.target === "email" ? ike(t, n) : rke(t, n); +} +function ike(t, e) { + const n = Di(t.title), i = Di(t.publisher), r = Di(t.author), s = Di(t.description), o = t.icon, a = t.url, l = t.thumbnail, u = t.caption, f = e.createElement("div"), d = ` + +
    + +
    +
    ${n}
    +
    ${HN(s, 120, 90)}
    + +
    + ${l ? `
    +
    ` : ""} +
    + ${u ? `
    ${u}
    ` : ""} +
    + + `; + return f.innerHTML = d, { + element: f + }; +} +function rke(t, e) { + const n = e.createElement("figure"), i = t.caption; + let r = "kg-card kg-bookmark-card"; + i && (r += " kg-card-hascaption"), n.setAttribute("class", r); + const s = e.createElement("a"); + s.setAttribute("class", "kg-bookmark-container"), s.href = t.url, n.appendChild(s); + const o = e.createElement("div"); + o.setAttribute("class", "kg-bookmark-content"), s.appendChild(o); + const a = e.createElement("div"); + a.setAttribute("class", "kg-bookmark-title"), a.textContent = t.title, o.appendChild(a); + const l = e.createElement("div"); + l.setAttribute("class", "kg-bookmark-description"), l.textContent = t.description, o.appendChild(l); + const u = e.createElement("div"); + if (u.setAttribute("class", "kg-bookmark-metadata"), o.appendChild(u), u.icon = t.icon, u.icon) { + const f = e.createElement("img"); + f.setAttribute("class", "kg-bookmark-icon"), f.src = u.icon, f.alt = "", u.appendChild(f); + } + if (u.publisher = t.publisher, u.publisher) { + const f = e.createElement("span"); + f.setAttribute("class", "kg-bookmark-author"), f.textContent = u.publisher, u.appendChild(f); + } + if (u.author = t.author, u.author) { + const f = e.createElement("span"); + f.setAttribute("class", "kg-bookmark-publisher"), f.textContent = u.author, u.appendChild(f); + } + if (u.thumbnail = t.thumbnail, u.thumbnail) { + const f = e.createElement("div"); + f.setAttribute("class", "kg-bookmark-thumbnail"), s.appendChild(f); + const d = e.createElement("img"); + d.src = u.thumbnail, d.alt = "", d.setAttribute("onerror", "this.style.display = 'none'"), f.appendChild(d); + } + if (i) { + const f = e.createElement("figcaption"); + f.innerHTML = i, n.appendChild(f); + } + return { + element: n + }; +} +let S1 = class extends Yn({ + nodeType: "bookmark", + properties: [{ + name: "title", + default: "", + wordCount: !0 + }, { + name: "description", + default: "", + wordCount: !0 + }, { + name: "url", + default: "", + urlType: "url", + wordCount: !0 + }, { + name: "caption", + default: "", + wordCount: !0 + }, { + name: "author", + default: "" + }, { + name: "publisher", + default: "" + }, { + name: "icon", + urlPath: "metadata.icon", + default: "", + urlType: "url" + }, { + name: "thumbnail", + urlPath: "metadata.thumbnail", + default: "", + urlType: "url" + }], + defaultRenderFn: nke +}) { + static importDOM() { + return tke(this); + } + /* override */ + constructor({ + url: e, + metadata: n, + caption: i + } = {}, r) { + super(r), this.__url = e || "", this.__icon = (n == null ? void 0 : n.icon) || "", this.__title = (n == null ? void 0 : n.title) || "", this.__description = (n == null ? void 0 : n.description) || "", this.__author = (n == null ? void 0 : n.author) || "", this.__publisher = (n == null ? void 0 : n.publisher) || "", this.__thumbnail = (n == null ? void 0 : n.thumbnail) || "", this.__caption = i || ""; + } + /* @override */ + getDataset() { + const e = this.getLatest(); + return { + url: e.__url, + metadata: { + icon: e.__icon, + title: e.__title, + description: e.__description, + author: e.__author, + publisher: e.__publisher, + thumbnail: e.__thumbnail + }, + caption: e.__caption + }; + } + /* @override */ + static importJSON(e) { + const { + url: n, + metadata: i, + caption: r + } = e; + return new this({ + url: n, + metadata: i, + caption: r + }); + } + /* @override */ + exportJSON() { + return { + type: "bookmark", + version: 1, + url: this.url, + metadata: { + icon: this.icon, + title: this.title, + description: this.description, + author: this.author, + publisher: this.publisher, + thumbnail: this.thumbnail + }, + caption: this.caption + }; + } + isEmpty() { + return !this.url; + } +}; +const ske = (t) => new S1(t); +function oke(t) { + return t instanceof S1; +} +function ake(t) { + if (!t) + return 0; + const e = ["Bytes", "KB", "MB", "GB", "TB"], n = t.split(" "), i = parseFloat(n[0]), r = n[1], s = e.indexOf(r); + return s === -1 ? 0 : Math.round(i * Math.pow(1024, s)); +} +function IW(t) { + if (!t) + return "0 Byte"; + const e = ["Bytes", "KB", "MB", "GB", "TB"]; + if (t === 0) + return "0 Byte"; + const n = parseInt(Math.floor(Math.log(t) / Math.log(1024))); + return Math.round(t / Math.pow(1024, n)) + " " + e[n]; +} +function lke(t, e = {}) { + Vn(e); + const n = e.createDocument(); + return !t.src || t.src.trim() === "" ? Ir(n) : e.target === "email" ? uke(t, n, e) : cke(t, n); +} +function uke(t, e, n) { + let i; + !t.fileTitle && !t.fileCaption ? i = "margin-top: 6px; height: 20px; width: 20px; max-width: 20px; padding-top: 4px; padding-bottom: 4px;" : i = "margin-top: 6px; height: 24px; width: 24px; max-width: 24px;"; + const r = ` + + + + +
    + + + + + +
    + ${t.fileTitle ? ` +
    + ${Di(t.fileTitle)} +
    + ` : ""} + ${t.fileCaption ? ` +
    + ${Di(t.fileCaption)} +
    + ` : ""} +
    + ${Di(t.fileName)} • ${IW(t.fileSize)} +
    +
    + + + +
    +
    + `, s = e.createElement("div"); + return s.innerHTML = r.trim(), { + element: s.firstElementChild + }; +} +function cke(t, e) { + const n = e.createElement("div"); + n.setAttribute("class", "kg-card kg-file-card"); + const i = e.createElement("a"); + i.setAttribute("class", "kg-file-card-container"), i.setAttribute("href", t.src), i.setAttribute("title", "Download"), i.setAttribute("download", ""); + const r = e.createElement("div"); + r.setAttribute("class", "kg-file-card-contents"); + const s = e.createElement("div"); + s.setAttribute("class", "kg-file-card-title"), s.textContent = t.fileTitle || ""; + const o = e.createElement("div"); + o.setAttribute("class", "kg-file-card-caption"), o.textContent = t.fileCaption || ""; + const a = e.createElement("div"); + a.setAttribute("class", "kg-file-card-metadata"); + const l = e.createElement("div"); + l.setAttribute("class", "kg-file-card-filename"), l.textContent = t.fileName || ""; + const u = e.createElement("div"); + u.setAttribute("class", "kg-file-card-filesize"), u.textContent = t.formattedFileSize || "", a.appendChild(l), a.appendChild(u), r.appendChild(s), r.appendChild(o), r.appendChild(a), i.appendChild(r); + const f = e.createElement("div"); + f.setAttribute("class", "kg-file-card-icon"); + const d = e.createElementNS("http://www.w3.org/2000/svg", "svg"); + d.setAttribute("viewBox", "0 0 24 24"); + const h = e.createElementNS("http://www.w3.org/2000/svg", "defs"), m = e.createElementNS("http://www.w3.org/2000/svg", "style"); + m.textContent = ".a{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5px;}", h.appendChild(m); + const g = e.createElementNS("http://www.w3.org/2000/svg", "title"); + g.textContent = "download-circle"; + const w = e.createElementNS("http://www.w3.org/2000/svg", "polyline"); + w.setAttribute("class", "a"), w.setAttribute("points", "8.25 14.25 12 18 15.75 14.25"); + const x = e.createElementNS("http://www.w3.org/2000/svg", "line"); + x.setAttribute("class", "a"), x.setAttribute("x1", "12"), x.setAttribute("y1", "6.75"), x.setAttribute("x2", "12"), x.setAttribute("y2", "18"); + const _ = e.createElementNS("http://www.w3.org/2000/svg", "circle"); + return _.setAttribute("class", "a"), _.setAttribute("cx", "12"), _.setAttribute("cy", "12"), _.setAttribute("r", "11.25"), d.appendChild(h), d.appendChild(g), d.appendChild(w), d.appendChild(x), d.appendChild(_), f.appendChild(d), i.appendChild(f), n.appendChild(i), { + element: n + }; +} +function fke(t) { + return { + div: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-file-card"); + return e.tagName === "DIV" && n ? { + conversion(r) { + var m, g, w, x; + const o = r.querySelector("a").getAttribute("href"), a = ((m = r.querySelector(".kg-file-card-title")) == null ? void 0 : m.textContent) || "", l = ((g = r.querySelector(".kg-file-card-caption")) == null ? void 0 : g.textContent) || "", u = ((w = r.querySelector(".kg-file-card-filename")) == null ? void 0 : w.textContent) || ""; + let f = ake(((x = r.querySelector(".kg-file-card-filesize")) == null ? void 0 : x.textContent) || ""); + const d = { + src: o, + fileTitle: a, + fileCaption: l, + fileName: u, + fileSize: f + }; + return { + node: new t(d) + }; + }, + priority: 1 + } : null; + } + }; +} +let C1 = class extends Yn({ + nodeType: "file", + properties: [{ + name: "src", + default: "", + urlType: "url" + }, { + name: "fileTitle", + default: "", + wordCount: !0 + }, { + name: "fileCaption", + default: "", + wordCount: !0 + }, { + name: "fileName", + default: "" + }, { + name: "fileSize", + default: "" + }], + defaultRenderFn: lke +}) { + /* @override */ + exportJSON() { + const { + src: e, + fileTitle: n, + fileCaption: i, + fileName: r, + fileSize: s + } = this; + return { + type: "file", + src: e && e.startsWith("data:") ? "" : e, + fileTitle: n, + fileCaption: i, + fileName: r, + fileSize: s + }; + } + static importDOM() { + return fke(this); + } + get formattedFileSize() { + return IW(this.fileSize); + } +}; +function dke(t) { + return t instanceof C1; +} +const hke = (t) => new C1(t); +function ww(t) { + return t = t.replace(/<[^>]*>?/gm, ""), t = t.replace(/[^\w\s]/gi, ""), t = t.replace(/\s+/g, "-"), t = t.toLowerCase(), t; +} +function pke(t, e = {}) { + Vn(e); + const n = e.createDocument(); + if (!t.header && !t.subheader && (!t.buttonEnabled || !t.buttonUrl || !t.buttonText)) + return Ir(n); + const i = { + size: t.size, + style: t.style, + buttonEnabled: t.buttonEnabled && !!t.buttonUrl && !!t.buttonText, + buttonUrl: t.buttonUrl, + buttonText: t.buttonText, + header: t.header, + headerSlug: ww(t.header), + subheader: t.subheader, + subheaderSlug: ww(t.subheader), + hasHeader: !!t.header, + hasSubheader: !!t.subheader && !!t.subheader.replace(/(
    )+$/g).trim(), + backgroundImageStyle: t.style === "image" ? `background-image: url(${t.backgroundImageSrc})` : "", + backgroundImageSrc: t.backgroundImageSrc + }, r = n.createElement("div"); + if (r.classList.add("kg-card", "kg-header-card", "kg-width-full", `kg-size-${i.size}`, `kg-style-${i.style}`), r.setAttribute("data-kg-background-image", i.backgroundImageSrc), r.setAttribute("style", i.backgroundImageStyle), i.hasHeader) { + const s = n.createElement("h2"); + s.classList.add("kg-header-card-header"), s.setAttribute("id", i.headerSlug), s.innerHTML = i.header, r.appendChild(s); + } + if (i.hasSubheader) { + const s = n.createElement("h3"); + s.classList.add("kg-header-card-subheader"), s.setAttribute("id", i.subheaderSlug), s.innerHTML = i.subheader, r.appendChild(s); + } + if (i.buttonEnabled) { + const s = n.createElement("a"); + s.classList.add("kg-header-card-button"), s.setAttribute("href", i.buttonUrl), s.textContent = i.buttonText, r.appendChild(s); + } + return { + element: r + }; +} +function mke(t) { + return { + div: (e) => { + var r, s, o, a; + const n = ((r = e.classList) == null ? void 0 : r.contains("kg-header-card")) && !((s = e.classList) != null && s.contains("kg-v2")), i = ((o = e.classList) == null ? void 0 : o.contains("kg-header-card")) && ((a = e.classList) == null ? void 0 : a.contains("kg-v2")); + return e.tagName === "DIV" && n ? { + conversion(l) { + const u = l, f = l.querySelector(".kg-header-card-header"), d = l.querySelector(".kg-header-card-subheader"), h = l.querySelector(".kg-header-card-button"), m = u.classList.contains("kg-size-large") ? "large" : "small", g = u.classList.contains("kg-style-image") ? "image" : "text", w = u.getAttribute("data-kg-background-image"), _ = !!f ? f.textContent : "", C = !!d ? d.textContent : "", E = !!h, M = E ? h.getAttribute("href") : "", $ = E ? h.textContent : "", P = { + size: m, + style: g, + backgroundImageSrc: w, + header: _, + subheader: C, + buttonEnabled: E, + buttonUrl: M, + buttonText: $, + version: 1 + }; + return { + node: new t(P) + }; + }, + priority: 1 + } : e.tagName === "DIV" && i ? { + conversion(l) { + var L; + const u = l, f = u.querySelector(".kg-header-card-heading"), d = u.querySelector(".kg-header-card-subheading"), h = u.querySelector(".kg-header-card-button"), m = u.classList.contains("kg-align-center") ? "center" : "", g = (L = u.querySelector(".kg-header-card-image")) == null ? void 0 : L.getAttribute("src"), w = g ? "split" : "", x = u.classList.contains("kg-style-accent") ? "accent" : u.getAttribute("data-background-color"), _ = (h == null ? void 0 : h.getAttribute("data-button-color")) || "", S = (f == null ? void 0 : f.getAttribute("data-text-color")) || "", C = (h == null ? void 0 : h.getAttribute("data-button-text-color")) || "", E = (f == null ? void 0 : f.textContent) || "", M = (d == null ? void 0 : d.textContent) || "", $ = !!h, P = $ ? h.getAttribute("href") : "", W = $ ? h.textContent : "", z = { + backgroundColor: x, + buttonColor: _, + alignment: m, + backgroundImageSrc: g, + layout: w, + textColor: S, + header: E, + subheader: M, + buttonEnabled: $, + buttonUrl: P, + buttonText: W, + buttonTextColor: C, + version: 2 + }; + return { + node: new t(z) + }; + }, + priority: 1 + } : null; + } + }; +} +function gke(t, e = {}) { + const n = yke(t).join(" "), i = t.backgroundColor === "accent" ? "kg-style-accent" : "", r = t.buttonColor === "accent" ? "kg-style-accent" : "", s = t.buttonColor !== "accent" ? `background-color: ${t.buttonColor};` : "", o = t.alignment === "center" ? "kg-align-center" : "", a = t.backgroundColor !== "accent" && (!t.backgroundImageSrc || t.layout === "split") ? `background-color: ${t.backgroundColor}` : ""; + let l = ""; + if (t.backgroundImageSrc) { + const m = { + src: t.backgroundImageSrc, + width: t.backgroundImageWidth, + height: t.backgroundImageHeight + }, g = NW({ + ...m, + options: e + }), w = g ? `srcset="${g}"` : ""; + l = ` + + `; + } + const u = () => t.header ? `

    ${t.header}

    ` : "", f = () => t.subheader ? `

    ${t.subheader}

    ` : "", d = () => t.buttonEnabled && t.buttonUrl && t.buttonUrl.trim() !== "" ? `${t.buttonText}` : "", h = a ? `style="${a};"` : ""; + return ` +
    + ${t.layout !== "split" ? l : ""} +
    + ${t.layout === "split" ? l : ""} +
    + ${u()} + ${f()} + ${d()} +
    +
    +
    + `; +} +function vke(t, e) { + var u, f, d, h, m; + const n = t.backgroundColor === "accent" ? `background-color: ${t.accentColor};` : ""; + let i = t.buttonColor === "accent" ? `background-color: ${t.accentColor};` : t.buttonColor, r = t.buttonColor !== "accent" ? `background-color: ${t.buttonColor};` : "", s = t.buttonTextColor; + const o = t.alignment === "center" ? "text-align: center;" : "", a = t.backgroundImageSrc ? t.layout !== "split" ? `background-image: url(${t.backgroundImageSrc}); background-size: cover; background-position: center center;` : `background-color: ${t.backgroundColor};` : `background-color: ${t.backgroundColor};`, l = `background-image: url(${t.backgroundImageSrc}); background-size: ${t.backgroundSize !== "contain" ? "cover" : "50%"}; background-position: center`; + return ((u = e == null ? void 0 : e.feature) != null && u.emailCustomization || (f = e == null ? void 0 : e.feature) != null && f.emailCustomizationAlpha) && ((d = e == null ? void 0 : e.design) == null ? void 0 : d.buttonStyle) === "outline" && (t.buttonColor === "accent" ? (i = "", r = ` + border: 1px solid ${t.accentColor}; + background-color: transparent; + color: ${t.accentColor} !important; + `, s = t.accentColor) : (r = ` + border: 1px solid ${t.buttonColor}; + background-color: transparent; + color: ${t.buttonColor} !important; + `, s = t.buttonColor)), (h = e == null ? void 0 : e.feature) != null && h.emailCustomization || (m = e == null ? void 0 : e.feature) != null && m.emailCustomizationAlpha ? ` +
    + ${t.layout === "split" && t.backgroundImageSrc ? ` + + + + +
    + ` : ""} + + + + +
    + + + + + + + + + ${t.buttonEnabled && t.buttonUrl && t.buttonUrl.trim() !== "" ? ` + + ` : ""} + +
    +

    ${t.header}

    +
    +

    ${t.subheader}

    +
    + + + + +
    + ${t.buttonText} +
    +
    +
    +
    + ` : ` +
    + ${t.layout === "split" && t.backgroundImageSrc ? ` +
    + ` : ""} +
    +

    ${t.header}

    +

    ${t.subheader}

    + ${t.buttonEnabled && t.buttonUrl && t.buttonUrl.trim() !== "" ? ` + ${t.buttonText} + ` : ""} +
    +
    + `; +} +function bke(t, e = {}) { + var o; + Vn(e); + const n = e.createDocument(), i = { + alignment: t.__alignment, + buttonText: t.__buttonText, + buttonEnabled: t.__buttonEnabled, + buttonUrl: t.__buttonUrl, + header: t.__header, + subheader: t.__subheader, + backgroundImageSrc: t.__backgroundImageSrc, + backgroundImageWidth: t.__backgroundImageWidth, + backgroundImageHeight: t.__backgroundImageHeight, + backgroundSize: t.__backgroundSize, + backgroundColor: t.__backgroundColor, + buttonColor: t.__buttonColor, + layout: t.__layout, + textColor: t.__textColor, + buttonTextColor: t.__buttonTextColor, + swapped: t.__swapped, + accentColor: t.__accentColor + }; + if (e.target === "email") { + const l = e.createDocument().createElement("div"); + return l.innerHTML = (o = vke(i, e)) == null ? void 0 : o.trim(), { + element: l.firstElementChild + }; + } + const r = gke(i, e), s = n.createElement("div"); + if (s.innerHTML = r == null ? void 0 : r.trim(), i.header === "") { + const a = s.querySelector(".kg-header-card-heading"); + a && a.remove(); + } + if (i.subheader === "") { + const a = s.querySelector(".kg-header-card-subheading"); + a && a.remove(); + } + return { + element: s.firstElementChild + }; +} +function yke(t) { + let e = ["kg-card kg-header-card kg-v2"]; + return t.layout && t.layout !== "split" && e.push(`kg-width-${t.layout}`), t.layout === "split" && e.push("kg-layout-split kg-width-full"), t.swapped && t.layout === "split" && e.push("kg-swapped"), t.layout && t.layout === "full" && e.push("kg-content-wide"), t.layout === "split" && t.backgroundSize === "contain" && e.push("kg-content-wide"), e; +} +let E1 = class extends Yn({ + nodeType: "header", + properties: [ + { + name: "size", + default: "small" + }, + { + name: "style", + default: "dark" + }, + { + name: "buttonEnabled", + default: !1 + }, + { + name: "buttonUrl", + default: "", + urlType: "url" + }, + { + name: "buttonText", + default: "" + }, + { + name: "header", + default: "", + urlType: "html", + wordCount: !0 + }, + { + name: "subheader", + default: "", + urlType: "html", + wordCount: !0 + }, + { + name: "backgroundImageSrc", + default: "", + urlType: "url" + }, + // we need to initialize a new version property here so that we can separate v1 and v2 + // we should never remove old properties, only add new ones, as this could break & corrupt existing content + // ref https://lexical.dev/docs/concepts/serialization#versioning--breaking-changes + { + name: "version", + default: 1 + }, + { + name: "accentColor", + default: "#FF1A75" + }, + // this is used to have the accent color hex for email + // v2 properties + { + name: "alignment", + default: "center" + }, + { + name: "backgroundColor", + default: "#000000" + }, + { + name: "backgroundImageWidth", + default: null + }, + { + name: "backgroundImageHeight", + default: null + }, + { + name: "backgroundSize", + default: "cover" + }, + { + name: "textColor", + default: "#FFFFFF" + }, + { + name: "buttonColor", + default: "#ffffff" + }, + { + name: "buttonTextColor", + default: "#000000" + }, + { + name: "layout", + default: "full" + }, + // replaces size + { + name: "swapped", + default: !1 + } + ], + defaultRenderFn: { + 1: pke, + 2: bke + } +}) { + static importDOM() { + return mke(this); + } +}; +const wke = (t) => new E1(t); +function kke(t) { + return t instanceof E1; +} +function xke(t) { + return { + "#comment": (e) => e.nodeType === 8 && e.nodeValue.trim() === "members-only" ? { + conversion() { + return { + node: new t() + }; + }, + priority: 0 + } : null + }; +} +function _ke(t, e = {}) { + Vn(e); + const i = e.createDocument().createElement("div"); + return i.innerHTML = "", { + element: i, + type: "inner" + }; +} +let T1 = class extends Yn({ + nodeType: "paywall", + defaultRenderFn: _ke +}) { + static importDOM() { + return xke(this); + } +}; +const Oke = (t) => new T1(t); +function Ske(t) { + return t instanceof T1; +} +function Cke(t) { + return { + div: (e) => { + var i; + const n = (i = e.classList) == null ? void 0 : i.contains("kg-product-card"); + return e.tagName === "DIV" && n ? { + conversion(r) { + const s = Io(r, { + selector: ".kg-product-card-title" + }), o = Io(r, { + selector: ".kg-product-card-description" + }), a = { + productButtonEnabled: !1, + productRatingEnabled: !1, + productTitle: s, + productDescription: o + }, l = r.querySelector(".kg-product-card-image"); + l && l.getAttribute("src") && (a.productImageSrc = l.getAttribute("src"), l.getAttribute("width") && (a.productImageWidth = l.getAttribute("width")), l.getAttribute("height") && (a.productImageHeight = l.getAttribute("height"))); + const u = [...r.querySelectorAll(".kg-product-card-rating-active")].length; + u && (a.productRatingEnabled = !0, a.productStarRating = u); + const f = r.querySelector("a"); + if (f) { + const h = f.getAttribute("href"), m = Eke(f); + h && m && (a.productButtonEnabled = !0, a.productButton = m, a.productUrl = h); + } + return !s && !o && !l && !f ? null : { + node: new t(a) + }; + }, + priority: 1 + } : null; + } + }; +} +function Eke(t) { + let e = t.textContent; + return e && (e = e.replace(/\n/g, " ").replace(/\s+/g, " ").trim()), e; +} +function Tke(t, e = {}) { + var l, u, f; + Vn(e); + const n = e.createDocument(); + if (t.isEmpty()) + return Ir(n); + let i = "5px"; + ((l = e.design) == null ? void 0 : l.buttonCorners) === "rounded" ? i = "6px" : ((u = e.design) == null ? void 0 : u.buttonCorners) === "square" ? i = "0px" : ((f = e.design) == null ? void 0 : f.buttonCorners) === "pill" && (i = "9999px"); + const r = { + ...t.getDataset(), + starIcon: '', + buttonBorderRadius: i + }, s = "kg-product-card-rating-active"; + for (let d = 1; d <= 5; d++) + r["star" + d] = "", t.productStarRating >= d && (r["star" + d] = s); + const o = e.target === "email" ? Mke({ + data: r, + feature: e.feature + }) : $ke({ + data: r, + feature: e.feature + }), a = n.createElement("div"); + return a.innerHTML = o.trim(), { + element: a.firstElementChild + }; +} +function $ke({ + data: t +}) { + return ` +
    +
    + ${t.productImageSrc ? `` : ""} +
    +

    ${t.productTitle}

    +
    + ${t.productRatingEnabled ? ` +
    + ${t.starIcon} + ${t.starIcon} + ${t.starIcon} + ${t.starIcon} + ${t.starIcon} +
    + ` : ""} + +
    ${t.productDescription}
    + ${t.productButtonEnabled ? ` + ${t.productButton} + ` : ""} +
    +
    + `; +} +function Mke({ + data: t, + feature: e +}) { + let n; + return t.productImageWidth && t.productImageHeight && (n = { + width: t.productImageWidth, + height: t.productImageHeight + }, t.productImageWidth >= 560 && (n = Eh(n, { + width: 560 + }))), e != null && e.emailCustomization || e != null && e.emailCustomizationAlpha ? ` + + + + +
    + + ${t.productImageSrc ? ` + + + + ` : ""} + + + + ${t.productRatingEnabled ? ` + + + + ` : ""} + + + + ${t.productButtonEnabled ? ` + + + + ` : ""} +
    + +
    +

    ${t.productTitle}

    +
    + +
    ${t.productDescription}
    + + + + +
    + ${t.productButton} +
    +
    +
    + ` : ` + + ${t.productImageSrc ? ` + + + + ` : ""} + + + + ${t.productRatingEnabled ? ` + + + + ` : ""} + + + + ${t.productButtonEnabled ? ` + + + + ` : ""} +
    + +
    +

    ${t.productTitle}

    +
    + +
    +
    ${t.productDescription}
    +
    + +
    + `; +} +let $1 = class extends Yn({ + nodeType: "product", + properties: [{ + name: "productImageSrc", + default: "", + urlType: "url" + }, { + name: "productImageWidth", + default: null + }, { + name: "productImageHeight", + default: null + }, { + name: "productTitle", + default: "", + urlType: "html", + wordCount: !0 + }, { + name: "productDescription", + default: "", + urlType: "html", + wordCount: !0 + }, { + name: "productRatingEnabled", + default: !1 + }, { + name: "productStarRating", + default: 5 + }, { + name: "productButtonEnabled", + default: !1 + }, { + name: "productButton", + default: "" + }, { + name: "productUrl", + default: "" + }], + defaultRenderFn: Tke +}) { + /* override */ + exportJSON() { + const { + productImageSrc: e, + productImageWidth: n, + productImageHeight: i, + productTitle: r, + productDescription: s, + productRatingEnabled: o, + productStarRating: a, + productButtonEnabled: l, + productButton: u, + productUrl: f + } = this; + return { + type: "product", + version: 1, + productImageSrc: e && e.startsWith("data:") ? "" : e, + productImageWidth: n, + productImageHeight: i, + productTitle: r, + productDescription: s, + productRatingEnabled: o, + productStarRating: a, + productButtonEnabled: l, + productButton: u, + productUrl: f + }; + } + static importDOM() { + return Cke(this); + } + isEmpty() { + const e = this.__productButtonEnabled && this.__productUrl && this.__productButton; + return !this.__productTitle && !this.__productDescription && !e && !this.__productImageSrc && !this.__productRatingEnabled; + } +}; +const Nke = (t) => new $1(t); +function Ake(t) { + return t instanceof $1; +} +function Dke(t) { + return { + figure: (e) => { + if (e.nodeType === 1 && e.tagName === "FIGURE") { + const n = e.querySelector("iframe"); + if (n) + return { + conversion(r) { + const s = QN(n); + return s ? (s.caption = Io(r), { + node: new t(s) + }) : null; + }, + priority: 1 + }; + if (e.querySelector("blockquote")) + return { + conversion(r) { + const s = r.querySelector("a"); + if (!s) + return null; + let o = s.getAttribute("href"); + if (!o || !o.match(/^https?:\/\//i)) + return null; + let a = { + url: o + }; + a.caption = Io(r); + let l = r.querySelector("figcaption"); + return l == null || l.remove(), a.html = r.innerHTML, { + node: new t(a) + }; + }, + priority: 1 + }; + } + return null; + }, + iframe: (e) => e.nodeType === 1 && e.tagName === "IFRAME" ? { + conversion(n) { + const i = QN(n); + return i ? { + node: new t(i) + } : null; + }, + priority: 1 + } : null + }; +} +function QN(t) { + if (!t.src || !t.src.match(/^(https?:)?\/\//i)) + return; + t.src.match(/^\/\//) && (t.src = `https:${t.src}`); + let e = { + url: t.src + }; + return e.html = t.outerHTML, e; +} +function Pke(t, e, n) { + const i = t.metadata, r = e.createElement("figure"); + r.setAttribute("class", "kg-card kg-embed-card"); + let s = t.html; + const o = i && i.tweet_data, a = n.target === "email"; + if (o && a) { + const u = o.id, f = new Intl.NumberFormat("en-US", { + style: "decimal", + notation: "compact", + unitDisplay: "narrow", + maximumFractionDigits: 1 + }), d = f.format(o.public_metrics.retweet_count), h = f.format(o.public_metrics.like_count), m = o.users && o.users.find((W) => W.id === o.author_id), g = ht.fromISO(o.created_at).toLocaleString(ht.TIME_SIMPLE), w = ht.fromISO(o.created_at).toLocaleString(ht.DATE_MED), x = o.entities && o.entities.mentions || [], _ = o.entities && o.entities.urls || [], S = o.entities && o.entities.hashtags || [], C = x.concat(_).concat(S).sort((W, z) => W.start - z.start); + let E = o.text, M = null; + const $ = o.attachments && o.attachments && o.attachments.media_keys; + $ && (M = o.includes.media[0].preview_image_url || o.includes.media[0].url); + const P = o.attachments && o.attachments && o.attachments.poll_ids; + if (x) { + let W = 0, z = [], Z = Hme(E); + for (const L of C) { + let Q = "text", V = Z.slice(L.start, L.end + 1).join("").replace(/\n/g, "
    "); + L.url && (!L.display_url || L.display_url.startsWith("pic.twitter.com") ? Q = "img_url" : (Q = "url", V = V.replace(L.url, L.display_url))), L.username && (Q = "mention"), L.tag && (Q = "hashtag"), z.push({ + type: "text", + data: Z.slice(W, L.start).join("").replace(/\n/g, "
    ") + }), z.push({ + type: Q, + data: V + }), W = L.end + 1; + } + z.push({ + type: "text", + data: Z.slice(W, Z.length).join("").replace(/\n/g, "
    ") + }), E = z.reduce((L, Q) => Q.type === "text" ? L + Q.data : Q.type === "mention" ? L + `${Q.data}` : Q.type === "hashtag" ? L + `${Q.data}` : Q.type === "url" ? L + `${Q.data}` : L, ""); + } + s = ` + + + + +
    + + ${m ? ` + + ${m.profile_image_url ? `` : ""} + ${m.name ? ` + ` : ""} + + + ` : ""} + + + + ${$ ? ` + + ` : ""} + + + + + + +
    + + + ${m.name}
    @${m.username}
    +
    + +
    + ${E} + ${P ? '
    View poll →' : ""} +
    +
    + +
    + + + + +
    + ${g} • ${w} +
    +
    + + + + +
    + + ${h} likes • + ${d} retweets + +
    +
    +
    + `; + } + r.innerHTML = s.trim(); + const l = t.caption; + if (l) { + const u = e.createElement("figcaption"); + u.innerHTML = l, r.appendChild(u), r.setAttribute("class", `${r.getAttribute("class")} kg-card-hascaption`); + } + return { + element: r + }; +} +function Ike(t, e = {}) { + Vn(e); + const n = e.createDocument(); + return t.embedType === "twitter" ? Pke(t, n, e) : Lke(t, n, e); +} +function Lke(t, e, n) { + if (t.isEmpty()) + return Ir(e); + const i = n.target === "email", r = t.metadata, s = t.url, o = t.embedType === "video" && r && r.thumbnail_url, a = e.createElement("figure"); + if (a.setAttribute("class", "kg-card kg-embed-card"), i && o) { + const f = r.thumbnail_width / r.thumbnail_height, d = Math.round(600 / 4), h = Math.round(600 / f), m = ` + + + + + + + + +
    + + +
    +
     
    +
    + + + + `; + a.innerHTML = m.trim(); + } else + a.innerHTML = t.html; + const l = t.caption; + if (l) { + const u = e.createElement("figcaption"); + u.innerHTML = l, a.appendChild(u), a.setAttribute("class", `${a.getAttribute("class")} kg-card-hascaption`); + } + return { + element: a + }; +} +let M1 = class extends Yn({ + nodeType: "embed", + properties: [{ + name: "url", + default: "", + urlType: "url" + }, { + name: "embedType", + default: "" + }, { + name: "html", + default: "" + }, { + name: "metadata", + default: {} + }, { + name: "caption", + default: "", + wordCount: !0 + }], + defaultRenderFn: Ike +}) { + static importDOM() { + return Dke(this); + } + isEmpty() { + return !this.__url && !this.__html; + } +}; +const Rke = (t) => new M1(t); +function jke(t) { + return t instanceof M1; +} +function T4(t) { + return t.replace(/\n/g, " ").replace(/\s+/g, " ").trim(); +} +function $4(t) { + return t.replace(/\{(\w*?)(?:,? *"(.*?)")?\}/g, "%%$&%%"); +} +function M4(t, e) { + const n = e.createElement("div"); + return n.innerHTML = t, n.querySelectorAll("code").forEach((s) => { + if (s.textContent.match(/((.*?){.*?}(.*?))/gi)) { + const a = s.innerHTML; + s.parentNode.replaceChild(e.createRange().createContextualFragment(a), s); + } + }), n.innerHTML; +} +function Fke(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = t.html; + if (!i || e.target !== "email") + return Ir(n); + const r = $4(M4(T4(i), n)), s = n.createElement("div"); + return s.innerHTML = r, { + element: s, + type: "inner" + }; +} +let N1 = class extends Yn({ + nodeType: "email", + properties: [{ + name: "html", + default: "", + urlType: "html" + }], + defaultRenderFn: Fke +}) { +}; +const Bke = (t) => new N1(t); +function zke(t) { + return t instanceof N1; +} +function U3(t, e) { + const n = yw(t); + return n.fileName = t.src.match(/[^/]*$/)[0], n.row = Math.floor(e / 3), n; +} +function Wke(t) { + return { + figure: (e) => { + var n; + return (n = e.classList) != null && n.contains("kg-gallery-card") ? { + conversion(i) { + const r = {}, s = Array.from(i.querySelectorAll("img")); + return r.images = s.map(U3), r.caption = Io(i), { + node: new t(r) + }; + }, + priority: 1 + } : null; + }, + div: (e) => { + function n(r) { + var s; + return r.tagName === "DIV" && ((s = r.dataset) == null ? void 0 : s.paragraphCount) && r.querySelectorAll("img").length > 0; + } + if (n(e)) + return { + conversion(r) { + const s = { + caption: Io(r) + }; + let o = Array.from(r.querySelectorAll("img")), a = r.nextElementSibling; + for (; a && n(a); ) { + let u = a; + o = o.concat(Array.from(u.querySelectorAll("img"))); + const f = Io(u); + f && (s.caption = `${s.caption} / ${f}`), a = u.nextElementSibling, u.remove(); + } + return s.images = o.map(U3), { + node: new t(s) + }; + }, + priority: 1 + }; + function i(r) { + return r.tagName === "DIV" && r.className.match(/sqs-gallery-container/) && !r.className.match(/summary-/); + } + return i(e) ? { + conversion(r) { + const s = {}; + let o = Array.from(r.querySelectorAll("img.thumb-image")); + return o = o.map((l) => { + if (!l.getAttribute("src")) + if (l.previousElementSibling.tagName === "NOSCRIPT" && l.previousElementSibling.getElementsByTagName("img").length) { + const u = l.previousElementSibling; + l.setAttribute("src", l.getAttribute("data-src")), u.remove(); + } else + return; + return l; + }).filter((l) => l !== void 0), s.images = o.map(U3), s.caption = Io(r, { + selector: ".meta-title" + }), { + node: new t(s) + }; + }, + priority: 1 + } : null; + } + }; +} +const Hke = 3; +function Qke(t) { + return t.fileName && t.src && t.width && t.height; +} +function Uke(t) { + const e = [], n = t.length; + return t.forEach((i, r) => { + let s = i.row; + n > 1 && n % Hke === 1 && r === n - 2 && (s = s + 1), e[s] || (e[s] = []), e[s].push(i); + }), e; +} +function Zke(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = t.images.filter(Qke); + if (!i.length) + return Ir(n); + const r = n.createElement("figure"); + r.setAttribute("class", "kg-card kg-gallery-card kg-width-wide"); + const s = n.createElement("div"); + s.setAttribute("class", "kg-gallery-container"), r.appendChild(s); + const o = Uke(i); + if (o.forEach((a) => { + const l = n.createElement("div"); + l.setAttribute("class", "kg-gallery-row"), a.forEach((u) => { + const f = n.createElement("div"); + f.setAttribute("class", "kg-gallery-image"); + const d = n.createElement("img"); + d.setAttribute("src", u.src), d.setAttribute("width", u.width), d.setAttribute("height", u.height), d.setAttribute("loading", "lazy"), d.setAttribute("alt", u.alt || ""), u.title && d.setAttribute("title", u.title); + const { + canTransformImage: h + } = e, { + defaultMaxWidth: m + } = e.imageOptimization || {}; + if (m && u.width > m && gf(u.src, e.siteUrl) && h && h(u.src)) { + const { + width: g, + height: w + } = Eh(u, { + width: m + }); + d.setAttribute("width", g), d.setAttribute("height", w); + } + if (e.target !== "email" && (AW(d, u, e), d.getAttribute("srcset") && u.width >= 720 && (o.length === 1 && a.length === 1 && u.width >= 1200 ? d.setAttribute("sizes", "(min-width: 1200px) 1200px") : d.setAttribute("sizes", "(min-width: 720px) 720px"))), e.target === "email") { + if (u.width > 600) { + const g = Eh(u, { + width: 600 + }); + d.setAttribute("width", g.width), d.setAttribute("height", g.height); + } + if (gf(u.src, e.siteUrl) && e.canTransformImage && e.canTransformImage(u.src)) { + const w = oE(u, e.imageOptimization.contentImageSizes).find((x) => x >= 1200); + if (!(!w || w === u.width)) { + const [, x, _] = u.src.match(/(.*\/content\/images)\/(.*)/); + d.setAttribute("src", `${x}/size/w${w}/${_}`); + } + } + if (MW(u.src)) { + const g = new URL(u.src); + g.searchParams.set("w", 1200), d.setAttribute("src", g.href); + } + } + if (u.href) { + const g = n.createElement("a"); + g.setAttribute("href", u.href), g.appendChild(d), f.appendChild(g); + } else + f.appendChild(d); + l.appendChild(f); + }), s.appendChild(l); + }), t.caption) { + let a = n.createElement("figcaption"); + a.innerHTML = t.caption, r.appendChild(a), r.setAttribute("class", `${r.getAttribute("class")} kg-card-hascaption`); + } + return { + element: r + }; +} +let A1 = class extends Yn({ + nodeType: "gallery", + properties: [{ + name: "images", + default: [] + }, { + name: "caption", + default: "", + wordCount: !0 + }], + defaultRenderFn: Zke +}) { + /* override */ + static get urlTransformMap() { + return { + caption: "html", + images: { + src: "url", + caption: "html" + } + }; + } + static importDOM() { + return Wke(this); + } + hasEditMode() { + return !1; + } +}; +const qke = (t) => new A1(t); +function Yke(t) { + return t instanceof A1; +} +function Vke(t, e = {}) { + Vn(e); + const n = e.createDocument(), { + html: i, + buttonText: r, + buttonUrl: s, + showButton: o, + alignment: a, + segment: l, + showDividers: u + } = t, f = o && !!r && !!s; + if (!i && !f || e.target !== "email") + return Ir(n); + const d = n.createElement("div"); + l && d.setAttribute("data-gh-segment", l), a === "center" && d.setAttribute("class", "align-center"), u && d.appendChild(n.createElement("hr")); + const h = $4(M4(T4(i), n)); + if (d.innerHTML = d.innerHTML + h, f) { + const m = ` +
    + + + + + + +
    + ${Di(r)} +
    +
    +

    + `, g = $4(M4(T4(m), n)); + d.innerHTML = d.innerHTML + g; + } + return u && d.appendChild(n.createElement("hr")), { + element: d + }; +} +let D1 = class extends Yn({ + nodeType: "email-cta", + properties: [{ + name: "alignment", + default: "left" + }, { + name: "buttonText", + default: "" + }, { + name: "buttonUrl", + default: "", + urlType: "url" + }, { + name: "html", + default: "", + urlType: "html" + }, { + name: "segment", + default: "status:free" + }, { + name: "showButton", + default: !1 + }, { + name: "showDividers", + default: !0 + }], + defaultRenderFn: Vke +}) { +}; +const Xke = (t) => new D1(t); +function Gke(t) { + return t instanceof D1; +} +function Kke(t) { + return t.classList.contains("kg-layout-split") ? "split" : t.classList.contains("kg-layout-full") ? "full" : t.classList.contains("kg-layout-wide") ? "wide" : "regular"; +} +function Jke(t) { + return { + div: (e) => { + var i; + const n = ((i = e.dataset) == null ? void 0 : i.lexicalSignupForm) === ""; + return e.tagName === "DIV" && n ? { + conversion(r) { + var W, z, Z, L, Q, V, H, R, q, Y, K, te, se, ce, U; + const s = Kke(r), o = ((W = r.querySelector("h2")) == null ? void 0 : W.textContent) || "", a = ((z = r.querySelector("h3")) == null ? void 0 : z.textContent) || "", l = ((Z = r.querySelector("p")) == null ? void 0 : Z.textContent) || "", u = (L = r.querySelector(".kg-signup-card-image")) == null ? void 0 : L.getAttribute("src"), f = r.style.backgroundColor || "", d = ((Q = r.querySelector(".kg-signup-card-button")) == null ? void 0 : Q.style.backgroundColor) || "", h = ((H = (V = r.querySelector(".kg-signup-card-button-default")) == null ? void 0 : V.textContent) == null ? void 0 : H.trim()) || "Subscribe", m = ((R = r.querySelector(".kg-signup-card-button")) == null ? void 0 : R.style.color) || "", g = ((q = r.querySelector(".kg-signup-card-success")) == null ? void 0 : q.style.color) || "", w = (Y = r.querySelector(".kg-signup-card-text")) != null && Y.classList.contains("kg-align-center") ? "center" : "left", x = ((te = (K = r.querySelector(".kg-signup-card-success")) == null ? void 0 : K.textContent) == null ? void 0 : te.trim()) || "", _ = [...r.querySelectorAll("input[data-members-label]")].map((F) => F.value), S = ((se = r.classList) == null ? void 0 : se.contains("kg-style-accent")) ?? !1, C = ((U = (ce = r.querySelector(".kg-signup-card-button")) == null ? void 0 : ce.classList) == null ? void 0 : U.contains("kg-style-accent")) ?? !1, E = r.classList.contains("kg-swapped"), M = r.classList.contains("kg-content-wide") ? "contain" : "cover", $ = { + layout: s, + buttonText: h, + header: o, + subheader: a, + disclaimer: l, + backgroundImageSrc: u, + backgroundSize: M, + backgroundColor: S ? "accent" : Vc(f) || "#ffffff", + buttonColor: C ? "accent" : Vc(d) || "#ffffff", + textColor: Vc(g) || "#ffffff", + buttonTextColor: Vc(m) || "#000000", + alignment: w, + successMessage: x, + labels: _, + swapped: E + }; + return { + node: new t($) + }; + }, + priority: 1 + } : null; + } + }; +} +function e2e(t) { + const e = i2e(t).join(" "), n = r2e(t), i = t.buttonColor === "accent" ? "kg-style-accent" : "", r = t.buttonColor !== "accent" ? `background-color: ${t.buttonColor};` : "", s = t.alignment === "center" ? "kg-align-center" : "", o = t.backgroundColor !== "accent" && (!t.backgroundImageSrc || t.layout === "split") ? `background-color: ${t.backgroundColor}` : "", a = t.backgroundImageSrc ? ` + + ` : "", l = ` + + `; + return ` + + `; +} +function t2e() { + return ` + + + + + + + + + `; +} +function n2e(t, e = {}) { + Vn(e); + const n = e.createDocument(), i = { + alignment: t.__alignment, + buttonText: t.__buttonText, + header: t.__header, + subheader: t.__subheader, + disclaimer: t.__disclaimer, + backgroundImageSrc: t.__backgroundImageSrc, + backgroundSize: t.__backgroundSize, + backgroundColor: t.__backgroundColor, + buttonColor: t.__buttonColor, + labels: t.__labels, + layout: t.__layout, + textColor: t.__textColor, + buttonTextColor: t.__buttonTextColor, + successMessage: t.__successMessage, + swapped: t.__swapped + }; + if (e.target === "email") + return { + element: n.createElement("div") + }; + const r = e2e(i), s = n.createElement("div"); + if (s.innerHTML = r == null ? void 0 : r.trim(), i.header === "") { + const o = s.querySelector(".kg-signup-card-heading"); + o && o.remove(); + } + if (i.subheader === "") { + const o = s.querySelector(".kg-signup-card-subheading"); + o && o.remove(); + } + if (i.disclaimer === "") { + const o = s.querySelector(".kg-signup-card-disclaimer"); + o && o.remove(); + } + return { + element: s.firstElementChild + }; +} +function i2e(t) { + let e = ["kg-card kg-signup-card"]; + return t.layout && t.layout !== "split" && e.push(`kg-width-${t.layout}`), t.layout === "split" && e.push("kg-layout-split kg-width-full"), t.swapped && t.layout === "split" && e.push("kg-swapped"), t.layout && t.layout === "full" && e.push("kg-content-wide"), t.layout === "split" && t.backgroundSize === "contain" && e.push("kg-content-wide"), e; +} +const r2e = (t) => t.layout === "split" && t.backgroundColor === "accent" || t.layout !== "split" && !t.backgroundImageSrc && t.backgroundColor === "accent" ? "kg-style-accent" : ""; +let P1 = class extends Yn({ + nodeType: "signup", + properties: [{ + name: "alignment", + default: "left" + }, { + name: "backgroundColor", + default: "#F0F0F0" + }, { + name: "backgroundImageSrc", + default: "" + }, { + name: "backgroundSize", + default: "cover" + }, { + name: "textColor", + default: "" + }, { + name: "buttonColor", + default: "accent" + }, { + name: "buttonTextColor", + default: "#FFFFFF" + }, { + name: "buttonText", + default: "Subscribe" + }, { + name: "disclaimer", + default: "", + wordCount: !0 + }, { + name: "header", + default: "", + wordCount: !0 + }, { + name: "labels", + default: [] + }, { + name: "layout", + default: "wide" + }, { + name: "subheader", + default: "", + wordCount: !0 + }, { + name: "successMessage", + default: "Email sent! Check your inbox to complete your signup." + }, { + name: "swapped", + default: !1 + }], + defaultRenderFn: n2e +}) { + /* override */ + constructor({ + alignment: e, + backgroundColor: n, + backgroundImageSrc: i, + backgroundSize: r, + textColor: s, + buttonColor: o, + buttonTextColor: a, + buttonText: l, + disclaimer: u, + header: f, + labels: d, + layout: h, + subheader: m, + successMessage: g, + swapped: w + } = {}, x) { + super(x), this.__alignment = e || "left", this.__backgroundColor = n || "#F0F0F0", this.__backgroundImageSrc = i || "", this.__backgroundSize = r || "cover", this.__textColor = n === "transparent" && (h === "split" || !i) ? "" : s || "#000000", this.__buttonColor = o || "accent", this.__buttonTextColor = a || "#FFFFFF", this.__buttonText = l || "Subscribe", this.__disclaimer = u || "", this.__header = f || "", this.__labels = d || [], this.__layout = h || "wide", this.__subheader = m || "", this.__successMessage = g || "Email sent! Check your inbox to complete your signup.", this.__swapped = w || !1; + } + static importDOM() { + return Jke(this); + } + // keeping some custom methods for labels as it requires some special handling + setLabels(e) { + if (!Array.isArray(e) || !e.every((i) => typeof i == "string")) + throw new Error("Invalid argument: Expected an array of strings."); + const n = this.getWritable(); + n.__labels = e; + } + addLabel(e) { + this.getWritable().__labels.push(e); + } + removeLabel(e) { + const n = this.getWritable(); + n.__labels = n.__labels.filter((i) => i !== e); + } +}; +const s2e = (t) => new P1(t); +function o2e(t) { + return t instanceof P1; +} +function a2e(t, e) { + Vn(e); + const n = e.createDocument(), i = t.accentColor, r = t.backgroundColor, s = "https://partner.transistor.fm/ghost/embed/{uuid}", o = new URLSearchParams(); + i && o.set("color", i.replace(/^#/, "")), r && o.set("background", r.replace(/^#/, "")); + const a = o.toString(), l = a ? `${s}?${a}` : s, u = n.createElement("iframe"); + u.setAttribute("width", "100%"), u.setAttribute("height", "180"), u.setAttribute("frameborder", "no"), u.setAttribute("scrolling", "no"), u.setAttribute("seamless", ""), u.setAttribute("src", l); + const f = n.createElement("figure"); + return f.setAttribute("class", "kg-card kg-transistor-card"), f.appendChild(u), s0({ + element: f, + type: "inner" + }, t.visibility, e); +} +const UN = { + web: { + nonMember: !1, + // Hide from public visitors - requires member UUID + memberSegment: lo + // Show to all members (free + paid) + }, + email: { + memberSegment: lo + } +}; +let I1 = class extends Yn({ + nodeType: "transistor", + hasVisibility: !0, + properties: [ + { + name: "accentColor", + default: "" + }, + // Player accent color (text/buttons) - hex value + { + name: "backgroundColor", + default: "" + } + // Player background color - hex value + ], + defaultRenderFn: a2e +}) { + constructor(e = {}, n) { + super(e, n), e.visibility || (this.__visibility = PN(UN)); + } + static getPropertyDefaults() { + const e = super.getPropertyDefaults(); + return e.visibility = PN(UN), e; + } + isEmpty() { + return !1; + } + hasEditMode() { + return !0; + } +}; +const l2e = (t) => new I1(t), u2e = (t) => t instanceof I1, c2 = { + replace: N.TextNode, + with: (t) => new Fo(t.__text) +}; +class Fo extends N.TextNode { + constructor(e, n) { + super(e, n); + } + static getType() { + return "extended-text"; + } + static clone(e) { + return new Fo(e.__text, e.__key); + } + static importDOM() { + const e = N.TextNode.importDOM(); + return { + ...e, + span: () => ({ + conversion: c2e(e == null ? void 0 : e.span, f2e), + priority: 1 + }) + }; + } + static importJSON(e) { + return N.TextNode.importJSON(e); + } + exportJSON() { + const e = super.exportJSON(); + return e.type = "extended-text", e; + } + isSimpleText() { + return (this.__type === "text" || this.__type === "extended-text") && this.__mode === 0; + } + isInline() { + return !0; + } +} +function c2e(t, e) { + return (n) => { + const i = t == null ? void 0 : t(n); + if (!i) + return null; + const r = i.conversion(n); + return r && { + ...r, + forChild: (s, o) => { + const l = ((r == null ? void 0 : r.forChild) ?? ((u) => u))(s, o); + return N.$isTextNode(l) ? e(l, n) : l; + } + }; + }; +} +function f2e(t, e) { + var l, u, f, d, h; + const n = e, i = n.style.fontWeight === "bold" || ((l = n.parentElement) == null ? void 0 : l.style.fontWeight) === "bold", r = n.style.fontStyle === "italic" || ((u = n.parentElement) == null ? void 0 : u.style.fontStyle) === "italic", s = n.style.textDecoration === "underline" || ((f = n.parentElement) == null ? void 0 : f.style.textDecoration) === "underline", o = n.classList.contains("Strikethrough") || ((d = n.parentElement) == null ? void 0 : d.classList.contains("Strikethrough")), a = n.classList.contains("Highlight") || ((h = n.parentElement) == null ? void 0 : h.classList.contains("Highlight")); + return i && !t.hasFormat("bold") && (t = t.toggleFormat("bold")), r && !t.hasFormat("italic") && (t = t.toggleFormat("italic")), s && !t.hasFormat("underline") && (t = t.toggleFormat("underline")), o && !t.hasFormat("strikethrough") && (t = t.toggleFormat("strikethrough")), a && !t.hasFormat("highlight") && (t = t.toggleFormat("highlight")), t; +} +const f2 = { + replace: rn.HeadingNode, + with: (t) => new uc(t.__tag) +}; +class uc extends rn.HeadingNode { + constructor(e, n) { + super(e, n); + } + static getType() { + return "extended-heading"; + } + static clone(e) { + return new uc(e.__tag, e.__key); + } + static importDOM() { + const e = rn.HeadingNode.importDOM(); + return { + ...e, + p: d2e(e == null ? void 0 : e.p) + }; + } + static importJSON(e) { + return rn.HeadingNode.importJSON(e); + } + exportJSON() { + const e = super.exportJSON(); + return e.type = "extended-heading", e; + } +} +function d2e(t) { + return (e) => { + const n = t == null ? void 0 : t(e); + if (n) + return n; + const i = e, r = i.getAttribute("role") === "heading", s = i.getAttribute("aria-level"); + if (r && s) { + const o = parseInt(s, 10); + if (o > 0 && o < 7) + return { + conversion: () => ({ + node: new uc(`h${o}`) + }), + priority: 1 + }; + } + return null; + }; +} +const aE = { + replace: rn.QuoteNode, + with: () => new If() +}; +class If extends rn.QuoteNode { + constructor(e) { + super(e); + } + static getType() { + return "extended-quote"; + } + static clone(e) { + return new If(e.__key); + } + static importDOM() { + return { + ...rn.QuoteNode.importDOM(), + blockquote: h2e + }; + } + static importJSON(e) { + return rn.QuoteNode.importJSON(e); + } + exportJSON() { + const e = super.exportJSON(); + return e.type = "extended-quote", e; + } + /* c8 ignore start */ + extractWithChild() { + return !0; + } + /* c8 ignore end */ +} +function h2e() { + return { + conversion: () => ({ + node: new If(), + after: (e) => { + const n = []; + return e.forEach((i) => { + N.$isParagraphNode(i) ? (n.length > 0 && (n.push(N.$createLineBreakNode()), n.push(N.$createLineBreakNode())), n.push(...i.getChildren())) : n.push(i); + }), n; + } + }), + priority: 1 + }; +} +class uo extends N.TextNode { + static getType() { + return "tk"; + } + static clone(e) { + return new uo(e.__text, e.__key); + } + constructor(e, n) { + super(e, n); + } + createDOM(e) { + var r; + const n = super.createDOM(e), i = ((r = e.theme.tk) == null ? void 0 : r.split(" ")) || []; + return n.classList.add(...i), n.dataset.kgTk = !0, n; + } + static importJSON(e) { + const n = lE(e.text); + return n.setFormat(e.format), n.setDetail(e.detail), n.setMode(e.mode), n.setStyle(e.style), n; + } + exportJSON() { + return { + ...super.exportJSON(), + type: "tk" + }; + } + canInsertTextBefore() { + return !1; + } + isTextEntity() { + return !0; + } +} +function lE(t) { + return N.$applyNodeReplacement(new uo(t)); +} +function LW(t) { + return t instanceof uo; +} +var p2e = ` + + +`; +class Ma extends N.ElementNode { + constructor(n, i) { + super(i); + // We keep track of the format that was applied to the original '@' character + // so we can re-apply that when converting to a LinkNode + we(this, "__linkFormat", null); + this.__linkFormat = n; + } + static getType() { + return "at-link"; + } + static clone(n) { + return new Ma(n.__linkFormat, n.__key); + } + // This is a temporary node, it should never be serialized but we need + // to implement just in case and to match expected types. The AtLinkPlugin + // should take care of replacing this node with it's children when needed. + static importJSON({ + linkFormat: n + }) { + return uE(n); + } + exportJSON() { + return { + ...super.exportJSON(), + type: "at-link", + version: 1, + linkFormat: this.__linkFormat + }; + } + createDOM(n) { + const i = document.createElement("span"), r = (n.theme.atLink || "").split(" ").filter(Boolean), s = (n.theme.atLinkIcon || "").split(" ").filter(Boolean); + i.classList.add(...r); + const o = new DOMParser().parseFromString(p2e, "image/svg+xml").documentElement; + return o.classList.add(...s), i.appendChild(o), i; + } + updateDOM() { + return !1; + } + // should not render anything - this is a placeholder node + exportDOM() { + return null; + } + /* c8 ignore next 3 */ + static importDOM() { + return null; + } + getTextContent() { + return ""; + } + isInline() { + return !0; + } + canBeEmpty() { + return !1; + } + setLinkFormat(n) { + const i = this.getWritable(); + i.__linkFormat = n; + } + getLinkFormat() { + return this.getLatest().__linkFormat; + } +} +function uE(t) { + return N.$applyNodeReplacement(new Ma(t)); +} +function ul(t) { + return t instanceof Ma; +} +class cc extends N.TextNode { + constructor(n, i, r) { + super(n, r); + we(this, "__placeholder", null); + we(this, "defaultPlaceholder", "Find a post, tag or author"); + this.__placeholder = i; + } + static getType() { + return "at-link-search"; + } + static clone(n) { + return new cc(n.__text, n.__placeholder, n.__key); + } + // This is a temporary node, it should never be serialized but we need + // to implement just in case and to match expected types. The AtLinkPlugin + // should take care of replacing this node when needed. + static importJSON({ + text: n, + placeholder: i + }) { + return Sg(n, i); + } + exportJSON() { + return { + ...super.exportJSON(), + type: "at-link-search", + version: 1, + placeholder: this.__placeholder + }; + } + createDOM(n) { + const i = super.createDOM(n); + return i.dataset.placeholder = "", this.__text ? i.dataset.placeholder = this.__placeholder || "" : i.dataset.placeholder = this.__placeholder ?? this.defaultPlaceholder, i.classList.add(...n.theme.atLinkSearch.split(" ")), i; + } + updateDOM(n, i) { + return this.__text && (i.dataset.placeholder = this.__placeholder ?? ""), super.updateDOM(...arguments); + } + // should not render anything - this is a placeholder node + exportDOM() { + return null; + } + /* c8 ignore next 3 */ + static importDOM() { + return null; + } + canHaveFormat() { + return !1; + } + setPlaceholder(n) { + const i = this.getWritable(); + i.__placeholder = n; + } + getPlaceholder() { + return this.getLatest().__placeholder; + } + // Lexical will incorrectly pick up this node as an element node when the + // cursor is placed by the SVG icon element in the parent AtLinkNode. We + // need these methods to avoid throwing errors in that case but otherwise + // behaviour is unaffected. + getChildrenSize() { + return 0; + } + getChildAtIndex() { + return null; + } +} +function Sg(t = "", e = null) { + return N.$applyNodeReplacement(new cc(t, e)); +} +function cl(t) { + return t instanceof cc; +} +class Lf extends N.TextNode { + static getType() { + return "zwnj"; + } + static clone(e) { + return new Lf("", e.__key); + } + createDOM(e) { + const n = super.createDOM(e); + return n.innerHTML = "‌", n; + } + updateDOM() { + return !1; + } + exportJSON() { + return { + ...super.exportJSON(), + type: "zwnj", + version: 1 + }; + } + getTextContent() { + return ""; + } + isToken() { + return !0; + } +} +function N4() { + return new Lf(""); +} +function zd(t) { + return t instanceof Lf; +} +var m2e = { + import: { + br: (t) => { + var o, a; + const e = !!t.closest('[id^="docs-internal-guid-"]'), n = (o = t.previousElementSibling) == null ? void 0 : o.nodeName, i = (a = t.nextElementSibling) == null ? void 0 : a.nodeName, r = ["H1", "H2", "H3", "H4", "H5", "H6"], s = ["UL", "OL", "DL"]; + return e && (n === "P" && i === "P" || n === "BR" || i === "BR" || [...r, ...s].includes(n) && i === "P" || n === "P" && [...r, ...s].includes(i)) ? { + conversion: () => null, + priority: 1 + } : null; + } + } +}, g2e = { + import: { + p: (t) => !!t.closest('[id^="docs-internal-guid-"]') && t.textContent === "" ? { + conversion: () => null, + priority: 1 + } : null + } +}; +const RW = { + generateDecoratorNode: Yn, + visibility: zye, + rgbToHex: Vc, + taggedTemplateFns: zwe +}, A4 = { + linebreak: m2e, + paragraph: g2e +}, jW = { + html: { + import: { + ...A4.linebreak.import, + ...A4.paragraph.import + } + } +}, v2e = [Fo, c2, uc, f2, If, aE, p1, h1, m1, g1, v1, b1, y1, w1, k1, x1, C1, _1, O1, E1, S1, T1, $1, M1, N1, A1, D1, P1, I1, uo, Ma, cc, Lf], b2e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + $createAsideNode: $we, + $createAtLinkNode: uE, + $createAtLinkSearchNode: Sg, + $createAudioNode: mwe, + $createBookmarkNode: ske, + $createButtonNode: Jwe, + $createCallToActionNode: Cwe, + $createCalloutNode: kwe, + $createCodeBlockNode: Vye, + $createEmailCtaNode: Xke, + $createEmailNode: Bke, + $createEmbedNode: Rke, + $createFileNode: hke, + $createGalleryNode: qke, + $createHeaderNode: wke, + $createHorizontalRuleNode: Dwe, + $createHtmlNode: jwe, + $createImageNode: Uye, + $createMarkdownNode: Kye, + $createPaywallNode: Oke, + $createProductNode: Nke, + $createSignupNode: s2e, + $createTKNode: lE, + $createToggleNode: Uwe, + $createTransistorNode: l2e, + $createVideoNode: owe, + $createZWNJNode: N4, + $isAsideNode: Mwe, + $isAtLinkNode: ul, + $isAtLinkSearchNode: cl, + $isAudioNode: gwe, + $isBookmarkNode: oke, + $isButtonNode: eke, + $isCallToActionNode: Ewe, + $isCalloutNode: wwe, + $isCodeBlockNode: Xye, + $isEmailCtaNode: Gke, + $isEmailNode: zke, + $isEmbedNode: jke, + $isFileNode: dke, + $isGalleryNode: Yke, + $isHeaderNode: kke, + $isHorizontalRuleNode: Pwe, + $isHtmlNode: Fwe, + $isImageNode: Zye, + $isKoenigCard: qc, + $isMarkdownNode: Jye, + $isPaywallNode: Ske, + $isProductNode: Ake, + $isSignupNode: o2e, + $isTKNode: LW, + $isToggleNode: Zwe, + $isTransistorNode: u2e, + $isVideoNode: awe, + $isZWNJNode: zd, + AsideNode: w1, + AtLinkNode: Ma, + AtLinkSearchNode: cc, + AudioNode: v1, + BookmarkNode: S1, + ButtonNode: O1, + CallToActionNode: y1, + CalloutNode: b1, + CodeBlockNode: p1, + DEFAULT_CONFIG: jW, + DEFAULT_NODES: v2e, + EmailCtaNode: D1, + EmailNode: N1, + EmbedNode: M1, + ExtendedHeadingNode: uc, + ExtendedQuoteNode: If, + ExtendedTextNode: Fo, + FileNode: C1, + GalleryNode: A1, + HeaderNode: E1, + HorizontalRuleNode: k1, + HtmlNode: x1, + ImageNode: h1, + KoenigDecoratorNode: iE, + MarkdownNode: m1, + PaywallNode: T1, + ProductNode: $1, + SignupNode: P1, + TKNode: uo, + ToggleNode: _1, + TransistorNode: I1, + VideoNode: g1, + ZWNJNode: Lf, + extendedHeadingNodeReplacement: f2, + extendedQuoteNodeReplacement: aE, + extendedTextNodeReplacement: c2, + serializers: A4, + utils: RW +}, Symbol.toStringTag, { value: "Module" })); +class cE extends w1 { + createDOM(e) { + const n = document.createElement("aside"); + return lt.addClassNamesToElement(n, e.theme.aside), n; + } + // Mutation + insertNewAfter() { + const e = N.$createParagraphNode(), n = this.getDirection(); + return e.setDirection(n), this.insertAfter(e), e; + } + collapseAtStart() { + const e = N.$createParagraphNode(); + return this.getChildren().forEach((i) => e.append(i)), this.replace(e), !0; + } +} +function FW() { + return new cE(); +} +function ZN(t) { + return t instanceof cE; +} +const y2e = (t) => /* @__PURE__ */ J.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ J.createElement("g", { fill: "none", fillRule: "evenodd" }, /* @__PURE__ */ J.createElement("path", { d: "M32 2.667C32 .889 31.111 0 29.333 0H2.667C1.93 0 1.302.26.78.781.261 1.301 0 1.931 0 2.667v26.666C0 31.111.889 32 2.667 32h26.666C31.111 32 32 31.111 32 29.333V2.667z", fill: "#465961", fillRule: "nonzero" }), /* @__PURE__ */ J.createElement("path", { stroke: "#FFF", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", d: "M10.5 12l-4 4.333 4 3.667M21.5 12l4 4.333-4 3.667M18 11l-4 10" }))), BW = j.createContext({}), w2e = ({ children: t }) => { + const [e, n] = j.useState(null), [i, r] = j.useState(!1), [s, o] = j.useState(!1), [a, l] = j.useState(!1), u = j.useMemo(() => ({ + selectedCardKey: e, + setSelectedCardKey: n, + isEditingCard: i, + setIsEditingCard: r, + isDragging: s, + setIsDragging: o, + showVisibilitySettings: a, + setShowVisibilitySettings: l + }), [ + e, + n, + i, + r, + s, + o, + a, + l + ]); + return /* @__PURE__ */ y.jsx(BW.Provider, { value: u, children: t }); +}, Rf = () => j.useContext(BW); +function St({ isVisible: t, children: e, ...n }) { + const { isDragging: i } = Rf(); + if (t && !i) + return /* @__PURE__ */ y.jsx("div", { className: "not-kg-prose absolute left-1/2 top-[-46px] z-[1000] -translate-x-1/2", ...n, children: e }); +} +function D4() { + return D4 = Object.assign ? Object.assign.bind() : function(t) { + for (var e = 1; e < arguments.length; e++) { + var n = arguments[e]; + for (var i in n) + Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); + } + return t; + }, D4.apply(this, arguments); +} +function k2e(t, e) { + if (t == null) return {}; + var n = {}, i = Object.keys(t), r, s; + for (s = 0; s < i.length; s++) + r = i[s], !(e.indexOf(r) >= 0) && (n[r] = t[r]); + return n; +} +let Kt = class zW { + /** + Get the line description around the given position. + */ + lineAt(e) { + if (e < 0 || e > this.length) + throw new RangeError(`Invalid position ${e} in document of length ${this.length}`); + return this.lineInner(e, !1, 1, 0); + } + /** + Get the description for the given (1-based) line number. + */ + line(e) { + if (e < 1 || e > this.lines) + throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`); + return this.lineInner(e, !0, 1, 0); + } + /** + Replace a range of the text with the given content. + */ + replace(e, n, i) { + [e, n] = Th(this, e, n); + let r = []; + return this.decompose( + 0, + e, + r, + 2 + /* Open.To */ + ), i.length && i.decompose( + 0, + i.length, + r, + 3 + /* Open.To */ + ), this.decompose( + n, + this.length, + r, + 1 + /* Open.From */ + ), ga.from(r, this.length - (n - e) + i.length); + } + /** + Append another document to this one. + */ + append(e) { + return this.replace(this.length, this.length, e); + } + /** + Retrieve the text between the given points. + */ + slice(e, n = this.length) { + [e, n] = Th(this, e, n); + let i = []; + return this.decompose(e, n, i, 0), ga.from(i, n - e); + } + /** + Test whether this text is equal to another instance. + */ + eq(e) { + if (e == this) + return !0; + if (e.length != this.length || e.lines != this.lines) + return !1; + let n = this.scanIdentical(e, 1), i = this.length - this.scanIdentical(e, -1), r = new Cg(this), s = new Cg(e); + for (let o = n, a = n; ; ) { + if (r.next(o), s.next(o), o = 0, r.lineBreak != s.lineBreak || r.done != s.done || r.value != s.value) + return !1; + if (a += r.value.length, r.done || a >= i) + return !0; + } + } + /** + Iterate over the text. When `dir` is `-1`, iteration happens + from end to start. This will return lines and the breaks between + them as separate strings. + */ + iter(e = 1) { + return new Cg(this, e); + } + /** + Iterate over a range of the text. When `from` > `to`, the + iterator will run in reverse. + */ + iterRange(e, n = this.length) { + return new WW(this, e, n); + } + /** + Return a cursor that iterates over the given range of lines, + _without_ returning the line breaks between, and yielding empty + strings for empty lines. + + When `from` and `to` are given, they should be 1-based line numbers. + */ + iterLines(e, n) { + let i; + if (e == null) + i = this.iter(); + else { + n == null && (n = this.lines + 1); + let r = this.line(e).from; + i = this.iterRange(r, Math.max(r, n == this.lines + 1 ? this.length : n <= 1 ? 0 : this.line(n - 1).to)); + } + return new HW(i); + } + /** + Return the document as a string, using newline characters to + separate lines. + */ + toString() { + return this.sliceString(0); + } + /** + Convert the document to an array of lines (which can be + deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)). + */ + toJSON() { + let e = []; + return this.flatten(e), e; + } + /** + @internal + */ + constructor() { + } + /** + Create a `Text` instance for the given array of lines. + */ + static of(e) { + if (e.length == 0) + throw new RangeError("A document must have at least one line"); + return e.length == 1 && !e[0] ? zW.empty : e.length <= 32 ? new hi(e) : ga.from(hi.split(e, [])); + } +}; +class hi extends Kt { + constructor(e, n = x2e(e)) { + super(), this.text = e, this.length = n; + } + get lines() { + return this.text.length; + } + get children() { + return null; + } + lineInner(e, n, i, r) { + for (let s = 0; ; s++) { + let o = this.text[s], a = r + o.length; + if ((n ? i : a) >= e) + return new _2e(r, a, i, o); + r = a + 1, i++; + } + } + decompose(e, n, i, r) { + let s = e <= 0 && n >= this.length ? this : new hi(qN(this.text, e, n), Math.min(n, this.length) - Math.max(0, e)); + if (r & 1) { + let o = i.pop(), a = oy(s.text, o.text.slice(), 0, s.length); + if (a.length <= 32) + i.push(new hi(a, o.length + s.length)); + else { + let l = a.length >> 1; + i.push(new hi(a.slice(0, l)), new hi(a.slice(l))); + } + } else + i.push(s); + } + replace(e, n, i) { + if (!(i instanceof hi)) + return super.replace(e, n, i); + [e, n] = Th(this, e, n); + let r = oy(this.text, oy(i.text, qN(this.text, 0, e)), n), s = this.length + i.length - (n - e); + return r.length <= 32 ? new hi(r, s) : ga.from(hi.split(r, []), s); + } + sliceString(e, n = this.length, i = ` +`) { + [e, n] = Th(this, e, n); + let r = ""; + for (let s = 0, o = 0; s <= n && o < this.text.length; o++) { + let a = this.text[o], l = s + a.length; + s > e && o && (r += i), e < l && n > s && (r += a.slice(Math.max(0, e - s), n - s)), s = l + 1; + } + return r; + } + flatten(e) { + for (let n of this.text) + e.push(n); + } + scanIdentical() { + return 0; + } + static split(e, n) { + let i = [], r = -1; + for (let s of e) + i.push(s), r += s.length + 1, i.length == 32 && (n.push(new hi(i, r)), i = [], r = -1); + return r > -1 && n.push(new hi(i, r)), n; + } +} +class ga extends Kt { + constructor(e, n) { + super(), this.children = e, this.length = n, this.lines = 0; + for (let i of e) + this.lines += i.lines; + } + lineInner(e, n, i, r) { + for (let s = 0; ; s++) { + let o = this.children[s], a = r + o.length, l = i + o.lines - 1; + if ((n ? l : a) >= e) + return o.lineInner(e, n, i, r); + r = a + 1, i = l + 1; + } + } + decompose(e, n, i, r) { + for (let s = 0, o = 0; o <= n && s < this.children.length; s++) { + let a = this.children[s], l = o + a.length; + if (e <= l && n >= o) { + let u = r & ((o <= e ? 1 : 0) | (l >= n ? 2 : 0)); + o >= e && l <= n && !u ? i.push(a) : a.decompose(e - o, n - o, i, u); + } + o = l + 1; + } + } + replace(e, n, i) { + if ([e, n] = Th(this, e, n), i.lines < this.lines) + for (let r = 0, s = 0; r < this.children.length; r++) { + let o = this.children[r], a = s + o.length; + if (e >= s && n <= a) { + let l = o.replace(e - s, n - s, i), u = this.lines - o.lines + l.lines; + if (l.lines < u >> 4 && l.lines > u >> 6) { + let f = this.children.slice(); + return f[r] = l, new ga(f, this.length - (n - e) + i.length); + } + return super.replace(s, a, l); + } + s = a + 1; + } + return super.replace(e, n, i); + } + sliceString(e, n = this.length, i = ` +`) { + [e, n] = Th(this, e, n); + let r = ""; + for (let s = 0, o = 0; s < this.children.length && o <= n; s++) { + let a = this.children[s], l = o + a.length; + o > e && s && (r += i), e < l && n > o && (r += a.sliceString(e - o, n - o, i)), o = l + 1; + } + return r; + } + flatten(e) { + for (let n of this.children) + n.flatten(e); + } + scanIdentical(e, n) { + if (!(e instanceof ga)) + return 0; + let i = 0, [r, s, o, a] = n > 0 ? [0, 0, this.children.length, e.children.length] : [this.children.length - 1, e.children.length - 1, -1, -1]; + for (; ; r += n, s += n) { + if (r == o || s == a) + return i; + let l = this.children[r], u = e.children[s]; + if (l != u) + return i + l.scanIdentical(u, n); + i += l.length + 1; + } + } + static from(e, n = e.reduce((i, r) => i + r.length + 1, -1)) { + let i = 0; + for (let m of e) + i += m.lines; + if (i < 32) { + let m = []; + for (let g of e) + g.flatten(m); + return new hi(m, n); + } + let r = Math.max( + 32, + i >> 5 + /* Tree.BranchShift */ + ), s = r << 1, o = r >> 1, a = [], l = 0, u = -1, f = []; + function d(m) { + let g; + if (m.lines > s && m instanceof ga) + for (let w of m.children) + d(w); + else m.lines > o && (l > o || !l) ? (h(), a.push(m)) : m instanceof hi && l && (g = f[f.length - 1]) instanceof hi && m.lines + g.lines <= 32 ? (l += m.lines, u += m.length + 1, f[f.length - 1] = new hi(g.text.concat(m.text), g.length + 1 + m.length)) : (l + m.lines > r && h(), l += m.lines, u += m.length + 1, f.push(m)); + } + function h() { + l != 0 && (a.push(f.length == 1 ? f[0] : ga.from(f, u)), u = -1, l = f.length = 0); + } + for (let m of e) + d(m); + return h(), a.length == 1 ? a[0] : new ga(a, n); + } +} +Kt.empty = /* @__PURE__ */ new hi([""], 0); +function x2e(t) { + let e = -1; + for (let n of t) + e += n.length + 1; + return e; +} +function oy(t, e, n = 0, i = 1e9) { + for (let r = 0, s = 0, o = !0; s < t.length && r <= i; s++) { + let a = t[s], l = r + a.length; + l >= n && (l > i && (a = a.slice(0, i - r)), r < n && (a = a.slice(n - r)), o ? (e[e.length - 1] += a, o = !1) : e.push(a)), r = l + 1; + } + return e; +} +function qN(t, e, n) { + return oy(t, [""], e, n); +} +class Cg { + constructor(e, n = 1) { + this.dir = n, this.done = !1, this.lineBreak = !1, this.value = "", this.nodes = [e], this.offsets = [n > 0 ? 1 : (e instanceof hi ? e.text.length : e.children.length) << 1]; + } + nextInner(e, n) { + for (this.done = this.lineBreak = !1; ; ) { + let i = this.nodes.length - 1, r = this.nodes[i], s = this.offsets[i], o = s >> 1, a = r instanceof hi ? r.text.length : r.children.length; + if (o == (n > 0 ? a : 0)) { + if (i == 0) + return this.done = !0, this.value = "", this; + n > 0 && this.offsets[i - 1]++, this.nodes.pop(), this.offsets.pop(); + } else if ((s & 1) == (n > 0 ? 0 : 1)) { + if (this.offsets[i] += n, e == 0) + return this.lineBreak = !0, this.value = ` +`, this; + e--; + } else if (r instanceof hi) { + let l = r.text[o + (n < 0 ? -1 : 0)]; + if (this.offsets[i] += n, l.length > Math.max(0, e)) + return this.value = e == 0 ? l : n > 0 ? l.slice(e) : l.slice(0, l.length - e), this; + e -= l.length; + } else { + let l = r.children[o + (n < 0 ? -1 : 0)]; + e > l.length ? (e -= l.length, this.offsets[i] += n) : (n < 0 && this.offsets[i]--, this.nodes.push(l), this.offsets.push(n > 0 ? 1 : (l instanceof hi ? l.text.length : l.children.length) << 1)); + } + } + } + next(e = 0) { + return e < 0 && (this.nextInner(-e, -this.dir), e = this.value.length), this.nextInner(e, this.dir); + } +} +class WW { + constructor(e, n, i) { + this.value = "", this.done = !1, this.cursor = new Cg(e, n > i ? -1 : 1), this.pos = n > i ? e.length : 0, this.from = Math.min(n, i), this.to = Math.max(n, i); + } + nextInner(e, n) { + if (n < 0 ? this.pos <= this.from : this.pos >= this.to) + return this.value = "", this.done = !0, this; + e += Math.max(0, n < 0 ? this.pos - this.to : this.from - this.pos); + let i = n < 0 ? this.pos - this.from : this.to - this.pos; + e > i && (e = i), i -= e; + let { value: r } = this.cursor.next(e); + return this.pos += (r.length + e) * n, this.value = r.length <= i ? r : n < 0 ? r.slice(r.length - i) : r.slice(0, i), this.done = !this.value, this; + } + next(e = 0) { + return e < 0 ? e = Math.max(e, this.from - this.pos) : e > 0 && (e = Math.min(e, this.to - this.pos)), this.nextInner(e, this.cursor.dir); + } + get lineBreak() { + return this.cursor.lineBreak && this.value != ""; + } +} +class HW { + constructor(e) { + this.inner = e, this.afterBreak = !0, this.value = "", this.done = !1; + } + next(e = 0) { + let { done: n, lineBreak: i, value: r } = this.inner.next(e); + return n && this.afterBreak ? (this.value = "", this.afterBreak = !1) : n ? (this.done = !0, this.value = "") : i ? this.afterBreak ? this.value = "" : (this.afterBreak = !0, this.next()) : (this.value = r, this.afterBreak = !1), this; + } + get lineBreak() { + return !1; + } +} +typeof Symbol < "u" && (Kt.prototype[Symbol.iterator] = function() { + return this.iter(); +}, Cg.prototype[Symbol.iterator] = WW.prototype[Symbol.iterator] = HW.prototype[Symbol.iterator] = function() { + return this; +}); +class _2e { + /** + @internal + */ + constructor(e, n, i, r) { + this.from = e, this.to = n, this.number = i, this.text = r; + } + /** + The length of the line (not including any line break after it). + */ + get length() { + return this.to - this.from; + } +} +function Th(t, e, n) { + return e = Math.max(0, Math.min(t.length, e)), [e, Math.max(e, Math.min(t.length, n))]; +} +let dh = /* @__PURE__ */ "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((t) => t ? parseInt(t, 36) : 1); +for (let t = 1; t < dh.length; t++) + dh[t] += dh[t - 1]; +function O2e(t) { + for (let e = 1; e < dh.length; e += 2) + if (dh[e] > t) + return dh[e - 1] <= t; + return !1; +} +function YN(t) { + return t >= 127462 && t <= 127487; +} +const VN = 8205; +function dr(t, e, n = !0, i = !0) { + return (n ? QW : S2e)(t, e, i); +} +function QW(t, e, n) { + if (e == t.length) + return e; + e && UW(t.charCodeAt(e)) && ZW(t.charCodeAt(e - 1)) && e--; + let i = ar(t, e); + for (e += io(i); e < t.length; ) { + let r = ar(t, e); + if (i == VN || r == VN || n && O2e(r)) + e += io(r), i = r; + else if (YN(r)) { + let s = 0, o = e - 2; + for (; o >= 0 && YN(ar(t, o)); ) + s++, o -= 2; + if (s % 2 == 0) + break; + e += 2; + } else + break; + } + return e; +} +function S2e(t, e, n) { + for (; e > 0; ) { + let i = QW(t, e - 2, n); + if (i < e) + return i; + e--; + } + return 0; +} +function UW(t) { + return t >= 56320 && t < 57344; +} +function ZW(t) { + return t >= 55296 && t < 56320; +} +function ar(t, e) { + let n = t.charCodeAt(e); + if (!ZW(n) || e + 1 == t.length) + return n; + let i = t.charCodeAt(e + 1); + return UW(i) ? (n - 55296 << 10) + (i - 56320) + 65536 : n; +} +function fE(t) { + return t <= 65535 ? String.fromCharCode(t) : (t -= 65536, String.fromCharCode((t >> 10) + 55296, (t & 1023) + 56320)); +} +function io(t) { + return t < 65536 ? 1 : 2; +} +const P4 = /\r\n?|\n/; +var ur = /* @__PURE__ */ function(t) { + return t[t.Simple = 0] = "Simple", t[t.TrackDel = 1] = "TrackDel", t[t.TrackBefore = 2] = "TrackBefore", t[t.TrackAfter = 3] = "TrackAfter", t; +}(ur || (ur = {})); +class Sa { + // Sections are encoded as pairs of integers. The first is the + // length in the current document, and the second is -1 for + // unaffected sections, and the length of the replacement content + // otherwise. So an insertion would be (0, n>0), a deletion (n>0, + // 0), and a replacement two positive numbers. + /** + @internal + */ + constructor(e) { + this.sections = e; + } + /** + The length of the document before the change. + */ + get length() { + let e = 0; + for (let n = 0; n < this.sections.length; n += 2) + e += this.sections[n]; + return e; + } + /** + The length of the document after the change. + */ + get newLength() { + let e = 0; + for (let n = 0; n < this.sections.length; n += 2) { + let i = this.sections[n + 1]; + e += i < 0 ? this.sections[n] : i; + } + return e; + } + /** + False when there are actual changes in this set. + */ + get empty() { + return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; + } + /** + Iterate over the unchanged parts left by these changes. `posA` + provides the position of the range in the old document, `posB` + the new position in the changed document. + */ + iterGaps(e) { + for (let n = 0, i = 0, r = 0; n < this.sections.length; ) { + let s = this.sections[n++], o = this.sections[n++]; + o < 0 ? (e(i, r, s), r += s) : r += o, i += s; + } + } + /** + Iterate over the ranges changed by these changes. (See + [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a + variant that also provides you with the inserted text.) + `fromA`/`toA` provides the extent of the change in the starting + document, `fromB`/`toB` the extent of the replacement in the + changed document. + + When `individual` is true, adjacent changes (which are kept + separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are + reported separately. + */ + iterChangedRanges(e, n = !1) { + I4(this, e, n); + } + /** + Get a description of the inverted form of these changes. + */ + get invertedDesc() { + let e = []; + for (let n = 0; n < this.sections.length; ) { + let i = this.sections[n++], r = this.sections[n++]; + r < 0 ? e.push(i, r) : e.push(r, i); + } + return new Sa(e); + } + /** + Compute the combined effect of applying another set of changes + after this one. The length of the document after this set should + match the length before `other`. + */ + composeDesc(e) { + return this.empty ? e : e.empty ? this : qW(this, e); + } + /** + Map this description, which should start with the same document + as `other`, over another set of changes, so that it can be + applied after it. When `before` is true, map as if the changes + in `other` happened before the ones in `this`. + */ + mapDesc(e, n = !1) { + return e.empty ? this : L4(this, e, n); + } + mapPos(e, n = -1, i = ur.Simple) { + let r = 0, s = 0; + for (let o = 0; o < this.sections.length; ) { + let a = this.sections[o++], l = this.sections[o++], u = r + a; + if (l < 0) { + if (u > e) + return s + (e - r); + s += a; + } else { + if (i != ur.Simple && u >= e && (i == ur.TrackDel && r < e && u > e || i == ur.TrackBefore && r < e || i == ur.TrackAfter && u > e)) + return null; + if (u > e || u == e && n < 0 && !a) + return e == r || n < 0 ? s : s + l; + s += l; + } + r = u; + } + if (e > r) + throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`); + return s; + } + /** + Check whether these changes touch a given range. When one of the + changes entirely covers the range, the string `"cover"` is + returned. + */ + touchesRange(e, n = e) { + for (let i = 0, r = 0; i < this.sections.length && r <= n; ) { + let s = this.sections[i++], o = this.sections[i++], a = r + s; + if (o >= 0 && r <= n && a >= e) + return r < e && a > n ? "cover" : !0; + r = a; + } + return !1; + } + /** + @internal + */ + toString() { + let e = ""; + for (let n = 0; n < this.sections.length; ) { + let i = this.sections[n++], r = this.sections[n++]; + e += (e ? " " : "") + i + (r >= 0 ? ":" + r : ""); + } + return e; + } + /** + Serialize this change desc to a JSON-representable value. + */ + toJSON() { + return this.sections; + } + /** + Create a change desc from its JSON representation (as produced + by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON). + */ + static fromJSON(e) { + if (!Array.isArray(e) || e.length % 2 || e.some((n) => typeof n != "number")) + throw new RangeError("Invalid JSON representation of ChangeDesc"); + return new Sa(e); + } + /** + @internal + */ + static create(e) { + return new Sa(e); + } +} +class Ii extends Sa { + constructor(e, n) { + super(e), this.inserted = n; + } + /** + Apply the changes to a document, returning the modified + document. + */ + apply(e) { + if (this.length != e.length) + throw new RangeError("Applying change set to a document with the wrong length"); + return I4(this, (n, i, r, s, o) => e = e.replace(r, r + (i - n), o), !1), e; + } + mapDesc(e, n = !1) { + return L4(this, e, n, !0); + } + /** + Given the document as it existed _before_ the changes, return a + change set that represents the inverse of this set, which could + be used to go from the document created by the changes back to + the document as it existed before the changes. + */ + invert(e) { + let n = this.sections.slice(), i = []; + for (let r = 0, s = 0; r < n.length; r += 2) { + let o = n[r], a = n[r + 1]; + if (a >= 0) { + n[r] = a, n[r + 1] = o; + let l = r >> 1; + for (; i.length < l; ) + i.push(Kt.empty); + i.push(o ? e.slice(s, s + o) : Kt.empty); + } + s += o; + } + return new Ii(n, i); + } + /** + Combine two subsequent change sets into a single set. `other` + must start in the document produced by `this`. If `this` goes + `docA` → `docB` and `other` represents `docB` → `docC`, the + returned value will represent the change `docA` → `docC`. + */ + compose(e) { + return this.empty ? e : e.empty ? this : qW(this, e, !0); + } + /** + Given another change set starting in the same document, maps this + change set over the other, producing a new change set that can be + applied to the document produced by applying `other`. When + `before` is `true`, order changes as if `this` comes before + `other`, otherwise (the default) treat `other` as coming first. + + Given two changes `A` and `B`, `A.compose(B.map(A))` and + `B.compose(A.map(B, true))` will produce the same document. This + provides a basic form of [operational + transformation](https://en.wikipedia.org/wiki/Operational_transformation), + and can be used for collaborative editing. + */ + map(e, n = !1) { + return e.empty ? this : L4(this, e, n, !0); + } + /** + Iterate over the changed ranges in the document, calling `f` for + each, with the range in the original document (`fromA`-`toA`) + and the range that replaces it in the new document + (`fromB`-`toB`). + + When `individual` is true, adjacent changes are reported + separately. + */ + iterChanges(e, n = !1) { + I4(this, e, n); + } + /** + Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change + set. + */ + get desc() { + return Sa.create(this.sections); + } + /** + @internal + */ + filter(e) { + let n = [], i = [], r = [], s = new o0(this); + e: for (let o = 0, a = 0; ; ) { + let l = o == e.length ? 1e9 : e[o++]; + for (; a < l || a == l && s.len == 0; ) { + if (s.done) + break e; + let f = Math.min(s.len, l - a); + Cr(r, f, -1); + let d = s.ins == -1 ? -1 : s.off == 0 ? s.ins : 0; + Cr(n, f, d), d > 0 && Ou(i, n, s.text), s.forward(f), a += f; + } + let u = e[o++]; + for (; a < u; ) { + if (s.done) + break e; + let f = Math.min(s.len, u - a); + Cr(n, f, -1), Cr(r, f, s.ins == -1 ? -1 : s.off == 0 ? s.ins : 0), s.forward(f), a += f; + } + } + return { + changes: new Ii(n, i), + filtered: Sa.create(r) + }; + } + /** + Serialize this change set to a JSON-representable value. + */ + toJSON() { + let e = []; + for (let n = 0; n < this.sections.length; n += 2) { + let i = this.sections[n], r = this.sections[n + 1]; + r < 0 ? e.push(i) : r == 0 ? e.push([i]) : e.push([i].concat(this.inserted[n >> 1].toJSON())); + } + return e; + } + /** + Create a change set for the given changes, for a document of the + given length, using `lineSep` as line separator. + */ + static of(e, n, i) { + let r = [], s = [], o = 0, a = null; + function l(f = !1) { + if (!f && !r.length) + return; + o < n && Cr(r, n - o, -1); + let d = new Ii(r, s); + a = a ? a.compose(d.map(a)) : d, r = [], s = [], o = 0; + } + function u(f) { + if (Array.isArray(f)) + for (let d of f) + u(d); + else if (f instanceof Ii) { + if (f.length != n) + throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${n})`); + l(), a = a ? a.compose(f.map(a)) : f; + } else { + let { from: d, to: h = d, insert: m } = f; + if (d > h || d < 0 || h > n) + throw new RangeError(`Invalid change range ${d} to ${h} (in doc of length ${n})`); + let g = m ? typeof m == "string" ? Kt.of(m.split(i || P4)) : m : Kt.empty, w = g.length; + if (d == h && w == 0) + return; + d < o && l(), d > o && Cr(r, d - o, -1), Cr(r, h - d, w), Ou(s, r, g), o = h; + } + } + return u(e), l(!a), a; + } + /** + Create an empty changeset of the given length. + */ + static empty(e) { + return new Ii(e ? [e, -1] : [], []); + } + /** + Create a changeset from its JSON representation (as produced by + [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON). + */ + static fromJSON(e) { + if (!Array.isArray(e)) + throw new RangeError("Invalid JSON representation of ChangeSet"); + let n = [], i = []; + for (let r = 0; r < e.length; r++) { + let s = e[r]; + if (typeof s == "number") + n.push(s, -1); + else { + if (!Array.isArray(s) || typeof s[0] != "number" || s.some((o, a) => a && typeof o != "string")) + throw new RangeError("Invalid JSON representation of ChangeSet"); + if (s.length == 1) + n.push(s[0], 0); + else { + for (; i.length < r; ) + i.push(Kt.empty); + i[r] = Kt.of(s.slice(1)), n.push(s[0], i[r].length); + } + } + } + return new Ii(n, i); + } + /** + @internal + */ + static createSet(e, n) { + return new Ii(e, n); + } +} +function Cr(t, e, n, i = !1) { + if (e == 0 && n <= 0) + return; + let r = t.length - 2; + r >= 0 && n <= 0 && n == t[r + 1] ? t[r] += e : e == 0 && t[r] == 0 ? t[r + 1] += n : i ? (t[r] += e, t[r + 1] += n) : t.push(e, n); +} +function Ou(t, e, n) { + if (n.length == 0) + return; + let i = e.length - 2 >> 1; + if (i < t.length) + t[t.length - 1] = t[t.length - 1].append(n); + else { + for (; t.length < i; ) + t.push(Kt.empty); + t.push(n); + } +} +function I4(t, e, n) { + let i = t.inserted; + for (let r = 0, s = 0, o = 0; o < t.sections.length; ) { + let a = t.sections[o++], l = t.sections[o++]; + if (l < 0) + r += a, s += a; + else { + let u = r, f = s, d = Kt.empty; + for (; u += a, f += l, l && i && (d = d.append(i[o - 2 >> 1])), !(n || o == t.sections.length || t.sections[o + 1] < 0); ) + a = t.sections[o++], l = t.sections[o++]; + e(r, u, s, f, d), r = u, s = f; + } + } +} +function L4(t, e, n, i = !1) { + let r = [], s = i ? [] : null, o = new o0(t), a = new o0(e); + for (let l = -1; ; ) + if (o.ins == -1 && a.ins == -1) { + let u = Math.min(o.len, a.len); + Cr(r, u, -1), o.forward(u), a.forward(u); + } else if (a.ins >= 0 && (o.ins < 0 || l == o.i || o.off == 0 && (a.len < o.len || a.len == o.len && !n))) { + let u = a.len; + for (Cr(r, a.ins, -1); u; ) { + let f = Math.min(o.len, u); + o.ins >= 0 && l < o.i && o.len <= f && (Cr(r, 0, o.ins), s && Ou(s, r, o.text), l = o.i), o.forward(f), u -= f; + } + a.next(); + } else if (o.ins >= 0) { + let u = 0, f = o.len; + for (; f; ) + if (a.ins == -1) { + let d = Math.min(f, a.len); + u += d, f -= d, a.forward(d); + } else if (a.ins == 0 && a.len < f) + f -= a.len, a.next(); + else + break; + Cr(r, u, l < o.i ? o.ins : 0), s && l < o.i && Ou(s, r, o.text), l = o.i, o.forward(o.len - f); + } else { + if (o.done && a.done) + return s ? Ii.createSet(r, s) : Sa.create(r); + throw new Error("Mismatched change set lengths"); + } +} +function qW(t, e, n = !1) { + let i = [], r = n ? [] : null, s = new o0(t), o = new o0(e); + for (let a = !1; ; ) { + if (s.done && o.done) + return r ? Ii.createSet(i, r) : Sa.create(i); + if (s.ins == 0) + Cr(i, s.len, 0, a), s.next(); + else if (o.len == 0 && !o.done) + Cr(i, 0, o.ins, a), r && Ou(r, i, o.text), o.next(); + else { + if (s.done || o.done) + throw new Error("Mismatched change set lengths"); + { + let l = Math.min(s.len2, o.len), u = i.length; + if (s.ins == -1) { + let f = o.ins == -1 ? -1 : o.off ? 0 : o.ins; + Cr(i, l, f, a), r && f && Ou(r, i, o.text); + } else o.ins == -1 ? (Cr(i, s.off ? 0 : s.len, l, a), r && Ou(r, i, s.textBit(l))) : (Cr(i, s.off ? 0 : s.len, o.off ? 0 : o.ins, a), r && !o.off && Ou(r, i, o.text)); + a = (s.ins > l || o.ins >= 0 && o.len > l) && (a || i.length > u), s.forward2(l), o.forward(l); + } + } + } +} +class o0 { + constructor(e) { + this.set = e, this.i = 0, this.next(); + } + next() { + let { sections: e } = this.set; + this.i < e.length ? (this.len = e[this.i++], this.ins = e[this.i++]) : (this.len = 0, this.ins = -2), this.off = 0; + } + get done() { + return this.ins == -2; + } + get len2() { + return this.ins < 0 ? this.len : this.ins; + } + get text() { + let { inserted: e } = this.set, n = this.i - 2 >> 1; + return n >= e.length ? Kt.empty : e[n]; + } + textBit(e) { + let { inserted: n } = this.set, i = this.i - 2 >> 1; + return i >= n.length && !e ? Kt.empty : n[i].slice(this.off, e == null ? void 0 : this.off + e); + } + forward(e) { + e == this.len ? this.next() : (this.len -= e, this.off += e); + } + forward2(e) { + this.ins == -1 ? this.forward(e) : e == this.ins ? this.next() : (this.ins -= e, this.off += e); + } +} +class Xc { + constructor(e, n, i) { + this.from = e, this.to = n, this.flags = i; + } + /** + The anchor of the range—the side that doesn't move when you + extend it. + */ + get anchor() { + return this.flags & 32 ? this.to : this.from; + } + /** + The head of the range, which is moved when the range is + [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend). + */ + get head() { + return this.flags & 32 ? this.from : this.to; + } + /** + True when `anchor` and `head` are at the same position. + */ + get empty() { + return this.from == this.to; + } + /** + If this is a cursor that is explicitly associated with the + character on one of its sides, this returns the side. -1 means + the character before its position, 1 the character after, and 0 + means no association. + */ + get assoc() { + return this.flags & 8 ? -1 : this.flags & 16 ? 1 : 0; + } + /** + The bidirectional text level associated with this cursor, if + any. + */ + get bidiLevel() { + let e = this.flags & 7; + return e == 7 ? null : e; + } + /** + The goal column (stored vertical offset) associated with a + cursor. This is used to preserve the vertical position when + [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across + lines of different length. + */ + get goalColumn() { + let e = this.flags >> 6; + return e == 16777215 ? void 0 : e; + } + /** + Map this range through a change, producing a valid range in the + updated document. + */ + map(e, n = -1) { + let i, r; + return this.empty ? i = r = e.mapPos(this.from, n) : (i = e.mapPos(this.from, 1), r = e.mapPos(this.to, -1)), i == this.from && r == this.to ? this : new Xc(i, r, this.flags); + } + /** + Extend this range to cover at least `from` to `to`. + */ + extend(e, n = e) { + if (e <= this.anchor && n >= this.anchor) + return he.range(e, n); + let i = Math.abs(e - this.anchor) > Math.abs(n - this.anchor) ? e : n; + return he.range(this.anchor, i); + } + /** + Compare this range to another range. + */ + eq(e, n = !1) { + return this.anchor == e.anchor && this.head == e.head && (!n || !this.empty || this.assoc == e.assoc); + } + /** + Return a JSON-serializable object representing the range. + */ + toJSON() { + return { anchor: this.anchor, head: this.head }; + } + /** + Convert a JSON representation of a range to a `SelectionRange` + instance. + */ + static fromJSON(e) { + if (!e || typeof e.anchor != "number" || typeof e.head != "number") + throw new RangeError("Invalid JSON representation for SelectionRange"); + return he.range(e.anchor, e.head); + } + /** + @internal + */ + static create(e, n, i) { + return new Xc(e, n, i); + } +} +class he { + constructor(e, n) { + this.ranges = e, this.mainIndex = n; + } + /** + Map a selection through a change. Used to adjust the selection + position for changes. + */ + map(e, n = -1) { + return e.empty ? this : he.create(this.ranges.map((i) => i.map(e, n)), this.mainIndex); + } + /** + Compare this selection to another selection. By default, ranges + are compared only by position. When `includeAssoc` is true, + cursor ranges must also have the same + [`assoc`](https://codemirror.net/6/docs/ref/#state.SelectionRange.assoc) value. + */ + eq(e, n = !1) { + if (this.ranges.length != e.ranges.length || this.mainIndex != e.mainIndex) + return !1; + for (let i = 0; i < this.ranges.length; i++) + if (!this.ranges[i].eq(e.ranges[i], n)) + return !1; + return !0; + } + /** + Get the primary selection range. Usually, you should make sure + your code applies to _all_ ranges, by using methods like + [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange). + */ + get main() { + return this.ranges[this.mainIndex]; + } + /** + Make sure the selection only has one range. Returns a selection + holding only the main range from this selection. + */ + asSingle() { + return this.ranges.length == 1 ? this : new he([this.main], 0); + } + /** + Extend this selection with an extra range. + */ + addRange(e, n = !0) { + return he.create([e].concat(this.ranges), n ? 0 : this.mainIndex + 1); + } + /** + Replace a given range with another range, and then normalize the + selection to merge and sort ranges if necessary. + */ + replaceRange(e, n = this.mainIndex) { + let i = this.ranges.slice(); + return i[n] = e, he.create(i, this.mainIndex); + } + /** + Convert this selection to an object that can be serialized to + JSON. + */ + toJSON() { + return { ranges: this.ranges.map((e) => e.toJSON()), main: this.mainIndex }; + } + /** + Create a selection from a JSON representation. + */ + static fromJSON(e) { + if (!e || !Array.isArray(e.ranges) || typeof e.main != "number" || e.main >= e.ranges.length) + throw new RangeError("Invalid JSON representation for EditorSelection"); + return new he(e.ranges.map((n) => Xc.fromJSON(n)), e.main); + } + /** + Create a selection holding a single range. + */ + static single(e, n = e) { + return new he([he.range(e, n)], 0); + } + /** + Sort and merge the given set of ranges, creating a valid + selection. + */ + static create(e, n = 0) { + if (e.length == 0) + throw new RangeError("A selection needs at least one range"); + for (let i = 0, r = 0; r < e.length; r++) { + let s = e[r]; + if (s.empty ? s.from <= i : s.from < i) + return he.normalized(e.slice(), n); + i = s.to; + } + return new he(e, n); + } + /** + Create a cursor selection range at the given position. You can + safely ignore the optional arguments in most situations. + */ + static cursor(e, n = 0, i, r) { + return Xc.create(e, e, (n == 0 ? 0 : n < 0 ? 8 : 16) | (i == null ? 7 : Math.min(6, i)) | (r ?? 16777215) << 6); + } + /** + Create a selection range. + */ + static range(e, n, i, r) { + let s = (i ?? 16777215) << 6 | (r == null ? 7 : Math.min(6, r)); + return n < e ? Xc.create(n, e, 48 | s) : Xc.create(e, n, (n > e ? 8 : 0) | s); + } + /** + @internal + */ + static normalized(e, n = 0) { + let i = e[n]; + e.sort((r, s) => r.from - s.from), n = e.indexOf(i); + for (let r = 1; r < e.length; r++) { + let s = e[r], o = e[r - 1]; + if (s.empty ? s.from <= o.to : s.from < o.to) { + let a = o.from, l = Math.max(s.to, o.to); + r <= n && n--, e.splice(--r, 2, s.anchor > s.head ? he.range(l, a) : he.range(a, l)); + } + } + return new he(e, n); + } +} +function YW(t, e) { + for (let n of t.ranges) + if (n.to > e) + throw new RangeError("Selection points outside of document"); +} +let dE = 0; +class Qe { + constructor(e, n, i, r, s) { + this.combine = e, this.compareInput = n, this.compare = i, this.isStatic = r, this.id = dE++, this.default = e([]), this.extensions = typeof s == "function" ? s(this) : s; + } + /** + Returns a facet reader for this facet, which can be used to + [read](https://codemirror.net/6/docs/ref/#state.EditorState.facet) it but not to define values for it. + */ + get reader() { + return this; + } + /** + Define a new facet. + */ + static define(e = {}) { + return new Qe(e.combine || ((n) => n), e.compareInput || ((n, i) => n === i), e.compare || (e.combine ? (n, i) => n === i : hE), !!e.static, e.enables); + } + /** + Returns an extension that adds the given value to this facet. + */ + of(e) { + return new ay([], this, 0, e); + } + /** + Create an extension that computes a value for the facet from a + state. You must take care to declare the parts of the state that + this value depends on, since your function is only called again + for a new state when one of those parts changed. + + In cases where your value depends only on a single field, you'll + want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead. + */ + compute(e, n) { + if (this.isStatic) + throw new Error("Can't compute a static facet"); + return new ay(e, this, 1, n); + } + /** + Create an extension that computes zero or more values for this + facet from a state. + */ + computeN(e, n) { + if (this.isStatic) + throw new Error("Can't compute a static facet"); + return new ay(e, this, 2, n); + } + from(e, n) { + return n || (n = (i) => i), this.compute([e], (i) => n(i.field(e))); + } +} +function hE(t, e) { + return t == e || t.length == e.length && t.every((n, i) => n === e[i]); +} +class ay { + constructor(e, n, i, r) { + this.dependencies = e, this.facet = n, this.type = i, this.value = r, this.id = dE++; + } + dynamicSlot(e) { + var n; + let i = this.value, r = this.facet.compareInput, s = this.id, o = e[s] >> 1, a = this.type == 2, l = !1, u = !1, f = []; + for (let d of this.dependencies) + d == "doc" ? l = !0 : d == "selection" ? u = !0 : ((n = e[d.id]) !== null && n !== void 0 ? n : 1) & 1 || f.push(e[d.id]); + return { + create(d) { + return d.values[o] = i(d), 1; + }, + update(d, h) { + if (l && h.docChanged || u && (h.docChanged || h.selection) || R4(d, f)) { + let m = i(d); + if (a ? !XN(m, d.values[o], r) : !r(m, d.values[o])) + return d.values[o] = m, 1; + } + return 0; + }, + reconfigure: (d, h) => { + let m, g = h.config.address[s]; + if (g != null) { + let w = xw(h, g); + if (this.dependencies.every((x) => x instanceof Qe ? h.facet(x) === d.facet(x) : x instanceof Ki ? h.field(x, !1) == d.field(x, !1) : !0) || (a ? XN(m = i(d), w, r) : r(m = i(d), w))) + return d.values[o] = w, 0; + } else + m = i(d); + return d.values[o] = m, 1; + } + }; + } +} +function XN(t, e, n) { + if (t.length != e.length) + return !1; + for (let i = 0; i < t.length; i++) + if (!n(t[i], e[i])) + return !1; + return !0; +} +function R4(t, e) { + let n = !1; + for (let i of e) + Eg(t, i) & 1 && (n = !0); + return n; +} +function C2e(t, e, n) { + let i = n.map((l) => t[l.id]), r = n.map((l) => l.type), s = i.filter((l) => !(l & 1)), o = t[e.id] >> 1; + function a(l) { + let u = []; + for (let f = 0; f < i.length; f++) { + let d = xw(l, i[f]); + if (r[f] == 2) + for (let h of d) + u.push(h); + else + u.push(d); + } + return e.combine(u); + } + return { + create(l) { + for (let u of i) + Eg(l, u); + return l.values[o] = a(l), 1; + }, + update(l, u) { + if (!R4(l, s)) + return 0; + let f = a(l); + return e.compare(f, l.values[o]) ? 0 : (l.values[o] = f, 1); + }, + reconfigure(l, u) { + let f = R4(l, i), d = u.config.facets[e.id], h = u.facet(e); + if (d && !f && hE(n, d)) + return l.values[o] = h, 0; + let m = a(l); + return e.compare(m, h) ? (l.values[o] = h, 0) : (l.values[o] = m, 1); + } + }; +} +const GN = /* @__PURE__ */ Qe.define({ static: !0 }); +class Ki { + constructor(e, n, i, r, s) { + this.id = e, this.createF = n, this.updateF = i, this.compareF = r, this.spec = s, this.provides = void 0; + } + /** + Define a state field. + */ + static define(e) { + let n = new Ki(dE++, e.create, e.update, e.compare || ((i, r) => i === r), e); + return e.provide && (n.provides = e.provide(n)), n; + } + create(e) { + let n = e.facet(GN).find((i) => i.field == this); + return ((n == null ? void 0 : n.create) || this.createF)(e); + } + /** + @internal + */ + slot(e) { + let n = e[this.id] >> 1; + return { + create: (i) => (i.values[n] = this.create(i), 1), + update: (i, r) => { + let s = i.values[n], o = this.updateF(s, r); + return this.compareF(s, o) ? 0 : (i.values[n] = o, 1); + }, + reconfigure: (i, r) => r.config.address[this.id] != null ? (i.values[n] = r.field(this), 0) : (i.values[n] = this.create(i), 1) + }; + } + /** + Returns an extension that enables this field and overrides the + way it is initialized. Can be useful when you need to provide a + non-default starting value for the field. + */ + init(e) { + return [this, GN.of({ field: this, create: e })]; + } + /** + State field instances can be used as + [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a + given state. + */ + get extension() { + return this; + } +} +const Bc = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 }; +function Tm(t) { + return (e) => new VW(e, t); +} +const jf = { + /** + The highest precedence level, for extensions that should end up + near the start of the precedence ordering. + */ + highest: /* @__PURE__ */ Tm(Bc.highest), + /** + A higher-than-default precedence, for extensions that should + come before those with default precedence. + */ + high: /* @__PURE__ */ Tm(Bc.high), + /** + The default precedence, which is also used for extensions + without an explicit precedence. + */ + default: /* @__PURE__ */ Tm(Bc.default), + /** + A lower-than-default precedence. + */ + low: /* @__PURE__ */ Tm(Bc.low), + /** + The lowest precedence level. Meant for things that should end up + near the end of the extension order. + */ + lowest: /* @__PURE__ */ Tm(Bc.lowest) +}; +class VW { + constructor(e, n) { + this.inner = e, this.prec = n; + } +} +class d2 { + /** + Create an instance of this compartment to add to your [state + configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions). + */ + of(e) { + return new j4(this, e); + } + /** + Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that + reconfigures this compartment. + */ + reconfigure(e) { + return d2.reconfigure.of({ compartment: this, extension: e }); + } + /** + Get the current content of the compartment in the state, or + `undefined` if it isn't present. + */ + get(e) { + return e.config.compartments.get(this); + } +} +class j4 { + constructor(e, n) { + this.compartment = e, this.inner = n; + } +} +class kw { + constructor(e, n, i, r, s, o) { + for (this.base = e, this.compartments = n, this.dynamicSlots = i, this.address = r, this.staticValues = s, this.facets = o, this.statusTemplate = []; this.statusTemplate.length < i.length; ) + this.statusTemplate.push( + 0 + /* SlotStatus.Unresolved */ + ); + } + staticFacet(e) { + let n = this.address[e.id]; + return n == null ? e.default : this.staticValues[n >> 1]; + } + static resolve(e, n, i) { + let r = [], s = /* @__PURE__ */ Object.create(null), o = /* @__PURE__ */ new Map(); + for (let h of E2e(e, n, o)) + h instanceof Ki ? r.push(h) : (s[h.facet.id] || (s[h.facet.id] = [])).push(h); + let a = /* @__PURE__ */ Object.create(null), l = [], u = []; + for (let h of r) + a[h.id] = u.length << 1, u.push((m) => h.slot(m)); + let f = i == null ? void 0 : i.config.facets; + for (let h in s) { + let m = s[h], g = m[0].facet, w = f && f[h] || []; + if (m.every( + (x) => x.type == 0 + /* Provider.Static */ + )) + if (a[g.id] = l.length << 1 | 1, hE(w, m)) + l.push(i.facet(g)); + else { + let x = g.combine(m.map((_) => _.value)); + l.push(i && g.compare(x, i.facet(g)) ? i.facet(g) : x); + } + else { + for (let x of m) + x.type == 0 ? (a[x.id] = l.length << 1 | 1, l.push(x.value)) : (a[x.id] = u.length << 1, u.push((_) => x.dynamicSlot(_))); + a[g.id] = u.length << 1, u.push((x) => C2e(x, g, m)); + } + } + let d = u.map((h) => h(a)); + return new kw(e, o, d, a, l, s); + } +} +function E2e(t, e, n) { + let i = [[], [], [], [], []], r = /* @__PURE__ */ new Map(); + function s(o, a) { + let l = r.get(o); + if (l != null) { + if (l <= a) + return; + let u = i[l].indexOf(o); + u > -1 && i[l].splice(u, 1), o instanceof j4 && n.delete(o.compartment); + } + if (r.set(o, a), Array.isArray(o)) + for (let u of o) + s(u, a); + else if (o instanceof j4) { + if (n.has(o.compartment)) + throw new RangeError("Duplicate use of compartment in extensions"); + let u = e.get(o.compartment) || o.inner; + n.set(o.compartment, u), s(u, a); + } else if (o instanceof VW) + s(o.inner, o.prec); + else if (o instanceof Ki) + i[a].push(o), o.provides && s(o.provides, a); + else if (o instanceof ay) + i[a].push(o), o.facet.extensions && s(o.facet.extensions, Bc.default); + else { + let u = o.extension; + if (!u) + throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`); + s(u, a); + } + } + return s(t, Bc.default), i.reduce((o, a) => o.concat(a)); +} +function Eg(t, e) { + if (e & 1) + return 2; + let n = e >> 1, i = t.status[n]; + if (i == 4) + throw new Error("Cyclic dependency between fields and/or facets"); + if (i & 2) + return i; + t.status[n] = 4; + let r = t.computeSlot(t, t.config.dynamicSlots[n]); + return t.status[n] = 2 | r; +} +function xw(t, e) { + return e & 1 ? t.config.staticValues[e >> 1] : t.values[e >> 1]; +} +const XW = /* @__PURE__ */ Qe.define(), F4 = /* @__PURE__ */ Qe.define({ + combine: (t) => t.some((e) => e), + static: !0 +}), GW = /* @__PURE__ */ Qe.define({ + combine: (t) => t.length ? t[0] : void 0, + static: !0 +}), KW = /* @__PURE__ */ Qe.define(), JW = /* @__PURE__ */ Qe.define(), eH = /* @__PURE__ */ Qe.define(), tH = /* @__PURE__ */ Qe.define({ + combine: (t) => t.length ? t[0] : !1 +}); +class za { + /** + @internal + */ + constructor(e, n) { + this.type = e, this.value = n; + } + /** + Define a new type of annotation. + */ + static define() { + return new T2e(); + } +} +class T2e { + /** + Create an instance of this annotation. + */ + of(e) { + return new za(this, e); + } +} +class $2e { + /** + @internal + */ + constructor(e) { + this.map = e; + } + /** + Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this + type. + */ + of(e) { + return new Ot(this, e); + } +} +class Ot { + /** + @internal + */ + constructor(e, n) { + this.type = e, this.value = n; + } + /** + Map this effect through a position mapping. Will return + `undefined` when that ends up deleting the effect. + */ + map(e) { + let n = this.type.map(this.value, e); + return n === void 0 ? void 0 : n == this.value ? this : new Ot(this.type, n); + } + /** + Tells you whether this effect object is of a given + [type](https://codemirror.net/6/docs/ref/#state.StateEffectType). + */ + is(e) { + return this.type == e; + } + /** + Define a new effect type. The type parameter indicates the type + of values that his effect holds. It should be a type that + doesn't include `undefined`, since that is used in + [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is + removed. + */ + static define(e = {}) { + return new $2e(e.map || ((n) => n)); + } + /** + Map an array of effects through a change set. + */ + static mapEffects(e, n) { + if (!e.length) + return e; + let i = []; + for (let r of e) { + let s = r.map(n); + s && i.push(s); + } + return i; + } +} +Ot.reconfigure = /* @__PURE__ */ Ot.define(); +Ot.appendConfig = /* @__PURE__ */ Ot.define(); +let Jr = class ng { + constructor(e, n, i, r, s, o) { + this.startState = e, this.changes = n, this.selection = i, this.effects = r, this.annotations = s, this.scrollIntoView = o, this._doc = null, this._state = null, i && YW(i, n.newLength), s.some((a) => a.type == ng.time) || (this.annotations = s.concat(ng.time.of(Date.now()))); + } + /** + @internal + */ + static create(e, n, i, r, s, o) { + return new ng(e, n, i, r, s, o); + } + /** + The new document produced by the transaction. Contrary to + [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't + force the entire new state to be computed right away, so it is + recommended that [transaction + filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter + when they need to look at the new document. + */ + get newDoc() { + return this._doc || (this._doc = this.changes.apply(this.startState.doc)); + } + /** + The new selection produced by the transaction. If + [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined, + this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's + current selection through the changes made by the transaction. + */ + get newSelection() { + return this.selection || this.startState.selection.map(this.changes); + } + /** + The new state created by the transaction. Computed on demand + (but retained for subsequent access), so it is recommended not to + access it in [transaction + filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible. + */ + get state() { + return this._state || this.startState.applyTransaction(this), this._state; + } + /** + Get the value of the given annotation type, if any. + */ + annotation(e) { + for (let n of this.annotations) + if (n.type == e) + return n.value; + } + /** + Indicates whether the transaction changed the document. + */ + get docChanged() { + return !this.changes.empty; + } + /** + Indicates whether this transaction reconfigures the state + (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or + with a top-level configuration + [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure). + */ + get reconfigured() { + return this.startState.config != this.state.config; + } + /** + Returns true if the transaction has a [user + event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to + or more specific than `event`. For example, if the transaction + has `"select.pointer"` as user event, `"select"` and + `"select.pointer"` will match it. + */ + isUserEvent(e) { + let n = this.annotation(ng.userEvent); + return !!(n && (n == e || n.length > e.length && n.slice(0, e.length) == e && n[e.length] == ".")); + } +}; +Jr.time = /* @__PURE__ */ za.define(); +Jr.userEvent = /* @__PURE__ */ za.define(); +Jr.addToHistory = /* @__PURE__ */ za.define(); +Jr.remote = /* @__PURE__ */ za.define(); +function M2e(t, e) { + let n = []; + for (let i = 0, r = 0; ; ) { + let s, o; + if (i < t.length && (r == e.length || e[r] >= t[i])) + s = t[i++], o = t[i++]; + else if (r < e.length) + s = e[r++], o = e[r++]; + else + return n; + !n.length || n[n.length - 1] < s ? n.push(s, o) : n[n.length - 1] < o && (n[n.length - 1] = o); + } +} +function nH(t, e, n) { + var i; + let r, s, o; + return n ? (r = e.changes, s = Ii.empty(e.changes.length), o = t.changes.compose(e.changes)) : (r = e.changes.map(t.changes), s = t.changes.mapDesc(e.changes, !0), o = t.changes.compose(r)), { + changes: o, + selection: e.selection ? e.selection.map(s) : (i = t.selection) === null || i === void 0 ? void 0 : i.map(r), + effects: Ot.mapEffects(t.effects, r).concat(Ot.mapEffects(e.effects, s)), + annotations: t.annotations.length ? t.annotations.concat(e.annotations) : e.annotations, + scrollIntoView: t.scrollIntoView || e.scrollIntoView + }; +} +function B4(t, e, n) { + let i = e.selection, r = hh(e.annotations); + return e.userEvent && (r = r.concat(Jr.userEvent.of(e.userEvent))), { + changes: e.changes instanceof Ii ? e.changes : Ii.of(e.changes || [], n, t.facet(GW)), + selection: i && (i instanceof he ? i : he.single(i.anchor, i.head)), + effects: hh(e.effects), + annotations: r, + scrollIntoView: !!e.scrollIntoView + }; +} +function iH(t, e, n) { + let i = B4(t, e.length ? e[0] : {}, t.doc.length); + e.length && e[0].filter === !1 && (n = !1); + for (let s = 1; s < e.length; s++) { + e[s].filter === !1 && (n = !1); + let o = !!e[s].sequential; + i = nH(i, B4(t, e[s], o ? i.changes.newLength : t.doc.length), o); + } + let r = Jr.create(t, i.changes, i.selection, i.effects, i.annotations, i.scrollIntoView); + return A2e(n ? N2e(r) : r); +} +function N2e(t) { + let e = t.startState, n = !0; + for (let r of e.facet(KW)) { + let s = r(t); + if (s === !1) { + n = !1; + break; + } + Array.isArray(s) && (n = n === !0 ? s : M2e(n, s)); + } + if (n !== !0) { + let r, s; + if (n === !1) + s = t.changes.invertedDesc, r = Ii.empty(e.doc.length); + else { + let o = t.changes.filter(n); + r = o.changes, s = o.filtered.mapDesc(o.changes).invertedDesc; + } + t = Jr.create(e, r, t.selection && t.selection.map(s), Ot.mapEffects(t.effects, s), t.annotations, t.scrollIntoView); + } + let i = e.facet(JW); + for (let r = i.length - 1; r >= 0; r--) { + let s = i[r](t); + s instanceof Jr ? t = s : Array.isArray(s) && s.length == 1 && s[0] instanceof Jr ? t = s[0] : t = iH(e, hh(s), !1); + } + return t; +} +function A2e(t) { + let e = t.startState, n = e.facet(eH), i = t; + for (let r = n.length - 1; r >= 0; r--) { + let s = n[r](t); + s && Object.keys(s).length && (i = nH(i, B4(e, s, t.changes.newLength), !0)); + } + return i == t ? t : Jr.create(e, t.changes, t.selection, i.effects, i.annotations, i.scrollIntoView); +} +const D2e = []; +function hh(t) { + return t == null ? D2e : Array.isArray(t) ? t : [t]; +} +var In = /* @__PURE__ */ function(t) { + return t[t.Word = 0] = "Word", t[t.Space = 1] = "Space", t[t.Other = 2] = "Other", t; +}(In || (In = {})); +const P2e = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; +let z4; +try { + z4 = /* @__PURE__ */ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u"); +} catch { +} +function I2e(t) { + if (z4) + return z4.test(t); + for (let e = 0; e < t.length; e++) { + let n = t[e]; + if (/\w/.test(n) || n > "€" && (n.toUpperCase() != n.toLowerCase() || P2e.test(n))) + return !0; + } + return !1; +} +function L2e(t) { + return (e) => { + if (!/\S/.test(e)) + return In.Space; + if (I2e(e)) + return In.Word; + for (let n = 0; n < t.length; n++) + if (e.indexOf(t[n]) > -1) + return In.Word; + return In.Other; + }; +} +class zt { + constructor(e, n, i, r, s, o) { + this.config = e, this.doc = n, this.selection = i, this.values = r, this.status = e.statusTemplate.slice(), this.computeSlot = s, o && (o._state = this); + for (let a = 0; a < this.config.dynamicSlots.length; a++) + Eg(this, a << 1); + this.computeSlot = null; + } + field(e, n = !0) { + let i = this.config.address[e.id]; + if (i == null) { + if (n) + throw new RangeError("Field is not present in this state"); + return; + } + return Eg(this, i), xw(this, i); + } + /** + Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this + state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec) + can be passed. Unless + [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the + [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec + are assumed to start in the _current_ document (not the document + produced by previous specs), and its + [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and + [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer + to the document created by its _own_ changes. The resulting + transaction contains the combined effect of all the different + specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later + specs take precedence over earlier ones. + */ + update(...e) { + return iH(this, e, !0); + } + /** + @internal + */ + applyTransaction(e) { + let n = this.config, { base: i, compartments: r } = n; + for (let a of e.effects) + a.is(d2.reconfigure) ? (n && (r = /* @__PURE__ */ new Map(), n.compartments.forEach((l, u) => r.set(u, l)), n = null), r.set(a.value.compartment, a.value.extension)) : a.is(Ot.reconfigure) ? (n = null, i = a.value) : a.is(Ot.appendConfig) && (n = null, i = hh(i).concat(a.value)); + let s; + n ? s = e.startState.values.slice() : (n = kw.resolve(i, r, this), s = new zt(n, this.doc, this.selection, n.dynamicSlots.map(() => null), (l, u) => u.reconfigure(l, this), null).values); + let o = e.startState.facet(F4) ? e.newSelection : e.newSelection.asSingle(); + new zt(n, e.newDoc, o, s, (a, l) => l.update(a, e), e); + } + /** + Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that + replaces every selection range with the given content. + */ + replaceSelection(e) { + return typeof e == "string" && (e = this.toText(e)), this.changeByRange((n) => ({ + changes: { from: n.from, to: n.to, insert: e }, + range: he.cursor(n.from + e.length) + })); + } + /** + Create a set of changes and a new selection by running the given + function for each range in the active selection. The function + can return an optional set of changes (in the coordinate space + of the start document), plus an updated range (in the coordinate + space of the document produced by the call's own changes). This + method will merge all the changes and ranges into a single + changeset and selection, and return it as a [transaction + spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to + [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update). + */ + changeByRange(e) { + let n = this.selection, i = e(n.ranges[0]), r = this.changes(i.changes), s = [i.range], o = hh(i.effects); + for (let a = 1; a < n.ranges.length; a++) { + let l = e(n.ranges[a]), u = this.changes(l.changes), f = u.map(r); + for (let h = 0; h < a; h++) + s[h] = s[h].map(f); + let d = r.mapDesc(u, !0); + s.push(l.range.map(d)), r = r.compose(f), o = Ot.mapEffects(o, f).concat(Ot.mapEffects(hh(l.effects), d)); + } + return { + changes: r, + selection: he.create(s, n.mainIndex), + effects: o + }; + } + /** + Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change + description, taking the state's document length and line + separator into account. + */ + changes(e = []) { + return e instanceof Ii ? e : Ii.of(e, this.doc.length, this.facet(zt.lineSeparator)); + } + /** + Using the state's [line + separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a + [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string. + */ + toText(e) { + return Kt.of(e.split(this.facet(zt.lineSeparator) || P4)); + } + /** + Return the given range of the document as a string. + */ + sliceDoc(e = 0, n = this.doc.length) { + return this.doc.sliceString(e, n, this.lineBreak); + } + /** + Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet). + */ + facet(e) { + let n = this.config.address[e.id]; + return n == null ? e.default : (Eg(this, n), xw(this, n)); + } + /** + Convert this state to a JSON-serializable object. When custom + fields should be serialized, you can pass them in as an object + mapping property names (in the resulting object, which should + not use `doc` or `selection`) to fields. + */ + toJSON(e) { + let n = { + doc: this.sliceDoc(), + selection: this.selection.toJSON() + }; + if (e) + for (let i in e) { + let r = e[i]; + r instanceof Ki && this.config.address[r.id] != null && (n[i] = r.spec.toJSON(this.field(e[i]), this)); + } + return n; + } + /** + Deserialize a state from its JSON representation. When custom + fields should be deserialized, pass the same object you passed + to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as + third argument. + */ + static fromJSON(e, n = {}, i) { + if (!e || typeof e.doc != "string") + throw new RangeError("Invalid JSON representation for EditorState"); + let r = []; + if (i) { + for (let s in i) + if (Object.prototype.hasOwnProperty.call(e, s)) { + let o = i[s], a = e[s]; + r.push(o.init((l) => o.spec.fromJSON(a, l))); + } + } + return zt.create({ + doc: e.doc, + selection: he.fromJSON(e.selection), + extensions: n.extensions ? r.concat([n.extensions]) : r + }); + } + /** + Create a new state. You'll usually only need this when + initializing an editor—updated states are created by applying + transactions. + */ + static create(e = {}) { + let n = kw.resolve(e.extensions || [], /* @__PURE__ */ new Map()), i = e.doc instanceof Kt ? e.doc : Kt.of((e.doc || "").split(n.staticFacet(zt.lineSeparator) || P4)), r = e.selection ? e.selection instanceof he ? e.selection : he.single(e.selection.anchor, e.selection.head) : he.single(0); + return YW(r, i.length), n.staticFacet(F4) || (r = r.asSingle()), new zt(n, i, r, n.dynamicSlots.map(() => null), (s, o) => o.create(s), null); + } + /** + The size (in columns) of a tab in the document, determined by + the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet. + */ + get tabSize() { + return this.facet(zt.tabSize); + } + /** + Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator) + string for this state. + */ + get lineBreak() { + return this.facet(zt.lineSeparator) || ` +`; + } + /** + Returns true when the editor is + [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only. + */ + get readOnly() { + return this.facet(tH); + } + /** + Look up a translation for the given phrase (via the + [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the + original string if no translation is found. + + If additional arguments are passed, they will be inserted in + place of markers like `$1` (for the first value) and `$2`, etc. + A single `$` is equivalent to `$1`, and `$$` will produce a + literal dollar sign. + */ + phrase(e, ...n) { + for (let i of this.facet(zt.phrases)) + if (Object.prototype.hasOwnProperty.call(i, e)) { + e = i[e]; + break; + } + return n.length && (e = e.replace(/\$(\$|\d*)/g, (i, r) => { + if (r == "$") + return "$"; + let s = +(r || 1); + return !s || s > n.length ? i : n[s - 1]; + })), e; + } + /** + Find the values for a given language data field, provided by the + the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet. + + Examples of language data fields are... + + - [`"commentTokens"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying + comment syntax. + - [`"autocomplete"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override) + for providing language-specific completion sources. + - [`"wordChars"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding + characters that should be considered part of words in this + language. + - [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls + bracket closing behavior. + */ + languageDataAt(e, n, i = -1) { + let r = []; + for (let s of this.facet(XW)) + for (let o of s(this, n, i)) + Object.prototype.hasOwnProperty.call(o, e) && r.push(o[e]); + return r; + } + /** + Return a function that can categorize strings (expected to + represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak)) + into one of: + + - Word (contains an alphanumeric character or a character + explicitly listed in the local language's `"wordChars"` + language data, which should be a string) + - Space (contains only whitespace) + - Other (anything else) + */ + charCategorizer(e) { + return L2e(this.languageDataAt("wordChars", e).join("")); + } + /** + Find the word at the given position, meaning the range + containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters + around it. If no word characters are adjacent to the position, + this returns null. + */ + wordAt(e) { + let { text: n, from: i, length: r } = this.doc.lineAt(e), s = this.charCategorizer(e), o = e - i, a = e - i; + for (; o > 0; ) { + let l = dr(n, o, !1); + if (s(n.slice(l, o)) != In.Word) + break; + o = l; + } + for (; a < r; ) { + let l = dr(n, a); + if (s(n.slice(a, l)) != In.Word) + break; + a = l; + } + return o == a ? null : he.range(o + i, a + i); + } +} +zt.allowMultipleSelections = F4; +zt.tabSize = /* @__PURE__ */ Qe.define({ + combine: (t) => t.length ? t[0] : 4 +}); +zt.lineSeparator = GW; +zt.readOnly = tH; +zt.phrases = /* @__PURE__ */ Qe.define({ + compare(t, e) { + let n = Object.keys(t), i = Object.keys(e); + return n.length == i.length && n.every((r) => t[r] == e[r]); + } +}); +zt.languageData = XW; +zt.changeFilter = KW; +zt.transactionFilter = JW; +zt.transactionExtender = eH; +d2.reconfigure = /* @__PURE__ */ Ot.define(); +function Wa(t, e, n = {}) { + let i = {}; + for (let r of t) + for (let s of Object.keys(r)) { + let o = r[s], a = i[s]; + if (a === void 0) + i[s] = o; + else if (!(a === o || o === void 0)) if (Object.hasOwnProperty.call(n, s)) + i[s] = n[s](a, o); + else + throw new Error("Config merge conflict for field " + s); + } + for (let r in e) + i[r] === void 0 && (i[r] = e[r]); + return i; +} +class vf { + /** + Compare this value with another value. Used when comparing + rangesets. The default implementation compares by identity. + Unless you are only creating a fixed number of unique instances + of your value type, it is a good idea to implement this + properly. + */ + eq(e) { + return this == e; + } + /** + Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value. + */ + range(e, n = e) { + return W4.create(e, n, this); + } +} +vf.prototype.startSide = vf.prototype.endSide = 0; +vf.prototype.point = !1; +vf.prototype.mapMode = ur.TrackDel; +let W4 = class rH { + constructor(e, n, i) { + this.from = e, this.to = n, this.value = i; + } + /** + @internal + */ + static create(e, n, i) { + return new rH(e, n, i); + } +}; +function H4(t, e) { + return t.from - e.from || t.value.startSide - e.value.startSide; +} +class pE { + constructor(e, n, i, r) { + this.from = e, this.to = n, this.value = i, this.maxPoint = r; + } + get length() { + return this.to[this.to.length - 1]; + } + // Find the index of the given position and side. Use the ranges' + // `from` pos when `end == false`, `to` when `end == true`. + findIndex(e, n, i, r = 0) { + let s = i ? this.to : this.from; + for (let o = r, a = s.length; ; ) { + if (o == a) + return o; + let l = o + a >> 1, u = s[l] - e || (i ? this.value[l].endSide : this.value[l].startSide) - n; + if (l == o) + return u >= 0 ? o : a; + u >= 0 ? a = l : o = l + 1; + } + } + between(e, n, i, r) { + for (let s = this.findIndex(n, -1e9, !0), o = this.findIndex(i, 1e9, !1, s); s < o; s++) + if (r(this.from[s] + e, this.to[s] + e, this.value[s]) === !1) + return !1; + } + map(e, n) { + let i = [], r = [], s = [], o = -1, a = -1; + for (let l = 0; l < this.value.length; l++) { + let u = this.value[l], f = this.from[l] + e, d = this.to[l] + e, h, m; + if (f == d) { + let g = n.mapPos(f, u.startSide, u.mapMode); + if (g == null || (h = m = g, u.startSide != u.endSide && (m = n.mapPos(f, u.endSide), m < h))) + continue; + } else if (h = n.mapPos(f, u.startSide), m = n.mapPos(d, u.endSide), h > m || h == m && u.startSide > 0 && u.endSide <= 0) + continue; + (m - h || u.endSide - u.startSide) < 0 || (o < 0 && (o = h), u.point && (a = Math.max(a, m - h)), i.push(u), r.push(h - o), s.push(m - o)); + } + return { mapped: i.length ? new pE(r, s, i, a) : null, pos: o }; + } +} +class Qt { + constructor(e, n, i, r) { + this.chunkPos = e, this.chunk = n, this.nextLayer = i, this.maxPoint = r; + } + /** + @internal + */ + static create(e, n, i, r) { + return new Qt(e, n, i, r); + } + /** + @internal + */ + get length() { + let e = this.chunk.length - 1; + return e < 0 ? 0 : Math.max(this.chunkEnd(e), this.nextLayer.length); + } + /** + The number of ranges in the set. + */ + get size() { + if (this.isEmpty) + return 0; + let e = this.nextLayer.size; + for (let n of this.chunk) + e += n.value.length; + return e; + } + /** + @internal + */ + chunkEnd(e) { + return this.chunkPos[e] + this.chunk[e].length; + } + /** + Update the range set, optionally adding new ranges or filtering + out existing ones. + + (Note: The type parameter is just there as a kludge to work + around TypeScript variance issues that prevented `RangeSet` + from being a subtype of `RangeSet` when `X` is a subtype of + `Y`.) + */ + update(e) { + let { add: n = [], sort: i = !1, filterFrom: r = 0, filterTo: s = this.length } = e, o = e.filter; + if (n.length == 0 && !o) + return this; + if (i && (n = n.slice().sort(H4)), this.isEmpty) + return n.length ? Qt.of(n) : this; + let a = new sH(this, null, -1).goto(0), l = 0, u = [], f = new Zu(); + for (; a.value || l < n.length; ) + if (l < n.length && (a.from - n[l].from || a.startSide - n[l].value.startSide) >= 0) { + let d = n[l++]; + f.addInner(d.from, d.to, d.value) || u.push(d); + } else a.rangeIndex == 1 && a.chunkIndex < this.chunk.length && (l == n.length || this.chunkEnd(a.chunkIndex) < n[l].from) && (!o || r > this.chunkEnd(a.chunkIndex) || s < this.chunkPos[a.chunkIndex]) && f.addChunk(this.chunkPos[a.chunkIndex], this.chunk[a.chunkIndex]) ? a.nextChunk() : ((!o || r > a.to || s < a.from || o(a.from, a.to, a.value)) && (f.addInner(a.from, a.to, a.value) || u.push(W4.create(a.from, a.to, a.value))), a.next()); + return f.finishInner(this.nextLayer.isEmpty && !u.length ? Qt.empty : this.nextLayer.update({ add: u, filter: o, filterFrom: r, filterTo: s })); + } + /** + Map this range set through a set of changes, return the new set. + */ + map(e) { + if (e.empty || this.isEmpty) + return this; + let n = [], i = [], r = -1; + for (let o = 0; o < this.chunk.length; o++) { + let a = this.chunkPos[o], l = this.chunk[o], u = e.touchesRange(a, a + l.length); + if (u === !1) + r = Math.max(r, l.maxPoint), n.push(l), i.push(e.mapPos(a)); + else if (u === !0) { + let { mapped: f, pos: d } = l.map(a, e); + f && (r = Math.max(r, f.maxPoint), n.push(f), i.push(d)); + } + } + let s = this.nextLayer.map(e); + return n.length == 0 ? s : new Qt(i, n, s || Qt.empty, r); + } + /** + Iterate over the ranges that touch the region `from` to `to`, + calling `f` for each. There is no guarantee that the ranges will + be reported in any specific order. When the callback returns + `false`, iteration stops. + */ + between(e, n, i) { + if (!this.isEmpty) { + for (let r = 0; r < this.chunk.length; r++) { + let s = this.chunkPos[r], o = this.chunk[r]; + if (n >= s && e <= s + o.length && o.between(s, e - s, n - s, i) === !1) + return; + } + this.nextLayer.between(e, n, i); + } + } + /** + Iterate over the ranges in this set, in order, including all + ranges that end at or after `from`. + */ + iter(e = 0) { + return a0.from([this]).goto(e); + } + /** + @internal + */ + get isEmpty() { + return this.nextLayer == this; + } + /** + Iterate over the ranges in a collection of sets, in order, + starting from `from`. + */ + static iter(e, n = 0) { + return a0.from(e).goto(n); + } + /** + Iterate over two groups of sets, calling methods on `comparator` + to notify it of possible differences. + */ + static compare(e, n, i, r, s = -1) { + let o = e.filter((d) => d.maxPoint > 0 || !d.isEmpty && d.maxPoint >= s), a = n.filter((d) => d.maxPoint > 0 || !d.isEmpty && d.maxPoint >= s), l = KN(o, a, i), u = new $m(o, l, s), f = new $m(a, l, s); + i.iterGaps((d, h, m) => JN(u, d, f, h, m, r)), i.empty && i.length == 0 && JN(u, 0, f, 0, 0, r); + } + /** + Compare the contents of two groups of range sets, returning true + if they are equivalent in the given range. + */ + static eq(e, n, i = 0, r) { + r == null && (r = 999999999); + let s = e.filter((f) => !f.isEmpty && n.indexOf(f) < 0), o = n.filter((f) => !f.isEmpty && e.indexOf(f) < 0); + if (s.length != o.length) + return !1; + if (!s.length) + return !0; + let a = KN(s, o), l = new $m(s, a, 0).goto(i), u = new $m(o, a, 0).goto(i); + for (; ; ) { + if (l.to != u.to || !Q4(l.active, u.active) || l.point && (!u.point || !l.point.eq(u.point))) + return !1; + if (l.to > r) + return !0; + l.next(), u.next(); + } + } + /** + Iterate over a group of range sets at the same time, notifying + the iterator about the ranges covering every given piece of + content. Returns the open count (see + [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end + of the iteration. + */ + static spans(e, n, i, r, s = -1) { + let o = new $m(e, null, s).goto(n), a = n, l = o.openStart; + for (; ; ) { + let u = Math.min(o.to, i); + if (o.point) { + let f = o.activeForPoint(o.to), d = o.pointFrom < n ? f.length + 1 : Math.min(f.length, l); + r.point(a, u, o.point, f, d, o.pointRank), l = Math.min(o.openEnd(u), f.length); + } else u > a && (r.span(a, u, o.active, l), l = o.openEnd(u)); + if (o.to > i) + return l + (o.point && o.to > i ? 1 : 0); + a = o.to, o.next(); + } + } + /** + Create a range set for the given range or array of ranges. By + default, this expects the ranges to be _sorted_ (by start + position and, if two start at the same position, + `value.startSide`). You can pass `true` as second argument to + cause the method to sort them. + */ + static of(e, n = !1) { + let i = new Zu(); + for (let r of e instanceof W4 ? [e] : n ? R2e(e) : e) + i.add(r.from, r.to, r.value); + return i.finish(); + } + /** + Join an array of range sets into a single set. + */ + static join(e) { + if (!e.length) + return Qt.empty; + let n = e[e.length - 1]; + for (let i = e.length - 2; i >= 0; i--) + for (let r = e[i]; r != Qt.empty; r = r.nextLayer) + n = new Qt(r.chunkPos, r.chunk, n, Math.max(r.maxPoint, n.maxPoint)); + return n; + } +} +Qt.empty = /* @__PURE__ */ new Qt([], [], null, -1); +function R2e(t) { + if (t.length > 1) + for (let e = t[0], n = 1; n < t.length; n++) { + let i = t[n]; + if (H4(e, i) > 0) + return t.slice().sort(H4); + e = i; + } + return t; +} +Qt.empty.nextLayer = Qt.empty; +class Zu { + finishChunk(e) { + this.chunks.push(new pE(this.from, this.to, this.value, this.maxPoint)), this.chunkPos.push(this.chunkStart), this.chunkStart = -1, this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint), this.maxPoint = -1, e && (this.from = [], this.to = [], this.value = []); + } + /** + Create an empty builder. + */ + constructor() { + this.chunks = [], this.chunkPos = [], this.chunkStart = -1, this.last = null, this.lastFrom = -1e9, this.lastTo = -1e9, this.from = [], this.to = [], this.value = [], this.maxPoint = -1, this.setMaxPoint = -1, this.nextLayer = null; + } + /** + Add a range. Ranges should be added in sorted (by `from` and + `value.startSide`) order. + */ + add(e, n, i) { + this.addInner(e, n, i) || (this.nextLayer || (this.nextLayer = new Zu())).add(e, n, i); + } + /** + @internal + */ + addInner(e, n, i) { + let r = e - this.lastTo || i.startSide - this.last.endSide; + if (r <= 0 && (e - this.lastFrom || i.startSide - this.last.startSide) < 0) + throw new Error("Ranges must be added sorted by `from` position and `startSide`"); + return r < 0 ? !1 : (this.from.length == 250 && this.finishChunk(!0), this.chunkStart < 0 && (this.chunkStart = e), this.from.push(e - this.chunkStart), this.to.push(n - this.chunkStart), this.last = i, this.lastFrom = e, this.lastTo = n, this.value.push(i), i.point && (this.maxPoint = Math.max(this.maxPoint, n - e)), !0); + } + /** + @internal + */ + addChunk(e, n) { + if ((e - this.lastTo || n.value[0].startSide - this.last.endSide) < 0) + return !1; + this.from.length && this.finishChunk(!0), this.setMaxPoint = Math.max(this.setMaxPoint, n.maxPoint), this.chunks.push(n), this.chunkPos.push(e); + let i = n.value.length - 1; + return this.last = n.value[i], this.lastFrom = n.from[i] + e, this.lastTo = n.to[i] + e, !0; + } + /** + Finish the range set. Returns the new set. The builder can't be + used anymore after this has been called. + */ + finish() { + return this.finishInner(Qt.empty); + } + /** + @internal + */ + finishInner(e) { + if (this.from.length && this.finishChunk(!1), this.chunks.length == 0) + return e; + let n = Qt.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(e) : e, this.setMaxPoint); + return this.from = null, n; + } +} +function KN(t, e, n) { + let i = /* @__PURE__ */ new Map(); + for (let s of t) + for (let o = 0; o < s.chunk.length; o++) + s.chunk[o].maxPoint <= 0 && i.set(s.chunk[o], s.chunkPos[o]); + let r = /* @__PURE__ */ new Set(); + for (let s of e) + for (let o = 0; o < s.chunk.length; o++) { + let a = i.get(s.chunk[o]); + a != null && (n ? n.mapPos(a) : a) == s.chunkPos[o] && !(n != null && n.touchesRange(a, a + s.chunk[o].length)) && r.add(s.chunk[o]); + } + return r; +} +class sH { + constructor(e, n, i, r = 0) { + this.layer = e, this.skip = n, this.minPoint = i, this.rank = r; + } + get startSide() { + return this.value ? this.value.startSide : 0; + } + get endSide() { + return this.value ? this.value.endSide : 0; + } + goto(e, n = -1e9) { + return this.chunkIndex = this.rangeIndex = 0, this.gotoInner(e, n, !1), this; + } + gotoInner(e, n, i) { + for (; this.chunkIndex < this.layer.chunk.length; ) { + let r = this.layer.chunk[this.chunkIndex]; + if (!(this.skip && this.skip.has(r) || this.layer.chunkEnd(this.chunkIndex) < e || r.maxPoint < this.minPoint)) + break; + this.chunkIndex++, i = !1; + } + if (this.chunkIndex < this.layer.chunk.length) { + let r = this.layer.chunk[this.chunkIndex].findIndex(e - this.layer.chunkPos[this.chunkIndex], n, !0); + (!i || this.rangeIndex < r) && this.setRangeIndex(r); + } + this.next(); + } + forward(e, n) { + (this.to - e || this.endSide - n) < 0 && this.gotoInner(e, n, !0); + } + next() { + for (; ; ) + if (this.chunkIndex == this.layer.chunk.length) { + this.from = this.to = 1e9, this.value = null; + break; + } else { + let e = this.layer.chunkPos[this.chunkIndex], n = this.layer.chunk[this.chunkIndex], i = e + n.from[this.rangeIndex]; + if (this.from = i, this.to = e + n.to[this.rangeIndex], this.value = n.value[this.rangeIndex], this.setRangeIndex(this.rangeIndex + 1), this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) + break; + } + } + setRangeIndex(e) { + if (e == this.layer.chunk[this.chunkIndex].value.length) { + if (this.chunkIndex++, this.skip) + for (; this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]); ) + this.chunkIndex++; + this.rangeIndex = 0; + } else + this.rangeIndex = e; + } + nextChunk() { + this.chunkIndex++, this.rangeIndex = 0, this.next(); + } + compare(e) { + return this.from - e.from || this.startSide - e.startSide || this.rank - e.rank || this.to - e.to || this.endSide - e.endSide; + } +} +class a0 { + constructor(e) { + this.heap = e; + } + static from(e, n = null, i = -1) { + let r = []; + for (let s = 0; s < e.length; s++) + for (let o = e[s]; !o.isEmpty; o = o.nextLayer) + o.maxPoint >= i && r.push(new sH(o, n, i, s)); + return r.length == 1 ? r[0] : new a0(r); + } + get startSide() { + return this.value ? this.value.startSide : 0; + } + goto(e, n = -1e9) { + for (let i of this.heap) + i.goto(e, n); + for (let i = this.heap.length >> 1; i >= 0; i--) + Z3(this.heap, i); + return this.next(), this; + } + forward(e, n) { + for (let i of this.heap) + i.forward(e, n); + for (let i = this.heap.length >> 1; i >= 0; i--) + Z3(this.heap, i); + (this.to - e || this.value.endSide - n) < 0 && this.next(); + } + next() { + if (this.heap.length == 0) + this.from = this.to = 1e9, this.value = null, this.rank = -1; + else { + let e = this.heap[0]; + this.from = e.from, this.to = e.to, this.value = e.value, this.rank = e.rank, e.value && e.next(), Z3(this.heap, 0); + } + } +} +function Z3(t, e) { + for (let n = t[e]; ; ) { + let i = (e << 1) + 1; + if (i >= t.length) + break; + let r = t[i]; + if (i + 1 < t.length && r.compare(t[i + 1]) >= 0 && (r = t[i + 1], i++), n.compare(r) < 0) + break; + t[i] = n, t[e] = r, e = i; + } +} +class $m { + constructor(e, n, i) { + this.minPoint = i, this.active = [], this.activeTo = [], this.activeRank = [], this.minActive = -1, this.point = null, this.pointFrom = 0, this.pointRank = 0, this.to = -1e9, this.endSide = 0, this.openStart = -1, this.cursor = a0.from(e, n, i); + } + goto(e, n = -1e9) { + return this.cursor.goto(e, n), this.active.length = this.activeTo.length = this.activeRank.length = 0, this.minActive = -1, this.to = e, this.endSide = n, this.openStart = -1, this.next(), this; + } + forward(e, n) { + for (; this.minActive > -1 && (this.activeTo[this.minActive] - e || this.active[this.minActive].endSide - n) < 0; ) + this.removeActive(this.minActive); + this.cursor.forward(e, n); + } + removeActive(e) { + ub(this.active, e), ub(this.activeTo, e), ub(this.activeRank, e), this.minActive = eA(this.active, this.activeTo); + } + addActive(e) { + let n = 0, { value: i, to: r, rank: s } = this.cursor; + for (; n < this.activeRank.length && (s - this.activeRank[n] || r - this.activeTo[n]) > 0; ) + n++; + cb(this.active, n, i), cb(this.activeTo, n, r), cb(this.activeRank, n, s), e && cb(e, n, this.cursor.from), this.minActive = eA(this.active, this.activeTo); + } + // After calling this, if `this.point` != null, the next range is a + // point. Otherwise, it's a regular range, covered by `this.active`. + next() { + let e = this.to, n = this.point; + this.point = null; + let i = this.openStart < 0 ? [] : null; + for (; ; ) { + let r = this.minActive; + if (r > -1 && (this.activeTo[r] - this.cursor.from || this.active[r].endSide - this.cursor.startSide) < 0) { + if (this.activeTo[r] > e) { + this.to = this.activeTo[r], this.endSide = this.active[r].endSide; + break; + } + this.removeActive(r), i && ub(i, r); + } else if (this.cursor.value) + if (this.cursor.from > e) { + this.to = this.cursor.from, this.endSide = this.cursor.startSide; + break; + } else { + let s = this.cursor.value; + if (!s.point) + this.addActive(i), this.cursor.next(); + else if (n && this.cursor.to == this.to && this.cursor.from < this.cursor.to) + this.cursor.next(); + else { + this.point = s, this.pointFrom = this.cursor.from, this.pointRank = this.cursor.rank, this.to = this.cursor.to, this.endSide = s.endSide, this.cursor.next(), this.forward(this.to, this.endSide); + break; + } + } + else { + this.to = this.endSide = 1e9; + break; + } + } + if (i) { + this.openStart = 0; + for (let r = i.length - 1; r >= 0 && i[r] < e; r--) + this.openStart++; + } + } + activeForPoint(e) { + if (!this.active.length) + return this.active; + let n = []; + for (let i = this.active.length - 1; i >= 0 && !(this.activeRank[i] < this.pointRank); i--) + (this.activeTo[i] > e || this.activeTo[i] == e && this.active[i].endSide >= this.point.endSide) && n.push(this.active[i]); + return n.reverse(); + } + openEnd(e) { + let n = 0; + for (let i = this.activeTo.length - 1; i >= 0 && this.activeTo[i] > e; i--) + n++; + return n; + } +} +function JN(t, e, n, i, r, s) { + t.goto(e), n.goto(i); + let o = i + r, a = i, l = i - e; + for (; ; ) { + let u = t.to + l - n.to || t.endSide - n.endSide, f = u < 0 ? t.to + l : n.to, d = Math.min(f, o); + if (t.point || n.point ? t.point && n.point && (t.point == n.point || t.point.eq(n.point)) && Q4(t.activeForPoint(t.to), n.activeForPoint(n.to)) || s.comparePoint(a, d, t.point, n.point) : d > a && !Q4(t.active, n.active) && s.compareRange(a, d, t.active, n.active), f > o) + break; + a = f, u <= 0 && t.next(), u >= 0 && n.next(); + } +} +function Q4(t, e) { + if (t.length != e.length) + return !1; + for (let n = 0; n < t.length; n++) + if (t[n] != e[n] && !t[n].eq(e[n])) + return !1; + return !0; +} +function ub(t, e) { + for (let n = e, i = t.length - 1; n < i; n++) + t[n] = t[n + 1]; + t.pop(); +} +function cb(t, e, n) { + for (let i = t.length - 1; i >= e; i--) + t[i + 1] = t[i]; + t[e] = n; +} +function eA(t, e) { + let n = -1, i = 1e9; + for (let r = 0; r < e.length; r++) + (e[r] - i || t[r].endSide - t[n].endSide) < 0 && (n = r, i = e[r]); + return n; +} +function dp(t, e, n = t.length) { + let i = 0; + for (let r = 0; r < n; ) + t.charCodeAt(r) == 9 ? (i += e - i % e, r++) : (i++, r = dr(t, r)); + return i; +} +function U4(t, e, n, i) { + for (let r = 0, s = 0; ; ) { + if (s >= e) + return r; + if (r == t.length) + break; + s += t.charCodeAt(r) == 9 ? n - s % n : 1, r = dr(t, r); + } + return i === !0 ? -1 : t.length; +} +const Z4 = "ͼ", tA = typeof Symbol > "u" ? "__" + Z4 : Symbol.for(Z4), q4 = typeof Symbol > "u" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet"), nA = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : {}; +class qu { + // :: (Object\n \n `;\n}\nfunction renderSignupCardToDOM(dataset, options = {}) {\n addCreateDocumentOption(options);\n const document = options.createDocument();\n const node = {\n alignment: dataset.__alignment,\n buttonText: dataset.__buttonText,\n header: dataset.__header,\n subheader: dataset.__subheader,\n disclaimer: dataset.__disclaimer,\n backgroundImageSrc: dataset.__backgroundImageSrc,\n backgroundSize: dataset.__backgroundSize,\n backgroundColor: dataset.__backgroundColor,\n buttonColor: dataset.__buttonColor,\n labels: dataset.__labels,\n layout: dataset.__layout,\n textColor: dataset.__textColor,\n buttonTextColor: dataset.__buttonTextColor,\n successMessage: dataset.__successMessage,\n swapped: dataset.__swapped\n };\n if (options.target === 'email') {\n return {\n element: document.createElement('div')\n }; // Return an empty element since we don't want to render the card in email\n }\n const htmlString = cardTemplate(node);\n const element = document.createElement('div');\n element.innerHTML = htmlString?.trim();\n if (node.header === '') {\n const h2Element = element.querySelector('.kg-signup-card-heading');\n if (h2Element) {\n h2Element.remove();\n }\n }\n if (node.subheader === '') {\n const h3Element = element.querySelector('.kg-signup-card-subheading');\n if (h3Element) {\n h3Element.remove();\n }\n }\n if (node.disclaimer === '') {\n const pElement = element.querySelector('.kg-signup-card-disclaimer');\n if (pElement) {\n pElement.remove();\n }\n }\n return {\n element: element.firstElementChild\n };\n}\nfunction getCardClasses(nodeData) {\n let cardClasses = ['kg-card kg-signup-card'];\n if (nodeData.layout && nodeData.layout !== 'split') {\n cardClasses.push(`kg-width-${nodeData.layout}`);\n }\n if (nodeData.layout === 'split') {\n cardClasses.push('kg-layout-split kg-width-full');\n }\n if (nodeData.swapped && nodeData.layout === 'split') {\n cardClasses.push('kg-swapped');\n }\n if (nodeData.layout && nodeData.layout === 'full') {\n cardClasses.push(`kg-content-wide`);\n }\n if (nodeData.layout === 'split') {\n if (nodeData.backgroundSize === 'contain') {\n cardClasses.push('kg-content-wide');\n }\n }\n return cardClasses;\n}\n\n// In general, we don't want to apply the accent style if there's a background image\n// but with the split format we display both an image and a background color\nconst getAccentClass = nodeData => {\n if (nodeData.layout === 'split' && nodeData.backgroundColor === 'accent') {\n return 'kg-style-accent';\n } else if (nodeData.layout !== 'split' && !nodeData.backgroundImageSrc && nodeData.backgroundColor === 'accent') {\n return 'kg-style-accent';\n } else {\n return '';\n }\n};\n\n/* eslint-disable ghost/filenames/match-exported-class */\nclass SignupNode extends generateDecoratorNode({\n nodeType: 'signup',\n properties: [{\n name: 'alignment',\n default: 'left'\n }, {\n name: 'backgroundColor',\n default: '#F0F0F0'\n }, {\n name: 'backgroundImageSrc',\n default: ''\n }, {\n name: 'backgroundSize',\n default: 'cover'\n }, {\n name: 'textColor',\n default: ''\n }, {\n name: 'buttonColor',\n default: 'accent'\n }, {\n name: 'buttonTextColor',\n default: '#FFFFFF'\n }, {\n name: 'buttonText',\n default: 'Subscribe'\n }, {\n name: 'disclaimer',\n default: '',\n wordCount: true\n }, {\n name: 'header',\n default: '',\n wordCount: true\n }, {\n name: 'labels',\n default: []\n }, {\n name: 'layout',\n default: 'wide'\n }, {\n name: 'subheader',\n default: '',\n wordCount: true\n }, {\n name: 'successMessage',\n default: 'Email sent! Check your inbox to complete your signup.'\n }, {\n name: 'swapped',\n default: false\n }],\n defaultRenderFn: renderSignupCardToDOM\n}) {\n /* override */\n constructor({\n alignment,\n backgroundColor,\n backgroundImageSrc,\n backgroundSize,\n textColor,\n buttonColor,\n buttonTextColor,\n buttonText,\n disclaimer,\n header,\n labels,\n layout,\n subheader,\n successMessage,\n swapped\n } = {}, key) {\n super(key);\n this.__alignment = alignment || 'left';\n this.__backgroundColor = backgroundColor || '#F0F0F0';\n this.__backgroundImageSrc = backgroundImageSrc || '';\n this.__backgroundSize = backgroundSize || 'cover';\n this.__textColor = backgroundColor === 'transparent' && (layout === 'split' || !backgroundImageSrc) ? '' : textColor || '#000000'; // text color should inherit with a transparent bg color unless we're using an image for the background (which supercedes the bg color)\n this.__buttonColor = buttonColor || 'accent';\n this.__buttonTextColor = buttonTextColor || '#FFFFFF';\n this.__buttonText = buttonText || 'Subscribe';\n this.__disclaimer = disclaimer || '';\n this.__header = header || '';\n this.__labels = labels || [];\n this.__layout = layout || 'wide';\n this.__subheader = subheader || '';\n this.__successMessage = successMessage || 'Email sent! Check your inbox to complete your signup.';\n this.__swapped = swapped || false;\n }\n static importDOM() {\n return signupParser(this);\n }\n\n // keeping some custom methods for labels as it requires some special handling\n\n setLabels(labels) {\n if (!Array.isArray(labels) || !labels.every(item => typeof item === 'string')) {\n throw new Error('Invalid argument: Expected an array of strings.'); // eslint-disable-line\n }\n const writable = this.getWritable();\n writable.__labels = labels;\n }\n addLabel(label) {\n const writable = this.getWritable();\n writable.__labels.push(label);\n }\n removeLabel(label) {\n const writable = this.getWritable();\n writable.__labels = writable.__labels.filter(l => l !== label);\n }\n}\nconst $createSignupNode = dataset => {\n return new SignupNode(dataset);\n};\nfunction $isSignupNode(node) {\n return node instanceof SignupNode;\n}\n\nfunction renderTransistorNode(node, options) {\n addCreateDocumentOption(options);\n const document = options.createDocument();\n const accentColor = node.accentColor;\n const backgroundColor = node.backgroundColor;\n\n // Build the embed URL with optional color parameters\n // {uuid} placeholder will be replaced server-side with the member's UUID\n const baseUrl = 'https://partner.transistor.fm/ghost/embed/{uuid}';\n const params = new URLSearchParams();\n if (accentColor) {\n params.set('color', accentColor.replace(/^#/, ''));\n }\n if (backgroundColor) {\n params.set('background', backgroundColor.replace(/^#/, ''));\n }\n const queryString = params.toString();\n const embedUrl = queryString ? `${baseUrl}?${queryString}` : baseUrl;\n const iframe = document.createElement('iframe');\n iframe.setAttribute('width', '100%');\n iframe.setAttribute('height', '180');\n iframe.setAttribute('frameborder', 'no');\n iframe.setAttribute('scrolling', 'no');\n iframe.setAttribute('seamless', '');\n iframe.setAttribute('src', embedUrl);\n const figure = document.createElement('figure');\n figure.setAttribute('class', 'kg-card kg-transistor-card');\n figure.appendChild(iframe);\n return renderWithVisibility({\n element: figure,\n type: 'inner'\n }, node.visibility, options);\n}\n\n// eslint-disable-next-line ghost/filenames/match-exported-class\n\n// Default visibility for Transistor: members only (no public visitors)\n// since the embed requires a member UUID to function\nconst TRANSISTOR_DEFAULT_VISIBILITY = {\n web: {\n nonMember: false,\n // Hide from public visitors - requires member UUID\n memberSegment: ALL_MEMBERS_SEGMENT // Show to all members (free + paid)\n },\n email: {\n memberSegment: ALL_MEMBERS_SEGMENT\n }\n};\nclass TransistorNode extends generateDecoratorNode({\n nodeType: 'transistor',\n hasVisibility: true,\n properties: [{\n name: 'accentColor',\n default: ''\n },\n // Player accent color (text/buttons) - hex value\n {\n name: 'backgroundColor',\n default: ''\n } // Player background color - hex value\n ],\n defaultRenderFn: renderTransistorNode\n}) {\n constructor(data = {}, key) {\n super(data, key);\n if (!data.visibility) {\n this.__visibility = cloneDeep(TRANSISTOR_DEFAULT_VISIBILITY);\n }\n }\n static getPropertyDefaults() {\n const defaults = super.getPropertyDefaults();\n defaults.visibility = cloneDeep(TRANSISTOR_DEFAULT_VISIBILITY);\n return defaults;\n }\n isEmpty() {\n return false; // Transistor card is never empty as it has a fixed URL\n }\n hasEditMode() {\n return true;\n }\n}\nconst $createTransistorNode = dataset => {\n return new TransistorNode(dataset);\n};\nconst $isTransistorNode = node => {\n return node instanceof TransistorNode;\n};\n\n/* eslint-disable ghost/filenames/match-exported-class */\n\n// Since the TextNode is foundational to all Lexical packages, including the\n// plain text use case. Handling any rich text logic is undesirable. This creates\n// the need to override the TextNode to handle serialization and deserialization\n// of HTML/CSS styling properties to achieve full fidelity between JSON <-> HTML.\n//\n// https://lexical.dev/docs/concepts/serialization#handling-extended-html-styling\n\nconst extendedTextNodeReplacement = {\n replace: TextNode,\n with: node => new ExtendedTextNode(node.__text)\n};\nclass ExtendedTextNode extends TextNode {\n constructor(text, key) {\n super(text, key);\n }\n static getType() {\n return 'extended-text';\n }\n static clone(node) {\n return new ExtendedTextNode(node.__text, node.__key);\n }\n static importDOM() {\n const importers = TextNode.importDOM();\n return {\n ...importers,\n span: () => ({\n conversion: patchConversion(importers?.span, convertSpanElement),\n priority: 1\n })\n };\n }\n static importJSON(serializedNode) {\n return TextNode.importJSON(serializedNode);\n }\n exportJSON() {\n const json = super.exportJSON();\n json.type = 'extended-text';\n return json;\n }\n isSimpleText() {\n return (this.__type === 'text' || this.__type === 'extended-text') && this.__mode === 0;\n }\n isInline() {\n return true;\n }\n}\nfunction patchConversion(originalDOMConverter, convertFn) {\n return node => {\n const original = originalDOMConverter?.(node);\n if (!original) {\n return null;\n }\n const originalOutput = original.conversion(node);\n if (!originalOutput) {\n return originalOutput;\n }\n return {\n ...originalOutput,\n forChild: (lexicalNode, parent) => {\n const originalForChild = originalOutput?.forChild ?? (x => x);\n const result = originalForChild(lexicalNode, parent);\n if ($isTextNode(result)) {\n return convertFn(result, node);\n }\n return result;\n }\n };\n };\n}\nfunction convertSpanElement(lexicalNode, domNode) {\n const span = domNode;\n\n // Word uses span tags + font-weight for bold text\n const hasBoldFontWeight = span.style.fontWeight === 'bold' || span.parentElement?.style.fontWeight === 'bold';\n // Word uses span tags + font-style for italic text\n const hasItalicFontStyle = span.style.fontStyle === 'italic' || span.parentElement?.style.fontStyle === 'italic';\n // Word uses span tags + text-decoration for underline text\n const hasUnderlineTextDecoration = span.style.textDecoration === 'underline' || span.parentElement?.style.textDecoration === 'underline';\n // Word uses span tags + \"Strikethrough\" class for strikethrough text\n const hasStrikethroughClass = span.classList.contains('Strikethrough') || span.parentElement?.classList.contains('Strikethrough');\n // Word uses span tags + \"Highlight\" class for highlighted text\n const hasHighlightClass = span.classList.contains('Highlight') || span.parentElement?.classList.contains('Highlight');\n if (hasBoldFontWeight && !lexicalNode.hasFormat('bold')) {\n lexicalNode = lexicalNode.toggleFormat('bold');\n }\n if (hasItalicFontStyle && !lexicalNode.hasFormat('italic')) {\n lexicalNode = lexicalNode.toggleFormat('italic');\n }\n if (hasUnderlineTextDecoration && !lexicalNode.hasFormat('underline')) {\n lexicalNode = lexicalNode.toggleFormat('underline');\n }\n if (hasStrikethroughClass && !lexicalNode.hasFormat('strikethrough')) {\n lexicalNode = lexicalNode.toggleFormat('strikethrough');\n }\n if (hasHighlightClass && !lexicalNode.hasFormat('highlight')) {\n lexicalNode = lexicalNode.toggleFormat('highlight');\n }\n return lexicalNode;\n}\n\n/* eslint-disable ghost/filenames/match-exported-class */\n\n// Since the HeadingNode is foundational to Lexical rich-text, only using a\n// custom HeadingNode is undesirable as it means every package would need to\n// be updated to work with the custom node. Instead we can use Lexical's node\n// override/replacement mechanism to extend the default with our custom parsing\n// logic.\n//\n// https://lexical.dev/docs/concepts/serialization#handling-extended-html-styling\n\nconst extendedHeadingNodeReplacement = {\n replace: HeadingNode,\n with: node => new ExtendedHeadingNode(node.__tag)\n};\nclass ExtendedHeadingNode extends HeadingNode {\n constructor(tag, key) {\n super(tag, key);\n }\n static getType() {\n return 'extended-heading';\n }\n static clone(node) {\n return new ExtendedHeadingNode(node.__tag, node.__key);\n }\n static importDOM() {\n const importers = HeadingNode.importDOM();\n return {\n ...importers,\n p: patchParagraphConversion(importers?.p)\n };\n }\n static importJSON(serializedNode) {\n return HeadingNode.importJSON(serializedNode);\n }\n exportJSON() {\n const json = super.exportJSON();\n json.type = 'extended-heading';\n return json;\n }\n}\nfunction patchParagraphConversion(originalDOMConverter) {\n return node => {\n // Original matches Google Docs p node to a null conversion so it's\n // child span is parsed as a heading. Don't prevent that here\n const original = originalDOMConverter?.(node);\n if (original) {\n return original;\n }\n const p = node;\n\n // Word uses paragraphs with role=\"heading\" to represent headings\n // and an aria-level=\"x\" to represent the heading level\n const hasAriaHeadingRole = p.getAttribute('role') === 'heading';\n const hasAriaLevel = p.getAttribute('aria-level');\n if (hasAriaHeadingRole && hasAriaLevel) {\n const level = parseInt(hasAriaLevel, 10);\n if (level > 0 && level < 7) {\n return {\n conversion: () => {\n return {\n node: new ExtendedHeadingNode(`h${level}`)\n };\n },\n priority: 1\n };\n }\n }\n return null;\n };\n}\n\n/* eslint-disable ghost/filenames/match-exported-class */\n\n// Since the QuoteNode is foundational to Lexical rich-text, only using a\n// custom QuoteNode is undesirable as it means every package would need to\n// be updated to work with the custom node. Instead we can use Lexical's node\n// override/replacement mechanism to extend the default with our custom parsing\n// logic.\n//\n// https://lexical.dev/docs/concepts/serialization#handling-extended-html-styling\n\nconst extendedQuoteNodeReplacement = {\n replace: QuoteNode,\n with: () => new ExtendedQuoteNode()\n};\nclass ExtendedQuoteNode extends QuoteNode {\n constructor(key) {\n super(key);\n }\n static getType() {\n return 'extended-quote';\n }\n static clone(node) {\n return new ExtendedQuoteNode(node.__key);\n }\n static importDOM() {\n const importers = QuoteNode.importDOM();\n return {\n ...importers,\n blockquote: convertBlockquoteElement\n };\n }\n static importJSON(serializedNode) {\n return QuoteNode.importJSON(serializedNode);\n }\n exportJSON() {\n const json = super.exportJSON();\n json.type = 'extended-quote';\n return json;\n }\n\n /* c8 ignore start */\n extractWithChild() {\n return true;\n }\n /* c8 ignore end */\n}\nfunction convertBlockquoteElement() {\n return {\n conversion: () => {\n const node = new ExtendedQuoteNode();\n return {\n node,\n after: childNodes => {\n // Blockquotes can have nested paragraphs. In our original mobiledoc\n // editor we parsed all of the nested paragraphs into a single blockquote\n // separating each paragraph with two line breaks. We replicate that\n // here so we don't have a breaking change in conversion behaviour.\n const newChildNodes = [];\n childNodes.forEach(child => {\n if ($isParagraphNode(child)) {\n if (newChildNodes.length > 0) {\n newChildNodes.push($createLineBreakNode());\n newChildNodes.push($createLineBreakNode());\n }\n newChildNodes.push(...child.getChildren());\n } else {\n newChildNodes.push(child);\n }\n });\n return newChildNodes;\n }\n };\n },\n priority: 1\n };\n}\n\n/* eslint-disable ghost/filenames/match-exported-class */\nclass TKNode extends TextNode {\n static getType() {\n return 'tk';\n }\n static clone(node) {\n return new TKNode(node.__text, node.__key);\n }\n constructor(text, key) {\n super(text, key);\n }\n createDOM(config) {\n const element = super.createDOM(config);\n const classes = config.theme.tk?.split(' ') || [];\n element.classList.add(...classes);\n element.dataset.kgTk = true;\n return element;\n }\n static importJSON(serializedNode) {\n const node = $createTKNode(serializedNode.text);\n node.setFormat(serializedNode.format);\n node.setDetail(serializedNode.detail);\n node.setMode(serializedNode.mode);\n node.setStyle(serializedNode.style);\n return node;\n }\n exportJSON() {\n return {\n ...super.exportJSON(),\n type: 'tk'\n };\n }\n canInsertTextBefore() {\n return false;\n }\n isTextEntity() {\n return true;\n }\n}\n\n/**\n * Generates a TKNode, which is a string following the format of a # followed by some text, eg. #lexical.\n * @param text - The text used inside the TKNode.\n * @returns - The TKNode with the embedded text.\n */\nfunction $createTKNode(text) {\n return $applyNodeReplacement(new TKNode(text));\n}\n\n/**\n * Determines if node is a TKNode.\n * @param node - The node to be checked.\n * @returns true if node is a TKNode, false otherwise.\n */\nfunction $isTKNode(node) {\n return node instanceof TKNode;\n}\n\nvar linkSVG = \"\\n \\n \\n\";\n\n/* eslint-disable ghost/filenames/match-exported-class */\n// Container element for a link search query. Temporary node used only inside\n// the editor that will be replaced with a LinkNode when the search is complete.\nclass AtLinkNode extends ElementNode {\n // We keep track of the format that was applied to the original '@' character\n // so we can re-apply that when converting to a LinkNode\n __linkFormat = null;\n static getType() {\n return 'at-link';\n }\n constructor(linkFormat, key) {\n super(key);\n this.__linkFormat = linkFormat;\n }\n static clone(node) {\n return new AtLinkNode(node.__linkFormat, node.__key);\n }\n\n // This is a temporary node, it should never be serialized but we need\n // to implement just in case and to match expected types. The AtLinkPlugin\n // should take care of replacing this node with it's children when needed.\n static importJSON({\n linkFormat\n }) {\n return $createAtLinkNode(linkFormat);\n }\n exportJSON() {\n return {\n ...super.exportJSON(),\n type: 'at-link',\n version: 1,\n linkFormat: this.__linkFormat\n };\n }\n createDOM(config) {\n const span = document.createElement('span');\n const atLinkClasses = (config.theme.atLink || '').split(' ').filter(Boolean);\n const atLinkIconClasses = (config.theme.atLinkIcon || '').split(' ').filter(Boolean);\n span.classList.add(...atLinkClasses);\n const svgElement = new DOMParser().parseFromString(linkSVG, 'image/svg+xml').documentElement;\n svgElement.classList.add(...atLinkIconClasses);\n span.appendChild(svgElement);\n return span;\n }\n updateDOM() {\n return false;\n }\n\n // should not render anything - this is a placeholder node\n exportDOM() {\n return null;\n }\n\n /* c8 ignore next 3 */\n static importDOM() {\n return null;\n }\n getTextContent() {\n return '';\n }\n isInline() {\n return true;\n }\n canBeEmpty() {\n return false;\n }\n setLinkFormat(linkFormat) {\n const self = this.getWritable();\n self.__linkFormat = linkFormat;\n }\n getLinkFormat() {\n const self = this.getLatest();\n return self.__linkFormat;\n }\n}\nfunction $createAtLinkNode(linkFormat) {\n return $applyNodeReplacement(new AtLinkNode(linkFormat));\n}\nfunction $isAtLinkNode(node) {\n return node instanceof AtLinkNode;\n}\n\n/* eslint-disable ghost/filenames/match-exported-class */\n\n// Represents the search query string inside an AtLinkNode. Used in place of a\n// regular TextNode to allow for :after styling to be applied to work as a placeholder\nclass AtLinkSearchNode extends TextNode {\n __placeholder = null;\n defaultPlaceholder = 'Find a post, tag or author';\n static getType() {\n return 'at-link-search';\n }\n constructor(text, placeholder, key) {\n super(text, key);\n this.__placeholder = placeholder;\n }\n static clone(node) {\n return new AtLinkSearchNode(node.__text, node.__placeholder, node.__key);\n }\n\n // This is a temporary node, it should never be serialized but we need\n // to implement just in case and to match expected types. The AtLinkPlugin\n // should take care of replacing this node when needed.\n static importJSON({\n text,\n placeholder\n }) {\n return $createAtLinkSearchNode(text, placeholder);\n }\n exportJSON() {\n return {\n ...super.exportJSON(),\n type: 'at-link-search',\n version: 1,\n placeholder: this.__placeholder\n };\n }\n createDOM(config) {\n const span = super.createDOM(config);\n span.dataset.placeholder = '';\n if (!this.__text) {\n span.dataset.placeholder = this.__placeholder ?? this.defaultPlaceholder;\n } else {\n span.dataset.placeholder = this.__placeholder || '';\n }\n span.classList.add(...config.theme.atLinkSearch.split(' '));\n return span;\n }\n updateDOM(prevNode, dom) {\n if (this.__text) {\n dom.dataset.placeholder = this.__placeholder ?? '';\n }\n return super.updateDOM(...arguments);\n }\n\n // should not render anything - this is a placeholder node\n exportDOM() {\n return null;\n }\n\n /* c8 ignore next 3 */\n static importDOM() {\n return null;\n }\n canHaveFormat() {\n return false;\n }\n setPlaceholder(text) {\n const self = this.getWritable();\n self.__placeholder = text;\n }\n getPlaceholder() {\n const self = this.getLatest();\n return self.__placeholder;\n }\n\n // Lexical will incorrectly pick up this node as an element node when the\n // cursor is placed by the SVG icon element in the parent AtLinkNode. We\n // need these methods to avoid throwing errors in that case but otherwise\n // behaviour is unaffected.\n getChildrenSize() {\n return 0;\n }\n getChildAtIndex() {\n return null;\n }\n}\nfunction $createAtLinkSearchNode(text = '', placeholder = null) {\n return $applyNodeReplacement(new AtLinkSearchNode(text, placeholder));\n}\nfunction $isAtLinkSearchNode(node) {\n return node instanceof AtLinkSearchNode;\n}\n\n/* eslint-disable ghost/filenames/match-exported-class */\n\n// This is used in places where we need an extra cursor position at the\n// beginning of an element node as it prevents Lexical normalizing the\n// cursor position to the end of the previous node.\nclass ZWNJNode extends TextNode {\n static getType() {\n return 'zwnj';\n }\n static clone(node) {\n return new ZWNJNode('', node.__key);\n }\n createDOM(config) {\n const span = super.createDOM(config);\n span.innerHTML = '‌';\n return span;\n }\n updateDOM() {\n return false;\n }\n exportJSON() {\n return {\n ...super.exportJSON(),\n type: 'zwnj',\n version: 1\n };\n }\n getTextContent() {\n return '';\n }\n isToken() {\n return true;\n }\n}\nfunction $createZWNJNode() {\n return new ZWNJNode('');\n}\nfunction $isZWNJNode(node) {\n return node instanceof ZWNJNode;\n}\n\nvar linebreakSerializers = {\n import: {\n br: node => {\n const isGoogleDocs = !!node.closest('[id^=\"docs-internal-guid-\"]');\n const previousNodeName = node.previousElementSibling?.nodeName;\n const nextNodeName = node.nextElementSibling?.nodeName;\n const headings = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];\n const lists = ['UL', 'OL', 'DL'];\n\n // Remove empty paragraphs when copy/pasting from Google docs:\n // - Between two paragraphs (P and P)\n // - Between multiple linebreaks (BR and BR)\n // - Between a list and a paragraph (UL/OL/DL and P), and vice versa\n // - Between a heading and a paragraph (H1-H6 and P), and vice versa\n if (isGoogleDocs) {\n if (previousNodeName === 'P' && nextNodeName === 'P' || previousNodeName === 'BR' || nextNodeName === 'BR' || [...headings, ...lists].includes(previousNodeName) && nextNodeName === 'P' || previousNodeName === 'P' && [...headings, ...lists].includes(nextNodeName)) {\n return {\n conversion: () => null,\n priority: 1\n };\n }\n }\n\n // allow lower priority converter to handle (i.e. default LineBreakNode.importDOM)\n return null;\n }\n }\n};\n\nvar paragraphSerializers = {\n import: {\n p: node => {\n const isGoogleDocs = !!node.closest('[id^=\"docs-internal-guid-\"]');\n\n // Google docs wraps dividers in paragraphs, without text content\n // Remove them to avoid creating empty paragraphs in the editor\n if (isGoogleDocs && node.textContent === '') {\n return {\n conversion: () => null,\n priority: 1\n };\n }\n return null;\n }\n }\n};\n\nconst utils = {\n generateDecoratorNode,\n visibility: visibilityUtils,\n rgbToHex,\n taggedTemplateFns\n};\nconst serializers = {\n linebreak: linebreakSerializers,\n paragraph: paragraphSerializers\n};\nconst DEFAULT_CONFIG = {\n html: {\n import: {\n ...serializers.linebreak.import,\n ...serializers.paragraph.import\n }\n }\n};\n\n// export convenience objects for use elsewhere\nconst DEFAULT_NODES = [ExtendedTextNode, extendedTextNodeReplacement, ExtendedHeadingNode, extendedHeadingNodeReplacement, ExtendedQuoteNode, extendedQuoteNodeReplacement, CodeBlockNode, ImageNode, MarkdownNode, VideoNode, AudioNode, CalloutNode, CallToActionNode, AsideNode, HorizontalRuleNode, HtmlNode, FileNode, ToggleNode, ButtonNode, HeaderNode, BookmarkNode, PaywallNode, ProductNode, EmbedNode, EmailNode, GalleryNode, EmailCtaNode, SignupNode, TransistorNode, TKNode, AtLinkNode, AtLinkSearchNode, ZWNJNode];\n\nexport { $createAsideNode, $createAtLinkNode, $createAtLinkSearchNode, $createAudioNode, $createBookmarkNode, $createButtonNode, $createCallToActionNode, $createCalloutNode, $createCodeBlockNode, $createEmailCtaNode, $createEmailNode, $createEmbedNode, $createFileNode, $createGalleryNode, $createHeaderNode, $createHorizontalRuleNode, $createHtmlNode, $createImageNode, $createMarkdownNode, $createPaywallNode, $createProductNode, $createSignupNode, $createTKNode, $createToggleNode, $createTransistorNode, $createVideoNode, $createZWNJNode, $isAsideNode, $isAtLinkNode, $isAtLinkSearchNode, $isAudioNode, $isBookmarkNode, $isButtonNode, $isCallToActionNode, $isCalloutNode, $isCodeBlockNode, $isEmailCtaNode, $isEmailNode, $isEmbedNode, $isFileNode, $isGalleryNode, $isHeaderNode, $isHorizontalRuleNode, $isHtmlNode, $isImageNode, $isKoenigCard, $isMarkdownNode, $isPaywallNode, $isProductNode, $isSignupNode, $isTKNode, $isToggleNode, $isTransistorNode, $isVideoNode, $isZWNJNode, AsideNode, AtLinkNode, AtLinkSearchNode, AudioNode, BookmarkNode, ButtonNode, CallToActionNode, CalloutNode, CodeBlockNode, DEFAULT_CONFIG, DEFAULT_NODES, EmailCtaNode, EmailNode, EmbedNode, ExtendedHeadingNode, ExtendedQuoteNode, ExtendedTextNode, FileNode, GalleryNode, HeaderNode, HorizontalRuleNode, HtmlNode, ImageNode, KoenigDecoratorNode, MarkdownNode, PaywallNode, ProductNode, SignupNode, TKNode, ToggleNode, TransistorNode, VideoNode, ZWNJNode, extendedHeadingNodeReplacement, extendedQuoteNodeReplacement, extendedTextNodeReplacement, serializers, utils };\n//# sourceMappingURL=kg-default-nodes.js.map\n","import {\n $createParagraphNode\n} from 'lexical';\nimport {AsideNode as BaseAsideNode} from '@tryghost/kg-default-nodes';\nimport {\n addClassNamesToElement\n} from '@lexical/utils';\n\nexport class AsideNode extends BaseAsideNode {\n createDOM(config) {\n const element = document.createElement('aside');\n addClassNamesToElement(element, config.theme.aside);\n return element;\n }\n\n // Mutation\n\n insertNewAfter() {\n const newBlock = $createParagraphNode();\n const direction = this.getDirection();\n newBlock.setDirection(direction);\n this.insertAfter(newBlock);\n return newBlock;\n }\n\n collapseAtStart() {\n const paragraph = $createParagraphNode();\n const children = this.getChildren();\n children.forEach(child => paragraph.append(child));\n this.replace(paragraph);\n return true;\n }\n}\n\nexport function $createAsideNode() {\n return new AsideNode();\n}\n\nexport function $isAsideNode(node) {\n return node instanceof AsideNode;\n}\n","import * as React from \"react\";\nconst SvgKgCardTypeGenEmbed = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 32, height: 32, viewBox: \"0 0 32 32\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { fill: \"none\", fillRule: \"evenodd\" }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M32 2.667C32 .889 31.111 0 29.333 0H2.667C1.93 0 1.302.26.78.781.261 1.301 0 1.931 0 2.667v26.666C0 31.111.889 32 2.667 32h26.666C31.111 32 32 31.111 32 29.333V2.667z\", fill: \"#465961\", fillRule: \"nonzero\" }), /* @__PURE__ */ React.createElement(\"path\", { stroke: \"#FFF\", strokeWidth: 2, strokeLinecap: \"round\", strokeLinejoin: \"round\", d: \"M10.5 12l-4 4.333 4 3.667M21.5 12l4 4.333-4 3.667M18 11l-4 10\" })));\nexport default SvgKgCardTypeGenEmbed;\n","import React from 'react';\n\nconst Context = React.createContext({});\n\nexport const KoenigSelectedCardContext = ({children}) => {\n const [selectedCardKey, setSelectedCardKey] = React.useState(null);\n const [isEditingCard, setIsEditingCard] = React.useState(false);\n const [isDragging, setIsDragging] = React.useState(false);\n const [showVisibilitySettings, setShowVisibilitySettings] = React.useState(false);\n const contextValue = React.useMemo(() => {\n return {\n selectedCardKey,\n setSelectedCardKey,\n isEditingCard,\n setIsEditingCard,\n isDragging,\n setIsDragging,\n showVisibilitySettings,\n setShowVisibilitySettings\n };\n }, [\n selectedCardKey,\n setSelectedCardKey,\n isEditingCard,\n setIsEditingCard,\n isDragging,\n setIsDragging,\n showVisibilitySettings,\n setShowVisibilitySettings\n ]);\n\n return {children};\n};\n\nexport const useKoenigSelectedCardContext = () => React.useContext(Context);\n","import React from 'react';\nimport {useKoenigSelectedCardContext} from '../../context/KoenigSelectedCardContext';\n\nexport function ActionToolbar({isVisible, children, ...props}) {\n const {isDragging} = useKoenigSelectedCardContext();\n\n if (isVisible && !isDragging) {\n return (\n
    \n {children}\n
    \n );\n }\n}\n","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n /**\n Get the line description around the given position.\n */\n lineAt(pos) {\n if (pos < 0 || pos > this.length)\n throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n return this.lineInner(pos, false, 1, 0);\n }\n /**\n Get the description for the given (1-based) line number.\n */\n line(n) {\n if (n < 1 || n > this.lines)\n throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`);\n return this.lineInner(n, true, 1, 0);\n }\n /**\n Replace a range of the text with the given content.\n */\n replace(from, to, text) {\n [from, to] = clip(this, from, to);\n let parts = [];\n this.decompose(0, from, parts, 2 /* Open.To */);\n if (text.length)\n text.decompose(0, text.length, parts, 1 /* Open.From */ | 2 /* Open.To */);\n this.decompose(to, this.length, parts, 1 /* Open.From */);\n return TextNode.from(parts, this.length - (to - from) + text.length);\n }\n /**\n Append another document to this one.\n */\n append(other) {\n return this.replace(this.length, this.length, other);\n }\n /**\n Retrieve the text between the given points.\n */\n slice(from, to = this.length) {\n [from, to] = clip(this, from, to);\n let parts = [];\n this.decompose(from, to, parts, 0);\n return TextNode.from(parts, to - from);\n }\n /**\n Test whether this text is equal to another instance.\n */\n eq(other) {\n if (other == this)\n return true;\n if (other.length != this.length || other.lines != this.lines)\n return false;\n let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1);\n let a = new RawTextCursor(this), b = new RawTextCursor(other);\n for (let skip = start, pos = start;;) {\n a.next(skip);\n b.next(skip);\n skip = 0;\n if (a.lineBreak != b.lineBreak || a.done != b.done || a.value != b.value)\n return false;\n pos += a.value.length;\n if (a.done || pos >= end)\n return true;\n }\n }\n /**\n Iterate over the text. When `dir` is `-1`, iteration happens\n from end to start. This will return lines and the breaks between\n them as separate strings.\n */\n iter(dir = 1) { return new RawTextCursor(this, dir); }\n /**\n Iterate over a range of the text. When `from` > `to`, the\n iterator will run in reverse.\n */\n iterRange(from, to = this.length) { return new PartialTextCursor(this, from, to); }\n /**\n Return a cursor that iterates over the given range of lines,\n _without_ returning the line breaks between, and yielding empty\n strings for empty lines.\n \n When `from` and `to` are given, they should be 1-based line numbers.\n */\n iterLines(from, to) {\n let inner;\n if (from == null) {\n inner = this.iter();\n }\n else {\n if (to == null)\n to = this.lines + 1;\n let start = this.line(from).from;\n inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to));\n }\n return new LineCursor(inner);\n }\n /**\n Return the document as a string, using newline characters to\n separate lines.\n */\n toString() { return this.sliceString(0); }\n /**\n Convert the document to an array of lines (which can be\n deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)).\n */\n toJSON() {\n let lines = [];\n this.flatten(lines);\n return lines;\n }\n /**\n @internal\n */\n constructor() { }\n /**\n Create a `Text` instance for the given array of lines.\n */\n static of(text) {\n if (text.length == 0)\n throw new RangeError(\"A document must have at least one line\");\n if (text.length == 1 && !text[0])\n return Text.empty;\n return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n }\n}\n// Leaves store an array of line strings. There are always line breaks\n// between these strings. Leaves are limited in size and have to be\n// contained in TextNode instances for bigger documents.\nclass TextLeaf extends Text {\n constructor(text, length = textLength(text)) {\n super();\n this.text = text;\n this.length = length;\n }\n get lines() { return this.text.length; }\n get children() { return null; }\n lineInner(target, isLine, line, offset) {\n for (let i = 0;; i++) {\n let string = this.text[i], end = offset + string.length;\n if ((isLine ? line : end) >= target)\n return new Line(offset, end, line, string);\n offset = end + 1;\n line++;\n }\n }\n decompose(from, to, target, open) {\n let text = from <= 0 && to >= this.length ? this\n : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));\n if (open & 1 /* Open.From */) {\n let prev = target.pop();\n let joined = appendText(text.text, prev.text.slice(), 0, text.length);\n if (joined.length <= 32 /* Tree.Branch */) {\n target.push(new TextLeaf(joined, prev.length + text.length));\n }\n else {\n let mid = joined.length >> 1;\n target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid)));\n }\n }\n else {\n target.push(text);\n }\n }\n replace(from, to, text) {\n if (!(text instanceof TextLeaf))\n return super.replace(from, to, text);\n [from, to] = clip(this, from, to);\n let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);\n let newLen = this.length + text.length - (to - from);\n if (lines.length <= 32 /* Tree.Branch */)\n return new TextLeaf(lines, newLen);\n return TextNode.from(TextLeaf.split(lines, []), newLen);\n }\n sliceString(from, to = this.length, lineSep = \"\\n\") {\n [from, to] = clip(this, from, to);\n let result = \"\";\n for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) {\n let line = this.text[i], end = pos + line.length;\n if (pos > from && i)\n result += lineSep;\n if (from < end && to > pos)\n result += line.slice(Math.max(0, from - pos), to - pos);\n pos = end + 1;\n }\n return result;\n }\n flatten(target) {\n for (let line of this.text)\n target.push(line);\n }\n scanIdentical() { return 0; }\n static split(text, target) {\n let part = [], len = -1;\n for (let line of text) {\n part.push(line);\n len += line.length + 1;\n if (part.length == 32 /* Tree.Branch */) {\n target.push(new TextLeaf(part, len));\n part = [];\n len = -1;\n }\n }\n if (len > -1)\n target.push(new TextLeaf(part, len));\n return target;\n }\n}\n// Nodes provide the tree structure of the `Text` type. They store a\n// number of other nodes or leaves, taking care to balance themselves\n// on changes. There are implied line breaks _between_ the children of\n// a node (but not before the first or after the last child).\nclass TextNode extends Text {\n constructor(children, length) {\n super();\n this.children = children;\n this.length = length;\n this.lines = 0;\n for (let child of children)\n this.lines += child.lines;\n }\n lineInner(target, isLine, line, offset) {\n for (let i = 0;; i++) {\n let child = this.children[i], end = offset + child.length, endLine = line + child.lines - 1;\n if ((isLine ? endLine : end) >= target)\n return child.lineInner(target, isLine, line, offset);\n offset = end + 1;\n line = endLine + 1;\n }\n }\n decompose(from, to, target, open) {\n for (let i = 0, pos = 0; pos <= to && i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n if (from <= end && to >= pos) {\n let childOpen = open & ((pos <= from ? 1 /* Open.From */ : 0) | (end >= to ? 2 /* Open.To */ : 0));\n if (pos >= from && end <= to && !childOpen)\n target.push(child);\n else\n child.decompose(from - pos, to - pos, target, childOpen);\n }\n pos = end + 1;\n }\n }\n replace(from, to, text) {\n [from, to] = clip(this, from, to);\n if (text.lines < this.lines)\n for (let i = 0, pos = 0; i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n // Fast path: if the change only affects one child and the\n // child's size remains in the acceptable range, only update\n // that child\n if (from >= pos && to <= end) {\n let updated = child.replace(from - pos, to - pos, text);\n let totalLines = this.lines - child.lines + updated.lines;\n if (updated.lines < (totalLines >> (5 /* Tree.BranchShift */ - 1)) &&\n updated.lines > (totalLines >> (5 /* Tree.BranchShift */ + 1))) {\n let copy = this.children.slice();\n copy[i] = updated;\n return new TextNode(copy, this.length - (to - from) + text.length);\n }\n return super.replace(pos, end, updated);\n }\n pos = end + 1;\n }\n return super.replace(from, to, text);\n }\n sliceString(from, to = this.length, lineSep = \"\\n\") {\n [from, to] = clip(this, from, to);\n let result = \"\";\n for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) {\n let child = this.children[i], end = pos + child.length;\n if (pos > from && i)\n result += lineSep;\n if (from < end && to > pos)\n result += child.sliceString(from - pos, to - pos, lineSep);\n pos = end + 1;\n }\n return result;\n }\n flatten(target) {\n for (let child of this.children)\n child.flatten(target);\n }\n scanIdentical(other, dir) {\n if (!(other instanceof TextNode))\n return 0;\n let length = 0;\n let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length]\n : [this.children.length - 1, other.children.length - 1, -1, -1];\n for (;; iA += dir, iB += dir) {\n if (iA == eA || iB == eB)\n return length;\n let chA = this.children[iA], chB = other.children[iB];\n if (chA != chB)\n return length + chA.scanIdentical(chB, dir);\n length += chA.length + 1;\n }\n }\n static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) {\n let lines = 0;\n for (let ch of children)\n lines += ch.lines;\n if (lines < 32 /* Tree.Branch */) {\n let flat = [];\n for (let ch of children)\n ch.flatten(flat);\n return new TextLeaf(flat, length);\n }\n let chunk = Math.max(32 /* Tree.Branch */, lines >> 5 /* Tree.BranchShift */), maxChunk = chunk << 1, minChunk = chunk >> 1;\n let chunked = [], currentLines = 0, currentLen = -1, currentChunk = [];\n function add(child) {\n let last;\n if (child.lines > maxChunk && child instanceof TextNode) {\n for (let node of child.children)\n add(node);\n }\n else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) {\n flush();\n chunked.push(child);\n }\n else if (child instanceof TextLeaf && currentLines &&\n (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf &&\n child.lines + last.lines <= 32 /* Tree.Branch */) {\n currentLines += child.lines;\n currentLen += child.length + 1;\n currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length);\n }\n else {\n if (currentLines + child.lines > chunk)\n flush();\n currentLines += child.lines;\n currentLen += child.length + 1;\n currentChunk.push(child);\n }\n }\n function flush() {\n if (currentLines == 0)\n return;\n chunked.push(currentChunk.length == 1 ? currentChunk[0] : TextNode.from(currentChunk, currentLen));\n currentLen = -1;\n currentLines = currentChunk.length = 0;\n }\n for (let child of children)\n add(child);\n flush();\n return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length);\n }\n}\nText.empty = /*@__PURE__*/new TextLeaf([\"\"], 0);\nfunction textLength(text) {\n let length = -1;\n for (let line of text)\n length += line.length + 1;\n return length;\n}\nfunction appendText(text, target, from = 0, to = 1e9) {\n for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {\n let line = text[i], end = pos + line.length;\n if (end >= from) {\n if (end > to)\n line = line.slice(0, to - pos);\n if (pos < from)\n line = line.slice(from - pos);\n if (first) {\n target[target.length - 1] += line;\n first = false;\n }\n else\n target.push(line);\n }\n pos = end + 1;\n }\n return target;\n}\nfunction sliceText(text, from, to) {\n return appendText(text, [\"\"], from, to);\n}\nclass RawTextCursor {\n constructor(text, dir = 1) {\n this.dir = dir;\n this.done = false;\n this.lineBreak = false;\n this.value = \"\";\n this.nodes = [text];\n this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1];\n }\n nextInner(skip, dir) {\n this.done = this.lineBreak = false;\n for (;;) {\n let last = this.nodes.length - 1;\n let top = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1;\n let size = top instanceof TextLeaf ? top.text.length : top.children.length;\n if (offset == (dir > 0 ? size : 0)) {\n if (last == 0) {\n this.done = true;\n this.value = \"\";\n return this;\n }\n if (dir > 0)\n this.offsets[last - 1]++;\n this.nodes.pop();\n this.offsets.pop();\n }\n else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) {\n this.offsets[last] += dir;\n if (skip == 0) {\n this.lineBreak = true;\n this.value = \"\\n\";\n return this;\n }\n skip--;\n }\n else if (top instanceof TextLeaf) {\n // Move to the next string\n let next = top.text[offset + (dir < 0 ? -1 : 0)];\n this.offsets[last] += dir;\n if (next.length > Math.max(0, skip)) {\n this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip);\n return this;\n }\n skip -= next.length;\n }\n else {\n let next = top.children[offset + (dir < 0 ? -1 : 0)];\n if (skip > next.length) {\n skip -= next.length;\n this.offsets[last] += dir;\n }\n else {\n if (dir < 0)\n this.offsets[last]--;\n this.nodes.push(next);\n this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1);\n }\n }\n }\n }\n next(skip = 0) {\n if (skip < 0) {\n this.nextInner(-skip, (-this.dir));\n skip = this.value.length;\n }\n return this.nextInner(skip, this.dir);\n }\n}\nclass PartialTextCursor {\n constructor(text, start, end) {\n this.value = \"\";\n this.done = false;\n this.cursor = new RawTextCursor(text, start > end ? -1 : 1);\n this.pos = start > end ? text.length : 0;\n this.from = Math.min(start, end);\n this.to = Math.max(start, end);\n }\n nextInner(skip, dir) {\n if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) {\n this.value = \"\";\n this.done = true;\n return this;\n }\n skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos);\n let limit = dir < 0 ? this.pos - this.from : this.to - this.pos;\n if (skip > limit)\n skip = limit;\n limit -= skip;\n let { value } = this.cursor.next(skip);\n this.pos += (value.length + skip) * dir;\n this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit);\n this.done = !this.value;\n return this;\n }\n next(skip = 0) {\n if (skip < 0)\n skip = Math.max(skip, this.from - this.pos);\n else if (skip > 0)\n skip = Math.min(skip, this.to - this.pos);\n return this.nextInner(skip, this.cursor.dir);\n }\n get lineBreak() { return this.cursor.lineBreak && this.value != \"\"; }\n}\nclass LineCursor {\n constructor(inner) {\n this.inner = inner;\n this.afterBreak = true;\n this.value = \"\";\n this.done = false;\n }\n next(skip = 0) {\n let { done, lineBreak, value } = this.inner.next(skip);\n if (done && this.afterBreak) {\n this.value = \"\";\n this.afterBreak = false;\n }\n else if (done) {\n this.done = true;\n this.value = \"\";\n }\n else if (lineBreak) {\n if (this.afterBreak) {\n this.value = \"\";\n }\n else {\n this.afterBreak = true;\n this.next();\n }\n }\n else {\n this.value = value;\n this.afterBreak = false;\n }\n return this;\n }\n get lineBreak() { return false; }\n}\nif (typeof Symbol != \"undefined\") {\n Text.prototype[Symbol.iterator] = function () { return this.iter(); };\n RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] =\n LineCursor.prototype[Symbol.iterator] = function () { return this; };\n}\n/**\nThis type describes a line in the document. It is created\non-demand when lines are [queried](https://codemirror.net/6/docs/ref/#state.Text.lineAt).\n*/\nclass Line {\n /**\n @internal\n */\n constructor(\n /**\n The position of the start of the line.\n */\n from, \n /**\n The position at the end of the line (_before_ the line break,\n or at the end of document for the last line).\n */\n to, \n /**\n This line's line number (1-based).\n */\n number, \n /**\n The line's content.\n */\n text) {\n this.from = from;\n this.to = to;\n this.number = number;\n this.text = text;\n }\n /**\n The length of the line (not including any line break after it).\n */\n get length() { return this.to - this.from; }\n}\nfunction clip(text, from, to) {\n from = Math.max(0, Math.min(text.length, from));\n return [from, Math.max(from, Math.min(text.length, to))];\n}\n\n// Compressed representation of the Grapheme_Cluster_Break=Extend\n// information from\n// http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n// Each pair of elements represents a range, as an offet from the\n// previous range and a length. Numbers are in base-36, with the empty\n// string being a shorthand for 1.\nlet extend = /*@__PURE__*/\"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o\".split(\",\").map(s => s ? parseInt(s, 36) : 1);\n// Convert offsets into absolute values\nfor (let i = 1; i < extend.length; i++)\n extend[i] += extend[i - 1];\nfunction isExtendingChar(code) {\n for (let i = 1; i < extend.length; i += 2)\n if (extend[i] > code)\n return extend[i - 1] <= code;\n return false;\n}\nfunction isRegionalIndicator(code) {\n return code >= 0x1F1E6 && code <= 0x1F1FF;\n}\nconst ZWJ = 0x200d;\n/**\nReturns a next grapheme cluster break _after_ (not equal to)\n`pos`, if `forward` is true, or before otherwise. Returns `pos`\nitself if no further cluster break is available in the string.\nMoves across surrogate pairs, extending characters (when\n`includeExtending` is true), characters joined with zero-width\njoiners, and flag emoji.\n*/\nfunction findClusterBreak(str, pos, forward = true, includeExtending = true) {\n return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);\n}\nfunction nextClusterBreak(str, pos, includeExtending) {\n if (pos == str.length)\n return pos;\n // If pos is in the middle of a surrogate pair, move to its start\n if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1)))\n pos--;\n let prev = codePointAt(str, pos);\n pos += codePointSize(prev);\n while (pos < str.length) {\n let next = codePointAt(str, pos);\n if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n pos += codePointSize(next);\n prev = next;\n }\n else if (isRegionalIndicator(next)) {\n let countBefore = 0, i = pos - 2;\n while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) {\n countBefore++;\n i -= 2;\n }\n if (countBefore % 2 == 0)\n break;\n else\n pos += 2;\n }\n else {\n break;\n }\n }\n return pos;\n}\nfunction prevClusterBreak(str, pos, includeExtending) {\n while (pos > 0) {\n let found = nextClusterBreak(str, pos - 2, includeExtending);\n if (found < pos)\n return found;\n pos--;\n }\n return 0;\n}\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; }\n/**\nFind the code point at the given position in a string (like the\n[`codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt)\nstring method).\n*/\nfunction codePointAt(str, pos) {\n let code0 = str.charCodeAt(pos);\n if (!surrogateHigh(code0) || pos + 1 == str.length)\n return code0;\n let code1 = str.charCodeAt(pos + 1);\n if (!surrogateLow(code1))\n return code0;\n return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000;\n}\n/**\nGiven a Unicode codepoint, return the JavaScript string that\nrespresents it (like\n[`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint)).\n*/\nfunction fromCodePoint(code) {\n if (code <= 0xffff)\n return String.fromCharCode(code);\n code -= 0x10000;\n return String.fromCharCode((code >> 10) + 0xd800, (code & 1023) + 0xdc00);\n}\n/**\nThe amount of positions a character takes up a JavaScript string.\n*/\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2; }\n\nconst DefaultSplit = /\\r\\n?|\\n/;\n/**\nDistinguishes different ways in which positions can be mapped.\n*/\nvar MapMode = /*@__PURE__*/(function (MapMode) {\n /**\n Map a position to a valid new position, even when its context\n was deleted.\n */\n MapMode[MapMode[\"Simple\"] = 0] = \"Simple\";\n /**\n Return null if deletion happens across the position.\n */\n MapMode[MapMode[\"TrackDel\"] = 1] = \"TrackDel\";\n /**\n Return null if the character _before_ the position is deleted.\n */\n MapMode[MapMode[\"TrackBefore\"] = 2] = \"TrackBefore\";\n /**\n Return null if the character _after_ the position is deleted.\n */\n MapMode[MapMode[\"TrackAfter\"] = 3] = \"TrackAfter\";\nreturn MapMode})(MapMode || (MapMode = {}));\n/**\nA change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet)\nthat doesn't store the inserted text. As such, it can't be\napplied, but is cheaper to store and manipulate.\n*/\nclass ChangeDesc {\n // Sections are encoded as pairs of integers. The first is the\n // length in the current document, and the second is -1 for\n // unaffected sections, and the length of the replacement content\n // otherwise. So an insertion would be (0, n>0), a deletion (n>0,\n // 0), and a replacement two positive numbers.\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n sections) {\n this.sections = sections;\n }\n /**\n The length of the document before the change.\n */\n get length() {\n let result = 0;\n for (let i = 0; i < this.sections.length; i += 2)\n result += this.sections[i];\n return result;\n }\n /**\n The length of the document after the change.\n */\n get newLength() {\n let result = 0;\n for (let i = 0; i < this.sections.length; i += 2) {\n let ins = this.sections[i + 1];\n result += ins < 0 ? this.sections[i] : ins;\n }\n return result;\n }\n /**\n False when there are actual changes in this set.\n */\n get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; }\n /**\n Iterate over the unchanged parts left by these changes. `posA`\n provides the position of the range in the old document, `posB`\n the new position in the changed document.\n */\n iterGaps(f) {\n for (let i = 0, posA = 0, posB = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n if (ins < 0) {\n f(posA, posB, len);\n posB += len;\n }\n else {\n posB += ins;\n }\n posA += len;\n }\n }\n /**\n Iterate over the ranges changed by these changes. (See\n [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a\n variant that also provides you with the inserted text.)\n `fromA`/`toA` provides the extent of the change in the starting\n document, `fromB`/`toB` the extent of the replacement in the\n changed document.\n \n When `individual` is true, adjacent changes (which are kept\n separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are\n reported separately.\n */\n iterChangedRanges(f, individual = false) {\n iterChanges(this, f, individual);\n }\n /**\n Get a description of the inverted form of these changes.\n */\n get invertedDesc() {\n let sections = [];\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n if (ins < 0)\n sections.push(len, ins);\n else\n sections.push(ins, len);\n }\n return new ChangeDesc(sections);\n }\n /**\n Compute the combined effect of applying another set of changes\n after this one. The length of the document after this set should\n match the length before `other`.\n */\n composeDesc(other) { return this.empty ? other : other.empty ? this : composeSets(this, other); }\n /**\n Map this description, which should start with the same document\n as `other`, over another set of changes, so that it can be\n applied after it. When `before` is true, map as if the changes\n in `other` happened before the ones in `this`.\n */\n mapDesc(other, before = false) { return other.empty ? this : mapSet(this, other, before); }\n mapPos(pos, assoc = -1, mode = MapMode.Simple) {\n let posA = 0, posB = 0;\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++], endA = posA + len;\n if (ins < 0) {\n if (endA > pos)\n return posB + (pos - posA);\n posB += len;\n }\n else {\n if (mode != MapMode.Simple && endA >= pos &&\n (mode == MapMode.TrackDel && posA < pos && endA > pos ||\n mode == MapMode.TrackBefore && posA < pos ||\n mode == MapMode.TrackAfter && endA > pos))\n return null;\n if (endA > pos || endA == pos && assoc < 0 && !len)\n return pos == posA || assoc < 0 ? posB : posB + ins;\n posB += ins;\n }\n posA = endA;\n }\n if (pos > posA)\n throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`);\n return posB;\n }\n /**\n Check whether these changes touch a given range. When one of the\n changes entirely covers the range, the string `\"cover\"` is\n returned.\n */\n touchesRange(from, to = from) {\n for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) {\n let len = this.sections[i++], ins = this.sections[i++], end = pos + len;\n if (ins >= 0 && pos <= to && end >= from)\n return pos < from && end > to ? \"cover\" : true;\n pos = end;\n }\n return false;\n }\n /**\n @internal\n */\n toString() {\n let result = \"\";\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n result += (result ? \" \" : \"\") + len + (ins >= 0 ? \":\" + ins : \"\");\n }\n return result;\n }\n /**\n Serialize this change desc to a JSON-representable value.\n */\n toJSON() { return this.sections; }\n /**\n Create a change desc from its JSON representation (as produced\n by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON).\n */\n static fromJSON(json) {\n if (!Array.isArray(json) || json.length % 2 || json.some(a => typeof a != \"number\"))\n throw new RangeError(\"Invalid JSON representation of ChangeDesc\");\n return new ChangeDesc(json);\n }\n /**\n @internal\n */\n static create(sections) { return new ChangeDesc(sections); }\n}\n/**\nA change set represents a group of modifications to a document. It\nstores the document length, and can only be applied to documents\nwith exactly that length.\n*/\nclass ChangeSet extends ChangeDesc {\n constructor(sections, \n /**\n @internal\n */\n inserted) {\n super(sections);\n this.inserted = inserted;\n }\n /**\n Apply the changes to a document, returning the modified\n document.\n */\n apply(doc) {\n if (this.length != doc.length)\n throw new RangeError(\"Applying change set to a document with the wrong length\");\n iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n return doc;\n }\n mapDesc(other, before = false) { return mapSet(this, other, before, true); }\n /**\n Given the document as it existed _before_ the changes, return a\n change set that represents the inverse of this set, which could\n be used to go from the document created by the changes back to\n the document as it existed before the changes.\n */\n invert(doc) {\n let sections = this.sections.slice(), inserted = [];\n for (let i = 0, pos = 0; i < sections.length; i += 2) {\n let len = sections[i], ins = sections[i + 1];\n if (ins >= 0) {\n sections[i] = ins;\n sections[i + 1] = len;\n let index = i >> 1;\n while (inserted.length < index)\n inserted.push(Text.empty);\n inserted.push(len ? doc.slice(pos, pos + len) : Text.empty);\n }\n pos += len;\n }\n return new ChangeSet(sections, inserted);\n }\n /**\n Combine two subsequent change sets into a single set. `other`\n must start in the document produced by `this`. If `this` goes\n `docA` → `docB` and `other` represents `docB` → `docC`, the\n returned value will represent the change `docA` → `docC`.\n */\n compose(other) { return this.empty ? other : other.empty ? this : composeSets(this, other, true); }\n /**\n Given another change set starting in the same document, maps this\n change set over the other, producing a new change set that can be\n applied to the document produced by applying `other`. When\n `before` is `true`, order changes as if `this` comes before\n `other`, otherwise (the default) treat `other` as coming first.\n \n Given two changes `A` and `B`, `A.compose(B.map(A))` and\n `B.compose(A.map(B, true))` will produce the same document. This\n provides a basic form of [operational\n transformation](https://en.wikipedia.org/wiki/Operational_transformation),\n and can be used for collaborative editing.\n */\n map(other, before = false) { return other.empty ? this : mapSet(this, other, before, true); }\n /**\n Iterate over the changed ranges in the document, calling `f` for\n each, with the range in the original document (`fromA`-`toA`)\n and the range that replaces it in the new document\n (`fromB`-`toB`).\n \n When `individual` is true, adjacent changes are reported\n separately.\n */\n iterChanges(f, individual = false) {\n iterChanges(this, f, individual);\n }\n /**\n Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change\n set.\n */\n get desc() { return ChangeDesc.create(this.sections); }\n /**\n @internal\n */\n filter(ranges) {\n let resultSections = [], resultInserted = [], filteredSections = [];\n let iter = new SectionIter(this);\n done: for (let i = 0, pos = 0;;) {\n let next = i == ranges.length ? 1e9 : ranges[i++];\n while (pos < next || pos == next && iter.len == 0) {\n if (iter.done)\n break done;\n let len = Math.min(iter.len, next - pos);\n addSection(filteredSections, len, -1);\n let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0;\n addSection(resultSections, len, ins);\n if (ins > 0)\n addInsert(resultInserted, resultSections, iter.text);\n iter.forward(len);\n pos += len;\n }\n let end = ranges[i++];\n while (pos < end) {\n if (iter.done)\n break done;\n let len = Math.min(iter.len, end - pos);\n addSection(resultSections, len, -1);\n addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0);\n iter.forward(len);\n pos += len;\n }\n }\n return { changes: new ChangeSet(resultSections, resultInserted),\n filtered: ChangeDesc.create(filteredSections) };\n }\n /**\n Serialize this change set to a JSON-representable value.\n */\n toJSON() {\n let parts = [];\n for (let i = 0; i < this.sections.length; i += 2) {\n let len = this.sections[i], ins = this.sections[i + 1];\n if (ins < 0)\n parts.push(len);\n else if (ins == 0)\n parts.push([len]);\n else\n parts.push([len].concat(this.inserted[i >> 1].toJSON()));\n }\n return parts;\n }\n /**\n Create a change set for the given changes, for a document of the\n given length, using `lineSep` as line separator.\n */\n static of(changes, length, lineSep) {\n let sections = [], inserted = [], pos = 0;\n let total = null;\n function flush(force = false) {\n if (!force && !sections.length)\n return;\n if (pos < length)\n addSection(sections, length - pos, -1);\n let set = new ChangeSet(sections, inserted);\n total = total ? total.compose(set.map(total)) : set;\n sections = [];\n inserted = [];\n pos = 0;\n }\n function process(spec) {\n if (Array.isArray(spec)) {\n for (let sub of spec)\n process(sub);\n }\n else if (spec instanceof ChangeSet) {\n if (spec.length != length)\n throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`);\n flush();\n total = total ? total.compose(spec.map(total)) : spec;\n }\n else {\n let { from, to = from, insert } = spec;\n if (from > to || from < 0 || to > length)\n throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);\n let insText = !insert ? Text.empty : typeof insert == \"string\" ? Text.of(insert.split(lineSep || DefaultSplit)) : insert;\n let insLen = insText.length;\n if (from == to && insLen == 0)\n return;\n if (from < pos)\n flush();\n if (from > pos)\n addSection(sections, from - pos, -1);\n addSection(sections, to - from, insLen);\n addInsert(inserted, sections, insText);\n pos = to;\n }\n }\n process(changes);\n flush(!total);\n return total;\n }\n /**\n Create an empty changeset of the given length.\n */\n static empty(length) {\n return new ChangeSet(length ? [length, -1] : [], []);\n }\n /**\n Create a changeset from its JSON representation (as produced by\n [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON).\n */\n static fromJSON(json) {\n if (!Array.isArray(json))\n throw new RangeError(\"Invalid JSON representation of ChangeSet\");\n let sections = [], inserted = [];\n for (let i = 0; i < json.length; i++) {\n let part = json[i];\n if (typeof part == \"number\") {\n sections.push(part, -1);\n }\n else if (!Array.isArray(part) || typeof part[0] != \"number\" || part.some((e, i) => i && typeof e != \"string\")) {\n throw new RangeError(\"Invalid JSON representation of ChangeSet\");\n }\n else if (part.length == 1) {\n sections.push(part[0], 0);\n }\n else {\n while (inserted.length < i)\n inserted.push(Text.empty);\n inserted[i] = Text.of(part.slice(1));\n sections.push(part[0], inserted[i].length);\n }\n }\n return new ChangeSet(sections, inserted);\n }\n /**\n @internal\n */\n static createSet(sections, inserted) {\n return new ChangeSet(sections, inserted);\n }\n}\nfunction addSection(sections, len, ins, forceJoin = false) {\n if (len == 0 && ins <= 0)\n return;\n let last = sections.length - 2;\n if (last >= 0 && ins <= 0 && ins == sections[last + 1])\n sections[last] += len;\n else if (len == 0 && sections[last] == 0)\n sections[last + 1] += ins;\n else if (forceJoin) {\n sections[last] += len;\n sections[last + 1] += ins;\n }\n else\n sections.push(len, ins);\n}\nfunction addInsert(values, sections, value) {\n if (value.length == 0)\n return;\n let index = (sections.length - 2) >> 1;\n if (index < values.length) {\n values[values.length - 1] = values[values.length - 1].append(value);\n }\n else {\n while (values.length < index)\n values.push(Text.empty);\n values.push(value);\n }\n}\nfunction iterChanges(desc, f, individual) {\n let inserted = desc.inserted;\n for (let posA = 0, posB = 0, i = 0; i < desc.sections.length;) {\n let len = desc.sections[i++], ins = desc.sections[i++];\n if (ins < 0) {\n posA += len;\n posB += len;\n }\n else {\n let endA = posA, endB = posB, text = Text.empty;\n for (;;) {\n endA += len;\n endB += ins;\n if (ins && inserted)\n text = text.append(inserted[(i - 2) >> 1]);\n if (individual || i == desc.sections.length || desc.sections[i + 1] < 0)\n break;\n len = desc.sections[i++];\n ins = desc.sections[i++];\n }\n f(posA, endA, posB, endB, text);\n posA = endA;\n posB = endB;\n }\n }\n}\nfunction mapSet(setA, setB, before, mkSet = false) {\n // Produce a copy of setA that applies to the document after setB\n // has been applied (assuming both start at the same document).\n let sections = [], insert = mkSet ? [] : null;\n let a = new SectionIter(setA), b = new SectionIter(setB);\n // Iterate over both sets in parallel. inserted tracks, for changes\n // in A that have to be processed piece-by-piece, whether their\n // content has been inserted already, and refers to the section\n // index.\n for (let inserted = -1;;) {\n if (a.ins == -1 && b.ins == -1) {\n // Move across ranges skipped by both sets.\n let len = Math.min(a.len, b.len);\n addSection(sections, len, -1);\n a.forward(len);\n b.forward(len);\n }\n else if (b.ins >= 0 && (a.ins < 0 || inserted == a.i || a.off == 0 && (b.len < a.len || b.len == a.len && !before))) {\n // If there's a change in B that comes before the next change in\n // A (ordered by start pos, then len, then before flag), skip\n // that (and process any changes in A it covers).\n let len = b.len;\n addSection(sections, b.ins, -1);\n while (len) {\n let piece = Math.min(a.len, len);\n if (a.ins >= 0 && inserted < a.i && a.len <= piece) {\n addSection(sections, 0, a.ins);\n if (insert)\n addInsert(insert, sections, a.text);\n inserted = a.i;\n }\n a.forward(piece);\n len -= piece;\n }\n b.next();\n }\n else if (a.ins >= 0) {\n // Process the part of a change in A up to the start of the next\n // non-deletion change in B (if overlapping).\n let len = 0, left = a.len;\n while (left) {\n if (b.ins == -1) {\n let piece = Math.min(left, b.len);\n len += piece;\n left -= piece;\n b.forward(piece);\n }\n else if (b.ins == 0 && b.len < left) {\n left -= b.len;\n b.next();\n }\n else {\n break;\n }\n }\n addSection(sections, len, inserted < a.i ? a.ins : 0);\n if (insert && inserted < a.i)\n addInsert(insert, sections, a.text);\n inserted = a.i;\n a.forward(a.len - left);\n }\n else if (a.done && b.done) {\n return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n }\n else {\n throw new Error(\"Mismatched change set lengths\");\n }\n }\n}\nfunction composeSets(setA, setB, mkSet = false) {\n let sections = [];\n let insert = mkSet ? [] : null;\n let a = new SectionIter(setA), b = new SectionIter(setB);\n for (let open = false;;) {\n if (a.done && b.done) {\n return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n }\n else if (a.ins == 0) { // Deletion in A\n addSection(sections, a.len, 0, open);\n a.next();\n }\n else if (b.len == 0 && !b.done) { // Insertion in B\n addSection(sections, 0, b.ins, open);\n if (insert)\n addInsert(insert, sections, b.text);\n b.next();\n }\n else if (a.done || b.done) {\n throw new Error(\"Mismatched change set lengths\");\n }\n else {\n let len = Math.min(a.len2, b.len), sectionLen = sections.length;\n if (a.ins == -1) {\n let insB = b.ins == -1 ? -1 : b.off ? 0 : b.ins;\n addSection(sections, len, insB, open);\n if (insert && insB)\n addInsert(insert, sections, b.text);\n }\n else if (b.ins == -1) {\n addSection(sections, a.off ? 0 : a.len, len, open);\n if (insert)\n addInsert(insert, sections, a.textBit(len));\n }\n else {\n addSection(sections, a.off ? 0 : a.len, b.off ? 0 : b.ins, open);\n if (insert && !b.off)\n addInsert(insert, sections, b.text);\n }\n open = (a.ins > len || b.ins >= 0 && b.len > len) && (open || sections.length > sectionLen);\n a.forward2(len);\n b.forward(len);\n }\n }\n}\nclass SectionIter {\n constructor(set) {\n this.set = set;\n this.i = 0;\n this.next();\n }\n next() {\n let { sections } = this.set;\n if (this.i < sections.length) {\n this.len = sections[this.i++];\n this.ins = sections[this.i++];\n }\n else {\n this.len = 0;\n this.ins = -2;\n }\n this.off = 0;\n }\n get done() { return this.ins == -2; }\n get len2() { return this.ins < 0 ? this.len : this.ins; }\n get text() {\n let { inserted } = this.set, index = (this.i - 2) >> 1;\n return index >= inserted.length ? Text.empty : inserted[index];\n }\n textBit(len) {\n let { inserted } = this.set, index = (this.i - 2) >> 1;\n return index >= inserted.length && !len ? Text.empty\n : inserted[index].slice(this.off, len == null ? undefined : this.off + len);\n }\n forward(len) {\n if (len == this.len)\n this.next();\n else {\n this.len -= len;\n this.off += len;\n }\n }\n forward2(len) {\n if (this.ins == -1)\n this.forward(len);\n else if (len == this.ins)\n this.next();\n else {\n this.ins -= len;\n this.off += len;\n }\n }\n}\n\n/**\nA single selection range. When\n[`allowMultipleSelections`](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)\nis enabled, a [selection](https://codemirror.net/6/docs/ref/#state.EditorSelection) may hold\nmultiple ranges. By default, selections hold exactly one range.\n*/\nclass SelectionRange {\n constructor(\n /**\n The lower boundary of the range.\n */\n from, \n /**\n The upper boundary of the range.\n */\n to, flags) {\n this.from = from;\n this.to = to;\n this.flags = flags;\n }\n /**\n The anchor of the range—the side that doesn't move when you\n extend it.\n */\n get anchor() { return this.flags & 32 /* RangeFlag.Inverted */ ? this.to : this.from; }\n /**\n The head of the range, which is moved when the range is\n [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend).\n */\n get head() { return this.flags & 32 /* RangeFlag.Inverted */ ? this.from : this.to; }\n /**\n True when `anchor` and `head` are at the same position.\n */\n get empty() { return this.from == this.to; }\n /**\n If this is a cursor that is explicitly associated with the\n character on one of its sides, this returns the side. -1 means\n the character before its position, 1 the character after, and 0\n means no association.\n */\n get assoc() { return this.flags & 8 /* RangeFlag.AssocBefore */ ? -1 : this.flags & 16 /* RangeFlag.AssocAfter */ ? 1 : 0; }\n /**\n The bidirectional text level associated with this cursor, if\n any.\n */\n get bidiLevel() {\n let level = this.flags & 7 /* RangeFlag.BidiLevelMask */;\n return level == 7 ? null : level;\n }\n /**\n The goal column (stored vertical offset) associated with a\n cursor. This is used to preserve the vertical position when\n [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across\n lines of different length.\n */\n get goalColumn() {\n let value = this.flags >> 6 /* RangeFlag.GoalColumnOffset */;\n return value == 16777215 /* RangeFlag.NoGoalColumn */ ? undefined : value;\n }\n /**\n Map this range through a change, producing a valid range in the\n updated document.\n */\n map(change, assoc = -1) {\n let from, to;\n if (this.empty) {\n from = to = change.mapPos(this.from, assoc);\n }\n else {\n from = change.mapPos(this.from, 1);\n to = change.mapPos(this.to, -1);\n }\n return from == this.from && to == this.to ? this : new SelectionRange(from, to, this.flags);\n }\n /**\n Extend this range to cover at least `from` to `to`.\n */\n extend(from, to = from) {\n if (from <= this.anchor && to >= this.anchor)\n return EditorSelection.range(from, to);\n let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;\n return EditorSelection.range(this.anchor, head);\n }\n /**\n Compare this range to another range.\n */\n eq(other, includeAssoc = false) {\n return this.anchor == other.anchor && this.head == other.head &&\n (!includeAssoc || !this.empty || this.assoc == other.assoc);\n }\n /**\n Return a JSON-serializable object representing the range.\n */\n toJSON() { return { anchor: this.anchor, head: this.head }; }\n /**\n Convert a JSON representation of a range to a `SelectionRange`\n instance.\n */\n static fromJSON(json) {\n if (!json || typeof json.anchor != \"number\" || typeof json.head != \"number\")\n throw new RangeError(\"Invalid JSON representation for SelectionRange\");\n return EditorSelection.range(json.anchor, json.head);\n }\n /**\n @internal\n */\n static create(from, to, flags) {\n return new SelectionRange(from, to, flags);\n }\n}\n/**\nAn editor selection holds one or more selection ranges.\n*/\nclass EditorSelection {\n constructor(\n /**\n The ranges in the selection, sorted by position. Ranges cannot\n overlap (but they may touch, if they aren't empty).\n */\n ranges, \n /**\n The index of the _main_ range in the selection (which is\n usually the range that was added last).\n */\n mainIndex) {\n this.ranges = ranges;\n this.mainIndex = mainIndex;\n }\n /**\n Map a selection through a change. Used to adjust the selection\n position for changes.\n */\n map(change, assoc = -1) {\n if (change.empty)\n return this;\n return EditorSelection.create(this.ranges.map(r => r.map(change, assoc)), this.mainIndex);\n }\n /**\n Compare this selection to another selection. By default, ranges\n are compared only by position. When `includeAssoc` is true,\n cursor ranges must also have the same\n [`assoc`](https://codemirror.net/6/docs/ref/#state.SelectionRange.assoc) value.\n */\n eq(other, includeAssoc = false) {\n if (this.ranges.length != other.ranges.length ||\n this.mainIndex != other.mainIndex)\n return false;\n for (let i = 0; i < this.ranges.length; i++)\n if (!this.ranges[i].eq(other.ranges[i], includeAssoc))\n return false;\n return true;\n }\n /**\n Get the primary selection range. Usually, you should make sure\n your code applies to _all_ ranges, by using methods like\n [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange).\n */\n get main() { return this.ranges[this.mainIndex]; }\n /**\n Make sure the selection only has one range. Returns a selection\n holding only the main range from this selection.\n */\n asSingle() {\n return this.ranges.length == 1 ? this : new EditorSelection([this.main], 0);\n }\n /**\n Extend this selection with an extra range.\n */\n addRange(range, main = true) {\n return EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1);\n }\n /**\n Replace a given range with another range, and then normalize the\n selection to merge and sort ranges if necessary.\n */\n replaceRange(range, which = this.mainIndex) {\n let ranges = this.ranges.slice();\n ranges[which] = range;\n return EditorSelection.create(ranges, this.mainIndex);\n }\n /**\n Convert this selection to an object that can be serialized to\n JSON.\n */\n toJSON() {\n return { ranges: this.ranges.map(r => r.toJSON()), main: this.mainIndex };\n }\n /**\n Create a selection from a JSON representation.\n */\n static fromJSON(json) {\n if (!json || !Array.isArray(json.ranges) || typeof json.main != \"number\" || json.main >= json.ranges.length)\n throw new RangeError(\"Invalid JSON representation for EditorSelection\");\n return new EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main);\n }\n /**\n Create a selection holding a single range.\n */\n static single(anchor, head = anchor) {\n return new EditorSelection([EditorSelection.range(anchor, head)], 0);\n }\n /**\n Sort and merge the given set of ranges, creating a valid\n selection.\n */\n static create(ranges, mainIndex = 0) {\n if (ranges.length == 0)\n throw new RangeError(\"A selection needs at least one range\");\n for (let pos = 0, i = 0; i < ranges.length; i++) {\n let range = ranges[i];\n if (range.empty ? range.from <= pos : range.from < pos)\n return EditorSelection.normalized(ranges.slice(), mainIndex);\n pos = range.to;\n }\n return new EditorSelection(ranges, mainIndex);\n }\n /**\n Create a cursor selection range at the given position. You can\n safely ignore the optional arguments in most situations.\n */\n static cursor(pos, assoc = 0, bidiLevel, goalColumn) {\n return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 8 /* RangeFlag.AssocBefore */ : 16 /* RangeFlag.AssocAfter */) |\n (bidiLevel == null ? 7 : Math.min(6, bidiLevel)) |\n ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215 /* RangeFlag.NoGoalColumn */) << 6 /* RangeFlag.GoalColumnOffset */));\n }\n /**\n Create a selection range.\n */\n static range(anchor, head, goalColumn, bidiLevel) {\n let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215 /* RangeFlag.NoGoalColumn */) << 6 /* RangeFlag.GoalColumnOffset */) |\n (bidiLevel == null ? 7 : Math.min(6, bidiLevel));\n return head < anchor ? SelectionRange.create(head, anchor, 32 /* RangeFlag.Inverted */ | 16 /* RangeFlag.AssocAfter */ | flags)\n : SelectionRange.create(anchor, head, (head > anchor ? 8 /* RangeFlag.AssocBefore */ : 0) | flags);\n }\n /**\n @internal\n */\n static normalized(ranges, mainIndex = 0) {\n let main = ranges[mainIndex];\n ranges.sort((a, b) => a.from - b.from);\n mainIndex = ranges.indexOf(main);\n for (let i = 1; i < ranges.length; i++) {\n let range = ranges[i], prev = ranges[i - 1];\n if (range.empty ? range.from <= prev.to : range.from < prev.to) {\n let from = prev.from, to = Math.max(range.to, prev.to);\n if (i <= mainIndex)\n mainIndex--;\n ranges.splice(--i, 2, range.anchor > range.head ? EditorSelection.range(to, from) : EditorSelection.range(from, to));\n }\n }\n return new EditorSelection(ranges, mainIndex);\n }\n}\nfunction checkSelection(selection, docLength) {\n for (let range of selection.ranges)\n if (range.to > docLength)\n throw new RangeError(\"Selection points outside of document\");\n}\n\nlet nextID = 0;\n/**\nA facet is a labeled value that is associated with an editor\nstate. It takes inputs from any number of extensions, and combines\nthose into a single output value.\n\nExamples of uses of facets are the [tab\nsize](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize), [editor\nattributes](https://codemirror.net/6/docs/ref/#view.EditorView^editorAttributes), and [update\nlisteners](https://codemirror.net/6/docs/ref/#view.EditorView^updateListener).\n\nNote that `Facet` instances can be used anywhere where\n[`FacetReader`](https://codemirror.net/6/docs/ref/#state.FacetReader) is expected.\n*/\nclass Facet {\n constructor(\n /**\n @internal\n */\n combine, \n /**\n @internal\n */\n compareInput, \n /**\n @internal\n */\n compare, isStatic, enables) {\n this.combine = combine;\n this.compareInput = compareInput;\n this.compare = compare;\n this.isStatic = isStatic;\n /**\n @internal\n */\n this.id = nextID++;\n this.default = combine([]);\n this.extensions = typeof enables == \"function\" ? enables(this) : enables;\n }\n /**\n Returns a facet reader for this facet, which can be used to\n [read](https://codemirror.net/6/docs/ref/#state.EditorState.facet) it but not to define values for it.\n */\n get reader() { return this; }\n /**\n Define a new facet.\n */\n static define(config = {}) {\n return new Facet(config.combine || ((a) => a), config.compareInput || ((a, b) => a === b), config.compare || (!config.combine ? sameArray : (a, b) => a === b), !!config.static, config.enables);\n }\n /**\n Returns an extension that adds the given value to this facet.\n */\n of(value) {\n return new FacetProvider([], this, 0 /* Provider.Static */, value);\n }\n /**\n Create an extension that computes a value for the facet from a\n state. You must take care to declare the parts of the state that\n this value depends on, since your function is only called again\n for a new state when one of those parts changed.\n \n In cases where your value depends only on a single field, you'll\n want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead.\n */\n compute(deps, get) {\n if (this.isStatic)\n throw new Error(\"Can't compute a static facet\");\n return new FacetProvider(deps, this, 1 /* Provider.Single */, get);\n }\n /**\n Create an extension that computes zero or more values for this\n facet from a state.\n */\n computeN(deps, get) {\n if (this.isStatic)\n throw new Error(\"Can't compute a static facet\");\n return new FacetProvider(deps, this, 2 /* Provider.Multi */, get);\n }\n from(field, get) {\n if (!get)\n get = x => x;\n return this.compute([field], state => get(state.field(field)));\n }\n}\nfunction sameArray(a, b) {\n return a == b || a.length == b.length && a.every((e, i) => e === b[i]);\n}\nclass FacetProvider {\n constructor(dependencies, facet, type, value) {\n this.dependencies = dependencies;\n this.facet = facet;\n this.type = type;\n this.value = value;\n this.id = nextID++;\n }\n dynamicSlot(addresses) {\n var _a;\n let getter = this.value;\n let compare = this.facet.compareInput;\n let id = this.id, idx = addresses[id] >> 1, multi = this.type == 2 /* Provider.Multi */;\n let depDoc = false, depSel = false, depAddrs = [];\n for (let dep of this.dependencies) {\n if (dep == \"doc\")\n depDoc = true;\n else if (dep == \"selection\")\n depSel = true;\n else if ((((_a = addresses[dep.id]) !== null && _a !== void 0 ? _a : 1) & 1) == 0)\n depAddrs.push(addresses[dep.id]);\n }\n return {\n create(state) {\n state.values[idx] = getter(state);\n return 1 /* SlotStatus.Changed */;\n },\n update(state, tr) {\n if ((depDoc && tr.docChanged) || (depSel && (tr.docChanged || tr.selection)) || ensureAll(state, depAddrs)) {\n let newVal = getter(state);\n if (multi ? !compareArray(newVal, state.values[idx], compare) : !compare(newVal, state.values[idx])) {\n state.values[idx] = newVal;\n return 1 /* SlotStatus.Changed */;\n }\n }\n return 0;\n },\n reconfigure: (state, oldState) => {\n let newVal, oldAddr = oldState.config.address[id];\n if (oldAddr != null) {\n let oldVal = getAddr(oldState, oldAddr);\n if (this.dependencies.every(dep => {\n return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) :\n dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true;\n }) || (multi ? compareArray(newVal = getter(state), oldVal, compare) : compare(newVal = getter(state), oldVal))) {\n state.values[idx] = oldVal;\n return 0;\n }\n }\n else {\n newVal = getter(state);\n }\n state.values[idx] = newVal;\n return 1 /* SlotStatus.Changed */;\n }\n };\n }\n}\nfunction compareArray(a, b, compare) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!compare(a[i], b[i]))\n return false;\n return true;\n}\nfunction ensureAll(state, addrs) {\n let changed = false;\n for (let addr of addrs)\n if (ensureAddr(state, addr) & 1 /* SlotStatus.Changed */)\n changed = true;\n return changed;\n}\nfunction dynamicFacetSlot(addresses, facet, providers) {\n let providerAddrs = providers.map(p => addresses[p.id]);\n let providerTypes = providers.map(p => p.type);\n let dynamic = providerAddrs.filter(p => !(p & 1));\n let idx = addresses[facet.id] >> 1;\n function get(state) {\n let values = [];\n for (let i = 0; i < providerAddrs.length; i++) {\n let value = getAddr(state, providerAddrs[i]);\n if (providerTypes[i] == 2 /* Provider.Multi */)\n for (let val of value)\n values.push(val);\n else\n values.push(value);\n }\n return facet.combine(values);\n }\n return {\n create(state) {\n for (let addr of providerAddrs)\n ensureAddr(state, addr);\n state.values[idx] = get(state);\n return 1 /* SlotStatus.Changed */;\n },\n update(state, tr) {\n if (!ensureAll(state, dynamic))\n return 0;\n let value = get(state);\n if (facet.compare(value, state.values[idx]))\n return 0;\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n },\n reconfigure(state, oldState) {\n let depChanged = ensureAll(state, providerAddrs);\n let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet);\n if (oldProviders && !depChanged && sameArray(providers, oldProviders)) {\n state.values[idx] = oldValue;\n return 0;\n }\n let value = get(state);\n if (facet.compare(value, oldValue)) {\n state.values[idx] = oldValue;\n return 0;\n }\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n }\n };\n}\nconst initField = /*@__PURE__*/Facet.define({ static: true });\n/**\nFields can store additional information in an editor state, and\nkeep it in sync with the rest of the state.\n*/\nclass StateField {\n constructor(\n /**\n @internal\n */\n id, createF, updateF, compareF, \n /**\n @internal\n */\n spec) {\n this.id = id;\n this.createF = createF;\n this.updateF = updateF;\n this.compareF = compareF;\n this.spec = spec;\n /**\n @internal\n */\n this.provides = undefined;\n }\n /**\n Define a state field.\n */\n static define(config) {\n let field = new StateField(nextID++, config.create, config.update, config.compare || ((a, b) => a === b), config);\n if (config.provide)\n field.provides = config.provide(field);\n return field;\n }\n create(state) {\n let init = state.facet(initField).find(i => i.field == this);\n return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state);\n }\n /**\n @internal\n */\n slot(addresses) {\n let idx = addresses[this.id] >> 1;\n return {\n create: (state) => {\n state.values[idx] = this.create(state);\n return 1 /* SlotStatus.Changed */;\n },\n update: (state, tr) => {\n let oldVal = state.values[idx];\n let value = this.updateF(oldVal, tr);\n if (this.compareF(oldVal, value))\n return 0;\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n },\n reconfigure: (state, oldState) => {\n if (oldState.config.address[this.id] != null) {\n state.values[idx] = oldState.field(this);\n return 0;\n }\n state.values[idx] = this.create(state);\n return 1 /* SlotStatus.Changed */;\n }\n };\n }\n /**\n Returns an extension that enables this field and overrides the\n way it is initialized. Can be useful when you need to provide a\n non-default starting value for the field.\n */\n init(create) {\n return [this, initField.of({ field: this, create })];\n }\n /**\n State field instances can be used as\n [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a\n given state.\n */\n get extension() { return this; }\n}\nconst Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 };\nfunction prec(value) {\n return (ext) => new PrecExtension(ext, value);\n}\n/**\nBy default extensions are registered in the order they are found\nin the flattened form of nested array that was provided.\nIndividual extension values can be assigned a precedence to\noverride this. Extensions that do not have a precedence set get\nthe precedence of the nearest parent with a precedence, or\n[`default`](https://codemirror.net/6/docs/ref/#state.Prec.default) if there is no such parent. The\nfinal ordering of extensions is determined by first sorting by\nprecedence and then by order within each precedence.\n*/\nconst Prec = {\n /**\n The highest precedence level, for extensions that should end up\n near the start of the precedence ordering.\n */\n highest: /*@__PURE__*/prec(Prec_.highest),\n /**\n A higher-than-default precedence, for extensions that should\n come before those with default precedence.\n */\n high: /*@__PURE__*/prec(Prec_.high),\n /**\n The default precedence, which is also used for extensions\n without an explicit precedence.\n */\n default: /*@__PURE__*/prec(Prec_.default),\n /**\n A lower-than-default precedence.\n */\n low: /*@__PURE__*/prec(Prec_.low),\n /**\n The lowest precedence level. Meant for things that should end up\n near the end of the extension order.\n */\n lowest: /*@__PURE__*/prec(Prec_.lowest)\n};\nclass PrecExtension {\n constructor(inner, prec) {\n this.inner = inner;\n this.prec = prec;\n }\n}\n/**\nExtension compartments can be used to make a configuration\ndynamic. By [wrapping](https://codemirror.net/6/docs/ref/#state.Compartment.of) part of your\nconfiguration in a compartment, you can later\n[replace](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) that part through a\ntransaction.\n*/\nclass Compartment {\n /**\n Create an instance of this compartment to add to your [state\n configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions).\n */\n of(ext) { return new CompartmentInstance(this, ext); }\n /**\n Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that\n reconfigures this compartment.\n */\n reconfigure(content) {\n return Compartment.reconfigure.of({ compartment: this, extension: content });\n }\n /**\n Get the current content of the compartment in the state, or\n `undefined` if it isn't present.\n */\n get(state) {\n return state.config.compartments.get(this);\n }\n}\nclass CompartmentInstance {\n constructor(compartment, inner) {\n this.compartment = compartment;\n this.inner = inner;\n }\n}\nclass Configuration {\n constructor(base, compartments, dynamicSlots, address, staticValues, facets) {\n this.base = base;\n this.compartments = compartments;\n this.dynamicSlots = dynamicSlots;\n this.address = address;\n this.staticValues = staticValues;\n this.facets = facets;\n this.statusTemplate = [];\n while (this.statusTemplate.length < dynamicSlots.length)\n this.statusTemplate.push(0 /* SlotStatus.Unresolved */);\n }\n staticFacet(facet) {\n let addr = this.address[facet.id];\n return addr == null ? facet.default : this.staticValues[addr >> 1];\n }\n static resolve(base, compartments, oldState) {\n let fields = [];\n let facets = Object.create(null);\n let newCompartments = new Map();\n for (let ext of flatten(base, compartments, newCompartments)) {\n if (ext instanceof StateField)\n fields.push(ext);\n else\n (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext);\n }\n let address = Object.create(null);\n let staticValues = [];\n let dynamicSlots = [];\n for (let field of fields) {\n address[field.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => field.slot(a));\n }\n let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets;\n for (let id in facets) {\n let providers = facets[id], facet = providers[0].facet;\n let oldProviders = oldFacets && oldFacets[id] || [];\n if (providers.every(p => p.type == 0 /* Provider.Static */)) {\n address[facet.id] = (staticValues.length << 1) | 1;\n if (sameArray(oldProviders, providers)) {\n staticValues.push(oldState.facet(facet));\n }\n else {\n let value = facet.combine(providers.map(p => p.value));\n staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value);\n }\n }\n else {\n for (let p of providers) {\n if (p.type == 0 /* Provider.Static */) {\n address[p.id] = (staticValues.length << 1) | 1;\n staticValues.push(p.value);\n }\n else {\n address[p.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => p.dynamicSlot(a));\n }\n }\n address[facet.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => dynamicFacetSlot(a, facet, providers));\n }\n }\n let dynamic = dynamicSlots.map(f => f(address));\n return new Configuration(base, newCompartments, dynamic, address, staticValues, facets);\n }\n}\nfunction flatten(extension, compartments, newCompartments) {\n let result = [[], [], [], [], []];\n let seen = new Map();\n function inner(ext, prec) {\n let known = seen.get(ext);\n if (known != null) {\n if (known <= prec)\n return;\n let found = result[known].indexOf(ext);\n if (found > -1)\n result[known].splice(found, 1);\n if (ext instanceof CompartmentInstance)\n newCompartments.delete(ext.compartment);\n }\n seen.set(ext, prec);\n if (Array.isArray(ext)) {\n for (let e of ext)\n inner(e, prec);\n }\n else if (ext instanceof CompartmentInstance) {\n if (newCompartments.has(ext.compartment))\n throw new RangeError(`Duplicate use of compartment in extensions`);\n let content = compartments.get(ext.compartment) || ext.inner;\n newCompartments.set(ext.compartment, content);\n inner(content, prec);\n }\n else if (ext instanceof PrecExtension) {\n inner(ext.inner, ext.prec);\n }\n else if (ext instanceof StateField) {\n result[prec].push(ext);\n if (ext.provides)\n inner(ext.provides, prec);\n }\n else if (ext instanceof FacetProvider) {\n result[prec].push(ext);\n if (ext.facet.extensions)\n inner(ext.facet.extensions, Prec_.default);\n }\n else {\n let content = ext.extension;\n if (!content)\n throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);\n inner(content, prec);\n }\n }\n inner(extension, Prec_.default);\n return result.reduce((a, b) => a.concat(b));\n}\nfunction ensureAddr(state, addr) {\n if (addr & 1)\n return 2 /* SlotStatus.Computed */;\n let idx = addr >> 1;\n let status = state.status[idx];\n if (status == 4 /* SlotStatus.Computing */)\n throw new Error(\"Cyclic dependency between fields and/or facets\");\n if (status & 2 /* SlotStatus.Computed */)\n return status;\n state.status[idx] = 4 /* SlotStatus.Computing */;\n let changed = state.computeSlot(state, state.config.dynamicSlots[idx]);\n return state.status[idx] = 2 /* SlotStatus.Computed */ | changed;\n}\nfunction getAddr(state, addr) {\n return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1];\n}\n\nconst languageData = /*@__PURE__*/Facet.define();\nconst allowMultipleSelections = /*@__PURE__*/Facet.define({\n combine: values => values.some(v => v),\n static: true\n});\nconst lineSeparator = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : undefined,\n static: true\n});\nconst changeFilter = /*@__PURE__*/Facet.define();\nconst transactionFilter = /*@__PURE__*/Facet.define();\nconst transactionExtender = /*@__PURE__*/Facet.define();\nconst readOnly = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : false\n});\n\n/**\nAnnotations are tagged values that are used to add metadata to\ntransactions in an extensible way. They should be used to model\nthings that effect the entire transaction (such as its [time\nstamp](https://codemirror.net/6/docs/ref/#state.Transaction^time) or information about its\n[origin](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent)). For effects that happen\n_alongside_ the other changes made by the transaction, [state\neffects](https://codemirror.net/6/docs/ref/#state.StateEffect) are more appropriate.\n*/\nclass Annotation {\n /**\n @internal\n */\n constructor(\n /**\n The annotation type.\n */\n type, \n /**\n The value of this annotation.\n */\n value) {\n this.type = type;\n this.value = value;\n }\n /**\n Define a new type of annotation.\n */\n static define() { return new AnnotationType(); }\n}\n/**\nMarker that identifies a type of [annotation](https://codemirror.net/6/docs/ref/#state.Annotation).\n*/\nclass AnnotationType {\n /**\n Create an instance of this annotation.\n */\n of(value) { return new Annotation(this, value); }\n}\n/**\nRepresentation of a type of state effect. Defined with\n[`StateEffect.define`](https://codemirror.net/6/docs/ref/#state.StateEffect^define).\n*/\nclass StateEffectType {\n /**\n @internal\n */\n constructor(\n // The `any` types in these function types are there to work\n // around TypeScript issue #37631, where the type guard on\n // `StateEffect.is` mysteriously stops working when these properly\n // have type `Value`.\n /**\n @internal\n */\n map) {\n this.map = map;\n }\n /**\n Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this\n type.\n */\n of(value) { return new StateEffect(this, value); }\n}\n/**\nState effects can be used to represent additional effects\nassociated with a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction.effects). They\nare often useful to model changes to custom [state\nfields](https://codemirror.net/6/docs/ref/#state.StateField), when those changes aren't implicit in\ndocument or selection changes.\n*/\nclass StateEffect {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n type, \n /**\n The value of this effect.\n */\n value) {\n this.type = type;\n this.value = value;\n }\n /**\n Map this effect through a position mapping. Will return\n `undefined` when that ends up deleting the effect.\n */\n map(mapping) {\n let mapped = this.type.map(this.value, mapping);\n return mapped === undefined ? undefined : mapped == this.value ? this : new StateEffect(this.type, mapped);\n }\n /**\n Tells you whether this effect object is of a given\n [type](https://codemirror.net/6/docs/ref/#state.StateEffectType).\n */\n is(type) { return this.type == type; }\n /**\n Define a new effect type. The type parameter indicates the type\n of values that his effect holds. It should be a type that\n doesn't include `undefined`, since that is used in\n [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is\n removed.\n */\n static define(spec = {}) {\n return new StateEffectType(spec.map || (v => v));\n }\n /**\n Map an array of effects through a change set.\n */\n static mapEffects(effects, mapping) {\n if (!effects.length)\n return effects;\n let result = [];\n for (let effect of effects) {\n let mapped = effect.map(mapping);\n if (mapped)\n result.push(mapped);\n }\n return result;\n }\n}\n/**\nThis effect can be used to reconfigure the root extensions of\nthe editor. Doing this will discard any extensions\n[appended](https://codemirror.net/6/docs/ref/#state.StateEffect^appendConfig), but does not reset\nthe content of [reconfigured](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure)\ncompartments.\n*/\nStateEffect.reconfigure = /*@__PURE__*/StateEffect.define();\n/**\nAppend extensions to the top-level configuration of the editor.\n*/\nStateEffect.appendConfig = /*@__PURE__*/StateEffect.define();\n/**\nChanges to the editor state are grouped into transactions.\nTypically, a user action creates a single transaction, which may\ncontain any number of document changes, may change the selection,\nor have other effects. Create a transaction by calling\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update), or immediately\ndispatch one by calling\n[`EditorView.dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch).\n*/\nclass Transaction {\n constructor(\n /**\n The state from which the transaction starts.\n */\n startState, \n /**\n The document changes made by this transaction.\n */\n changes, \n /**\n The selection set by this transaction, or undefined if it\n doesn't explicitly set a selection.\n */\n selection, \n /**\n The effects added to the transaction.\n */\n effects, \n /**\n @internal\n */\n annotations, \n /**\n Whether the selection should be scrolled into view after this\n transaction is dispatched.\n */\n scrollIntoView) {\n this.startState = startState;\n this.changes = changes;\n this.selection = selection;\n this.effects = effects;\n this.annotations = annotations;\n this.scrollIntoView = scrollIntoView;\n /**\n @internal\n */\n this._doc = null;\n /**\n @internal\n */\n this._state = null;\n if (selection)\n checkSelection(selection, changes.newLength);\n if (!annotations.some((a) => a.type == Transaction.time))\n this.annotations = annotations.concat(Transaction.time.of(Date.now()));\n }\n /**\n @internal\n */\n static create(startState, changes, selection, effects, annotations, scrollIntoView) {\n return new Transaction(startState, changes, selection, effects, annotations, scrollIntoView);\n }\n /**\n The new document produced by the transaction. Contrary to\n [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't\n force the entire new state to be computed right away, so it is\n recommended that [transaction\n filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter\n when they need to look at the new document.\n */\n get newDoc() {\n return this._doc || (this._doc = this.changes.apply(this.startState.doc));\n }\n /**\n The new selection produced by the transaction. If\n [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined,\n this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's\n current selection through the changes made by the transaction.\n */\n get newSelection() {\n return this.selection || this.startState.selection.map(this.changes);\n }\n /**\n The new state created by the transaction. Computed on demand\n (but retained for subsequent access), so it is recommended not to\n access it in [transaction\n filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible.\n */\n get state() {\n if (!this._state)\n this.startState.applyTransaction(this);\n return this._state;\n }\n /**\n Get the value of the given annotation type, if any.\n */\n annotation(type) {\n for (let ann of this.annotations)\n if (ann.type == type)\n return ann.value;\n return undefined;\n }\n /**\n Indicates whether the transaction changed the document.\n */\n get docChanged() { return !this.changes.empty; }\n /**\n Indicates whether this transaction reconfigures the state\n (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or\n with a top-level configuration\n [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure).\n */\n get reconfigured() { return this.startState.config != this.state.config; }\n /**\n Returns true if the transaction has a [user\n event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to\n or more specific than `event`. For example, if the transaction\n has `\"select.pointer\"` as user event, `\"select\"` and\n `\"select.pointer\"` will match it.\n */\n isUserEvent(event) {\n let e = this.annotation(Transaction.userEvent);\n return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == \".\"));\n }\n}\n/**\nAnnotation used to store transaction timestamps. Automatically\nadded to every transaction, holding `Date.now()`.\n*/\nTransaction.time = /*@__PURE__*/Annotation.define();\n/**\nAnnotation used to associate a transaction with a user interface\nevent. Holds a string identifying the event, using a\ndot-separated format to support attaching more specific\ninformation. The events used by the core libraries are:\n\n - `\"input\"` when content is entered\n - `\"input.type\"` for typed input\n - `\"input.type.compose\"` for composition\n - `\"input.paste\"` for pasted input\n - `\"input.drop\"` when adding content with drag-and-drop\n - `\"input.complete\"` when autocompleting\n - `\"delete\"` when the user deletes content\n - `\"delete.selection\"` when deleting the selection\n - `\"delete.forward\"` when deleting forward from the selection\n - `\"delete.backward\"` when deleting backward from the selection\n - `\"delete.cut\"` when cutting to the clipboard\n - `\"move\"` when content is moved\n - `\"move.drop\"` when content is moved within the editor through drag-and-drop\n - `\"select\"` when explicitly changing the selection\n - `\"select.pointer\"` when selecting with a mouse or other pointing device\n - `\"undo\"` and `\"redo\"` for history actions\n\nUse [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check\nwhether the annotation matches a given event.\n*/\nTransaction.userEvent = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating whether a transaction should be added to\nthe undo history or not.\n*/\nTransaction.addToHistory = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating (when present and true) that a transaction\nrepresents a change made by some other actor, not the user. This\nis used, for example, to tag other people's changes in\ncollaborative editing.\n*/\nTransaction.remote = /*@__PURE__*/Annotation.define();\nfunction joinRanges(a, b) {\n let result = [];\n for (let iA = 0, iB = 0;;) {\n let from, to;\n if (iA < a.length && (iB == b.length || b[iB] >= a[iA])) {\n from = a[iA++];\n to = a[iA++];\n }\n else if (iB < b.length) {\n from = b[iB++];\n to = b[iB++];\n }\n else\n return result;\n if (!result.length || result[result.length - 1] < from)\n result.push(from, to);\n else if (result[result.length - 1] < to)\n result[result.length - 1] = to;\n }\n}\nfunction mergeTransaction(a, b, sequential) {\n var _a;\n let mapForA, mapForB, changes;\n if (sequential) {\n mapForA = b.changes;\n mapForB = ChangeSet.empty(b.changes.length);\n changes = a.changes.compose(b.changes);\n }\n else {\n mapForA = b.changes.map(a.changes);\n mapForB = a.changes.mapDesc(b.changes, true);\n changes = a.changes.compose(mapForA);\n }\n return {\n changes,\n selection: b.selection ? b.selection.map(mapForB) : (_a = a.selection) === null || _a === void 0 ? void 0 : _a.map(mapForA),\n effects: StateEffect.mapEffects(a.effects, mapForA).concat(StateEffect.mapEffects(b.effects, mapForB)),\n annotations: a.annotations.length ? a.annotations.concat(b.annotations) : b.annotations,\n scrollIntoView: a.scrollIntoView || b.scrollIntoView\n };\n}\nfunction resolveTransactionInner(state, spec, docSize) {\n let sel = spec.selection, annotations = asArray(spec.annotations);\n if (spec.userEvent)\n annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent));\n return {\n changes: spec.changes instanceof ChangeSet ? spec.changes\n : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)),\n selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)),\n effects: asArray(spec.effects),\n annotations,\n scrollIntoView: !!spec.scrollIntoView\n };\n}\nfunction resolveTransaction(state, specs, filter) {\n let s = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length);\n if (specs.length && specs[0].filter === false)\n filter = false;\n for (let i = 1; i < specs.length; i++) {\n if (specs[i].filter === false)\n filter = false;\n let seq = !!specs[i].sequential;\n s = mergeTransaction(s, resolveTransactionInner(state, specs[i], seq ? s.changes.newLength : state.doc.length), seq);\n }\n let tr = Transaction.create(state, s.changes, s.selection, s.effects, s.annotations, s.scrollIntoView);\n return extendTransaction(filter ? filterTransaction(tr) : tr);\n}\n// Finish a transaction by applying filters if necessary.\nfunction filterTransaction(tr) {\n let state = tr.startState;\n // Change filters\n let result = true;\n for (let filter of state.facet(changeFilter)) {\n let value = filter(tr);\n if (value === false) {\n result = false;\n break;\n }\n if (Array.isArray(value))\n result = result === true ? value : joinRanges(result, value);\n }\n if (result !== true) {\n let changes, back;\n if (result === false) {\n back = tr.changes.invertedDesc;\n changes = ChangeSet.empty(state.doc.length);\n }\n else {\n let filtered = tr.changes.filter(result);\n changes = filtered.changes;\n back = filtered.filtered.mapDesc(filtered.changes).invertedDesc;\n }\n tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView);\n }\n // Transaction filters\n let filters = state.facet(transactionFilter);\n for (let i = filters.length - 1; i >= 0; i--) {\n let filtered = filters[i](tr);\n if (filtered instanceof Transaction)\n tr = filtered;\n else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction)\n tr = filtered[0];\n else\n tr = resolveTransaction(state, asArray(filtered), false);\n }\n return tr;\n}\nfunction extendTransaction(tr) {\n let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr;\n for (let i = extenders.length - 1; i >= 0; i--) {\n let extension = extenders[i](tr);\n if (extension && Object.keys(extension).length)\n spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true);\n }\n return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView);\n}\nconst none = [];\nfunction asArray(value) {\n return value == null ? none : Array.isArray(value) ? value : [value];\n}\n\n/**\nThe categories produced by a [character\ncategorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer). These are used\ndo things like selecting by word.\n*/\nvar CharCategory = /*@__PURE__*/(function (CharCategory) {\n /**\n Word characters.\n */\n CharCategory[CharCategory[\"Word\"] = 0] = \"Word\";\n /**\n Whitespace.\n */\n CharCategory[CharCategory[\"Space\"] = 1] = \"Space\";\n /**\n Anything else.\n */\n CharCategory[CharCategory[\"Other\"] = 2] = \"Other\";\nreturn CharCategory})(CharCategory || (CharCategory = {}));\nconst nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\nlet wordChar;\ntry {\n wordChar = /*@__PURE__*/new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\", \"u\");\n}\ncatch (_) { }\nfunction hasWordChar(str) {\n if (wordChar)\n return wordChar.test(str);\n for (let i = 0; i < str.length; i++) {\n let ch = str[i];\n if (/\\w/.test(ch) || ch > \"\\x80\" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)))\n return true;\n }\n return false;\n}\nfunction makeCategorizer(wordChars) {\n return (char) => {\n if (!/\\S/.test(char))\n return CharCategory.Space;\n if (hasWordChar(char))\n return CharCategory.Word;\n for (let i = 0; i < wordChars.length; i++)\n if (char.indexOf(wordChars[i]) > -1)\n return CharCategory.Word;\n return CharCategory.Other;\n };\n}\n\n/**\nThe editor state class is a persistent (immutable) data structure.\nTo update a state, you [create](https://codemirror.net/6/docs/ref/#state.EditorState.update) a\n[transaction](https://codemirror.net/6/docs/ref/#state.Transaction), which produces a _new_ state\ninstance, without modifying the original object.\n\nAs such, _never_ mutate properties of a state directly. That'll\njust break things.\n*/\nclass EditorState {\n constructor(\n /**\n @internal\n */\n config, \n /**\n The current document.\n */\n doc, \n /**\n The current selection.\n */\n selection, \n /**\n @internal\n */\n values, computeSlot, tr) {\n this.config = config;\n this.doc = doc;\n this.selection = selection;\n this.values = values;\n this.status = config.statusTemplate.slice();\n this.computeSlot = computeSlot;\n // Fill in the computed state immediately, so that further queries\n // for it made during the update return this state\n if (tr)\n tr._state = this;\n for (let i = 0; i < this.config.dynamicSlots.length; i++)\n ensureAddr(this, i << 1);\n this.computeSlot = null;\n }\n field(field, require = true) {\n let addr = this.config.address[field.id];\n if (addr == null) {\n if (require)\n throw new RangeError(\"Field is not present in this state\");\n return undefined;\n }\n ensureAddr(this, addr);\n return getAddr(this, addr);\n }\n /**\n Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this\n state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec)\n can be passed. Unless\n [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the\n [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec\n are assumed to start in the _current_ document (not the document\n produced by previous specs), and its\n [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and\n [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer\n to the document created by its _own_ changes. The resulting\n transaction contains the combined effect of all the different\n specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later\n specs take precedence over earlier ones.\n */\n update(...specs) {\n return resolveTransaction(this, specs, true);\n }\n /**\n @internal\n */\n applyTransaction(tr) {\n let conf = this.config, { base, compartments } = conf;\n for (let effect of tr.effects) {\n if (effect.is(Compartment.reconfigure)) {\n if (conf) {\n compartments = new Map;\n conf.compartments.forEach((val, key) => compartments.set(key, val));\n conf = null;\n }\n compartments.set(effect.value.compartment, effect.value.extension);\n }\n else if (effect.is(StateEffect.reconfigure)) {\n conf = null;\n base = effect.value;\n }\n else if (effect.is(StateEffect.appendConfig)) {\n conf = null;\n base = asArray(base).concat(effect.value);\n }\n }\n let startValues;\n if (!conf) {\n conf = Configuration.resolve(base, compartments, this);\n let intermediateState = new EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null);\n startValues = intermediateState.values;\n }\n else {\n startValues = tr.startState.values.slice();\n }\n let selection = tr.startState.facet(allowMultipleSelections) ? tr.newSelection : tr.newSelection.asSingle();\n new EditorState(conf, tr.newDoc, selection, startValues, (state, slot) => slot.update(state, tr), tr);\n }\n /**\n Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that\n replaces every selection range with the given content.\n */\n replaceSelection(text) {\n if (typeof text == \"string\")\n text = this.toText(text);\n return this.changeByRange(range => ({ changes: { from: range.from, to: range.to, insert: text },\n range: EditorSelection.cursor(range.from + text.length) }));\n }\n /**\n Create a set of changes and a new selection by running the given\n function for each range in the active selection. The function\n can return an optional set of changes (in the coordinate space\n of the start document), plus an updated range (in the coordinate\n space of the document produced by the call's own changes). This\n method will merge all the changes and ranges into a single\n changeset and selection, and return it as a [transaction\n spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to\n [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update).\n */\n changeByRange(f) {\n let sel = this.selection;\n let result1 = f(sel.ranges[0]);\n let changes = this.changes(result1.changes), ranges = [result1.range];\n let effects = asArray(result1.effects);\n for (let i = 1; i < sel.ranges.length; i++) {\n let result = f(sel.ranges[i]);\n let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes);\n for (let j = 0; j < i; j++)\n ranges[j] = ranges[j].map(newMapped);\n let mapBy = changes.mapDesc(newChanges, true);\n ranges.push(result.range.map(mapBy));\n changes = changes.compose(newMapped);\n effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy));\n }\n return {\n changes,\n selection: EditorSelection.create(ranges, sel.mainIndex),\n effects\n };\n }\n /**\n Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change\n description, taking the state's document length and line\n separator into account.\n */\n changes(spec = []) {\n if (spec instanceof ChangeSet)\n return spec;\n return ChangeSet.of(spec, this.doc.length, this.facet(EditorState.lineSeparator));\n }\n /**\n Using the state's [line\n separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a\n [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.\n */\n toText(string) {\n return Text.of(string.split(this.facet(EditorState.lineSeparator) || DefaultSplit));\n }\n /**\n Return the given range of the document as a string.\n */\n sliceDoc(from = 0, to = this.doc.length) {\n return this.doc.sliceString(from, to, this.lineBreak);\n }\n /**\n Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet).\n */\n facet(facet) {\n let addr = this.config.address[facet.id];\n if (addr == null)\n return facet.default;\n ensureAddr(this, addr);\n return getAddr(this, addr);\n }\n /**\n Convert this state to a JSON-serializable object. When custom\n fields should be serialized, you can pass them in as an object\n mapping property names (in the resulting object, which should\n not use `doc` or `selection`) to fields.\n */\n toJSON(fields) {\n let result = {\n doc: this.sliceDoc(),\n selection: this.selection.toJSON()\n };\n if (fields)\n for (let prop in fields) {\n let value = fields[prop];\n if (value instanceof StateField && this.config.address[value.id] != null)\n result[prop] = value.spec.toJSON(this.field(fields[prop]), this);\n }\n return result;\n }\n /**\n Deserialize a state from its JSON representation. When custom\n fields should be deserialized, pass the same object you passed\n to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as\n third argument.\n */\n static fromJSON(json, config = {}, fields) {\n if (!json || typeof json.doc != \"string\")\n throw new RangeError(\"Invalid JSON representation for EditorState\");\n let fieldInit = [];\n if (fields)\n for (let prop in fields) {\n if (Object.prototype.hasOwnProperty.call(json, prop)) {\n let field = fields[prop], value = json[prop];\n fieldInit.push(field.init(state => field.spec.fromJSON(value, state)));\n }\n }\n return EditorState.create({\n doc: json.doc,\n selection: EditorSelection.fromJSON(json.selection),\n extensions: config.extensions ? fieldInit.concat([config.extensions]) : fieldInit\n });\n }\n /**\n Create a new state. You'll usually only need this when\n initializing an editor—updated states are created by applying\n transactions.\n */\n static create(config = {}) {\n let configuration = Configuration.resolve(config.extensions || [], new Map);\n let doc = config.doc instanceof Text ? config.doc\n : Text.of((config.doc || \"\").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit));\n let selection = !config.selection ? EditorSelection.single(0)\n : config.selection instanceof EditorSelection ? config.selection\n : EditorSelection.single(config.selection.anchor, config.selection.head);\n checkSelection(selection, doc.length);\n if (!configuration.staticFacet(allowMultipleSelections))\n selection = selection.asSingle();\n return new EditorState(configuration, doc, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null);\n }\n /**\n The size (in columns) of a tab in the document, determined by\n the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet.\n */\n get tabSize() { return this.facet(EditorState.tabSize); }\n /**\n Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator)\n string for this state.\n */\n get lineBreak() { return this.facet(EditorState.lineSeparator) || \"\\n\"; }\n /**\n Returns true when the editor is\n [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only.\n */\n get readOnly() { return this.facet(readOnly); }\n /**\n Look up a translation for the given phrase (via the\n [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the\n original string if no translation is found.\n \n If additional arguments are passed, they will be inserted in\n place of markers like `$1` (for the first value) and `$2`, etc.\n A single `$` is equivalent to `$1`, and `$$` will produce a\n literal dollar sign.\n */\n phrase(phrase, ...insert) {\n for (let map of this.facet(EditorState.phrases))\n if (Object.prototype.hasOwnProperty.call(map, phrase)) {\n phrase = map[phrase];\n break;\n }\n if (insert.length)\n phrase = phrase.replace(/\\$(\\$|\\d*)/g, (m, i) => {\n if (i == \"$\")\n return \"$\";\n let n = +(i || 1);\n return !n || n > insert.length ? m : insert[n - 1];\n });\n return phrase;\n }\n /**\n Find the values for a given language data field, provided by the\n the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet.\n \n Examples of language data fields are...\n \n - [`\"commentTokens\"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying\n comment syntax.\n - [`\"autocomplete\"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override)\n for providing language-specific completion sources.\n - [`\"wordChars\"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding\n characters that should be considered part of words in this\n language.\n - [`\"closeBrackets\"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls\n bracket closing behavior.\n */\n languageDataAt(name, pos, side = -1) {\n let values = [];\n for (let provider of this.facet(languageData)) {\n for (let result of provider(this, pos, side)) {\n if (Object.prototype.hasOwnProperty.call(result, name))\n values.push(result[name]);\n }\n }\n return values;\n }\n /**\n Return a function that can categorize strings (expected to\n represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak))\n into one of:\n \n - Word (contains an alphanumeric character or a character\n explicitly listed in the local language's `\"wordChars\"`\n language data, which should be a string)\n - Space (contains only whitespace)\n - Other (anything else)\n */\n charCategorizer(at) {\n return makeCategorizer(this.languageDataAt(\"wordChars\", at).join(\"\"));\n }\n /**\n Find the word at the given position, meaning the range\n containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters\n around it. If no word characters are adjacent to the position,\n this returns null.\n */\n wordAt(pos) {\n let { text, from, length } = this.doc.lineAt(pos);\n let cat = this.charCategorizer(pos);\n let start = pos - from, end = pos - from;\n while (start > 0) {\n let prev = findClusterBreak(text, start, false);\n if (cat(text.slice(prev, start)) != CharCategory.Word)\n break;\n start = prev;\n }\n while (end < length) {\n let next = findClusterBreak(text, end);\n if (cat(text.slice(end, next)) != CharCategory.Word)\n break;\n end = next;\n }\n return start == end ? null : EditorSelection.range(start + from, end + from);\n }\n}\n/**\nA facet that, when enabled, causes the editor to allow multiple\nranges to be selected. Be careful though, because by default the\neditor relies on the native DOM selection, which cannot handle\nmultiple selections. An extension like\n[`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) can be used to make\nsecondary selections visible to the user.\n*/\nEditorState.allowMultipleSelections = allowMultipleSelections;\n/**\nConfigures the tab size to use in this state. The first\n(highest-precedence) value of the facet is used. If no value is\ngiven, this defaults to 4.\n*/\nEditorState.tabSize = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : 4\n});\n/**\nThe line separator to use. By default, any of `\"\\n\"`, `\"\\r\\n\"`\nand `\"\\r\"` is treated as a separator when splitting lines, and\nlines are joined with `\"\\n\"`.\n\nWhen you configure a value here, only that precise separator\nwill be used, allowing you to round-trip documents through the\neditor without normalizing line separators.\n*/\nEditorState.lineSeparator = lineSeparator;\n/**\nThis facet controls the value of the\n[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) getter, which is\nconsulted by commands and extensions that implement editing\nfunctionality to determine whether they should apply. It\ndefaults to false, but when its highest-precedence value is\n`true`, such functionality disables itself.\n\nNot to be confused with\n[`EditorView.editable`](https://codemirror.net/6/docs/ref/#view.EditorView^editable), which\ncontrols whether the editor's DOM is set to be editable (and\nthus focusable).\n*/\nEditorState.readOnly = readOnly;\n/**\nRegisters translation phrases. The\n[`phrase`](https://codemirror.net/6/docs/ref/#state.EditorState.phrase) method will look through\nall objects registered with this facet to find translations for\nits argument.\n*/\nEditorState.phrases = /*@__PURE__*/Facet.define({\n compare(a, b) {\n let kA = Object.keys(a), kB = Object.keys(b);\n return kA.length == kB.length && kA.every(k => a[k] == b[k]);\n }\n});\n/**\nA facet used to register [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) providers.\n*/\nEditorState.languageData = languageData;\n/**\nFacet used to register change filters, which are called for each\ntransaction (unless explicitly\n[disabled](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter)), and can suppress\npart of the transaction's changes.\n\nSuch a function can return `true` to indicate that it doesn't\nwant to do anything, `false` to completely stop the changes in\nthe transaction, or a set of ranges in which changes should be\nsuppressed. Such ranges are represented as an array of numbers,\nwith each pair of two numbers indicating the start and end of a\nrange. So for example `[10, 20, 100, 110]` suppresses changes\nbetween 10 and 20, and between 100 and 110.\n*/\nEditorState.changeFilter = changeFilter;\n/**\nFacet used to register a hook that gets a chance to update or\nreplace transaction specs before they are applied. This will\nonly be applied for transactions that don't have\n[`filter`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter) set to `false`. You\ncan either return a single transaction spec (possibly the input\ntransaction), or an array of specs (which will be combined in\nthe same way as the arguments to\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update)).\n\nWhen possible, it is recommended to avoid accessing\n[`Transaction.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state) in a filter,\nsince it will force creation of a state that will then be\ndiscarded again, if the transaction is actually filtered.\n\n(This functionality should be used with care. Indiscriminately\nmodifying transaction is likely to break something or degrade\nthe user experience.)\n*/\nEditorState.transactionFilter = transactionFilter;\n/**\nThis is a more limited form of\n[`transactionFilter`](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter),\nwhich can only add\n[annotations](https://codemirror.net/6/docs/ref/#state.TransactionSpec.annotations) and\n[effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects). _But_, this type\nof filter runs even if the transaction has disabled regular\n[filtering](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter), making it suitable\nfor effects that don't need to touch the changes or selection,\nbut do want to process every transaction.\n\nExtenders run _after_ filters, when both are present.\n*/\nEditorState.transactionExtender = transactionExtender;\nCompartment.reconfigure = /*@__PURE__*/StateEffect.define();\n\n/**\nUtility function for combining behaviors to fill in a config\nobject from an array of provided configs. `defaults` should hold\ndefault values for all optional fields in `Config`.\n\nThe function will, by default, error\nwhen a field gets two values that aren't `===`-equal, but you can\nprovide combine functions per field to do something else.\n*/\nfunction combineConfig(configs, defaults, // Should hold only the optional properties of Config, but I haven't managed to express that\ncombine = {}) {\n let result = {};\n for (let config of configs)\n for (let key of Object.keys(config)) {\n let value = config[key], current = result[key];\n if (current === undefined)\n result[key] = value;\n else if (current === value || value === undefined) ; // No conflict\n else if (Object.hasOwnProperty.call(combine, key))\n result[key] = combine[key](current, value);\n else\n throw new Error(\"Config merge conflict for field \" + key);\n }\n for (let key in defaults)\n if (result[key] === undefined)\n result[key] = defaults[key];\n return result;\n}\n\n/**\nEach range is associated with a value, which must inherit from\nthis class.\n*/\nclass RangeValue {\n /**\n Compare this value with another value. Used when comparing\n rangesets. The default implementation compares by identity.\n Unless you are only creating a fixed number of unique instances\n of your value type, it is a good idea to implement this\n properly.\n */\n eq(other) { return this == other; }\n /**\n Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value.\n */\n range(from, to = from) { return Range.create(from, to, this); }\n}\nRangeValue.prototype.startSide = RangeValue.prototype.endSide = 0;\nRangeValue.prototype.point = false;\nRangeValue.prototype.mapMode = MapMode.TrackDel;\n/**\nA range associates a value with a range of positions.\n*/\nclass Range {\n constructor(\n /**\n The range's start position.\n */\n from, \n /**\n Its end position.\n */\n to, \n /**\n The value associated with this range.\n */\n value) {\n this.from = from;\n this.to = to;\n this.value = value;\n }\n /**\n @internal\n */\n static create(from, to, value) {\n return new Range(from, to, value);\n }\n}\nfunction cmpRange(a, b) {\n return a.from - b.from || a.value.startSide - b.value.startSide;\n}\nclass Chunk {\n constructor(from, to, value, \n // Chunks are marked with the largest point that occurs\n // in them (or -1 for no points), so that scans that are\n // only interested in points (such as the\n // heightmap-related logic) can skip range-only chunks.\n maxPoint) {\n this.from = from;\n this.to = to;\n this.value = value;\n this.maxPoint = maxPoint;\n }\n get length() { return this.to[this.to.length - 1]; }\n // Find the index of the given position and side. Use the ranges'\n // `from` pos when `end == false`, `to` when `end == true`.\n findIndex(pos, side, end, startAt = 0) {\n let arr = end ? this.to : this.from;\n for (let lo = startAt, hi = arr.length;;) {\n if (lo == hi)\n return lo;\n let mid = (lo + hi) >> 1;\n let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side;\n if (mid == lo)\n return diff >= 0 ? lo : hi;\n if (diff >= 0)\n hi = mid;\n else\n lo = mid + 1;\n }\n }\n between(offset, from, to, f) {\n for (let i = this.findIndex(from, -1000000000 /* C.Far */, true), e = this.findIndex(to, 1000000000 /* C.Far */, false, i); i < e; i++)\n if (f(this.from[i] + offset, this.to[i] + offset, this.value[i]) === false)\n return false;\n }\n map(offset, changes) {\n let value = [], from = [], to = [], newPos = -1, maxPoint = -1;\n for (let i = 0; i < this.value.length; i++) {\n let val = this.value[i], curFrom = this.from[i] + offset, curTo = this.to[i] + offset, newFrom, newTo;\n if (curFrom == curTo) {\n let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode);\n if (mapped == null)\n continue;\n newFrom = newTo = mapped;\n if (val.startSide != val.endSide) {\n newTo = changes.mapPos(curFrom, val.endSide);\n if (newTo < newFrom)\n continue;\n }\n }\n else {\n newFrom = changes.mapPos(curFrom, val.startSide);\n newTo = changes.mapPos(curTo, val.endSide);\n if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0)\n continue;\n }\n if ((newTo - newFrom || val.endSide - val.startSide) < 0)\n continue;\n if (newPos < 0)\n newPos = newFrom;\n if (val.point)\n maxPoint = Math.max(maxPoint, newTo - newFrom);\n value.push(val);\n from.push(newFrom - newPos);\n to.push(newTo - newPos);\n }\n return { mapped: value.length ? new Chunk(from, to, value, maxPoint) : null, pos: newPos };\n }\n}\n/**\nA range set stores a collection of [ranges](https://codemirror.net/6/docs/ref/#state.Range) in a\nway that makes them efficient to [map](https://codemirror.net/6/docs/ref/#state.RangeSet.map) and\n[update](https://codemirror.net/6/docs/ref/#state.RangeSet.update). This is an immutable data\nstructure.\n*/\nclass RangeSet {\n constructor(\n /**\n @internal\n */\n chunkPos, \n /**\n @internal\n */\n chunk, \n /**\n @internal\n */\n nextLayer, \n /**\n @internal\n */\n maxPoint) {\n this.chunkPos = chunkPos;\n this.chunk = chunk;\n this.nextLayer = nextLayer;\n this.maxPoint = maxPoint;\n }\n /**\n @internal\n */\n static create(chunkPos, chunk, nextLayer, maxPoint) {\n return new RangeSet(chunkPos, chunk, nextLayer, maxPoint);\n }\n /**\n @internal\n */\n get length() {\n let last = this.chunk.length - 1;\n return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length);\n }\n /**\n The number of ranges in the set.\n */\n get size() {\n if (this.isEmpty)\n return 0;\n let size = this.nextLayer.size;\n for (let chunk of this.chunk)\n size += chunk.value.length;\n return size;\n }\n /**\n @internal\n */\n chunkEnd(index) {\n return this.chunkPos[index] + this.chunk[index].length;\n }\n /**\n Update the range set, optionally adding new ranges or filtering\n out existing ones.\n \n (Note: The type parameter is just there as a kludge to work\n around TypeScript variance issues that prevented `RangeSet`\n from being a subtype of `RangeSet` when `X` is a subtype of\n `Y`.)\n */\n update(updateSpec) {\n let { add = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec;\n let filter = updateSpec.filter;\n if (add.length == 0 && !filter)\n return this;\n if (sort)\n add = add.slice().sort(cmpRange);\n if (this.isEmpty)\n return add.length ? RangeSet.of(add) : this;\n let cur = new LayerCursor(this, null, -1).goto(0), i = 0, spill = [];\n let builder = new RangeSetBuilder();\n while (cur.value || i < add.length) {\n if (i < add.length && (cur.from - add[i].from || cur.startSide - add[i].value.startSide) >= 0) {\n let range = add[i++];\n if (!builder.addInner(range.from, range.to, range.value))\n spill.push(range);\n }\n else if (cur.rangeIndex == 1 && cur.chunkIndex < this.chunk.length &&\n (i == add.length || this.chunkEnd(cur.chunkIndex) < add[i].from) &&\n (!filter || filterFrom > this.chunkEnd(cur.chunkIndex) || filterTo < this.chunkPos[cur.chunkIndex]) &&\n builder.addChunk(this.chunkPos[cur.chunkIndex], this.chunk[cur.chunkIndex])) {\n cur.nextChunk();\n }\n else {\n if (!filter || filterFrom > cur.to || filterTo < cur.from || filter(cur.from, cur.to, cur.value)) {\n if (!builder.addInner(cur.from, cur.to, cur.value))\n spill.push(Range.create(cur.from, cur.to, cur.value));\n }\n cur.next();\n }\n }\n return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? RangeSet.empty\n : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo }));\n }\n /**\n Map this range set through a set of changes, return the new set.\n */\n map(changes) {\n if (changes.empty || this.isEmpty)\n return this;\n let chunks = [], chunkPos = [], maxPoint = -1;\n for (let i = 0; i < this.chunk.length; i++) {\n let start = this.chunkPos[i], chunk = this.chunk[i];\n let touch = changes.touchesRange(start, start + chunk.length);\n if (touch === false) {\n maxPoint = Math.max(maxPoint, chunk.maxPoint);\n chunks.push(chunk);\n chunkPos.push(changes.mapPos(start));\n }\n else if (touch === true) {\n let { mapped, pos } = chunk.map(start, changes);\n if (mapped) {\n maxPoint = Math.max(maxPoint, mapped.maxPoint);\n chunks.push(mapped);\n chunkPos.push(pos);\n }\n }\n }\n let next = this.nextLayer.map(changes);\n return chunks.length == 0 ? next : new RangeSet(chunkPos, chunks, next || RangeSet.empty, maxPoint);\n }\n /**\n Iterate over the ranges that touch the region `from` to `to`,\n calling `f` for each. There is no guarantee that the ranges will\n be reported in any specific order. When the callback returns\n `false`, iteration stops.\n */\n between(from, to, f) {\n if (this.isEmpty)\n return;\n for (let i = 0; i < this.chunk.length; i++) {\n let start = this.chunkPos[i], chunk = this.chunk[i];\n if (to >= start && from <= start + chunk.length &&\n chunk.between(start, from - start, to - start, f) === false)\n return;\n }\n this.nextLayer.between(from, to, f);\n }\n /**\n Iterate over the ranges in this set, in order, including all\n ranges that end at or after `from`.\n */\n iter(from = 0) {\n return HeapCursor.from([this]).goto(from);\n }\n /**\n @internal\n */\n get isEmpty() { return this.nextLayer == this; }\n /**\n Iterate over the ranges in a collection of sets, in order,\n starting from `from`.\n */\n static iter(sets, from = 0) {\n return HeapCursor.from(sets).goto(from);\n }\n /**\n Iterate over two groups of sets, calling methods on `comparator`\n to notify it of possible differences.\n */\n static compare(oldSets, newSets, \n /**\n This indicates how the underlying data changed between these\n ranges, and is needed to synchronize the iteration.\n */\n textDiff, comparator, \n /**\n Can be used to ignore all non-point ranges, and points below\n the given size. When -1, all ranges are compared.\n */\n minPointSize = -1) {\n let a = oldSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n let b = newSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n let sharedChunks = findSharedChunks(a, b, textDiff);\n let sideA = new SpanCursor(a, sharedChunks, minPointSize);\n let sideB = new SpanCursor(b, sharedChunks, minPointSize);\n textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator));\n if (textDiff.empty && textDiff.length == 0)\n compare(sideA, 0, sideB, 0, 0, comparator);\n }\n /**\n Compare the contents of two groups of range sets, returning true\n if they are equivalent in the given range.\n */\n static eq(oldSets, newSets, from = 0, to) {\n if (to == null)\n to = 1000000000 /* C.Far */ - 1;\n let a = oldSets.filter(set => !set.isEmpty && newSets.indexOf(set) < 0);\n let b = newSets.filter(set => !set.isEmpty && oldSets.indexOf(set) < 0);\n if (a.length != b.length)\n return false;\n if (!a.length)\n return true;\n let sharedChunks = findSharedChunks(a, b);\n let sideA = new SpanCursor(a, sharedChunks, 0).goto(from), sideB = new SpanCursor(b, sharedChunks, 0).goto(from);\n for (;;) {\n if (sideA.to != sideB.to ||\n !sameValues(sideA.active, sideB.active) ||\n sideA.point && (!sideB.point || !sideA.point.eq(sideB.point)))\n return false;\n if (sideA.to > to)\n return true;\n sideA.next();\n sideB.next();\n }\n }\n /**\n Iterate over a group of range sets at the same time, notifying\n the iterator about the ranges covering every given piece of\n content. Returns the open count (see\n [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end\n of the iteration.\n */\n static spans(sets, from, to, iterator, \n /**\n When given and greater than -1, only points of at least this\n size are taken into account.\n */\n minPointSize = -1) {\n let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from;\n let openRanges = cursor.openStart;\n for (;;) {\n let curTo = Math.min(cursor.to, to);\n if (cursor.point) {\n let active = cursor.activeForPoint(cursor.to);\n let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges);\n iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);\n openRanges = Math.min(cursor.openEnd(curTo), active.length);\n }\n else if (curTo > pos) {\n iterator.span(pos, curTo, cursor.active, openRanges);\n openRanges = cursor.openEnd(curTo);\n }\n if (cursor.to > to)\n return openRanges + (cursor.point && cursor.to > to ? 1 : 0);\n pos = cursor.to;\n cursor.next();\n }\n }\n /**\n Create a range set for the given range or array of ranges. By\n default, this expects the ranges to be _sorted_ (by start\n position and, if two start at the same position,\n `value.startSide`). You can pass `true` as second argument to\n cause the method to sort them.\n */\n static of(ranges, sort = false) {\n let build = new RangeSetBuilder();\n for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges)\n build.add(range.from, range.to, range.value);\n return build.finish();\n }\n /**\n Join an array of range sets into a single set.\n */\n static join(sets) {\n if (!sets.length)\n return RangeSet.empty;\n let result = sets[sets.length - 1];\n for (let i = sets.length - 2; i >= 0; i--) {\n for (let layer = sets[i]; layer != RangeSet.empty; layer = layer.nextLayer)\n result = new RangeSet(layer.chunkPos, layer.chunk, result, Math.max(layer.maxPoint, result.maxPoint));\n }\n return result;\n }\n}\n/**\nThe empty set of ranges.\n*/\nRangeSet.empty = /*@__PURE__*/new RangeSet([], [], null, -1);\nfunction lazySort(ranges) {\n if (ranges.length > 1)\n for (let prev = ranges[0], i = 1; i < ranges.length; i++) {\n let cur = ranges[i];\n if (cmpRange(prev, cur) > 0)\n return ranges.slice().sort(cmpRange);\n prev = cur;\n }\n return ranges;\n}\nRangeSet.empty.nextLayer = RangeSet.empty;\n/**\nA range set builder is a data structure that helps build up a\n[range set](https://codemirror.net/6/docs/ref/#state.RangeSet) directly, without first allocating\nan array of [`Range`](https://codemirror.net/6/docs/ref/#state.Range) objects.\n*/\nclass RangeSetBuilder {\n finishChunk(newArrays) {\n this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint));\n this.chunkPos.push(this.chunkStart);\n this.chunkStart = -1;\n this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint);\n this.maxPoint = -1;\n if (newArrays) {\n this.from = [];\n this.to = [];\n this.value = [];\n }\n }\n /**\n Create an empty builder.\n */\n constructor() {\n this.chunks = [];\n this.chunkPos = [];\n this.chunkStart = -1;\n this.last = null;\n this.lastFrom = -1000000000 /* C.Far */;\n this.lastTo = -1000000000 /* C.Far */;\n this.from = [];\n this.to = [];\n this.value = [];\n this.maxPoint = -1;\n this.setMaxPoint = -1;\n this.nextLayer = null;\n }\n /**\n Add a range. Ranges should be added in sorted (by `from` and\n `value.startSide`) order.\n */\n add(from, to, value) {\n if (!this.addInner(from, to, value))\n (this.nextLayer || (this.nextLayer = new RangeSetBuilder)).add(from, to, value);\n }\n /**\n @internal\n */\n addInner(from, to, value) {\n let diff = from - this.lastTo || value.startSide - this.last.endSide;\n if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0)\n throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");\n if (diff < 0)\n return false;\n if (this.from.length == 250 /* C.ChunkSize */)\n this.finishChunk(true);\n if (this.chunkStart < 0)\n this.chunkStart = from;\n this.from.push(from - this.chunkStart);\n this.to.push(to - this.chunkStart);\n this.last = value;\n this.lastFrom = from;\n this.lastTo = to;\n this.value.push(value);\n if (value.point)\n this.maxPoint = Math.max(this.maxPoint, to - from);\n return true;\n }\n /**\n @internal\n */\n addChunk(from, chunk) {\n if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0)\n return false;\n if (this.from.length)\n this.finishChunk(true);\n this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint);\n this.chunks.push(chunk);\n this.chunkPos.push(from);\n let last = chunk.value.length - 1;\n this.last = chunk.value[last];\n this.lastFrom = chunk.from[last] + from;\n this.lastTo = chunk.to[last] + from;\n return true;\n }\n /**\n Finish the range set. Returns the new set. The builder can't be\n used anymore after this has been called.\n */\n finish() { return this.finishInner(RangeSet.empty); }\n /**\n @internal\n */\n finishInner(next) {\n if (this.from.length)\n this.finishChunk(false);\n if (this.chunks.length == 0)\n return next;\n let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint);\n this.from = null; // Make sure further `add` calls produce errors\n return result;\n }\n}\nfunction findSharedChunks(a, b, textDiff) {\n let inA = new Map();\n for (let set of a)\n for (let i = 0; i < set.chunk.length; i++)\n if (set.chunk[i].maxPoint <= 0)\n inA.set(set.chunk[i], set.chunkPos[i]);\n let shared = new Set();\n for (let set of b)\n for (let i = 0; i < set.chunk.length; i++) {\n let known = inA.get(set.chunk[i]);\n if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i] &&\n !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i].length)))\n shared.add(set.chunk[i]);\n }\n return shared;\n}\nclass LayerCursor {\n constructor(layer, skip, minPoint, rank = 0) {\n this.layer = layer;\n this.skip = skip;\n this.minPoint = minPoint;\n this.rank = rank;\n }\n get startSide() { return this.value ? this.value.startSide : 0; }\n get endSide() { return this.value ? this.value.endSide : 0; }\n goto(pos, side = -1000000000 /* C.Far */) {\n this.chunkIndex = this.rangeIndex = 0;\n this.gotoInner(pos, side, false);\n return this;\n }\n gotoInner(pos, side, forward) {\n while (this.chunkIndex < this.layer.chunk.length) {\n let next = this.layer.chunk[this.chunkIndex];\n if (!(this.skip && this.skip.has(next) ||\n this.layer.chunkEnd(this.chunkIndex) < pos ||\n next.maxPoint < this.minPoint))\n break;\n this.chunkIndex++;\n forward = false;\n }\n if (this.chunkIndex < this.layer.chunk.length) {\n let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true);\n if (!forward || this.rangeIndex < rangeIndex)\n this.setRangeIndex(rangeIndex);\n }\n this.next();\n }\n forward(pos, side) {\n if ((this.to - pos || this.endSide - side) < 0)\n this.gotoInner(pos, side, true);\n }\n next() {\n for (;;) {\n if (this.chunkIndex == this.layer.chunk.length) {\n this.from = this.to = 1000000000 /* C.Far */;\n this.value = null;\n break;\n }\n else {\n let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex];\n let from = chunkPos + chunk.from[this.rangeIndex];\n this.from = from;\n this.to = chunkPos + chunk.to[this.rangeIndex];\n this.value = chunk.value[this.rangeIndex];\n this.setRangeIndex(this.rangeIndex + 1);\n if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint)\n break;\n }\n }\n }\n setRangeIndex(index) {\n if (index == this.layer.chunk[this.chunkIndex].value.length) {\n this.chunkIndex++;\n if (this.skip) {\n while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]))\n this.chunkIndex++;\n }\n this.rangeIndex = 0;\n }\n else {\n this.rangeIndex = index;\n }\n }\n nextChunk() {\n this.chunkIndex++;\n this.rangeIndex = 0;\n this.next();\n }\n compare(other) {\n return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank ||\n this.to - other.to || this.endSide - other.endSide;\n }\n}\nclass HeapCursor {\n constructor(heap) {\n this.heap = heap;\n }\n static from(sets, skip = null, minPoint = -1) {\n let heap = [];\n for (let i = 0; i < sets.length; i++) {\n for (let cur = sets[i]; !cur.isEmpty; cur = cur.nextLayer) {\n if (cur.maxPoint >= minPoint)\n heap.push(new LayerCursor(cur, skip, minPoint, i));\n }\n }\n return heap.length == 1 ? heap[0] : new HeapCursor(heap);\n }\n get startSide() { return this.value ? this.value.startSide : 0; }\n goto(pos, side = -1000000000 /* C.Far */) {\n for (let cur of this.heap)\n cur.goto(pos, side);\n for (let i = this.heap.length >> 1; i >= 0; i--)\n heapBubble(this.heap, i);\n this.next();\n return this;\n }\n forward(pos, side) {\n for (let cur of this.heap)\n cur.forward(pos, side);\n for (let i = this.heap.length >> 1; i >= 0; i--)\n heapBubble(this.heap, i);\n if ((this.to - pos || this.value.endSide - side) < 0)\n this.next();\n }\n next() {\n if (this.heap.length == 0) {\n this.from = this.to = 1000000000 /* C.Far */;\n this.value = null;\n this.rank = -1;\n }\n else {\n let top = this.heap[0];\n this.from = top.from;\n this.to = top.to;\n this.value = top.value;\n this.rank = top.rank;\n if (top.value)\n top.next();\n heapBubble(this.heap, 0);\n }\n }\n}\nfunction heapBubble(heap, index) {\n for (let cur = heap[index];;) {\n let childIndex = (index << 1) + 1;\n if (childIndex >= heap.length)\n break;\n let child = heap[childIndex];\n if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) {\n child = heap[childIndex + 1];\n childIndex++;\n }\n if (cur.compare(child) < 0)\n break;\n heap[childIndex] = cur;\n heap[index] = child;\n index = childIndex;\n }\n}\nclass SpanCursor {\n constructor(sets, skip, minPoint) {\n this.minPoint = minPoint;\n this.active = [];\n this.activeTo = [];\n this.activeRank = [];\n this.minActive = -1;\n // A currently active point range, if any\n this.point = null;\n this.pointFrom = 0;\n this.pointRank = 0;\n this.to = -1000000000 /* C.Far */;\n this.endSide = 0;\n // The amount of open active ranges at the start of the iterator.\n // Not including points.\n this.openStart = -1;\n this.cursor = HeapCursor.from(sets, skip, minPoint);\n }\n goto(pos, side = -1000000000 /* C.Far */) {\n this.cursor.goto(pos, side);\n this.active.length = this.activeTo.length = this.activeRank.length = 0;\n this.minActive = -1;\n this.to = pos;\n this.endSide = side;\n this.openStart = -1;\n this.next();\n return this;\n }\n forward(pos, side) {\n while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0)\n this.removeActive(this.minActive);\n this.cursor.forward(pos, side);\n }\n removeActive(index) {\n remove(this.active, index);\n remove(this.activeTo, index);\n remove(this.activeRank, index);\n this.minActive = findMinIndex(this.active, this.activeTo);\n }\n addActive(trackOpen) {\n let i = 0, { value, to, rank } = this.cursor;\n // Organize active marks by rank first, then by size\n while (i < this.activeRank.length && (rank - this.activeRank[i] || to - this.activeTo[i]) > 0)\n i++;\n insert(this.active, i, value);\n insert(this.activeTo, i, to);\n insert(this.activeRank, i, rank);\n if (trackOpen)\n insert(trackOpen, i, this.cursor.from);\n this.minActive = findMinIndex(this.active, this.activeTo);\n }\n // After calling this, if `this.point` != null, the next range is a\n // point. Otherwise, it's a regular range, covered by `this.active`.\n next() {\n let from = this.to, wasPoint = this.point;\n this.point = null;\n let trackOpen = this.openStart < 0 ? [] : null;\n for (;;) {\n let a = this.minActive;\n if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) {\n if (this.activeTo[a] > from) {\n this.to = this.activeTo[a];\n this.endSide = this.active[a].endSide;\n break;\n }\n this.removeActive(a);\n if (trackOpen)\n remove(trackOpen, a);\n }\n else if (!this.cursor.value) {\n this.to = this.endSide = 1000000000 /* C.Far */;\n break;\n }\n else if (this.cursor.from > from) {\n this.to = this.cursor.from;\n this.endSide = this.cursor.startSide;\n break;\n }\n else {\n let nextVal = this.cursor.value;\n if (!nextVal.point) { // Opening a range\n this.addActive(trackOpen);\n this.cursor.next();\n }\n else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) {\n // Ignore any non-empty points that end precisely at the end of the prev point\n this.cursor.next();\n }\n else { // New point\n this.point = nextVal;\n this.pointFrom = this.cursor.from;\n this.pointRank = this.cursor.rank;\n this.to = this.cursor.to;\n this.endSide = nextVal.endSide;\n this.cursor.next();\n this.forward(this.to, this.endSide);\n break;\n }\n }\n }\n if (trackOpen) {\n this.openStart = 0;\n for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--)\n this.openStart++;\n }\n }\n activeForPoint(to) {\n if (!this.active.length)\n return this.active;\n let active = [];\n for (let i = this.active.length - 1; i >= 0; i--) {\n if (this.activeRank[i] < this.pointRank)\n break;\n if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide)\n active.push(this.active[i]);\n }\n return active.reverse();\n }\n openEnd(to) {\n let open = 0;\n for (let i = this.activeTo.length - 1; i >= 0 && this.activeTo[i] > to; i--)\n open++;\n return open;\n }\n}\nfunction compare(a, startA, b, startB, length, comparator) {\n a.goto(startA);\n b.goto(startB);\n let endB = startB + length;\n let pos = startB, dPos = startB - startA;\n for (;;) {\n let diff = (a.to + dPos) - b.to || a.endSide - b.endSide;\n let end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB);\n if (a.point || b.point) {\n if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) &&\n sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to))))\n comparator.comparePoint(pos, clipEnd, a.point, b.point);\n }\n else {\n if (clipEnd > pos && !sameValues(a.active, b.active))\n comparator.compareRange(pos, clipEnd, a.active, b.active);\n }\n if (end > endB)\n break;\n pos = end;\n if (diff <= 0)\n a.next();\n if (diff >= 0)\n b.next();\n }\n}\nfunction sameValues(a, b) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (a[i] != b[i] && !a[i].eq(b[i]))\n return false;\n return true;\n}\nfunction remove(array, index) {\n for (let i = index, e = array.length - 1; i < e; i++)\n array[i] = array[i + 1];\n array.pop();\n}\nfunction insert(array, index, value) {\n for (let i = array.length - 1; i >= index; i--)\n array[i + 1] = array[i];\n array[index] = value;\n}\nfunction findMinIndex(value, array) {\n let found = -1, foundPos = 1000000000 /* C.Far */;\n for (let i = 0; i < array.length; i++)\n if ((array[i] - foundPos || value[i].endSide - value[found].endSide) < 0) {\n found = i;\n foundPos = array[i];\n }\n return found;\n}\n\n/**\nCount the column position at the given offset into the string,\ntaking extending characters and tab size into account.\n*/\nfunction countColumn(string, tabSize, to = string.length) {\n let n = 0;\n for (let i = 0; i < to;) {\n if (string.charCodeAt(i) == 9) {\n n += tabSize - (n % tabSize);\n i++;\n }\n else {\n n++;\n i = findClusterBreak(string, i);\n }\n }\n return n;\n}\n/**\nFind the offset that corresponds to the given column position in a\nstring, taking extending characters and tab size into account. By\ndefault, the string length is returned when it is too short to\nreach the column. Pass `strict` true to make it return -1 in that\nsituation.\n*/\nfunction findColumn(string, col, tabSize, strict) {\n for (let i = 0, n = 0;;) {\n if (n >= col)\n return i;\n if (i == string.length)\n break;\n n += string.charCodeAt(i) == 9 ? tabSize - (n % tabSize) : 1;\n i = findClusterBreak(string, i);\n }\n return strict === true ? -1 : string.length;\n}\n\nexport { Annotation, AnnotationType, ChangeDesc, ChangeSet, CharCategory, Compartment, EditorSelection, EditorState, Facet, Line, MapMode, Prec, Range, RangeSet, RangeSetBuilder, RangeValue, SelectionRange, StateEffect, StateEffectType, StateField, Text, Transaction, codePointAt, codePointSize, combineConfig, countColumn, findClusterBreak, findColumn, fromCodePoint };\n","const C = \"\\u037c\"\nconst COUNT = typeof Symbol == \"undefined\" ? \"__\" + C : Symbol.for(C)\nconst SET = typeof Symbol == \"undefined\" ? \"__styleSet\" + Math.floor(Math.random() * 1e8) : Symbol(\"styleSet\")\nconst top = typeof globalThis != \"undefined\" ? globalThis : typeof window != \"undefined\" ? window : {}\n\n// :: - Style modules encapsulate a set of CSS rules defined from\n// JavaScript. Their definitions are only available in a given DOM\n// root after it has been _mounted_ there with `StyleModule.mount`.\n//\n// Style modules should be created once and stored somewhere, as\n// opposed to re-creating them every time you need them. The amount of\n// CSS rules generated for a given DOM root is bounded by the amount\n// of style modules that were used. So to avoid leaking rules, don't\n// create these dynamically, but treat them as one-time allocations.\nexport class StyleModule {\n // :: (Object + + `}function fke(t,e={}){jn(e);const n=e.createDocument(),i={alignment:t.__alignment,buttonText:t.__buttonText,header:t.__header,subheader:t.__subheader,disclaimer:t.__disclaimer,backgroundImageSrc:t.__backgroundImageSrc,backgroundSize:t.__backgroundSize,backgroundColor:t.__backgroundColor,buttonColor:t.__buttonColor,labels:t.__labels,layout:t.__layout,textColor:t.__textColor,buttonTextColor:t.__buttonTextColor,successMessage:t.__successMessage,swapped:t.__swapped};if(e.target==="email")return{element:n.createElement("div")};const r=uke(i),o=n.createElement("div");if(o.innerHTML=r==null?void 0:r.trim(),i.header===""){const s=o.querySelector(".kg-signup-card-heading");s&&s.remove()}if(i.subheader===""){const s=o.querySelector(".kg-signup-card-subheading");s&&s.remove()}if(i.disclaimer===""){const s=o.querySelector(".kg-signup-card-disclaimer");s&&s.remove()}return{element:o.firstElementChild}}function dke(t){let e=["kg-card kg-signup-card"];return t.layout&&t.layout!=="split"&&e.push(`kg-width-${t.layout}`),t.layout==="split"&&e.push("kg-layout-split kg-width-full"),t.swapped&&t.layout==="split"&&e.push("kg-swapped"),t.layout&&t.layout==="full"&&e.push("kg-content-wide"),t.layout==="split"&&t.backgroundSize==="contain"&&e.push("kg-content-wide"),e}const hke=t=>t.layout==="split"&&t.backgroundColor==="accent"||t.layout!=="split"&&!t.backgroundImageSrc&&t.backgroundColor==="accent"?"kg-style-accent":"";let rm=class extends Rn({nodeType:"signup",properties:[{name:"alignment",default:"left"},{name:"backgroundColor",default:"#F0F0F0"},{name:"backgroundImageSrc",default:""},{name:"backgroundSize",default:"cover"},{name:"textColor",default:""},{name:"buttonColor",default:"accent"},{name:"buttonTextColor",default:"#FFFFFF"},{name:"buttonText",default:"Subscribe"},{name:"disclaimer",default:"",wordCount:!0},{name:"header",default:"",wordCount:!0},{name:"labels",default:[]},{name:"layout",default:"wide"},{name:"subheader",default:"",wordCount:!0},{name:"successMessage",default:"Email sent! Check your inbox to complete your signup."},{name:"swapped",default:!1}],defaultRenderFn:fke}){constructor({alignment:e,backgroundColor:n,backgroundImageSrc:i,backgroundSize:r,textColor:o,buttonColor:s,buttonTextColor:a,buttonText:l,disclaimer:u,header:f,labels:d,layout:h,subheader:g,successMessage:m,swapped:y}={},x){super(x),this.__alignment=e||"left",this.__backgroundColor=n||"#F0F0F0",this.__backgroundImageSrc=i||"",this.__backgroundSize=r||"cover",this.__textColor=n==="transparent"&&(h==="split"||!i)?"":o||"#000000",this.__buttonColor=s||"accent",this.__buttonTextColor=a||"#FFFFFF",this.__buttonText=l||"Subscribe",this.__disclaimer=u||"",this.__header=f||"",this.__labels=d||[],this.__layout=h||"wide",this.__subheader=g||"",this.__successMessage=m||"Email sent! Check your inbox to complete your signup.",this.__swapped=y||!1}static importDOM(){return lke(this)}setLabels(e){if(!Array.isArray(e)||!e.every(i=>typeof i=="string"))throw new Error("Invalid argument: Expected an array of strings.");const n=this.getWritable();n.__labels=e}addLabel(e){this.getWritable().__labels.push(e)}removeLabel(e){const n=this.getWritable();n.__labels=n.__labels.filter(i=>i!==e)}};const pke=t=>new rm(t);function gke(t){return t instanceof rm}function mke(t,e){jn(e);const n=e.createDocument(),i=t.accentColor,r=t.backgroundColor,o="https://partner.transistor.fm/ghost/embed/{uuid}",s=new URLSearchParams;i&&s.set("color",i.replace(/^#/,"")),r&&s.set("background",r.replace(/^#/,""));const a=s.toString(),l=a?`${o}?${a}`:o,u=n.createElement("iframe");u.setAttribute("width","100%"),u.setAttribute("height","180"),u.setAttribute("frameborder","no"),u.setAttribute("scrolling","no"),u.setAttribute("seamless",""),u.setAttribute("src",l);const f=n.createElement("figure");return f.setAttribute("class","kg-card kg-transistor-card"),f.appendChild(u),Ig({element:f,type:"inner"},t.visibility,e)}const nD={web:{nonMember:!1,memberSegment:es},email:{memberSegment:es}};let om=class extends Rn({nodeType:"transistor",hasVisibility:!0,properties:[{name:"accentColor",default:""},{name:"backgroundColor",default:""}],defaultRenderFn:mke}){constructor(e={},n){super(e,n),e.visibility||(this.__visibility=vP(nD))}static getPropertyDefaults(){const e=super.getPropertyDefaults();return e.visibility=vP(nD),e}isEmpty(){return!1}hasEditMode(){return!0}};const vke=t=>new om(t),bke=t=>t instanceof om,Kb={replace:A.TextNode,with:t=>new Ns(t.__text)};class Ns extends A.TextNode{constructor(e,n){super(e,n)}static getType(){return"extended-text"}static clone(e){return new Ns(e.__text,e.__key)}static importDOM(){const e=A.TextNode.importDOM();return{...e,span:()=>({conversion:kke(e==null?void 0:e.span,yke),priority:1})}}static importJSON(e){return A.TextNode.importJSON(e)}exportJSON(){const e=super.exportJSON();return e.type="extended-text",e}isSimpleText(){return(this.__type==="text"||this.__type==="extended-text")&&this.__mode===0}isInline(){return!0}}function kke(t,e){return n=>{const i=t==null?void 0:t(n);if(!i)return null;const r=i.conversion(n);return r&&{...r,forChild:(o,s)=>{const l=((r==null?void 0:r.forChild)??(u=>u))(o,s);return A.$isTextNode(l)?e(l,n):l}}}}function yke(t,e){var l,u,f,d,h;const n=e,i=n.style.fontWeight==="bold"||((l=n.parentElement)==null?void 0:l.style.fontWeight)==="bold",r=n.style.fontStyle==="italic"||((u=n.parentElement)==null?void 0:u.style.fontStyle)==="italic",o=n.style.textDecoration==="underline"||((f=n.parentElement)==null?void 0:f.style.textDecoration)==="underline",s=n.classList.contains("Strikethrough")||((d=n.parentElement)==null?void 0:d.classList.contains("Strikethrough")),a=n.classList.contains("Highlight")||((h=n.parentElement)==null?void 0:h.classList.contains("Highlight"));return i&&!t.hasFormat("bold")&&(t=t.toggleFormat("bold")),r&&!t.hasFormat("italic")&&(t=t.toggleFormat("italic")),o&&!t.hasFormat("underline")&&(t=t.toggleFormat("underline")),s&&!t.hasFormat("strikethrough")&&(t=t.toggleFormat("strikethrough")),a&&!t.hasFormat("highlight")&&(t=t.toggleFormat("highlight")),t}const Jb={replace:Kt.HeadingNode,with:t=>new ru(t.__tag)};class ru extends Kt.HeadingNode{constructor(e,n){super(e,n)}static getType(){return"extended-heading"}static clone(e){return new ru(e.__tag,e.__key)}static importDOM(){const e=Kt.HeadingNode.importDOM();return{...e,p:wke(e==null?void 0:e.p)}}static importJSON(e){return Kt.HeadingNode.importJSON(e)}exportJSON(){const e=super.exportJSON();return e.type="extended-heading",e}}function wke(t){return e=>{const n=t==null?void 0:t(e);if(n)return n;const i=e,r=i.getAttribute("role")==="heading",o=i.getAttribute("aria-level");if(r&&o){const s=parseInt(o,10);if(s>0&&s<7)return{conversion:()=>({node:new ru(`h${s}`)}),priority:1}}return null}}const dS={replace:Kt.QuoteNode,with:()=>new jc};class jc extends Kt.QuoteNode{constructor(e){super(e)}static getType(){return"extended-quote"}static clone(e){return new jc(e.__key)}static importDOM(){return{...Kt.QuoteNode.importDOM(),blockquote:xke}}static importJSON(e){return Kt.QuoteNode.importJSON(e)}exportJSON(){const e=super.exportJSON();return e.type="extended-quote",e}extractWithChild(){return!0}}function xke(){return{conversion:()=>({node:new jc,after:e=>{const n=[];return e.forEach(i=>{A.$isParagraphNode(i)?(n.length>0&&(n.push(A.$createLineBreakNode()),n.push(A.$createLineBreakNode())),n.push(...i.getChildren())):n.push(i)}),n}}),priority:1}}class ts extends A.TextNode{static getType(){return"tk"}static clone(e){return new ts(e.__text,e.__key)}constructor(e,n){super(e,n)}createDOM(e){var r;const n=super.createDOM(e),i=((r=e.theme.tk)==null?void 0:r.split(" "))||[];return n.classList.add(...i),n.dataset.kgTk=!0,n}static importJSON(e){const n=hS(e.text);return n.setFormat(e.format),n.setDetail(e.detail),n.setMode(e.mode),n.setStyle(e.style),n}exportJSON(){return{...super.exportJSON(),type:"tk"}}canInsertTextBefore(){return!1}isTextEntity(){return!0}}function hS(t){return A.$applyNodeReplacement(new ts(t))}function iD(t){return t instanceof ts}var _ke=` + + +`;class aa extends A.ElementNode{constructor(n,i){super(i);ye(this,"__linkFormat",null);this.__linkFormat=n}static getType(){return"at-link"}static clone(n){return new aa(n.__linkFormat,n.__key)}static importJSON({linkFormat:n}){return pS(n)}exportJSON(){return{...super.exportJSON(),type:"at-link",version:1,linkFormat:this.__linkFormat}}createDOM(n){const i=document.createElement("span"),r=(n.theme.atLink||"").split(" ").filter(Boolean),o=(n.theme.atLinkIcon||"").split(" ").filter(Boolean);i.classList.add(...r);const s=new DOMParser().parseFromString(_ke,"image/svg+xml").documentElement;return s.classList.add(...o),i.appendChild(s),i}updateDOM(){return!1}exportDOM(){return null}static importDOM(){return null}getTextContent(){return""}isInline(){return!0}canBeEmpty(){return!1}setLinkFormat(n){const i=this.getWritable();i.__linkFormat=n}getLinkFormat(){return this.getLatest().__linkFormat}}function pS(t){return A.$applyNodeReplacement(new aa(t))}function Ga(t){return t instanceof aa}class ou extends A.TextNode{constructor(n,i,r){super(n,r);ye(this,"__placeholder",null);ye(this,"defaultPlaceholder","Find a post, tag or author");this.__placeholder=i}static getType(){return"at-link-search"}static clone(n){return new ou(n.__text,n.__placeholder,n.__key)}static importJSON({text:n,placeholder:i}){return sm(n,i)}exportJSON(){return{...super.exportJSON(),type:"at-link-search",version:1,placeholder:this.__placeholder}}createDOM(n){const i=super.createDOM(n);return i.dataset.placeholder="",this.__text?i.dataset.placeholder=this.__placeholder||"":i.dataset.placeholder=this.__placeholder??this.defaultPlaceholder,i.classList.add(...n.theme.atLinkSearch.split(" ")),i}updateDOM(n,i){return this.__text&&(i.dataset.placeholder=this.__placeholder??""),super.updateDOM(...arguments)}exportDOM(){return null}static importDOM(){return null}canHaveFormat(){return!1}setPlaceholder(n){const i=this.getWritable();i.__placeholder=n}getPlaceholder(){return this.getLatest().__placeholder}getChildrenSize(){return 0}getChildAtIndex(){return null}}function sm(t="",e=null){return A.$applyNodeReplacement(new ou(t,e))}function Ka(t){return t instanceof ou}class Fc extends A.TextNode{static getType(){return"zwnj"}static clone(e){return new Fc("",e.__key)}createDOM(e){const n=super.createDOM(e);return n.innerHTML="‌",n}updateDOM(){return!1}exportJSON(){return{...super.exportJSON(),type:"zwnj",version:1}}getTextContent(){return""}isToken(){return!0}}function gS(){return new Fc("")}function zd(t){return t instanceof Fc}var Oke={import:{br:t=>{var s,a;const e=!!t.closest('[id^="docs-internal-guid-"]'),n=(s=t.previousElementSibling)==null?void 0:s.nodeName,i=(a=t.nextElementSibling)==null?void 0:a.nodeName,r=["H1","H2","H3","H4","H5","H6"],o=["UL","OL","DL"];return e&&(n==="P"&&i==="P"||n==="BR"||i==="BR"||[...r,...o].includes(n)&&i==="P"||n==="P"&&[...r,...o].includes(i))?{conversion:()=>null,priority:1}:null}}},Ske={import:{p:t=>!!t.closest('[id^="docs-internal-guid-"]')&&t.textContent===""?{conversion:()=>null,priority:1}:null}};const rD={generateDecoratorNode:Rn,visibility:X1e,rgbToHex:Rc,taggedTemplateFns:Xve},mS={linebreak:Oke,paragraph:Ske},oD={html:{import:{...mS.linebreak.import,...mS.paragraph.import}}},Cke=Object.freeze(Object.defineProperty({__proto__:null,$createAsideNode:jve,$createAtLinkNode:pS,$createAtLinkSearchNode:sm,$createAudioNode:Ove,$createBookmarkNode:pbe,$createButtonNode:lbe,$createCallToActionNode:Ive,$createCalloutNode:Mve,$createCodeBlockNode:rve,$createEmailCtaNode:oke,$createEmailNode:Vbe,$createEmbedNode:Zbe,$createFileNode:xbe,$createGalleryNode:nke,$createHeaderNode:$be,$createHorizontalRuleNode:Wve,$createHtmlNode:qve,$createImageNode:eve,$createMarkdownNode:ave,$createPaywallNode:Pbe,$createProductNode:zbe,$createSignupNode:pke,$createTKNode:hS,$createToggleNode:ebe,$createTransistorNode:vke,$createVideoNode:gve,$createZWNJNode:gS,$isAsideNode:Fve,$isAtLinkNode:Ga,$isAtLinkSearchNode:Ka,$isAudioNode:Sve,$isBookmarkNode:gbe,$isButtonNode:ube,$isCallToActionNode:Lve,$isCalloutNode:$ve,$isCodeBlockNode:ove,$isEmailCtaNode:ske,$isEmailNode:Xbe,$isEmbedNode:qbe,$isFileNode:wbe,$isGalleryNode:ike,$isHeaderNode:Mbe,$isHorizontalRuleNode:Hve,$isHtmlNode:Yve,$isImageNode:tve,$isKoenigCard:Pc,$isMarkdownNode:lve,$isPaywallNode:Dbe,$isProductNode:Bbe,$isSignupNode:gke,$isTKNode:iD,$isToggleNode:tbe,$isTransistorNode:bke,$isVideoNode:mve,$isZWNJNode:zd,AsideNode:Qg,AtLinkNode:aa,AtLinkSearchNode:ou,AudioNode:zg,BookmarkNode:Vg,ButtonNode:Yg,CallToActionNode:Hg,CalloutNode:Bg,CodeBlockNode:Rg,DEFAULT_CONFIG:oD,DEFAULT_NODES:[Ns,Kb,ru,Jb,jc,dS,Rg,Lg,jg,Fg,zg,Bg,Hg,Qg,Ug,Zg,Xg,qg,Yg,Gg,Vg,Kg,Jg,em,tm,nm,im,rm,om,ts,aa,ou,Fc],EmailCtaNode:im,EmailNode:tm,EmbedNode:em,ExtendedHeadingNode:ru,ExtendedQuoteNode:jc,ExtendedTextNode:Ns,FileNode:Xg,GalleryNode:nm,HeaderNode:Gg,HorizontalRuleNode:Ug,HtmlNode:Zg,ImageNode:Lg,KoenigDecoratorNode:rS,MarkdownNode:jg,PaywallNode:Kg,ProductNode:Jg,SignupNode:rm,TKNode:ts,ToggleNode:qg,TransistorNode:om,VideoNode:Fg,ZWNJNode:Fc,extendedHeadingNodeReplacement:Jb,extendedQuoteNodeReplacement:dS,extendedTextNodeReplacement:Kb,serializers:mS,utils:rD},Symbol.toStringTag,{value:"Module"}));class vS extends Qg{createDOM(e){const n=document.createElement("aside");return ut.addClassNamesToElement(n,e.theme.aside),n}insertNewAfter(){const e=A.$createParagraphNode(),n=this.getDirection();return e.setDirection(n),this.insertAfter(e),e}collapseAtStart(){const e=A.$createParagraphNode();return this.getChildren().forEach(i=>e.append(i)),this.replace(e),!0}}function sD(){return new vS}function aD(t){return t instanceof vS}const Eke=t=>J.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t},J.createElement("g",{fill:"none",fillRule:"evenodd"},J.createElement("path",{d:"M32 2.667C32 .889 31.111 0 29.333 0H2.667C1.93 0 1.302.26.78.781.261 1.301 0 1.931 0 2.667v26.666C0 31.111.889 32 2.667 32h26.666C31.111 32 32 31.111 32 29.333V2.667z",fill:"#465961",fillRule:"nonzero"}),J.createElement("path",{stroke:"#FFF",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 12l-4 4.333 4 3.667M21.5 12l4 4.333-4 3.667M18 11l-4 10"}))),lD=T.createContext({}),Tke=({children:t})=>{const[e,n]=T.useState(null),[i,r]=T.useState(!1),[o,s]=T.useState(!1),[a,l]=T.useState(!1),u=T.useMemo(()=>({selectedCardKey:e,setSelectedCardKey:n,isEditingCard:i,setIsEditingCard:r,isDragging:o,setIsDragging:s,showVisibilitySettings:a,setShowVisibilitySettings:l}),[e,n,i,r,o,s,a,l]);return k.jsx(lD.Provider,{value:u,children:t})},zc=()=>T.useContext(lD);function xt({isVisible:t,children:e,...n}){const{isDragging:i}=zc();if(t&&!i)return k.jsx("div",{className:"not-kg-prose absolute left-1/2 top-[-46px] z-[1000] -translate-x-1/2",...n,children:e})}function bS(){return bS=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}let Yt=class Tee{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,i){[e,n]=Bd(this,e,n);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(n,this.length,r,1),la.from(r,this.length-(n-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Bd(this,e,n);let i=[];return this.decompose(e,n,i,0),la.from(i,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new am(this),o=new am(e);for(let s=n,a=n;;){if(r.next(s),o.next(s),s=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(a+=r.value.length,r.done||a>=i)return!0}}iter(e=1){return new am(this,e)}iterRange(e,n=this.length){return new cD(this,e,n)}iterLines(e,n){let i;if(e==null)i=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new fD(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Tee.empty:e.length<=32?new ai(e):la.from(ai.split(e,[]))}};class ai extends Yt{constructor(e,n=Mke(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,i,r){for(let o=0;;o++){let s=this.text[o],a=r+s.length;if((n?i:a)>=e)return new Nke(r,a,i,s);r=a+1,i++}}decompose(e,n,i,r){let o=e<=0&&n>=this.length?this:new ai(uD(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(r&1){let s=i.pop(),a=ek(o.text,s.text.slice(),0,o.length);if(a.length<=32)i.push(new ai(a,s.length+o.length));else{let l=a.length>>1;i.push(new ai(a.slice(0,l)),new ai(a.slice(l)))}}else i.push(o)}replace(e,n,i){if(!(i instanceof ai))return super.replace(e,n,i);[e,n]=Bd(this,e,n);let r=ek(this.text,ek(i.text,uD(this.text,0,e)),n),o=this.length+i.length-(n-e);return r.length<=32?new ai(r,o):la.from(ai.split(r,[]),o)}sliceString(e,n=this.length,i=` +`){[e,n]=Bd(this,e,n);let r="";for(let o=0,s=0;o<=n&&se&&s&&(r+=i),eo&&(r+=a.slice(Math.max(0,e-o),n-o)),o=l+1}return r}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let i=[],r=-1;for(let o of e)i.push(o),r+=o.length+1,i.length==32&&(n.push(new ai(i,r)),i=[],r=-1);return r>-1&&n.push(new ai(i,r)),n}}class la extends Yt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,n,i,r){for(let o=0;;o++){let s=this.children[o],a=r+s.length,l=i+s.lines-1;if((n?l:a)>=e)return s.lineInner(e,n,i,r);r=a+1,i=l+1}}decompose(e,n,i,r){for(let o=0,s=0;s<=n&&o=s){let u=r&((s<=e?1:0)|(l>=n?2:0));s>=e&&l<=n&&!u?i.push(a):a.decompose(e-s,n-s,i,u)}s=l+1}}replace(e,n,i){if([e,n]=Bd(this,e,n),i.lines=o&&n<=a){let l=s.replace(e-o,n-o,i),u=this.lines-s.lines+l.lines;if(l.lines>4&&l.lines>u>>6){let f=this.children.slice();return f[r]=l,new la(f,this.length-(n-e)+i.length)}return super.replace(o,a,l)}o=a+1}return super.replace(e,n,i)}sliceString(e,n=this.length,i=` +`){[e,n]=Bd(this,e,n);let r="";for(let o=0,s=0;oe&&o&&(r+=i),es&&(r+=a.sliceString(e-s,n-s,i)),s=l+1}return r}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof la))return 0;let i=0,[r,o,s,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=n,o+=n){if(r==s||o==a)return i;let l=this.children[r],u=e.children[o];if(l!=u)return i+l.scanIdentical(u,n);i+=l.length+1}}static from(e,n=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let g of e)i+=g.lines;if(i<32){let g=[];for(let m of e)m.flatten(g);return new ai(g,n)}let r=Math.max(32,i>>5),o=r<<1,s=r>>1,a=[],l=0,u=-1,f=[];function d(g){let m;if(g.lines>o&&g instanceof la)for(let y of g.children)d(y);else g.lines>s&&(l>s||!l)?(h(),a.push(g)):g instanceof ai&&l&&(m=f[f.length-1])instanceof ai&&g.lines+m.lines<=32?(l+=g.lines,u+=g.length+1,f[f.length-1]=new ai(m.text.concat(g.text),m.length+1+g.length)):(l+g.lines>r&&h(),l+=g.lines,u+=g.length+1,f.push(g))}function h(){l!=0&&(a.push(f.length==1?f[0]:la.from(f,u)),u=-1,l=f.length=0)}for(let g of e)d(g);return h(),a.length==1?a[0]:new la(a,n)}}Yt.empty=new ai([""],0);function Mke(t){let e=-1;for(let n of t)e+=n.length+1;return e}function ek(t,e,n=0,i=1e9){for(let r=0,o=0,s=!0;o=n&&(l>i&&(a=a.slice(0,i-r)),r0?1:(e instanceof ai?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],o=this.offsets[i],s=o>>1,a=r instanceof ai?r.text.length:r.children.length;if(s==(n>0?a:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(n>0?0:1)){if(this.offsets[i]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(r instanceof ai){let l=r.text[s+(n<0?-1:0)];if(this.offsets[i]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=r.children[s+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof ai?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class cD{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new am(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*n,this.value=r.length<=i?r:n<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class fD{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:r}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Yt.prototype[Symbol.iterator]=function(){return this.iter()},am.prototype[Symbol.iterator]=cD.prototype[Symbol.iterator]=fD.prototype[Symbol.iterator]=function(){return this});class Nke{constructor(e,n,i,r){this.from=e,this.to=n,this.number=i,this.text=r}get length(){return this.to-this.from}}function Bd(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}let Wd="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=1;tt)return Wd[e-1]<=t;return!1}function dD(t){return t>=127462&&t<=127487}const hD=8205;function Ki(t,e,n=!0,i=!0){return(n?pD:Pke)(t,e,i)}function pD(t,e,n){if(e==t.length)return e;e&&gD(t.charCodeAt(e))&&mD(t.charCodeAt(e-1))&&e--;let i=Ji(t,e);for(e+=ns(i);e=0&&dD(Ji(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function Pke(t,e,n){for(;e>0;){let i=pD(t,e-2,n);if(i=56320&&t<57344}function mD(t){return t>=55296&&t<56320}function Ji(t,e){let n=t.charCodeAt(e);if(!mD(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return gD(i)?(n-55296<<10)+(i-56320)+65536:n}function kS(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function ns(t){return t<65536?1:2}const yS=/\r\n?|\n/;var er=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(er||(er={}));class ua{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return o+(e-r);o+=a}else{if(i!=er.Simple&&u>=e&&(i==er.TrackDel&&re||i==er.TrackBefore&&re))return null;if(u>e||u==e&&n<0&&!a)return e==r||n<0?o:o+l;o+=l}r=u}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,n=e){for(let i=0,r=0;i=0&&r<=n&&a>=e)return rn?"cover":!0;r=a}return!1}toString(){let e="";for(let n=0;n=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ua(e)}static create(e){return new ua(e)}}class Ci extends ua{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return wS(this,(n,i,r,o,s)=>e=e.replace(r,r+(i-n),s),!1),e}mapDesc(e,n=!1){return xS(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let r=0,o=0;r=0){n[r]=a,n[r+1]=s;let l=r>>1;for(;i.length0&&su(i,n,o.text),o.forward(f),a+=f}let u=e[s++];for(;a>1].toJSON()))}return e}static of(e,n,i){let r=[],o=[],s=0,a=null;function l(f=!1){if(!f&&!r.length)return;sh||d<0||h>n)throw new RangeError(`Invalid change range ${d} to ${h} (in doc of length ${n})`);let m=g?typeof g=="string"?Yt.of(g.split(i||yS)):g:Yt.empty,y=m.length;if(d==h&&y==0)return;ds&&xr(r,d-s,-1),xr(r,h-d,y),su(o,r,m),s=h}}return u(e),l(!a),a}static empty(e){return new Ci(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let r=0;ra&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)n.push(o[0],0);else{for(;i.length=0&&n<=0&&n==t[r+1]?t[r]+=e:e==0&&t[r]==0?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function su(t,e,n){if(n.length==0)return;let i=e.length-2>>1;if(i>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(r,u,o,f,d),r=u,o=f}}}function xS(t,e,n,i=!1){let r=[],o=i?[]:null,s=new lm(t),a=new lm(e);for(let l=-1;;)if(s.ins==-1&&a.ins==-1){let u=Math.min(s.len,a.len);xr(r,u,-1),s.forward(u),a.forward(u)}else if(a.ins>=0&&(s.ins<0||l==s.i||s.off==0&&(a.len=0&&l=0){let u=0,f=s.len;for(;f;)if(a.ins==-1){let d=Math.min(f,a.len);u+=d,f-=d,a.forward(d)}else if(a.ins==0&&a.lenl||s.ins>=0&&s.len>l)&&(a||i.length>u),o.forward2(l),s.forward(l)}}}}class lm{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?Yt.empty:e[n]}textBit(e){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!e?Yt.empty:n[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Bc{constructor(e,n,i){this.from=e,this.to=n,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,n):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new Bc(i,r,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return he.range(e,n);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return he.range(this.anchor,i)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return he.range(e.anchor,e.head)}static create(e,n,i){return new Bc(e,n,i)}}class he{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:he.create(this.ranges.map(i=>i.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new he(e.ranges.map(n=>Bc.fromJSON(n)),e.main)}static single(e,n=e){return new he([he.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;re?8:0)|o)}static normalized(e,n=0){let i=e[n];e.sort((r,o)=>r.from-o.from),n=e.indexOf(i);for(let r=1;ro.head?he.range(l,a):he.range(a,l))}}return new he(e,n)}}function bD(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let _S=0;class Qe{constructor(e,n,i,r,o){this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=_S++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Qe(e.combine||(n=>n),e.compareInput||((n,i)=>n===i),e.compare||(e.combine?(n,i)=>n===i:OS),!!e.static,e.enables)}of(e){return new tk([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new tk(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new tk(e,this,2,n)}from(e,n){return n||(n=i=>i),this.compute([e],i=>n(i.field(e)))}}function OS(t,e){return t==e||t.length==e.length&&t.every((n,i)=>n===e[i])}class tk{constructor(e,n,i,r){this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=_S++}dynamicSlot(e){var n;let i=this.value,r=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,u=!1,f=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?u=!0:((n=e[d.id])!==null&&n!==void 0?n:1)&1||f.push(e[d.id]);return{create(d){return d.values[s]=i(d),1},update(d,h){if(l&&h.docChanged||u&&(h.docChanged||h.selection)||SS(d,f)){let g=i(d);if(a?!kD(g,d.values[s],r):!r(g,d.values[s]))return d.values[s]=g,1}return 0},reconfigure:(d,h)=>{let g,m=h.config.address[o];if(m!=null){let y=rk(h,m);if(this.dependencies.every(x=>x instanceof Qe?h.facet(x)===d.facet(x):x instanceof zi?h.field(x,!1)==d.field(x,!1):!0)||(a?kD(g=i(d),y,r):r(g=i(d),y)))return d.values[s]=y,0}else g=i(d);return d.values[s]=g,1}}}}function kD(t,e,n){if(t.length!=e.length)return!1;for(let i=0;it[l.id]),r=n.map(l=>l.type),o=i.filter(l=>!(l&1)),s=t[e.id]>>1;function a(l){let u=[];for(let f=0;fi===r),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(yD).find(i=>i.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,r)=>{let o=i.values[n],s=this.updateF(o,r);return this.compareF(o,s)?0:(i.values[n]=s,1)},reconfigure:(i,r)=>r.config.address[this.id]!=null?(i.values[n]=r.field(this),0):(i.values[n]=this.create(i),1)}}init(e){return[this,yD.of({field:this,create:e})]}get extension(){return this}}const Wc={lowest:4,low:3,default:2,high:1,highest:0};function um(t){return e=>new wD(e,t)}const Hc={highest:um(Wc.highest),high:um(Wc.high),default:um(Wc.default),low:um(Wc.low),lowest:um(Wc.lowest)};class wD{constructor(e,n){this.inner=e,this.prec=n}}class nk{of(e){return new CS(this,e)}reconfigure(e){return nk.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class CS{constructor(e,n){this.compartment=e,this.inner=n}}class ik{constructor(e,n,i,r,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,i){let r=[],o=Object.create(null),s=new Map;for(let h of Ike(e,n,s))h instanceof zi?r.push(h):(o[h.facet.id]||(o[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],u=[];for(let h of r)a[h.id]=u.length<<1,u.push(g=>h.slot(g));let f=i==null?void 0:i.config.facets;for(let h in o){let g=o[h],m=g[0].facet,y=f&&f[h]||[];if(g.every(x=>x.type==0))if(a[m.id]=l.length<<1|1,OS(y,g))l.push(i.facet(m));else{let x=m.combine(g.map(_=>_.value));l.push(i&&m.compare(x,i.facet(m))?i.facet(m):x)}else{for(let x of g)x.type==0?(a[x.id]=l.length<<1|1,l.push(x.value)):(a[x.id]=u.length<<1,u.push(_=>x.dynamicSlot(_)));a[m.id]=u.length<<1,u.push(x=>Dke(x,m,g))}}let d=u.map(h=>h(a));return new ik(e,s,d,a,l,o)}}function Ike(t,e,n){let i=[[],[],[],[],[]],r=new Map;function o(s,a){let l=r.get(s);if(l!=null){if(l<=a)return;let u=i[l].indexOf(s);u>-1&&i[l].splice(u,1),s instanceof CS&&n.delete(s.compartment)}if(r.set(s,a),Array.isArray(s))for(let u of s)o(u,a);else if(s instanceof CS){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(s.compartment)||s.inner;n.set(s.compartment,u),o(u,a)}else if(s instanceof wD)o(s.inner,s.prec);else if(s instanceof zi)i[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof tk)i[a].push(s),s.facet.extensions&&o(s.facet.extensions,Wc.default);else{let u=s.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(u,a)}}return o(t,Wc.default),i.reduce((s,a)=>s.concat(a))}function cm(t,e){if(e&1)return 2;let n=e>>1,i=t.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function rk(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const xD=Qe.define(),ES=Qe.define({combine:t=>t.some(e=>e),static:!0}),_D=Qe.define({combine:t=>t.length?t[0]:void 0,static:!0}),OD=Qe.define(),SD=Qe.define(),CD=Qe.define(),ED=Qe.define({combine:t=>t.length?t[0]:!1});class ca{constructor(e,n){this.type=e,this.value=n}static define(){return new Lke}}class Lke{of(e){return new ca(this,e)}}class Rke{constructor(e){this.map=e}of(e){return new _t(this,e)}}class _t{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new _t(this.type,n)}is(e){return this.type==e}static define(e={}){return new Rke(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let i=[];for(let r of e){let o=r.map(n);o&&i.push(o)}return i}}_t.reconfigure=_t.define(),_t.appendConfig=_t.define();let jr=class ev{constructor(e,n,i,r,o,s){this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&bD(i,n.newLength),o.some(a=>a.type==ev.time)||(this.annotations=o.concat(ev.time.of(Date.now())))}static create(e,n,i,r,o,s){return new ev(e,n,i,r,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(ev.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}};jr.time=ca.define(),jr.userEvent=ca.define(),jr.addToHistory=ca.define(),jr.remote=ca.define();function jke(t,e){let n=[];for(let i=0,r=0;;){let o,s;if(i=t[i]))o=t[i++],s=t[i++];else if(r=0;r--){let o=i[r](t);o instanceof jr?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof jr?t=o[0]:t=$D(e,Hd(o),!1)}return t}function zke(t){let e=t.startState,n=e.facet(CD),i=t;for(let r=n.length-1;r>=0;r--){let o=n[r](t);o&&Object.keys(o).length&&(i=TD(i,TS(e,o,t.changes.newLength),!0))}return i==t?t:jr.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}const Bke=[];function Hd(t){return t==null?Bke:Array.isArray(t)?t:[t]}var Nn=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Nn||(Nn={}));const Wke=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let $S;try{$S=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Hke(t){if($S)return $S.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||Wke.test(n)))return!0}return!1}function Qke(t){return e=>{if(!/\S/.test(e))return Nn.Space;if(Hke(e))return Nn.Word;for(let n=0;n-1)return Nn.Word;return Nn.Other}}class jt{constructor(e,n,i,r,o,s){this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;ar.set(u,l)),n=null),r.set(a.value.compartment,a.value.extension)):a.is(_t.reconfigure)?(n=null,i=a.value):a.is(_t.appendConfig)&&(n=null,i=Hd(i).concat(a.value));let o;n?o=e.startState.values.slice():(n=ik.resolve(i,r,this),o=new jt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,u)=>u.reconfigure(l,this),null).values);let s=e.startState.facet(ES)?e.newSelection:e.newSelection.asSingle();new jt(n,e.newDoc,s,o,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:he.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,i=e(n.ranges[0]),r=this.changes(i.changes),o=[i.range],s=Hd(i.effects);for(let a=1;as.spec.fromJSON(a,l)))}}return jt.create({doc:e.doc,selection:he.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(e={}){let n=ik.resolve(e.extensions||[],new Map),i=e.doc instanceof Yt?e.doc:Yt.of((e.doc||"").split(n.staticFacet(jt.lineSeparator)||yS)),r=e.selection?e.selection instanceof he?e.selection:he.single(e.selection.anchor,e.selection.head):he.single(0);return bD(r,i.length),n.staticFacet(ES)||(r=r.asSingle()),new jt(n,i,r,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(jt.tabSize)}get lineBreak(){return this.facet(jt.lineSeparator)||` +`}get readOnly(){return this.facet(ED)}phrase(e,...n){for(let i of this.facet(jt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>n.length?i:n[o-1]})),e}languageDataAt(e,n,i=-1){let r=[];for(let o of this.facet(xD))for(let s of o(this,n,i))Object.prototype.hasOwnProperty.call(s,e)&&r.push(s[e]);return r}charCategorizer(e){return Qke(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:i,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-i,a=e-i;for(;s>0;){let l=Ki(n,s,!1);if(o(n.slice(l,s))!=Nn.Word)break;s=l}for(;at.length?t[0]:4}),jt.lineSeparator=_D,jt.readOnly=ED,jt.phrases=Qe.define({compare(t,e){let n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every(r=>t[r]==e[r])}}),jt.languageData=xD,jt.changeFilter=OD,jt.transactionFilter=SD,jt.transactionExtender=CD,nk.reconfigure=_t.define();function fa(t,e,n={}){let i={};for(let r of t)for(let o of Object.keys(r)){let s=r[o],a=i[o];if(a===void 0)i[o]=s;else if(!(a===s||s===void 0))if(Object.hasOwnProperty.call(n,o))i[o]=n[o](a,s);else throw new Error("Config merge conflict for field "+o)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}class Qc{eq(e){return this==e}range(e,n=e){return MS.create(e,n,this)}}Qc.prototype.startSide=Qc.prototype.endSide=0,Qc.prototype.point=!1,Qc.prototype.mapMode=er.TrackDel;let MS=class $ee{constructor(e,n,i){this.from=e,this.to=n,this.value=i}static create(e,n,i){return new $ee(e,n,i)}};function NS(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class AS{constructor(e,n,i,r){this.from=e,this.to=n,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,n,i,r=0){let o=i?this.to:this.from;for(let s=r,a=o.length;;){if(s==a)return s;let l=s+a>>1,u=o[l]-e||(i?this.value[l].endSide:this.value[l].startSide)-n;if(l==s)return u>=0?s:a;u>=0?a=l:s=l+1}}between(e,n,i,r){for(let o=this.findIndex(n,-1e9,!0),s=this.findIndex(i,1e9,!1,o);og||h==g&&u.startSide>0&&u.endSide<=0)continue;(g-h||u.endSide-u.startSide)<0||(s<0&&(s=h),u.point&&(a=Math.max(a,g-h)),i.push(u),r.push(h-s),o.push(g-s))}return{mapped:i.length?new AS(r,o,i,a):null,pos:s}}}class zt{constructor(e,n,i,r){this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=r}static create(e,n,i,r){return new zt(e,n,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:i=!1,filterFrom:r=0,filterTo:o=this.length}=e,s=e.filter;if(n.length==0&&!s)return this;if(i&&(n=n.slice().sort(NS)),this.isEmpty)return n.length?zt.of(n):this;let a=new ND(this,null,-1).goto(0),l=0,u=[],f=new au;for(;a.value||l=0){let d=n[l++];f.addInner(d.from,d.to,d.value)||u.push(d)}else a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||oa.to||o=o&&e<=o+s.length&&s.between(o,e-o,n-o,i)===!1)return}this.nextLayer.between(e,n,i)}}iter(e=0){return fm.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return fm.from(e).goto(n)}static compare(e,n,i,r,o=-1){let s=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),l=MD(s,a,i),u=new dm(s,l,o),f=new dm(a,l,o);i.iterGaps((d,h,g)=>AD(u,d,f,h,g,r)),i.empty&&i.length==0&&AD(u,0,f,0,0,r)}static eq(e,n,i=0,r){r==null&&(r=999999999);let o=e.filter(f=>!f.isEmpty&&n.indexOf(f)<0),s=n.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let a=MD(o,s),l=new dm(o,a,0).goto(i),u=new dm(s,a,0).goto(i);for(;;){if(l.to!=u.to||!DS(l.active,u.active)||l.point&&(!u.point||!l.point.eq(u.point)))return!1;if(l.to>r)return!0;l.next(),u.next()}}static spans(e,n,i,r,o=-1){let s=new dm(e,null,o).goto(n),a=n,l=s.openStart;for(;;){let u=Math.min(s.to,i);if(s.point){let f=s.activeForPoint(s.to),d=s.pointFroma&&(r.span(a,u,s.active,l),l=s.openEnd(u));if(s.to>i)return l+(s.point&&s.to>i?1:0);a=s.to,s.next()}}static of(e,n=!1){let i=new au;for(let r of e instanceof MS?[e]:n?Uke(e):e)i.add(r.from,r.to,r.value);return i.finish()}static join(e){if(!e.length)return zt.empty;let n=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let r=e[i];r!=zt.empty;r=r.nextLayer)n=new zt(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}zt.empty=new zt([],[],null,-1);function Uke(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(NS);e=i}return t}zt.empty.nextLayer=zt.empty;class au{finishChunk(e){this.chunks.push(new AS(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new au)).add(e,n,i)}addInner(e,n,i){let r=e-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=n,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let i=n.value.length-1;return this.last=n.value[i],this.lastFrom=n.from[i]+e,this.lastTo=n.to[i]+e,!0}finish(){return this.finishInner(zt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=zt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function MD(t,e,n){let i=new Map;for(let o of t)for(let s=0;s=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&r.push(new ND(s,n,i,o));return r.length==1?r[0]:new fm(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let i of this.heap)i.goto(e,n);for(let i=this.heap.length>>1;i>=0;i--)PS(this.heap,i);return this.next(),this}forward(e,n){for(let i of this.heap)i.forward(e,n);for(let i=this.heap.length>>1;i>=0;i--)PS(this.heap,i);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),PS(this.heap,0)}}}function PS(t,e){for(let n=t[e];;){let i=(e<<1)+1;if(i>=t.length)break;let r=t[i];if(i+1=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}class dm{constructor(e,n,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=fm.from(e,n,i)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){ok(this.active,e),ok(this.activeTo,e),ok(this.activeRank,e),this.minActive=PD(this.active,this.activeTo)}addActive(e){let n=0,{value:i,to:r,rank:o}=this.cursor;for(;n0;)n++;sk(this.active,n,i),sk(this.activeTo,n,r),sk(this.activeRank,n,o),e&&sk(e,n,this.cursor.from),this.minActive=PD(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&ok(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&i[r]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&n.push(this.active[i]);return n.reverse()}openEnd(e){let n=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)n++;return n}}function AD(t,e,n,i,r,o){t.goto(e),n.goto(i);let s=i+r,a=i,l=i-e;for(;;){let u=t.to+l-n.to||t.endSide-n.endSide,f=u<0?t.to+l:n.to,d=Math.min(f,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&DS(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(a,d,t.point,n.point):d>a&&!DS(t.active,n.active)&&o.compareRange(a,d,t.active,n.active),f>s)break;a=f,u<=0&&t.next(),u>=0&&n.next()}}function DS(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;i--)t[i+1]=t[i];t[e]=n}function PD(t,e){let n=-1,i=1e9;for(let r=0;r=e)return r;if(r==t.length)break;o+=t.charCodeAt(r)==9?n-o%n:1,r=Ki(t,r)}return i===!0?-1:t.length}const LS="ͼ",DD=typeof Symbol>"u"?"__"+LS:Symbol.for(LS),RS=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ID=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class lu{constructor(e,n){this.rules=[];let{finish:i}=n||{};function r(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,a,l,u){let f=[],d=/^@(\w+)\b/.exec(s[0]),h=d&&d[1]=="keyframes";if(d&&a==null)return l.push(s[0]+";");for(let g in a){let m=a[g];if(/&/.test(g))o(g.split(/,\s*/).map(y=>s.map(x=>y.replace(/&/,x))).reduce((y,x)=>y.concat(x)),m,l);else if(m&&typeof m=="object"){if(!d)throw new RangeError("The value of a property ("+g+") should be a primitive value.");o(r(g),m,f,h)}else m!=null&&f.push(g.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+m+";")}(f.length||h)&&l.push((i&&!d&&!u?s.map(i):s).join(", ")+" {"+f.join(" ")+"}")}for(let s in e)o(r(s),e[s],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=ID[DD]||1;return ID[DD]=e+1,LS+e.toString(36)}static mount(e,n,i){let r=e[RS],o=i&&i.nonce;r?o&&r.setNonce(o):r=new Zke(e,o),r.mount(Array.isArray(n)?n:[n])}}let LD=new Map;class Zke{constructor(e,n){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let o=LD.get(i);if(o)return e.adoptedStyleSheets=[o.sheet,...e.adoptedStyleSheets],e[RS]=o;this.sheet=new r.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],LD.set(i,this)}else{this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);let o=e.head||e;o.insertBefore(this.styleTag,o.firstChild)}this.modules=[],e[RS]=this}mount(e){let n=this.sheet,i=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,s),n)for(let l=0;l",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},qke=typeof navigator<"u"&&/Mac/.test(navigator.platform),Yke=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tr=0;tr<10;tr++)uu[48+tr]=uu[96+tr]=String(tr);for(var tr=1;tr<=24;tr++)uu[tr+111]="F"+tr;for(var tr=65;tr<=90;tr++)uu[tr]=String.fromCharCode(tr+32),hm[tr]=String.fromCharCode(tr);for(var jS in uu)hm.hasOwnProperty(jS)||(hm[jS]=uu[jS]);function Vke(t){var e=qke&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Yke&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?hm:uu)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function ak(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function FS(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Xke(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function lk(t,e){if(!e.anchorNode)return!1;try{return FS(t,e.anchorNode)}catch{return!1}}function Ud(t){return t.nodeType==3?Uc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function pm(t,e,n,i){return n?RD(t,e,n,i,-1)||RD(t,e,n,i,1):!1}function gm(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function RD(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:Ja(t))){if(t.nodeName=="DIV")return!1;let o=t.parentNode;if(!o||o.nodeType!=1)return!1;e=gm(t)+(r<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?Ja(t):0}else return!1}}function Ja(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function uk(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Gke(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function jD(t,e){let n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function Kke(t,e,n,i,r,o,s,a){let l=t.ownerDocument,u=l.defaultView||window;for(let f=t,d=!1;f&&!d;)if(f.nodeType==1){let h,g=f==l.body,m=1,y=1;if(g)h=Gke(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(d=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:m,scaleY:y}=jD(f,S)),h={left:S.left,right:S.left+f.clientWidth*m,top:S.top,bottom:S.top+f.clientHeight*y}}let x=0,_=0;if(r=="nearest")e.top0&&e.bottom>h.bottom+_&&(_=e.bottom-h.bottom+_+s)):e.bottom>h.bottom&&(_=e.bottom-h.bottom+s,n<0&&e.top-_0&&e.right>h.right+x&&(x=e.right-h.right+x+o)):e.right>h.right&&(x=e.right-h.right+o,n<0&&e.leftn.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else if(n.nodeType==11)n=n.host;else break;return null}class eye{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:i}=e;this.set(n,Math.min(e.anchorOffset,n?Ja(n):0),i,Math.min(e.focusOffset,i?Ja(i):0))}set(e,n,i,r){this.anchorNode=e,this.anchorOffset=n,this.focusNode=i,this.focusOffset=r}}let Zd=null;function FD(t){if(t.setActive)return t.setActive();if(Zd)return t.focus(Zd);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Zd==null?{get preventScroll(){return Zd={preventScroll:!0},!0}}:void 0),!Zd){Zd=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}class _r{constructor(e,n,i=!0){this.node=e,this.offset=n,this.precise=i}static before(e,n){return new _r(e.parentNode,gm(e),n)}static after(e,n){return new _r(e.parentNode,gm(e)+1,n)}}const zS=[];class gn{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let i=this.dom,r=null,o;for(let s of this.children){if(s.flags&7){if(!s.dom&&(o=r?r.nextSibling:i.firstChild)){let a=gn.get(o);(!a||!a.parent&&a.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,n),s.flags&=-8}if(o=r?r.nextSibling:i.firstChild,n&&!n.written&&n.node==i&&o!=s.dom&&(n.written=!0),s.dom.parentNode==i)for(;o&&o!=s.dom;)o=HD(o);else i.insertBefore(s.dom,o);r=s.dom}for(o=r?r.nextSibling:i.firstChild,o&&n&&n.node==i&&(n.written=!0);o;)o=HD(o)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,n),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let i;if(e==this.dom)i=this.dom.childNodes[n];else{let r=Ja(e)==0?0:n==0?-1:1;for(;;){let o=e.parentNode;if(o==this.dom)break;r==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?r=-1:r=1),e=o}r<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!gn.get(i);)i=i.nextSibling;if(!i)return this.length;for(let r=0,o=0;;r++){let s=this.children[r];if(s.dom==i)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,n,i=0){let r=-1,o=-1,s=-1,a=-1;for(let l=0,u=i,f=i;ln)return d.domBoundsAround(e,n,u);if(h>=e&&r==-1&&(r=l,o=u),u>n&&d.dom.parentNode==this.dom){s=l,a=f;break}f=h,u=h+d.breakAfter}return{from:o,to:a<0?i+this.length:a,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,i=zS){this.markDirty();for(let r=e;rthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function UD(t,e,n,i,r,o,s,a,l){let{children:u}=t,f=u.length?u[e]:null,d=o.length?o[o.length-1]:null,h=d?d.breakAfter:s;if(!(e==i&&f&&!s&&!h&&o.length<2&&f.merge(n,r,o.length?d:null,n==0,a,l))){if(i0&&(!s&&o.length&&f.merge(n,f.length,o[0],!1,a,0)?f.breakAfter=o.shift().breakAfter:(n2);var Ye={mac:XD||/Mac/.test(To.platform),windows:/Win/.test(To.platform),linux:/Linux|X11/.test(To.platform),ie:ck,ie_version:qD?BS.documentMode||6:HS?+HS[1]:WS?+WS[1]:0,gecko:YD,gecko_version:YD?+(/Firefox\/(\d+)/.exec(To.userAgent)||[0,0])[1]:0,chrome:!!QS,chrome_version:QS?+QS[1]:0,ios:XD,android:/Android\b/.test(To.userAgent),safari:VD,webkit_version:iye?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:BS.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const rye=256;class el extends gn{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,i){return this.flags&8||i&&(!(i instanceof el)||this.length-(n-e)+i.length>rye||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new el(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new _r(this.dom,e)}domBoundsAround(e,n,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return oye(this.dom,e,n)}}class tl extends gn{constructor(e,n=[],i=0){super(),this.mark=e,this.children=n,this.length=i;for(let r of n)r.setParent(this)}setAttrs(e){if(BD(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,i,r,o,s){return i&&(!(i instanceof tl&&i.mark.eq(this.mark))||e&&o<=0||ne&&n.push(i=e&&(r=o),i=l,o++}let s=this.length-e;return this.length=e,r>-1&&(this.children.length=r,this.markDirty()),new tl(this.mark,n,s)}domAtPos(e){return GD(this,e)}coordsAt(e,n){return JD(this,e,n)}}function oye(t,e,n){let i=t.nodeValue.length;e>i&&(e=i);let r=e,o=e,s=0;e==0&&n<0||e==i&&n>=0?Ye.chrome||Ye.gecko||(e?(r--,s=1):o=0)?0:a.length-1];return Ye.safari&&!s&&l.width==0&&(l=Array.prototype.find.call(a,u=>u.width)||l),s?uk(l,s<0):l||null}class cu extends gn{static create(e,n,i){return new cu(e,n,i)}constructor(e,n,i){super(),this.widget=e,this.length=n,this.side=i,this.prevWidget=null}split(e){let n=cu.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,i,r,o,s){return i&&(!(i instanceof cu)||!this.widget.compare(i.widget)||e>0&&o<=0||n0)?_r.before(this.dom):_r.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let s=this.side?this.side<0:e>0;for(let a=s?r.length-1:0;o=r[a],!(e>0?a==0:a==r.length-1||o.top0?_r.before(this.dom):_r.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Yt.empty}get isHidden(){return!0}}el.prototype.children=cu.prototype.children=Yd.prototype.children=zS;function GD(t,e){let n=t.dom,{children:i}=t,r=0;for(let o=0;ro&&e0;o--){let s=i[o-1];if(s.dom.parentNode==n)return s.domAtPos(s.length)}for(let o=r;o0&&e instanceof tl&&r.length&&(i=r[r.length-1])instanceof tl&&i.mark.eq(e.mark)?KD(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function JD(t,e,n){let i=null,r=-1,o=null,s=-1;function a(u,f){for(let d=0,h=0;d=f&&(g.children.length?a(g,f-h):(!o||o.isHidden&&n>0)&&(m>f||h==m&&g.getSide()>0)?(o=g,s=f-h):(h-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(r.indexOf(o)==-1||t[o]!==e[o]))return!1;return!0}function qS(t,e,n){let i=!1;if(e)for(let r in e)n&&r in n||(i=!0,r=="style"?t.style.cssText="":t.removeAttribute(r));if(n)for(let r in n)e&&e[r]==n[r]||(i=!0,r=="style"?t.style.cssText=n[r]:t.setAttribute(r,n[r]));return i}function aye(t){let e=Object.create(null);for(let n=0;n0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){ZS(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){KD(this,e,n)}addLineDeco(e){let n=e.spec.attributes,i=e.spec.class;n&&(this.attrs=US(n,this.attrs||{})),i&&(this.attrs=US({class:i},this.attrs||{}))}domAtPos(e){return GD(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var i;this.dom?this.flags&4&&(BD(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(qS(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let r=this.dom.lastChild;for(;r&&gn.get(r)instanceof tl;)r=r.lastChild;if(!r||!this.length||r.nodeName!="BR"&&((i=gn.get(r))===null||i===void 0?void 0:i.isEditable)==!1&&(!Ye.ios||!this.children.some(o=>o instanceof el))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let i of this.children){if(!(i instanceof el)||/[^ -~]/.test(i.text))return null;let r=Ud(i.dom);if(r.length!=1)return null;e+=r[0].width,n=r[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let i=JD(this,e,n);if(!this.children.length&&i&&this.parent){let{heightOracle:r}=this.parent.view.viewState,o=i.bottom-i.top;if(Math.abs(o-r.lineHeight)<2&&r.textHeight=n){if(o instanceof Ei)return o;if(s>n)break}r=s+o.breakAfter}return null}}class fu extends gn{constructor(e,n,i){super(),this.widget=e,this.length=n,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,n,i,r,o,s){return i&&(!(i instanceof fu)||!this.widget.compare(i.widget)||e>0&&o<=0||n0}}class da{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Fr=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Fr||(Fr={}));class it extends Qc{constructor(e,n,i,r){super(),this.startSide=e,this.endSide=n,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new mm(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return n+=i&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new du(e,n,n,i,e.widget||null,!1)}static replace(e){let n=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:o,end:s}=tI(e,n);i=(o?n?-3e8:-1:5e8)-1,r=(s?n?2e8:1:-6e8)+1}return new du(e,i,r,n,e.widget||null,!0)}static line(e){return new vm(e)}static set(e,n=!1){return zt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}it.none=zt.empty;class mm extends it{constructor(e){let{start:n,end:i}=tI(e);super(n?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,i;return this==e||e instanceof mm&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&ZS(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}mm.prototype.point=!1;class vm extends it{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof vm&&this.spec.class==e.spec.class&&ZS(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}vm.prototype.mapMode=er.TrackBefore,vm.prototype.point=!0;class du extends it{constructor(e,n,i,r,o,s){super(n,i,o,e),this.block=r,this.isReplace=s,this.mapMode=r?n<=0?er.TrackBefore:er.TrackAfter:er.TrackDel}get type(){return this.startSide!=this.endSide?Fr.WidgetRange:this.startSide<=0?Fr.WidgetBefore:Fr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof du&&lye(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}du.prototype.point=!0;function tI(t,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=t;return n==null&&(n=t.inclusive),i==null&&(i=t.inclusive),{start:n??e,end:i??e}}function lye(t,e){return t==e||!!(t&&e&&t.compare(e))}function YS(t,e,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}class bm{constructor(e,n,i,r){this.doc=e,this.pos=n,this.end=i,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof fu&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ei),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(fk(new Yd(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof fu)&&this.getLine()}buildText(e,n,i){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let r=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(n.slice(n.length-i)),this.getLine().append(fk(new el(this.text.slice(this.textOff,this.textOff+r)),n),i),this.atCursorPos=!0,this.textOff+=r,e-=r,i=0}}span(e,n,i,r){this.buildText(n-e,i,r),this.pos=n,this.openStart<0&&(this.openStart=r)}point(e,n,i,r,o,s){if(this.disallowBlockEffectsFor[s]&&i instanceof du){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=n-e;if(i instanceof du)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new fu(i.widget||new nI("div"),a,i));else{let l=cu.create(i.widget||new nI("span"),a,a?0:i.startSide),u=this.atCursorPos&&!l.isEditable&&o<=r.length&&(e0),f=!l.isEditable&&(er.length||i.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!u&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(r),u&&(d.append(fk(new Yd(1),r),o),o=r.length+Math.max(0,o-r.length)),d.append(fk(l,r),o),this.atCursorPos=f,this.pendingBuffer=f?er.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=o)}static build(e,n,i,r,o){let s=new bm(e,n,i,o);return s.openEnd=zt.spans(r,n,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function fk(t,e){for(let n of e)t=new tl(n,[t],t.length);return t}class nI extends da{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}var mn=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(mn||(mn={}));const Zc=mn.LTR,VS=mn.RTL;function iI(t){let e=[];for(let n=0;n=n){if(a.level==i)return s;(o<0||(r!=0?r<0?a.fromn:e[o].level>a.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function oI(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;y-=3)if(ha[y+1]==-g){let x=ha[y+2],_=x&2?r:x&4?x&1?o:r:0;_&&(nn[d]=nn[ha[y]]=_),a=y;break}}else{if(ha.length==189)break;ha[a++]=d,ha[a++]=h,ha[a++]=l}else if((m=nn[d])==2||m==1){let y=m==r;l=y?0:1;for(let x=a-3;x>=0;x-=3){let _=ha[x+2];if(_&2)break;if(y)ha[x+2]|=2;else{if(_&4)break;ha[x+2]|=4}}}}}function pye(t,e,n,i){for(let r=0,o=i;r<=n.length;r++){let s=r?n[r-1].to:t,a=rl;)m==x&&(m=n[--y].from,x=y?n[y-1].to:t),nn[--m]=g;l=f}else o=u,l++}}}function GS(t,e,n,i,r,o,s){let a=i%2?2:1;if(i%2==r%2)for(let l=e,u=0;ll&&s.push(new hu(l,y.from,g));let x=y.direction==Zc!=!(g%2);KS(t,x?i+1:i,r,y.inner,y.from,y.to,s),l=y.to}m=y.to}else{if(m==n||(f?nn[m]!=a:nn[m]==a))break;m++}h?GS(t,l,m,i+1,r,h,s):le;){let f=!0,d=!1;if(!u||l>o[u-1].to){let y=nn[l-1];y!=a&&(f=!1,d=y==16)}let h=!f&&a==1?[]:null,g=f?i:i+1,m=l;e:for(;;)if(u&&m==o[u-1].to){if(d)break e;let y=o[--u];if(!f)for(let x=y.from,_=u;;){if(x==e)break e;if(_&&o[_-1].to==x)x=o[--_].from;else{if(nn[x-1]==a)break e;break}}if(h)h.push(y);else{y.tonn.length;)nn[nn.length]=256;let i=[],r=e==Zc?0:1;return KS(t,r,r,n,0,t.length,i),i}function sI(t){return[new hu(0,t,0)]}let aI="";function mye(t,e,n,i,r){var o;let s=i.head-t.from,a=hu.find(e,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc),l=e[a],u=l.side(r,n);if(s==u){let h=a+=r?1:-1;if(h<0||h>=e.length)return null;l=e[a=h],s=l.side(!r,n),u=l.side(r,n)}let f=Ki(t.text,s,l.forward(r,n));(fl.to)&&(f=u),aI=t.text.slice(Math.min(s,f),Math.max(s,f));let d=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return d&&f==u&&d.level+(r?0:1)t.some(e=>e)}),gI=Qe.define({combine:t=>t.some(e=>e)});class Vd{constructor(e,n="nearest",i="nearest",r=5,o=5,s=!1){this.range=e,this.y=n,this.x=i,this.yMargin=r,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Vd(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Vd(he.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const dk=_t.define({map:(t,e)=>t.map(e)});function is(t,e,n){let i=t.facet(fI);i.length?i[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}const hk=Qe.define({combine:t=>t.length?t[0]:!0});let bye=0;const km=Qe.define();class li{constructor(e,n,i,r,o){this.id=e,this.create=n,this.domEventHandlers=i,this.domEventObservers=r,this.extension=o(this)}static define(e,n){const{eventHandlers:i,eventObservers:r,provide:o,decorations:s}=n||{};return new li(bye++,e,i,r,a=>{let l=[km.of(a)];return s&&l.push(ym.of(u=>{let f=u.plugin(a);return f?s(f):it.none})),o&&l.push(o(a)),l})}static fromClass(e,n){return li.define(i=>new e(i),n)}}class e4{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(i){if(is(n.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(n){is(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(i){is(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const mI=Qe.define(),t4=Qe.define(),ym=Qe.define(),vI=Qe.define(),n4=Qe.define(),bI=Qe.define();function kI(t,e){let n=t.state.facet(bI);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(t):o),r=[];return zt.spans(i,e.from,e.to,{point(){},span(o,s,a,l){let u=o-e.from,f=s-e.from,d=r;for(let h=a.length-1;h>=0;h--,l--){let g=a[h].spec.bidiIsolate,m;if(g==null&&(g=vye(e.text,u,f)),l>0&&d.length&&(m=d[d.length-1]).to==u&&m.direction==g)m.to=f,d=m.inner;else{let y={from:u,to:f,direction:g,inner:[]};d.push(y),d=y.inner}}}}),r}const yI=Qe.define();function wI(t){let e=0,n=0,i=0,r=0;for(let o of t.state.facet(yI)){let s=o(t);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(n=Math.max(n,s.right)),s.top!=null&&(i=Math.max(i,s.top)),s.bottom!=null&&(r=Math.max(r,s.bottom)))}return{left:e,right:n,top:i,bottom:r}}const wm=Qe.define();class rs{constructor(e,n,i,r){this.fromA=e,this.toA=n,this.fromB=i,this.toB=r}join(e){return new rs(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,i=this;for(;n>0;n--){let r=e[n-1];if(!(r.fromA>i.toA)){if(r.toAf)break;o+=2}if(!l)return i;new rs(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),s=l.toA,a=l.toB}}}class pk{constructor(e,n,i){this.view=e,this.state=n,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Ci.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,s,a,l)=>r.push(new rs(o,s,a,l))),this.changedRanges=r}static create(e,n,i){return new pk(e,n,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class xI extends gn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Ei],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new rs(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:u,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let r=-1;this.view.inputState.composing>=0&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!Sye(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let o=r>-1?yye(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:f}=this.hasComposition;i=new rs(u,f,e.changes.mapPos(u,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Ye.ie||Ye.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,a=this.updateDeco(),l=_ye(s,a,e.changes);return i=rs.extendWithRanges(i,l),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,i);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Ye.chrome||Ye.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||r.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to=0?r[s]:null;if(!a)break;let{fromA:l,toA:u,fromB:f,toB:d}=a,h,g,m,y;if(i&&i.range.fromBf){let E=bm.build(this.view.state.doc,f,i.range.fromB,this.decorations,this.dynamicDecorationMap),N=bm.build(this.view.state.doc,i.range.toB,d,this.decorations,this.dynamicDecorationMap);g=E.breakAtStart,m=E.openStart,y=N.openEnd;let M=this.compositionView(i);N.breakAtStart?M.breakAfter=1:N.content.length&&M.merge(M.length,M.length,N.content[0],!1,N.openStart,0)&&(M.breakAfter=N.content[0].breakAfter,N.content.shift()),E.content.length&&M.merge(0,0,E.content[E.content.length-1],!0,0,E.openEnd)&&E.content.pop(),h=E.content.concat(M).concat(N.content)}else({content:h,breakAtStart:g,openStart:m,openEnd:y}=bm.build(this.view.state.doc,f,d,this.decorations,this.dynamicDecorationMap));let{i:x,off:_}=o.findPos(u,1),{i:S,off:C}=o.findPos(l,-1);UD(this,S,C,x,_,h,g,m,y)}i&&this.fixCompositionDOM(i)}compositionView(e){let n=new el(e.text.nodeValue);n.flags|=8;for(let{deco:r}of e.marks)n=new tl(r,[n],n.length);let i=new Ei;return i.append(n,0),i}fixCompositionDOM(e){let n=(o,s)=>{s.flags|=8|(s.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(s);let a=gn.get(o);a&&a!=s&&(a.dom=null),s.setDOM(o)},i=this.childPos(e.range.fromB,1),r=this.children[i.i];n(e.line,r);for(let o=e.marks.length-1;o>=-1;o--)i=r.childPos(i.off,1),r=r.children[i.i],n(o>=0?e.marks[o].node:e.text,r)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,r=i==this.dom,o=!r&&lk(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(r||n||o))return;let s=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(Ye.gecko&&a.empty&&!this.hasComposition&&kye(l)){let d=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(d,l.node.childNodes[l.offset]||null)),l=u=new _r(d,0),s=!0}let f=this.view.observer.selectionRange;(s||!f.focusNode||(!pm(l.node,l.offset,f.anchorNode,f.anchorOffset)||!pm(u.node,u.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{Ye.android&&Ye.chrome&&this.dom.contains(f.focusNode)&&Oye(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=ak(this.view.root);if(d)if(a.empty){if(Ye.gecko){let h=wye(l.node,l.offset);if(h&&h!=3){let g=SI(l.node,l.offset,h==1?1:-1);g&&(l=new _r(g.node,g.offset))}}d.collapse(l.node,l.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(l.node,l.offset);try{d.extend(u.node,u.offset)}catch{}}else{let h=document.createRange();a.anchor>a.head&&([l,u]=[u,l]),h.setEnd(u.node,u.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(l,u)),this.impreciseAnchor=l.precise?null:new _r(f.anchorNode,f.anchorOffset),this.impreciseHead=u.precise?null:new _r(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&pm(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,i=ak(e.root),{anchorNode:r,anchorOffset:o}=e.observer.selectionRange;if(!i||!n.empty||!n.assoc||!i.modify)return;let s=Ei.find(this,n.head);if(!s)return;let a=s.posAtStart;if(n.head==a||n.head==a+s.length)return;let l=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!l||!u||l.bottom>u.top)return;let f=this.domAtPos(n.head+n.assoc);i.collapse(f.node,f.offset),i.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=n.from&&i.collapse(r,o)}moveToLine(e){let n=this.dom,i;if(e.node!=n)return e;for(let r=e.offset;!i&&r=0;r--){let o=gn.get(n.childNodes[r]);o instanceof Ei&&(i=o.domAtPos(o.length))}return i?new _r(i.node,i.offset,!0):e}nearest(e){for(let n=e;n;){let i=gn.get(n);if(i&&i.rootView==this)return i;n=n.parentNode}return null}posFromDOM(e,n){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,n)+i.posAtStart}domAtPos(e){let{i:n,off:i}=this.childCursor().findPos(e,-1);for(;n=0;s--){let a=this.children[s],l=o-a.breakAfter,u=l-a.length;if(le||a.covers(1))&&(!i||a instanceof Ei&&!(i instanceof Ei&&n>=0))&&(i=a,r=u),o=u}return i?i.coordsAt(e-r,n):null}coordsForChar(e){let{i:n,off:i}=this.childPos(e,1),r=this.children[n];if(!(r instanceof Ei))return null;for(;r.children.length;){let{i:a,off:l}=r.childPos(i,1);for(;;a++){if(a==r.children.length)return null;if((r=r.children[a]).length)break}i=l}if(!(r instanceof el))return null;let o=Ki(r.text,i);if(o==i)return null;let s=Uc(r.dom,i,o).getClientRects();for(let a=0;aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==mn.LTR;for(let u=0,f=0;fr)break;if(u>=i){let g=d.dom.getBoundingClientRect();if(n.push(g.height),s){let m=d.dom.lastChild,y=m?Ud(m):[];if(y.length){let x=y[y.length-1],_=l?x.right-g.left:g.right-x.left;_>a&&(a=_,this.minWidth=o,this.minWidthFrom=u,this.minWidthTo=h)}}}u=h+d.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?mn.RTL:mn.LTR}measureTextSize(){for(let o of this.children)if(o instanceof Ei){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),n,i,r;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let o=Ud(e.firstChild)[0];n=e.getBoundingClientRect().height,i=o?o.width/27:7,r=o?o.height:n,e.remove()}),{lineHeight:n,charWidth:i,textHeight:r}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new QD(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let i=0,r=0;;r++){let o=r==n.viewports.length?null:n.viewports[r],s=o?o.from-1:this.length;if(s>i){let a=(n.lineBlockAt(s).bottom-n.lineBlockAt(i).top)/this.view.scaleY;e.push(it.replace({widget:new _I(a),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!o)break;i=o.to+1}return it.set(e)}updateDeco(){let e=this.view.state.facet(ym).map((r,o)=>(this.dynamicDecorationMap[o]=typeof r=="function")?r(this.view):r),n=!1,i=this.view.state.facet(vI).map((r,o)=>{let s=typeof r=="function";return s&&(n=!0),s?r(this.view):r});i.length&&(this.dynamicDecorationMap[e.length]=n,e.push(zt.join(i)));for(let r=e.length;rn.anchor?-1:1),r;if(!i)return;!n.empty&&(r=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let o=wI(this.view),s={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;Kke(this.view.scrollDOM,s,n.head0)i=i.childNodes[r-1],r=Ja(i);else break}if(n>=0)for(let i=t,r=e;;){if(i.nodeType==3)return{node:i,offset:r};if(i.nodeType==1&&r=0)i=i.childNodes[r],r=0;else break}return null}function wye(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(n=!0)}),n}function Cye(t,e,n=1){let i=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(r.length==0)return he.cursor(e);o==0?n=1:o==r.length&&(n=-1);let s=o,a=o;n<0?s=Ki(r.text,o,!1):a=Ki(r.text,o);let l=i(r.text.slice(s,a));for(;s>0;){let u=Ki(r.text,s,!1);if(i(r.text.slice(u,s))!=l)break;s=u}for(;at?e.left-t:Math.max(0,t-e.right)}function Tye(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function i4(t,e){return t.tope.top+1}function CI(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function r4(t,e,n){let i,r,o,s,a=!1,l,u,f,d;for(let m=t.firstChild;m;m=m.nextSibling){let y=Ud(m);for(let x=0;xC||s==C&&o>S){i=m,r=_,o=S,s=C;let E=C?n<_.top?-1:1:S?e<_.left?-1:1:0;a=!E||(E>0?x0)}S==0?n>_.bottom&&(!f||f.bottom<_.bottom)?(l=m,f=_):n<_.top&&(!d||d.top>_.top)&&(u=m,d=_):f&&i4(f,_)?f=EI(f,_.bottom):d&&i4(d,_)&&(d=CI(d,_.top))}}if(f&&f.bottom>=n?(i=l,r=f):d&&d.top<=n&&(i=u,r=d),!i)return{node:t,offset:0};let h=Math.max(r.left,Math.min(r.right,e));if(i.nodeType==3)return TI(i,h,n);if(a&&i.contentEditable!="false")return r4(i,h,n);let g=Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0);return{node:t,offset:g}}function TI(t,e,n){let i=t.nodeValue.length,r=-1,o=1e9,s=0;for(let a=0;an?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&d=(f.left+f.right)/2,g=h;if((Ye.chrome||Ye.gecko)&&Uc(t,a).getBoundingClientRect().left==f.right&&(g=!h),d<=0)return{node:t,offset:a+(g?1:0)};r=a+(g?1:0),o=d}}}return{node:t,offset:r>-1?r:s>0?t.nodeValue.length:0}}function $I(t,e,n,i=-1){var r,o;let s=t.contentDOM.getBoundingClientRect(),a=s.top+t.viewState.paddingTop,l,{docHeight:u}=t.viewState,{x:f,y:d}=e,h=d-a;if(h<0)return 0;if(h>u)return t.state.doc.length;for(let E=t.viewState.heightOracle.textHeight/2,N=!1;l=t.elementAtHeight(h),l.type!=Fr.Text;)for(;h=i>0?l.bottom+E:l.top-E,!(h>=0&&h<=u);){if(N)return n?null:0;N=!0,i=-i}d=a+h;let g=l.from;if(gt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:MI(t,s,l,f,d);let m=t.dom.ownerDocument,y=t.root.elementFromPoint?t.root:m,x=y.elementFromPoint(f,d);x&&!t.contentDOM.contains(x)&&(x=null),x||(f=Math.max(s.left+1,Math.min(s.right-1,f)),x=y.elementFromPoint(f,d),x&&!t.contentDOM.contains(x)&&(x=null));let _,S=-1;if(x&&((r=t.docView.nearest(x))===null||r===void 0?void 0:r.isEditable)!=!1){if(m.caretPositionFromPoint){let E=m.caretPositionFromPoint(f,d);E&&({offsetNode:_,offset:S}=E)}else if(m.caretRangeFromPoint){let E=m.caretRangeFromPoint(f,d);E&&({startContainer:_,startOffset:S}=E,(!t.contentDOM.contains(_)||Ye.safari&&$ye(_,S,f)||Ye.chrome&&Mye(_,S,f))&&(_=void 0))}}if(!_||!t.docView.dom.contains(_)){let E=Ei.find(t.docView,g);if(!E)return h>l.top+l.height/2?l.to:l.from;({node:_,offset:S}=r4(E.dom,f,d))}let C=t.docView.nearest(_);if(!C)return null;if(C.isWidget&&((o=C.dom)===null||o===void 0?void 0:o.nodeType)==1){let E=C.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((r-n.top-(t.defaultLineHeight-a)*.5)/a);o+=l*t.viewState.heightOracle.lineLength}let s=t.state.sliceDoc(n.from,n.to);return n.from+IS(s,o,t.state.tabSize)}function $ye(t,e,n){let i;if(t.nodeType!=3||e!=(i=t.nodeValue.length))return!1;for(let r=t.nextSibling;r;r=r.nextSibling)if(r.nodeType!=1||r.nodeName!="BR")return!1;return Uc(t,i-1,i).getBoundingClientRect().left>n}function Mye(t,e,n){if(e!=0)return!1;for(let r=t;;){let o=r.parentNode;if(!o||o.nodeType!=1||o.firstChild!=r)return!1;if(o.classList.contains("cm-line"))break;r=o}let i=t.nodeType==1?t.getBoundingClientRect():Uc(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}function o4(t,e){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){for(let i of n.type)if(i.to>e||i.to==e&&(i.to==n.to||i.type==Fr.Text))return i}return n}function Nye(t,e,n,i){let r=o4(t,e.head),o=!i||r.type!=Fr.Text||!(t.lineWrapping||r.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(o){let s=t.dom.getBoundingClientRect(),a=t.textDirectionAt(r.from),l=t.posAtCoords({x:n==(a==mn.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(l!=null)return he.cursor(l,n?-1:1)}return he.cursor(n?r.to:r.from,n?-1:1)}function NI(t,e,n,i){let r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),s=t.textDirectionAt(r.from);for(let a=e,l=null;;){let u=mye(r,o,s,a,n),f=aI;if(!u){if(r.number==(n?t.state.doc.lines:1))return a;f=` +`,r=t.state.doc.line(r.number+(n?1:-1)),o=t.bidiSpans(r),u=t.visualLineSide(r,!n)}if(l){if(!l(f))return a}else{if(!i)return u;l=i(f)}a=u}}function Aye(t,e,n){let i=t.state.charCategorizer(e),r=i(n);return o=>{let s=i(o);return r==Nn.Space&&(r=s),r==s}}function Pye(t,e,n,i){let r=e.head,o=n?1:-1;if(r==(n?t.state.doc.length:0))return he.cursor(r,e.assoc);let s=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||-1),f=t.documentTop;if(u)s==null&&(s=u.left-l.left),a=o<0?u.top:u.bottom;else{let g=t.viewState.lineBlockAt(r);s==null&&(s=Math.min(l.right-l.left,t.defaultCharacterWidth*(r-g.from))),a=(o<0?g.top:g.bottom)+f}let d=l.left+s,h=i??t.viewState.heightOracle.textHeight>>1;for(let g=0;;g+=10){let m=a+(h+g)*o,y=$I(t,{x:d,y:m},!1,o);if(ml.bottom||(o<0?yr)){let x=t.docView.coordsForChar(y),_=!x||m{if(e>o&&er(t)),n.from,e.head>n.from?-1:1);return i==n.from?n:he.cursor(i,inull),Ye.gecko&&Xye(e.contentDOM.ownerDocument)}handleEvent(e){!Wye(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,n){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,n);for(let r of i.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=Iye(e),i=this.handlers,r=this.view.contentDOM;for(let o in n)if(o!="scroll"){let s=!n[o].handlers.length,a=i[o];a&&s!=!a.handlers.length&&(r.removeEventListener(o,this.handleEvent),a=null),a||r.addEventListener(o,this.handleEvent,{passive:s})}for(let o in i)o!="scroll"&&!n[o]&&r.removeEventListener(o,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()i.keyCode==e.keyCode))&&!e.ctrlKey||Lye.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,qd(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Ye.safari&&!Ye.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function AI(t,e){return(n,i)=>{try{return e.call(t,i,n)}catch(r){is(n.state,r)}}}function Iye(t){let e=Object.create(null);function n(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of t){let r=i.spec;if(r&&r.domEventHandlers)for(let o in r.domEventHandlers){let s=r.domEventHandlers[o];s&&n(o).handlers.push(AI(i.value,s))}if(r&&r.domEventObservers)for(let o in r.domEventObservers){let s=r.domEventObservers[o];s&&n(o).observers.push(AI(i.value,s))}}for(let i in As)n(i).handlers.push(As[i]);for(let i in Ps)n(i).observers.push(Ps[i]);return e}const PI=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Lye="dthko",DI=[16,17,18,20,91,92,224,225],mk=6;function vk(t){return Math.max(0,t)*.7+8}function Rye(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class jye{constructor(e,n,i,r){this.view=e,this.startEvent=n,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=Jke(e.contentDOM),this.atoms=e.state.facet(n4).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(jt.allowMultipleSelections)&&Fye(e,n),this.dragging=Bye(e,n)&&QI(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var n;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Rye(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,r=0,o=((n=this.scrollParent)===null||n===void 0?void 0:n.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},s=wI(this.view);e.clientX-s.left<=o.left+mk?i=-vk(o.left-e.clientX):e.clientX+s.right>=o.right-mk&&(i=vk(e.clientX-o.right)),e.clientY-s.top<=o.top+mk?r=-vk(o.top-e.clientY):e.clientY+s.bottom>=o.bottom-mk&&(r=vk(e.clientY-o.bottom)),this.setScrollSpeed(i,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let i=0;ithis.select(this.lastEvent),20)}}function Fye(t,e){let n=t.state.facet(lI);return n.length?n[0](e):Ye.mac?e.metaKey:e.ctrlKey}function zye(t,e){let n=t.state.facet(uI);return n.length?n[0](e):Ye.mac?!e.altKey:!e.ctrlKey}function Bye(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let i=ak(t.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let o=0;o=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function Wye(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,i;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=gn.get(n))&&i.ignoreEvent(e))return!1;return!0}const As=Object.create(null),Ps=Object.create(null),II=Ye.ie&&Ye.ie_version<15||Ye.ios&&Ye.webkit_version<604;function Hye(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),LI(t,n.value)},50)}function LI(t,e){let{state:n}=t,i,r=1,o=n.toText(e),s=o.lines==n.selection.ranges.length;if(a4!=null&&n.selection.ranges.every(l=>l.empty)&&a4==o.toString()){let l=-1;i=n.changeByRange(u=>{let f=n.doc.lineAt(u.from);if(f.from==l)return{range:u};l=f.from;let d=n.toText((s?o.line(r++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:d},range:he.cursor(u.from+d.length)}})}else s?i=n.changeByRange(l=>{let u=o.line(r++);return{changes:{from:l.from,to:l.to,insert:u.text},range:he.cursor(l.from+u.length)}}):i=n.replaceSelection(o);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Ps.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},As.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now()),!1),Ps.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Ps.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},As.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of t.state.facet(cI))if(n=i(t,e),n)break;if(!n&&e.button==0&&(n=Zye(t,e)),n){let i=!t.hasFocus;t.inputState.startMouseSelection(new jye(t,e,n,i)),i&&t.observer.ignore(()=>FD(t.contentDOM));let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}return!1};function RI(t,e,n,i){if(i==1)return he.cursor(e,n);if(i==2)return Cye(t.state,e,n);{let r=Ei.find(t.docView,e),o=t.state.doc.lineAt(r?r.posAtEnd:e),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return at>=e.top&&t<=e.bottom,FI=(t,e,n)=>jI(e,n)&&t>=n.left&&t<=n.right;function Qye(t,e,n,i){let r=Ei.find(t.docView,e);if(!r)return 1;let o=e-r.posAtStart;if(o==0)return 1;if(o==r.length)return-1;let s=r.coordsAt(o,-1);if(s&&FI(n,i,s))return-1;let a=r.coordsAt(o,1);return a&&FI(n,i,a)?1:s&&jI(i,s)?-1:1}function zI(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Qye(t,n,e.clientX,e.clientY)}}const Uye=Ye.ie&&Ye.ie_version<=11;let BI=null,WI=0,HI=0;function QI(t){if(!Uye)return t.detail;let e=BI,n=HI;return BI=t,HI=Date.now(),WI=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(WI+1)%3:1}function Zye(t,e){let n=zI(t,e),i=QI(e),r=t.state.selection;return{update(o){o.docChanged&&(n.pos=o.changes.mapPos(n.pos),r=r.map(o.changes))},get(o,s,a){let l=zI(t,o),u,f=RI(t,l.pos,l.bias,i);if(n.pos!=l.pos&&!s){let d=RI(t,n.pos,n.bias,i),h=Math.min(d.from,f.from),g=Math.max(d.to,f.to);f=h1&&(u=qye(r,l.pos))?u:a?r.addRange(f):he.create([f])}}}function qye(t,e){for(let n=0;n=e)return he.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}As.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let r=t.docView.nearest(e.target);if(r&&r.isWidget){let o=r.posAtStart,s=o+r.length;(o>=n.to||s<=n.from)&&(n=he.range(o,s))}}let{inputState:i}=t;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove"),!1},As.dragend=t=>(t.inputState.draggedContent=null,!1);function UI(t,e,n,i){if(!n)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=t.inputState,s=i&&o&&zye(t,e)?{from:o.from,to:o.to}:null,a={from:r,insert:n},l=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),t.inputState.draggedContent=null}As.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,o=()=>{++r==n.length&&UI(t,e,i.filter(s=>s!=null).join(t.state.lineBreak),!1)};for(let s=0;s{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(i[s]=a.result),o()},a.readAsText(n[s])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return UI(t,e,i,!0),!0}return!1},As.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=II?null:e.clipboardData;return n?(LI(t,n.getData("text/plain")||n.getData("text/uri-text")),!0):(Hye(t),!1)};function Yye(t,e){let n=t.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),t.focus()},50)}function Vye(t){let e=[],n=[],i=!1;for(let r of t.selection.ranges)r.empty||(e.push(t.sliceDoc(r.from,r.to)),n.push(r));if(!e.length){let r=-1;for(let{from:o}of t.selection.ranges){let s=t.doc.lineAt(o);s.number>r&&(e.push(s.text),n.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),r=s.number}i=!0}return{text:e.join(t.lineBreak),ranges:n,linewise:i}}let a4=null;As.copy=As.cut=(t,e)=>{let{text:n,ranges:i,linewise:r}=Vye(t.state);if(!n&&!r)return!1;a4=r?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=II?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(Yye(t,n),!1)};const ZI=ca.define();function qI(t,e){let n=[];for(let i of t.facet(hI)){let r=i(t,e);r&&n.push(r)}return n?t.update({effects:n,annotations:ZI.of(!0)}):null}function YI(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=qI(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ps.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),YI(t)},Ps.blur=t=>{t.observer.clearSelectionRange(),YI(t)},Ps.compositionstart=Ps.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Ps.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ye.chrome&&Ye.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50)},Ps.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},As.beforeinput=(t,e)=>{var n;let i;if(Ye.chrome&&Ye.android&&(i=PI.find(r=>r.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let r=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return!1};const VI=new Set;function Xye(t){VI.has(t)||(VI.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const XI=["pre-wrap","normal","pre-line","break-spaces"];class Gye{constructor(e){this.lineWrapping=e,this.doc=Yt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,n){let i=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((n-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return XI.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let i=0;i-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=i,this.textHeight=r,this.lineLength=o,l){this.heightSamples={};for(let u=0;u0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,n){this.height!=n&&(Math.abs(this.height-n)>bk&&(e.heightChanged=!0),this.height=n)}replace(e,n,i){return zr.of(i)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,i,r){let o=this,s=i.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:u,fromB:f,toB:d}=r[a],h=o.lineAt(l,vn.ByPosNoHeight,i.setDoc(n),0,0),g=h.to>=u?h:o.lineAt(u,vn.ByPosNoHeight,i,0,0);for(d+=g.to-u,u=g.to;a>0&&h.from<=r[a-1].toA;)l=r[a-1].fromA,f=r[a-1].fromB,a--,lo*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),i+=1+a.break,r-=a.size}else if(o>r*2){let a=e[i];a.break?e.splice(i,1,a.left,null,a.right):e.splice(i,1,a.left,a.right),i+=2+a.break,o-=a.size}else break;else if(r=o&&s(this.blockAt(0,i,r,o))}updateHeight(e,n=0,i=!1,r){return r&&r.from<=n&&r.more&&this.setHeight(e,r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class $o extends GI{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,i,r){return new pa(r,this.length,i,this.height,this.breaks)}replace(e,n,i){let r=i[0];return i.length==1&&(r instanceof $o||r instanceof nr&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof nr?r=new $o(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):zr.of(i)}updateHeight(e,n=0,i=!1,r){return r&&r.from<=n&&r.more?this.setHeight(e,r.heights[r.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class nr extends zr{constructor(e){super(e,0)}heightMetrics(e,n){let i=e.doc.lineAt(n).number,r=e.doc.lineAt(n+this.length).number,o=r-i+1,s,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*o);s=l/o,this.length>o+1&&(a=(this.height-l)/(this.length-o-1))}else s=this.height/o;return{firstLine:i,lastLine:r,perLine:s,perChar:a}}blockAt(e,n,i,r){let{firstLine:o,lastLine:s,perLine:a,perChar:l}=this.heightMetrics(n,r);if(n.lineWrapping){let u=r+Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length),f=n.doc.lineAt(u),d=a+f.length*l,h=Math.max(i,e-d/2);return new pa(f.from,f.length,h,d,0)}else{let u=Math.max(0,Math.min(s-o,Math.floor((e-i)/a))),{from:f,length:d}=n.doc.line(o+u);return new pa(f,d,i+a*u,a,0)}}lineAt(e,n,i,r,o){if(n==vn.ByHeight)return this.blockAt(e,i,r,o);if(n==vn.ByPosNoHeight){let{from:g,to:m}=i.doc.lineAt(e);return new pa(g,m-g,0,0,0)}let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(i,o),u=i.doc.lineAt(e),f=a+u.length*l,d=u.number-s,h=r+a*d+l*(u.from-o-d);return new pa(u.from,u.length,Math.max(r,Math.min(h,r+this.height-f)),f,0)}forEachLine(e,n,i,r,o,s){e=Math.max(e,o),n=Math.min(n,o+this.length);let{firstLine:a,perLine:l,perChar:u}=this.heightMetrics(i,o);for(let f=e,d=r;f<=n;){let h=i.doc.lineAt(f);if(f==e){let m=h.number-a;d+=l*m+u*(e-o-m)}let g=l+u*h.length;s(new pa(h.from,h.length,d,g,0)),d+=g,f=h.to+1}}replace(e,n,i){let r=this.length-n;if(r>0){let o=i[i.length-1];o instanceof nr?i[i.length-1]=new nr(o.length+r):i.push(null,new nr(r-1))}if(e>0){let o=i[0];o instanceof nr?i[0]=new nr(e+o.length):i.unshift(new nr(e-1),null)}return zr.of(i)}decomposeLeft(e,n){n.push(new nr(e-1),null)}decomposeRight(e,n){n.push(null,new nr(this.length-e-1))}updateHeight(e,n=0,i=!1,r){let o=n+this.length;if(r&&r.from<=n+this.length&&r.more){let s=[],a=Math.max(n,r.from),l=-1;for(r.from>n&&s.push(new nr(r.from-n-1).updateHeight(e,n));a<=o&&r.more;){let f=e.doc.lineAt(a).length;s.length&&s.push(null);let d=r.heights[r.index++];l==-1?l=d:Math.abs(d-l)>=bk&&(l=-2);let h=new $o(f,d);h.outdated=!1,s.push(h),a+=f+1}a<=o&&s.push(null,new nr(o-a).updateHeight(e,a));let u=zr.of(s);return(l<0||Math.abs(u.height-this.height)>=bk||Math.abs(l-this.heightMetrics(e,n).perLine)>=bk)&&(e.heightChanged=!0),u}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Jye extends zr{constructor(e,n,i){super(e.length+n+i.length,e.height+i.height,n|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,n,i,r){let o=i+this.left.height;return ea))return u;let f=n==vn.ByPosNoHeight?vn.ByPosNoHeight:vn.ByPos;return l?u.join(this.right.lineAt(a,f,i,s,a)):this.left.lineAt(a,f,i,r,o).join(u)}forEachLine(e,n,i,r,o,s){let a=r+this.left.height,l=o+this.left.length+this.break;if(this.break)e=l&&this.right.forEachLine(e,n,i,a,l,s);else{let u=this.lineAt(l,vn.ByPos,i,r,o);e=e&&u.from<=n&&s(u),n>u.to&&this.right.forEachLine(u.to+1,n,i,a,l,s)}}replace(e,n,i){let r=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-r,n-r,i));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let a of i)o.push(a);if(e>0&&KI(o,s-1),n=i&&n.push(null)),e>i&&this.right.decomposeLeft(e-i,n)}decomposeRight(e,n){let i=this.left.length,r=i+this.break;if(e>=r)return this.right.decomposeRight(e-r,n);e2*n.size||n.size>2*e.size?zr.of(this.break?[e,null,n]:[e,n]):(this.left=e,this.right=n,this.height=e.height+n.height,this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,i=!1,r){let{left:o,right:s}=this,a=n+o.length+this.break,l=null;return r&&r.from<=n+o.length&&r.more?l=o=o.updateHeight(e,n,i,r):o.updateHeight(e,n,i),r&&r.from<=a+s.length&&r.more?l=s=s.updateHeight(e,a,i,r):s.updateHeight(e,a,i),l?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function KI(t,e){let n,i;t[e]==null&&(n=t[e-1])instanceof nr&&(i=t[e+1])instanceof nr&&t.splice(e-1,3,new nr(n.length+1+i.length))}const ewe=5;class l4{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let i=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof $o?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new $o(i-this.pos,-1)),this.writtenTo=i,n>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,i){if(e=ewe)&&this.addLineDeco(r,o,s)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new $o(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let i=new nr(n-e);return this.oracle.doc.lineAt(e).to==n&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof $o)return e;let n=new $o(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=n,this.writtenTo=this.pos=this.pos+i}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof $o)&&!this.isCovered?this.nodes.push(new $o(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&d.overflow!="visible"){let h=f.getBoundingClientRect();o=Math.max(o,h.left),s=Math.min(s,h.right),a=Math.max(a,h.top),l=u==t.parentNode?h.bottom:Math.min(l,h.bottom)}u=d.position=="absolute"||d.position=="fixed"?f.offsetParent:f.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function rwe(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class u4{constructor(e,n,i){this.from=e,this.to=n,this.size=i}static same(e,n){if(e.length!=n.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new Gye(n),this.stateDeco=e.facet(ym).filter(i=>typeof i!="function"),this.heightMap=zr.empty().applyChanges(this.stateDeco,Yt.empty,this.heightOracle.setDoc(e.doc),[new rs(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=it.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let i=0;i<=1;i++){let r=i?n.head:n.anchor;if(!e.some(({from:o,to:s})=>r>=o&&r<=s)){let{from:o,to:s}=this.lineBlockAt(r);e.push(new kk(o,s))}}this.viewports=e.sort((i,r)=>i.from-r.from),this.scaler=this.heightMap.height<=7e6?eL:new lwe(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:xm(e,this.scaler))})}update(e,n=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(ym).filter(f=>typeof f!="function");let r=e.changedRanges,o=rs.extendWithRanges(r,twe(i,this.stateDeco,e?e.changes:Ci.empty(this.state.doc.length))),s=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=s&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let u=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),u&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(gI)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,i=window.getComputedStyle(n),r=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?mn.RTL:mn.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),a=n.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,f=0;if(a.width&&a.height){let{scaleX:E,scaleY:N}=jD(n,a);(this.scaleX!=E||this.scaleY!=N)&&(this.scaleX=E,this.scaleY=N,u|=8,s=l=!0)}let d=(parseInt(i.paddingTop)||0)*this.scaleY,h=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=h)&&(this.paddingTop=d,this.paddingBottom=h,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8);let g=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=g&&(this.scrollAnchorHeight=-1,this.scrollTop=g),this.scrolledToBottom=WD(e.scrollDOM);let m=(this.printing?rwe:iwe)(n,this.paddingTop),y=m.top-this.pixelViewport.top,x=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let S=a.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),l){let E=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(E)&&(s=!0),s||r.lineWrapping&&Math.abs(S-this.contentDOMWidth)>r.charWidth){let{lineHeight:N,charWidth:M,textHeight:I}=e.docView.measureTextSize();s=N>0&&r.refresh(o,N,M,I,S/M,E),s&&(e.docView.minWidth=0,u|=8)}y>0&&x>0?f=Math.max(y,x):y<0&&x<0&&(f=Math.min(y,x)),r.heightChanged=!1;for(let N of this.viewports){let M=N.from==this.viewport.from?E:e.docView.measureVisibleLineHeights(N);this.heightMap=(s?zr.empty().applyChanges(this.stateDeco,Yt.empty,this.heightOracle,[new rs(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,s,new Kye(N.from,M))}r.heightChanged&&(u|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(u&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:a}=this,l=new kk(r.lineAt(s-i*1e3,vn.ByHeight,o,0,0).from,r.lineAt(a+(1-i)*1e3,vn.ByHeight,o,0,0).to);if(n){let{head:u}=n.range;if(ul.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=r.lineAt(u,vn.ByPos,o,0,0),h;n.y=="center"?h=(d.top+d.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&u=a+Math.max(10,Math.min(i,250)))&&r>s-2*1e3&&o>1,s=r<<1;if(this.defaultTextDirection!=mn.LTR&&!i)return[];let a=[],l=(u,f,d,h)=>{if(f-uu&&xx.from>=d.from&&x.to<=d.to&&Math.abs(x.from-u)x.from<_&&x.to>_));if(!y){if(fx.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(he.cursor(f),!1,!0).head;x>u&&(f=x)}y=new u4(u,f,this.gapSize(d,u,f,h))}a.push(y)};for(let u of this.viewportLines){if(u.lengthu.from&&l(u.from,h,u,f),gn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];zt.spans(e,this.viewport.from,this.viewport.to,{span(r,o){n.push({from:r,to:o})},point(){}},20);let i=n.length!=this.visibleRanges.length||this.visibleRanges.some((r,o)=>r.from!=n[o].from||r.to!=n[o].to);return this.visibleRanges=n,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||xm(this.heightMap.lineAt(e,vn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return xm(this.heightMap.lineAt(this.scaler.fromDOM(e),vn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return xm(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class kk{constructor(e,n){this.from=e,this.to=n}}function swe(t,e,n){let i=[],r=t,o=0;return zt.spans(n,t,e,{span(){},point(s,a){s>r&&(i.push({from:r,to:s}),o+=s-r),r=a}},20),r=1)return e[e.length-1].to;let i=Math.floor(t*n);for(let r=0;;r++){let{from:o,to:s}=e[r],a=s-o;if(i<=a)return o+i;i-=a}}function wk(t,e){let n=0;for(let{from:i,to:r}of t.ranges){if(e<=r){n+=e-i;break}n+=r-i}return n/t.total}function awe(t,e){for(let n of t)if(e(n))return n}const eL={toDOM(t){return t},fromDOM(t){return t},scale:1};class lwe{constructor(e,n,i){let r=0,o=0,s=0;this.viewports=i.map(({from:a,to:l})=>{let u=n.lineAt(a,vn.ByPos,e,0,0).top,f=n.lineAt(l,vn.ByPos,e,0,0).bottom;return r+=f-u,{from:a,to:l,top:u,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let a of this.viewports)a.domTop=s+(a.top-o)*this.scale,s=a.domBottom=a.domTop+(a.bottom-a.top),o=a.bottom}toDOM(e){for(let n=0,i=0,r=0;;n++){let o=nxm(r,e)):t._content)}const xk=Qe.define({combine:t=>t.join(" ")}),c4=Qe.define({combine:t=>t.indexOf(!0)>-1}),f4=lu.newName(),tL=lu.newName(),nL=lu.newName(),iL={"&light":"."+tL,"&dark":"."+nL};function d4(t,e,n){return new lu(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return t;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):t+" "+i}})}const uwe=d4("."+f4,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},iL),_m="￿";class cwe{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(jt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=_m}readRange(e,n){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r);let o=this.text.length;this.readNode(r);let s=r.nextSibling;if(s==n)break;let a=gn.get(r),l=gn.get(s);(a&&l?a.breakAfter:(a?a.breakAfter:rL(r))||rL(s)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=s}return this.findPointBefore(i,n),this}readTextNode(e){let n=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,n.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,a;if(this.lineSeparator?(o=n.indexOf(this.lineSeparator,i),s=this.lineSeparator.length):(a=r.exec(n))&&(o=a.index,s=a[0].length),this.append(n.slice(i,o<0?n.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=s-1);i=o+s}}readNode(e){if(e.cmIgnore)return;let n=gn.get(e),i=n&&n.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==n&&(i.pos=this.text.length)}findPointInside(e,n){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(fwe(e,i.node,i.offset)?n:0))}}function fwe(t,e,n){for(;;){if(!e||n-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,i,0))){let a=o||s?[]:gwe(e),l=new cwe(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=mwe(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!FS(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),u=s&&s.node==a.anchorNode&&s.offset==a.anchorOffset||!FS(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),f=e.viewport;if(Ye.ios&&e.state.selection.main.empty&&l!=u&&(f.from>0||f.toDate.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:a}=e.bounds,l=r.from,u=null;(o===8||Ye.android&&e.text.length=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:(Ye.mac||Ye.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(i&&n.insert.length==2&&(i=he.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:Yt.of([" "])}):Ye.chrome&&n&&n.from==n.to&&n.from==r.head&&n.insert.toString()==` + `&&t.lineWrapping&&(i&&(i=he.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:Yt.of([" "])}),n){if(Ye.ios&&t.inputState.flushIOSKey()||Ye.android&&(n.from==r.from&&n.to==r.to&&n.insert.length==1&&n.insert.lines==2&&qd(t.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&n.insert.length==0||o==8&&n.insert.lengthr.head)&&qd(t.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&n.insert.length==0&&qd(t.contentDOM,"Delete",46)))return!0;let s=n.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=hwe(t,n,i));return t.state.facet(dI).some(u=>u(t,n.from,n.to,s,l))||t.dispatch(l()),!0}else if(i&&!i.main.eq(r)){let s=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(s=!0),a=t.inputState.lastSelectionOrigin),t.dispatch({selection:i,scrollIntoView:s,userEvent:a}),!0}else return!1}function hwe(t,e,n){let i,r=t.state,o=r.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=o.frome.to?r.sliceDoc(e.to,o.to):"";i=r.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+l))}else{let a=r.changes(e),l=n&&n.main.to<=a.newLength?n.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let u=t.state.sliceDoc(e.from,e.to),f,d=n&&OI(t,n.main.head);if(d){let m=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-m}}else f=t.state.doc.lineAt(o.head);let h=o.to-e.to,g=o.to-o.from;i=r.changeByRange(m=>{if(m.from==o.from&&m.to==o.to)return{changes:a,range:l||m.map(a)};let y=m.to-h,x=y-u.length;if(m.to-m.from!=g||t.state.sliceDoc(x,y)!=u||m.to>=f.from&&m.from<=f.to)return{range:m};let _=r.changes({from:x,to:y,insert:e.insert}),S=m.to-o.to;return{changes:_,range:l?he.range(Math.max(0,l.anchor+S),Math.max(0,l.head+S)):m.map(_)}})}else i={changes:a,selection:l&&r.selection.replaceRange(l)}}let s="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,s+=".compose",t.inputState.compositionFirstChange&&(s+=".start",t.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:s,scrollIntoView:!0})}function pwe(t,e,n,i){let r=Math.min(t.length,e.length),o=0;for(;o0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if(i=="end"){let l=Math.max(0,o-Math.min(s,a));n-=s+l-o}if(s=s?o-n:0;o-=l,a=o+(a-s),s=o}else if(a=a?o-n:0;o-=l,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}function gwe(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}=t.observer.selectionRange;return n&&(e.push(new oL(n,i)),(r!=n||o!=i)&&e.push(new oL(r,o))),e}function mwe(t,e){if(t.length==0)return null;let n=t[0].pos,i=t.length==2?t[1].pos:n;return n>-1&&i>-1?he.single(n+e,i+e):null}const vwe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},h4=Ye.ie&&Ye.ie_version<=11;class bwe{constructor(e){this.view=e,this.active=!1,this.selectionRange=new eye,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let i of n)this.queue.push(i);(Ye.ie&&Ye.ie_version<=11||Ye.ios&&e.composing)&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),h4&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,i)=>n!=e[i]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(hk)?i.root.activeElement!=this.dom:!lk(i.dom,r))return;let o=r.anchorNode&&i.docView.nearest(r.anchorNode);if(o&&o.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ye.ie&&Ye.ie_version<=11||Ye.android&&Ye.chrome)&&!i.state.selection.main.empty&&r.focusNode&&pm(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Ye.safari&&e.root.nodeType==11&&Xke(this.dom.ownerDocument)==this.dom&&kwe(this.view)||ak(e.root);if(!n||this.selectionRange.eq(n))return!1;let i=lk(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&qd(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,i=-1,r=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(r=!0),n==-1?{from:n,to:i}=s:(n=Math.min(s.from,n),i=Math.max(s.to,i)))}return{from:n,to:i,typeOver:r}}readChange(){let{from:e,to:n,typeOver:i}=this.processRecords(),r=this.selectionChanged&&lk(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new dwe(this.view,e,n,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let i=this.view.state,r=sL(this.view,n);return this.view.state==i&&this.view.update([]),r}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let i=aL(n,e.previousSibling||e.target.previousSibling,-1),r=aL(n,e.nextSibling||e.target.nextSibling,1);return{from:i?n.posAfter(i):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,n,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function aL(t,e,n){for(;e;){let i=gn.get(e);if(i&&i.parent==t)return i;let r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function kwe(t){let e=null;function n(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;let i=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return pm(a.node,a.offset,o,s)&&([i,r,o,s]=[o,s,i,r]),{anchorNode:i,anchorOffset:r,focusNode:o,focusOffset:s}}class Te{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(i=>i.forEach(r=>n(r,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||tye(e.parent)||document,this.viewState=new JI(e.state||jt.create(e)),e.scrollTo&&e.scrollTo.is(dk)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(km).map(i=>new e4(i));for(let i of this.plugins)i.update(this);this.observer=new bwe(this),this.inputState=new Dye(this),this.inputState.ensureHandlers(this.plugins),this.docView=new xI(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let n=e.length==1&&e[0]instanceof jr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,i=!1,r,o=this.state;for(let h of e){if(h.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=h.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,a=0,l=null;e.some(h=>h.annotation(ZI))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=qI(o,s),l||(a=1));let u=this.observer.delayedAndroidKey,f=null;if(u?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(f=null)):this.observer.clear(),o.facet(jt.phrases)!=this.state.facet(jt.phrases))return this.setState(o);r=pk.create(this,o,e),r.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(d&&(d=d.map(h.changes)),h.scrollIntoView){let{main:g}=h.state.selection;d=new Vd(g.empty?g:he.cursor(g.head,g.head>g.anchor?-1:1))}for(let g of h.effects)g.is(dk)&&(d=g.value.clip(this.state))}this.viewState.update(r,d),this.bidiCache=_k.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(wm)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(xk)!=r.state.facet(xk)&&(this.viewState.mustMeasureContent=!0),(n||i||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!r.empty)for(let h of this.state.facet(JS))try{h(r)}catch(g){is(this.state,g,"update listener")}(l||f)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),f&&!sL(this,f)&&u.force&&qd(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new JI(e),this.plugins=e.facet(km).map(i=>new e4(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new xI(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(km),i=e.state.facet(km);if(n!=i){let r=[];for(let o of i){let s=n.indexOf(o);if(s<0)r.push(new e4(o));else{let a=this.plugins[s];a.mustUpdate=e,r.push(a)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,i=this.scrollDOM,r=i.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(s<0)if(WD(i))o=-1,s=this.viewState.heightMap.height;else{let g=this.viewState.scrollAnchorAt(r);o=g.from,s=g.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];l&4||([this.measureRequests,u]=[u,this.measureRequests]);let f=u.map(g=>{try{return g.read(this)}catch(m){return is(this.state,m),lL}}),d=pk.create(this,this.state,[]),h=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),h=this.docView.update(d));for(let g=0;g1||m<-1){r=r+m,i.scrollTop=r/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(JS))a(n)}get themeClasses(){return f4+" "+(this.state.facet(c4)?nL:tL)+" "+this.state.facet(xk)}updateAttrs(){let e=uL(this,mI,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(hk)?"true":"false",class:"cm-content",style:`${Ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),uL(this,t4,n);let i=this.observer.ignore(()=>{let r=qS(this.contentDOM,this.contentAttrs,n),o=qS(this.dom,this.editorAttrs,e);return r||o});return this.editorAttrs=e,this.contentAttrs=n,i}showAnnouncements(e){let n=!0;for(let i of e)for(let r of i.effects)if(r.is(Te.announce)){n&&(this.announceDOM.textContent=""),n=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(wm);let e=this.state.facet(Te.cspNonce);lu.mount(this.root,this.styleModules.concat(uwe).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;ni.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,i){return s4(this,e,NI(this,e,n,i))}moveByGroup(e,n){return s4(this,e,NI(this,e,n,i=>Aye(this,e.head,i)))}visualLineSide(e,n){let i=this.bidiSpans(e),r=this.textDirectionAt(e.from),o=i[n?i.length-1:0];return he.cursor(o.side(n,r)+e.from,o.forward(!n,r)?1:-1)}moveToLineBoundary(e,n,i=!0){return Nye(this,e,n,i)}moveVertically(e,n,i){return s4(this,e,Pye(this,e,n,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),$I(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let i=this.docView.coordsAt(e,n);if(!i||i.left==i.right)return i;let r=this.state.doc.lineAt(e),o=this.bidiSpans(r),s=o[hu.find(o,e-r.from,-1,n)];return uk(i,s.dir==mn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(pI)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ywe)return sI(e.length);let n=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==n&&(o.fresh||oI(o.isolates,i=kI(this,e))))return o.order;i||(i=kI(this,e));let r=gye(e.text,n,i);return this.bidiCache.push(new _k(e.from,e.to,n,i,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{FD(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return dk.of(new Vd(typeof e=="number"?he.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return dk.of(new Vd(he.cursor(i.from),"start","start",i.top-e,n,!0))}static domEventHandlers(e){return li.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return li.define(()=>({}),{eventObservers:e})}static theme(e,n){let i=lu.newName(),r=[xk.of(i),wm.of(d4(`.${i}`,e))];return n&&n.dark&&r.push(c4.of(!0)),r}static baseTheme(e){return Hc.lowest(wm.of(d4("."+f4,e,iL)))}static findFromDOM(e){var n;let i=e.querySelector(".cm-content"),r=i&&gn.get(i)||gn.get(e);return((n=r==null?void 0:r.rootView)===null||n===void 0?void 0:n.view)||null}}Te.styleModule=wm,Te.inputHandler=dI,Te.focusChangeEffect=hI,Te.perLineTextDirection=pI,Te.exceptionSink=fI,Te.updateListener=JS,Te.editable=hk,Te.mouseSelectionStyle=cI,Te.dragMovesSelection=uI,Te.clickAddsSelectionRange=lI,Te.decorations=ym,Te.outerDecorations=vI,Te.atomicRanges=n4,Te.bidiIsolatedRanges=bI,Te.scrollMargins=yI,Te.darkTheme=c4,Te.cspNonce=Qe.define({combine:t=>t.length?t[0]:""}),Te.contentAttributes=t4,Te.editorAttributes=mI,Te.lineWrapping=Te.contentAttributes.of({class:"cm-lineWrapping"}),Te.announce=_t.define();const ywe=4096,lL={};class _k{constructor(e,n,i,r,o,s){this.from=e,this.to=n,this.dir=i,this.isolates=r,this.fresh=o,this.order=s}static update(e,n){if(n.empty&&!e.some(o=>o.fresh))return e;let i=[],r=e.length?e[e.length-1].dir:mn.LTR;for(let o=Math.max(0,e.length-10);o=0;r--){let o=i[r],s=typeof o=="function"?o(t):o;s&&US(s,n)}return n}const wwe=Ye.mac?"mac":Ye.windows?"win":Ye.linux?"linux":"key";function xwe(t,e){const n=t.split(/-(?!$)/);let i=n[n.length-1];i=="Space"&&(i=" ");let r,o,s,a;for(let l=0;li.concat(r),[]))),n}function Owe(t,e,n){return dL(fL(t.state),e,t,n)}let pu=null;const Swe=4e3;function Cwe(t,e=wwe){let n=Object.create(null),i=Object.create(null),r=(s,a)=>{let l=i[s];if(l==null)i[s]=a;else if(l!=a)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,a,l,u,f)=>{var d,h;let g=n[s]||(n[s]=Object.create(null)),m=a.split(/ (?!$)/).map(_=>xwe(_,e));for(let _=1;_{let E=pu={view:C,prefix:S,scope:s};return setTimeout(()=>{pu==E&&(pu=null)},Swe),!0}]})}let y=m.join(" ");r(y,!1);let x=g[y]||(g[y]={preventDefault:!1,stopPropagation:!1,run:((h=(d=g._any)===null||d===void 0?void 0:d.run)===null||h===void 0?void 0:h.slice())||[]});l&&x.run.push(l),u&&(x.preventDefault=!0),f&&(x.stopPropagation=!0)};for(let s of t){let a=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let u of a){let f=n[u]||(n[u]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let d in f)f[d].run.push(s.any)}let l=s[e]||s.key;if(l)for(let u of a)o(u,l,s.run,s.preventDefault,s.stopPropagation),s.shift&&o(u,"Shift-"+l,s.shift,s.preventDefault,s.stopPropagation)}return n}function dL(t,e,n,i){let r=Vke(e),o=Ji(r,0),s=ns(o)==r.length&&r!=" ",a="",l=!1,u=!1,f=!1;pu&&pu.view==n&&pu.scope==i&&(a=pu.prefix+" ",DI.indexOf(e.keyCode)<0&&(u=!0,pu=null));let d=new Set,h=x=>{if(x){for(let _ of x.run)if(!d.has(_)&&(d.add(_),_(n,e)))return x.stopPropagation&&(f=!0),!0;x.preventDefault&&(x.stopPropagation&&(f=!0),u=!0)}return!1},g=t[i],m,y;return g&&(h(g[a+Ok(r,e,!s)])?l=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ye.windows&&e.ctrlKey&&e.altKey)&&(m=uu[e.keyCode])&&m!=r?(h(g[a+Ok(m,e,!0)])||e.shiftKey&&(y=hm[e.keyCode])!=r&&y!=m&&h(g[a+Ok(y,e,!1)]))&&(l=!0):s&&e.shiftKey&&h(g[a+Ok(r,e,!0)])&&(l=!0),!l&&h(g._any)&&(l=!0)),u&&(l=!0),l&&f&&e.stopPropagation(),l}class Om{constructor(e,n,i,r,o){this.className=e,this.left=n,this.top=i,this.width=r,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,i){if(i.empty){let r=e.coordsAtPos(i.head,i.assoc||1);if(!r)return[];let o=hL(e);return[new Om(n,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]}else return Ewe(e,n,i)}}function hL(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==mn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function pL(t,e,n){let i=he.cursor(e);return{from:Math.max(n.from,t.moveToLineBoundary(i,!1,!0).from),to:Math.min(n.to,t.moveToLineBoundary(i,!0,!0).from),type:Fr.Text}}function Ewe(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let i=Math.max(n.from,t.viewport.from),r=Math.min(n.to,t.viewport.to),o=t.textDirection==mn.LTR,s=t.contentDOM,a=s.getBoundingClientRect(),l=hL(t),u=s.querySelector(".cm-line"),f=u&&window.getComputedStyle(u),d=a.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),h=a.right-(f?parseInt(f.paddingRight):0),g=o4(t,i),m=o4(t,r),y=g.type==Fr.Text?g:null,x=m.type==Fr.Text?m:null;if(y&&(t.lineWrapping||g.widgetLineBreaks)&&(y=pL(t,i,y)),x&&(t.lineWrapping||m.widgetLineBreaks)&&(x=pL(t,r,x)),y&&x&&y.from==x.from)return S(C(n.from,n.to,y));{let N=y?C(n.from,null,y):E(g,!1),M=x?C(null,n.to,x):E(m,!0),I=[];return(y||g).to<(x||m).from-(y&&x?1:0)||g.widgetLineBreaks>1&&N.bottom+t.defaultLineHeight/2Q&&H.from=q)break;oe>j&&R(Math.max(te,j),N==null&&te<=Q,Math.min(oe,q),M==null&&oe>=V,K.dir)}if(j=Y.to+1,j>=q)break}return Z.length==0&&R(Q,N==null,V,M==null,t.textDirection),{top:W,bottom:B,horizontal:Z}}function E(N,M){let I=a.top+(M?N.top:N.bottom);return{top:I,bottom:I,horizontal:[]}}}function Twe(t,e){return t.constructor==e.constructor&&t.eq(e)}class $we{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Sk)!=e.state.facet(Sk)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let n=0,i=e.facet(Sk);for(;n!Twe(n,this.drawn[i]))){let n=this.dom.firstChild,i=0;for(let r of e)r.update&&n&&r.constructor&&this.drawn[i].constructor&&r.update(n,this.drawn[i])?(n=n.nextSibling,i++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Sk=Qe.define();function gL(t){return[li.define(e=>new $we(e,t)),Sk.of(t)]}const mL=!Ye.ios,Sm=Qe.define({combine(t){return fa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function vL(t={}){return[Sm.of(t),Mwe,Nwe,Awe,gI.of(!0)]}function bL(t){return t.startState.facet(Sm)!=t.state.facet(Sm)}const Mwe=gL({above:!0,markers(t){let{state:e}=t,n=e.facet(Sm),i=[];for(let r of e.selection.ranges){let o=r==e.selection.main;if(r.empty?!o||mL:n.drawRangeCursor){let s=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:he.cursor(r.head,r.head>r.anchor?-1:1);for(let l of Om.forRange(t,s,a))i.push(l)}}return i},update(t,e){t.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=bL(t);return n&&kL(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){kL(e.state,t)},class:"cm-cursorLayer"});function kL(t,e){e.style.animationDuration=t.facet(Sm).cursorBlinkRate+"ms"}const Nwe=gL({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Om.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||bL(t)},class:"cm-selectionLayer"}),p4={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};mL&&(p4[".cm-line"].caretColor="transparent !important",p4[".cm-content"]={caretColor:"transparent !important"});const Awe=Hc.highest(Te.theme(p4)),yL=_t.define({map(t,e){return t==null?null:e.mapPos(t)}}),Cm=zi.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,i)=>i.is(yL)?i.value:n,t)}}),Pwe=li.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Cm);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Cm)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Cm),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let i=t.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-i.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Cm)!=t&&this.view.dispatch({effects:yL.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Dwe(){return[Cm,Pwe]}function wL(t,e,n,i,r){e.lastIndex=0;for(let o=t.iterRange(n,i),s=n,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=e.exec(o.value);)r(s+a.index,a)}function Iwe(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let i=[];for(let{from:r,to:o}of n)r=Math.max(t.state.doc.lineAt(r).from,r-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),i.length&&i[i.length-1].to>=r?i[i.length-1].to=o:i.push({from:r,to:o});return i}class Lwe{constructor(e){const{regexp:n,decoration:i,decorate:r,boundary:o,maxLength:s=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=(a,l,u,f)=>r(f,u,u+a[0].length,a,l);else if(typeof i=="function")this.addMatch=(a,l,u,f)=>{let d=i(a,l,u);d&&f(u,u+a[0].length,d)};else if(i)this.addMatch=(a,l,u,f)=>f(u,u+a[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=s}createDeco(e){let n=new au,i=n.add.bind(n);for(let{from:r,to:o}of Iwe(e,this.maxLength))wL(e.state.doc,this.regexp,r,o,(s,a)=>this.addMatch(a,e,s,i));return n.finish()}updateDeco(e,n){let i=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((o,s,a,l)=>{l>e.view.viewport.from&&a1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,n.map(e.changes),i,r):n}updateRange(e,n,i,r){for(let o of e.visibleRanges){let s=Math.max(o.from,i),a=Math.min(o.to,r);if(a>s){let l=e.state.doc.lineAt(s),u=l.tol.from;s--)if(this.boundary.test(l.text[s-1-l.from])){f=s;break}for(;ah.push(_.range(y,x));if(l==u)for(this.regexp.lastIndex=f-l.from;(g=this.regexp.exec(l.text))&&g.indexthis.addMatch(x,e,y,m));n=n.update({filterFrom:f,filterTo:d,filter:(y,x)=>yd,add:h})}}return n}}const g4=/x/.unicode!=null?"gu":"g",Rwe=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,g4),jwe={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let m4=null;function Fwe(){var t;if(m4==null&&typeof document<"u"&&document.body){let e=document.body.style;m4=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return m4||!1}const Ck=Qe.define({combine(t){let e=fa(t,{render:null,specialChars:Rwe,addSpecialChars:null});return(e.replaceTabs=!Fwe())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,g4)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,g4)),e}});function xL(t={}){return[Ck.of(t),zwe()]}let _L=null;function zwe(){return _L||(_L=li.fromClass(class{constructor(t){this.view=t,this.decorations=it.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Ck)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Lwe({regexp:t.specialChars,decoration:(e,n,i)=>{let{doc:r}=n.state,o=Ji(e[0],0);if(o==9){let s=r.lineAt(i),a=n.state.tabSize,l=Qd(s.text,a,i-s.from);return it.replace({widget:new Qwe((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=it.replace({widget:new Hwe(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Ck);t.startState.facet(Ck)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const Bwe="•";function Wwe(t){return t>=32?Bwe:t==10?"␤":String.fromCharCode(9216+t)}class Hwe extends da{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Wwe(this.code),i=e.state.phrase("Control character")+" "+(jwe[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,n);if(r)return r;let o=document.createElement("span");return o.textContent=n,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class Qwe extends da{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function Uwe(){return qwe}const Zwe=it.line({class:"cm-activeLine"}),qwe=li.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let i of t.state.selection.ranges){let r=t.lineBlockAt(i.head);r.from>e&&(n.push(Zwe.range(r.from)),e=r.from)}return it.set(n)}},{decorations:t=>t.decorations});let Ywe=class extends da{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let n=e.firstChild?Ud(e.firstChild):[];if(!n.length)return null;let i=window.getComputedStyle(e.parentNode),r=uk(n[0],i.direction!="rtl"),o=parseInt(i.lineHeight);return r.bottom-r.top>o*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+o}:r}ignoreEvent(){return!1}};function Vwe(t){return li.fromClass(class{constructor(e){this.view=e,this.placeholder=t?it.set([it.widget({widget:new Ywe(t),side:1}).range(0)]):it.none}get decorations(){return this.view.state.doc.length?it.none:this.placeholder}},{decorations:e=>e.decorations})}const v4=2e3;function Xwe(t,e,n){let i=Math.min(e.line,n.line),r=Math.max(e.line,n.line),o=[];if(e.off>v4||n.off>v4||e.col<0||n.col<0){let s=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=i;l<=r;l++){let u=t.doc.line(l);u.length<=a&&o.push(he.range(u.from+s,u.to+a))}}else{let s=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=i;l<=r;l++){let u=t.doc.line(l),f=IS(u.text,s,t.tabSize,!0);if(f<0)o.push(he.cursor(u.to));else{let d=IS(u.text,a,t.tabSize);o.push(he.range(u.from+f,u.from+d))}}}return o}function Gwe(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function OL(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),i=t.state.doc.lineAt(n),r=n-i.from,o=r>v4?-1:r==i.length?Gwe(t,e.clientX):Qd(i.text,t.state.tabSize,n-i.from);return{line:i.number,col:o,off:r}}function Kwe(t,e){let n=OL(t,e),i=t.state.selection;return n?{update(r){if(r.docChanged){let o=r.changes.mapPos(r.startState.doc.line(n.line).from),s=r.state.doc.lineAt(o);n={line:s.number,col:n.col,off:Math.min(n.off,s.length)},i=i.map(r.changes)}},get(r,o,s){let a=OL(t,r);if(!a)return i;let l=Xwe(t.state,n,a);return l.length?s?he.create(l.concat(i.ranges)):he.create(l):i}}:null}function Jwe(t){let e=n=>n.altKey&&n.button==0;return Te.mouseSelectionStyle.of((n,i)=>e(i)?Kwe(n,i):null)}const exe={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},txe={style:"cursor: crosshair"};function nxe(t={}){let[e,n]=exe[t.key||"Alt"],i=li.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||n(r))},keyup(r){(r.keyCode==e||!n(r))&&this.set(!1)},mousemove(r){this.set(n(r))}}});return[i,Te.contentAttributes.of(r=>{var o;return!((o=r.plugin(i))===null||o===void 0)&&o.isDown?txe:null})]}const Em="-10000px";class SL{constructor(e,n,i){this.facet=n,this.createTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(r=>r),this.tooltipViews=this.tooltips.map(i)}update(e,n){var i;let r=e.state.facet(this.facet),o=r.filter(l=>l);if(r===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let s=[],a=n?[]:null;for(let l=0;ln[u]=l),n.length=a.length),this.input=r,this.tooltips=o,this.tooltipViews=s,!0}}function ixe(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const b4=Qe.define({combine:t=>{var e,n,i;return{position:Ye.ios?"absolute":((e=t.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((i=t.find(r=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||ixe}}}),CL=new WeakMap,k4=li.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(b4);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new SL(t,y4,n=>this.createTooltip(n)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,i=t.state.facet(b4);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",e.dom.appendChild(n)}return e.dom.style.position=this.position,e.dom.style.top=Em,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(t=n.destroy)===null||t===void 0||t.call(n);this.parent&&this.container.remove(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,n=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Ye.gecko)i=r.offsetParent!=this.container.ownerDocument.body;else if(r.style.top==Em&&r.style.left=="0px"){let o=r.getBoundingClientRect();i=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(i||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(e=r.width/this.parent.offsetWidth,n=r.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:n}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((r,o)=>{let s=this.manager.tooltipViews[o];return s.getCoords?s.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(b4).tooltipSpace(this.view),scaleX:e,scaleY:n,makeAbsolute:i}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:n,space:i,scaleX:r,scaleY:o}=t,s=[];for(let a=0;a=Math.min(n.bottom,i.bottom)||d.rightMath.min(n.right,i.right)+.1){f.style.top=Em;continue}let g=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,m=g?7:0,y=h.right-h.left,x=(e=CL.get(u))!==null&&e!==void 0?e:h.bottom-h.top,_=u.offset||oxe,S=this.view.textDirection==mn.LTR,C=h.width>i.right-i.left?S?i.left:i.right-h.width:S?Math.min(d.left-(g?14:0)+_.x,i.right-y):Math.max(i.left,d.left-y+(g?14:0)-_.x),E=this.above[a];!l.strictSide&&(E?d.top-(h.bottom-h.top)-_.yi.bottom)&&E==i.bottom-d.bottom>d.top-i.top&&(E=this.above[a]=!E);let N=(E?d.top-i.top:i.bottom-d.bottom)-m;if(NC&&W.topM&&(M=E?W.top-x-2-m:W.bottom+m+2);if(this.position=="absolute"?(f.style.top=(M-t.parent.top)/o+"px",f.style.left=(C-t.parent.left)/r+"px"):(f.style.top=M/o+"px",f.style.left=C/r+"px"),g){let W=d.left+(S?_.x:-_.x)-(C+14-7);g.style.left=W/r+"px"}u.overlap!==!0&&s.push({left:C,top:M,right:I,bottom:M+x}),f.classList.toggle("cm-tooltip-above",E),f.classList.toggle("cm-tooltip-below",!E),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=Em}},{eventObservers:{scroll(){this.maybeMeasure()}}}),rxe=Te.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),oxe={x:0,y:0},y4=Qe.define({enables:[k4,rxe]}),Ek=Qe.define();class Tk{static create(e){return new Tk(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new SL(e,Ek,n=>this.createHostedView(n))}createHostedView(e){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(n.dom),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let i of this.manager.tooltipViews){let r=i[e];if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const sxe=y4.compute([Ek],t=>{let e=t.facet(Ek).filter(n=>n);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var i;return(i=n.end)!==null&&i!==void 0?i:n.pos})),create:Tk.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class axe{constructor(e,n,i,r,o){this.view=e,this.source=n,this.field=i,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;ea.bottom||n.xa.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(r)).find(f=>f.from<=r&&f.to>=r),u=l&&l.dir==mn.RTL?-1:1;o=n.x{this.pending==a&&(this.pending=null,l&&e.dispatch({effects:this.setHover.of(l)}))},l=>is(e.state,l,"hover tooltip"))}else s&&e.dispatch({effects:this.setHover.of(s)})}get tooltip(){let e=this.view.plugin(k4),n=e?e.manager.tooltips.findIndex(i=>i.create==Tk.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i&&r&&!lxe(r.dom,e)||this.pending){let{pos:o}=i||this.pending,s=(n=i==null?void 0:i.end)!==null&&n!==void 0?n:o;(o==s?this.view.posAtCoords(this.lastMove)!=o:!uxe(this.view,o,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of(null)})}}watchTooltipLeave(e){let n=i=>{e.removeEventListener("mouseleave",n),this.active&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const $k=4;function lxe(t,e){let n=t.getBoundingClientRect();return e.clientX>=n.left-$k&&e.clientX<=n.right+$k&&e.clientY>=n.top-$k&&e.clientY<=n.bottom+$k}function uxe(t,e,n,i,r,o){let s=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(s.left>i||s.rightr||Math.min(s.bottom,a)=e&&l<=n}function cxe(t,e={}){let n=_t.define(),i=zi.define({create(){return null},update(r,o){if(r&&(e.hideOnChange&&(o.docChanged||o.selection)||e.hideOn&&e.hideOn(o,r)))return null;if(r&&o.docChanged){let s=o.changes.mapPos(r.pos,-1,er.TrackDel);if(s==null)return null;let a=Object.assign(Object.create(null),r);a.pos=s,r.end!=null&&(a.end=o.changes.mapPos(r.end)),r=a}for(let s of o.effects)s.is(n)&&(r=s.value),s.is(fxe)&&(r=null);return r},provide:r=>Ek.from(r)});return[i,li.define(r=>new axe(r,t,i,n,e.hoverTime||300)),sxe]}function EL(t,e){let n=t.plugin(k4);if(!n)return null;let i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}const fxe=_t.define(),TL=Qe.define({combine(t){let e,n;for(let i of t)e=e||i.topContainer,n=n||i.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Tm(t,e){let n=t.plugin($L),i=n?n.specs.indexOf(e):-1;return i>-1?n.panels[i]:null}const $L=li.fromClass(class{constructor(t){this.input=t.state.facet($m),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(TL);this.top=new Mk(t,!0,e.topContainer),this.bottom=new Mk(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(TL);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Mk(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Mk(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet($m);if(n!=this.input){let i=n.filter(l=>l),r=[],o=[],s=[],a=[];for(let l of i){let u=this.specs.indexOf(l),f;u<0?(f=l(t.view),a.push(f)):(f=this.panels[u],f.update&&f.update(t)),r.push(f),(f.top?o:s).push(f)}this.specs=i,this.panels=r,this.top.sync(o),this.bottom.sync(s);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let i of this.panels)i.update&&i.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Te.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Mk{constructor(e,n,i){this.view=e,this.top=n,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=ML(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=ML(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function ML(t){let e=t.nextSibling;return t.remove(),e}const $m=Qe.define({enables:$L});class il extends Qc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}il.prototype.elementClass="",il.prototype.toDOM=void 0,il.prototype.mapMode=er.TrackBefore,il.prototype.startSide=il.prototype.endSide=-1,il.prototype.point=!0;const Nk=Qe.define(),dxe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>zt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Mm=Qe.define();function hxe(t){return[AL(),Mm.of(Object.assign(Object.assign({},dxe),t))]}const NL=Qe.define({combine:t=>t.some(e=>e)});function AL(t){return[pxe]}const pxe=li.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Mm).map(e=>new DL(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(NL),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,i=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(i<(n.to-n.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(NL)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=zt.iter(this.view.state.facet(Nk),this.view.viewport.from),i=[],r=this.gutters.map(o=>new gxe(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let s=!0;for(let a of o.type)if(a.type==Fr.Text&&s){w4(n,i,a.from);for(let l of r)l.line(this.view,a,i);s=!1}else if(a.widget)for(let l of r)l.widget(this.view,a)}else if(o.type==Fr.Text){w4(n,i,o.from);for(let s of r)s.line(this.view,o,i)}else if(o.widget)for(let s of r)s.widget(this.view,o);for(let o of r)o.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Mm),n=t.state.facet(Mm),i=t.docChanged||t.heightChanged||t.viewportChanged||!zt.eq(t.startState.facet(Nk),t.state.facet(Nk),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let r of this.gutters)r.update(t)&&(i=!0);else{i=!0;let r=[];for(let o of n){let s=e.indexOf(o);s<0?r.push(new DL(this.view,o)):(this.gutters[s].update(t),r.push(this.gutters[s]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)this.dom.appendChild(o.dom);this.gutters=r}return i}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>Te.scrollMargins.of(e=>{let n=e.plugin(t);return!n||n.gutters.length==0||!n.fixed?null:e.textDirection==mn.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}})});function PL(t){return Array.isArray(t)?t:[t]}function w4(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class gxe{constructor(e,n,i){this.gutter=e,this.height=i,this.i=0,this.cursor=zt.iter(e.markers,n.from)}addElement(e,n,i){let{gutter:r}=this,o=(n.top-this.height)/e.scaleY,s=n.height/e.scaleY;if(this.i==r.elements.length){let a=new IL(e,s,o,i);r.elements.push(a),r.dom.appendChild(a.dom)}else r.elements[this.i].update(e,s,o,i);this.height=n.bottom,this.i++}line(e,n,i){let r=[];w4(this.cursor,r,n.from),i.length&&(r=r.concat(i));let o=this.gutter.config.lineMarker(e,n,r);o&&r.unshift(o);let s=this.gutter;r.length==0&&!s.config.renderEmptyElements||this.addElement(e,n,r)}widget(e,n){let i=this.gutter.config.widgetMarker(e,n.widget,n);i&&this.addElement(e,n,[i])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class DL{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in n.domEventHandlers)this.dom.addEventListener(i,r=>{let o=r.target,s;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let l=o.getBoundingClientRect();s=(l.top+l.bottom)/2}else s=r.clientY;let a=e.lineBlockAtHeight(s-e.documentTop);n.domEventHandlers[i](e,a,r)&&r.preventDefault()});this.markers=PL(n.markers(e)),n.initialSpacer&&(this.spacer=new IL(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=PL(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let i=e.view.viewport;return!zt.eq(this.markers,n,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class IL{constructor(e,n,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,i,r)}update(e,n,i,r){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),mxe(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,n){let i="cm-gutterElement",r=this.dom.firstChild;for(let o=0,s=0;;){let a=s,l=oo(a,l,u)||s(a,l,u):s}return i}})}});class x4 extends il{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function _4(t,e){return t.state.facet(Xd).formatNumber(e,t.state)}const bxe=Mm.compute([Xd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(vxe)},lineMarker(e,n,i){return i.some(r=>r.toDOM)?null:new x4(_4(e,e.state.doc.lineAt(n.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(Xd)!=e.state.facet(Xd),initialSpacer(e){return new x4(_4(e,LL(e.state.doc.lines)))},updateSpacer(e,n){let i=_4(n.view,LL(n.view.state.doc.lines));return i==e.number?e:new x4(i)},domEventHandlers:t.facet(Xd).domEventHandlers}));function O4(t={}){return[Xd.of(t),AL(),bxe]}function LL(t){let e=9;for(;e{let e=[],n=-1;for(let i of t.selection.ranges){let r=t.doc.lineAt(i.head).from;r>n&&(n=r,e.push(kxe.range(r)))}return zt.of(e)});function wxe(){return yxe}const RL=1024;let xxe=0,os=class{constructor(e,n){this.from=e,this.to=n}};class Et{constructor(e={}){this.id=xxe++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Br.match(e)),n=>{let i=e(n);return i===void 0?null:[this,i]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")}),Et.openedBy=new Et({deserialize:t=>t.split(" ")}),Et.group=new Et({deserialize:t=>t.split(" ")}),Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),Et.contextHash=new Et({perNode:!0}),Et.lookAhead=new Et({perNode:!0}),Et.mounted=new Et({perNode:!0});class Nm{constructor(e,n,i){this.tree=e,this.overlay=n,this.parser=i}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const _xe=Object.create(null);class Br{constructor(e,n,i,r=0){this.name=e,this.props=n,this.id=i,this.flags=r}static define(e){let n=e.props&&e.props.length?Object.create(null):_xe,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Br(e.name||"",n,e.id,i);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let i in e)for(let r of i.split(" "))n[r]=e[i];return i=>{for(let r=i.prop(Et.group),o=-1;o<(r?r.length:0);o++){let s=n[o<0?i.name:r[o]];if(s)return s}}}}Br.none=new Br("",Object.create(null),0,8);class S4{constructor(e){this.types=e;for(let n=0;n0;for(let l=this.cursor(s|ln.IncludeAnonymous);;){let u=!1;if(l.from<=o&&l.to>=r&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:$4(Br.none,this.children,this.positions,0,this.children.length,0,this.length,(n,i,r)=>new Fn(this.type,n,i,r,this.propValues),e.makeTree||((n,i,r)=>new Fn(Br.none,n,i,r)))}static build(e){return Exe(e)}}Fn.empty=new Fn(Br.none,[],[],0);class C4{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new C4(this.buffer,this.index)}}class gu{constructor(e,n,i){this.buffer=e,this.length=n,this.set=i}get type(){return Br.none}toString(){let e=[];for(let n=0;n0));l=s[l+3]);return a}slice(e,n,i){let r=this.buffer,o=new Uint16Array(n-e),s=0;for(let a=e,l=0;a=e&&ne;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function Am(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?a.length:-1;e!=u;e+=n){let f=a[e],d=l[e]+s.from;if(FL(r,i,d,d+f.length)){if(f instanceof gu){if(o&ln.ExcludeBuffers)continue;let h=f.findChild(0,f.buffer.length,n,i-d,r);if(h>-1)return new ga(new Oxe(s,f,e,d),null,h)}else if(o&ln.IncludeAnonymous||!f.type.isAnonymous||T4(f)){let h;if(!(o&ln.IgnoreMounts)&&(h=Nm.get(f))&&!h.overlay)return new Or(h.tree,d,e,s);let g=new Or(f,d,e,s);return o&ln.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?f.children.length-1:0,n,i,r)}}}if(o&ln.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,i=0){let r;if(!(i&ln.IgnoreOverlays)&&(r=Nm.get(this._tree))&&r.overlay){let o=e-this.from;for(let{from:s,to:a}of r.overlay)if((n>0?s<=o:s=o:a>o))return new Or(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function BL(t,e,n,i){let r=t.cursor(),o=[];if(!r.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=r.type.is(n),!r.nextSibling())return o}for(;;){if(i!=null&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return i==null?o:[]}}function E4(t,e,n=e.length-1){for(let i=t;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}class Oxe{constructor(e,n,i,r){this.parent=e,this.buffer=n,this.index=i,this.start=r}}class ga extends zL{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,i){super(),this.context=e,this._parent=n,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,n,i){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,i);return o<0?null:new ga(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,i=0){if(i&ln.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new ga(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ga(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new ga(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:i}=this.context,r=this.index+4,o=i.buffer[this.index+3];if(o>r){let s=i.buffer[this.index+1];e.push(i.slice(r,o,s)),n.push(0)}return new Fn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function WL(t){if(!t.length)return null;let e=0,n=t[0];for(let o=1;on.from||s.to=e){let a=new Or(s.tree,s.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(Am(a,e,n,!1))}}return r?WL(r):i}class Pk{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Or)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof Or?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,i,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.buffer.start,i);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,i=this.mode){return this.buffer?i&ln.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ln.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ln.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(i<0?n.buffer.length:n.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,i,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let o=n+e,s=e<0?-1:i._tree.children.length;o!=s;o+=e){let a=i._tree.children[o];if(this.mode&ln.IncludeAnonymous||a instanceof gu||!a.type.isAnonymous||T4(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==r){if(r==this.index)return s;n=s,i=o+1;break e}r=this.stack[--o]}for(let r=i;r=0;o--){if(o<0)return E4(this._tree,e,r);let s=i[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[r]&&e[r]!=s.name)return!1;r--}}return!0}}function T4(t){return t.children.some(e=>e instanceof gu||!e.type.isAnonymous||T4(e))}function Exe(t){var e;let{buffer:n,nodeSet:i,maxBufferLength:r=RL,reused:o=[],minRepeatType:s=i.types.length}=t,a=Array.isArray(n)?new C4(n,n.length):n,l=i.types,u=0,f=0;function d(N,M,I,W,B,Z){let{id:R,start:Q,end:V,size:H}=a,j=f,q=u;if(H<0)if(a.next(),H==-1){let ce=o[R];I.push(ce),W.push(Q-N);return}else if(H==-3){u=R;return}else if(H==-4){f=R;return}else throw new RangeError(`Unrecognized record size: ${H}`);let Y=l[R],K,te,oe=Q-N;if(V-Q<=r&&(te=x(a.pos-M,B))){let ce=new Uint16Array(te.size-te.skip),U=a.pos-te.size,F=ce.length;for(;a.pos>U;)F=_(te.start,ce,F);K=new gu(ce,V-te.start,i),oe=te.start-N}else{let ce=a.pos-H;a.next();let U=[],F=[],se=R>=s?R:-1,le=0,pe=V;for(;a.pos>ce;)se>=0&&a.id==se&&a.size>=0?(a.end<=pe-r&&(m(U,F,Q,le,a.end,pe,se,j,q),le=U.length,pe=a.end),a.next()):Z>2500?h(Q,ce,U,F):d(Q,ce,U,F,se,Z+1);if(se>=0&&le>0&&le-1&&le>0){let je=g(Y,q);K=$4(Y,U,F,0,U.length,0,V-Q,je,je)}else K=y(Y,U,F,V-Q,j-V,q)}I.push(K),W.push(oe)}function h(N,M,I,W){let B=[],Z=0,R=-1;for(;a.pos>M;){let{id:Q,start:V,end:H,size:j}=a;if(j>4)a.next();else{if(R>-1&&V=0;H-=3)Q[j++]=B[H],Q[j++]=B[H+1]-V,Q[j++]=B[H+2]-V,Q[j++]=j;I.push(new gu(Q,B[2]-V,i)),W.push(V-N)}}function g(N,M){return(I,W,B)=>{let Z=0,R=I.length-1,Q,V;if(R>=0&&(Q=I[R])instanceof Fn){if(!R&&Q.type==N&&Q.length==B)return Q;(V=Q.prop(Et.lookAhead))&&(Z=W[R]+Q.length+V)}return y(N,I,W,B,Z,M)}}function m(N,M,I,W,B,Z,R,Q,V){let H=[],j=[];for(;N.length>W;)H.push(N.pop()),j.push(M.pop()+I-B);N.push(y(i.types[R],H,j,Z-B,Q-Z,V)),M.push(B-I)}function y(N,M,I,W,B,Z,R){if(Z){let Q=[Et.contextHash,Z];R=R?[Q].concat(R):[Q]}if(B>25){let Q=[Et.lookAhead,B];R=R?[Q].concat(R):[Q]}return new Fn(N,M,I,W,R)}function x(N,M){let I=a.fork(),W=0,B=0,Z=0,R=I.end-r,Q={size:0,start:0,skip:0};e:for(let V=I.pos-N;I.pos>V;){let H=I.size;if(I.id==M&&H>=0){Q.size=W,Q.start=B,Q.skip=Z,Z+=4,W+=4,I.next();continue}let j=I.pos-H;if(H<0||j=s?4:0,Y=I.start;for(I.next();I.pos>j;){if(I.size<0)if(I.size==-3)q+=4;else break e;else I.id>=s&&(q+=4);I.next()}B=Y,W+=H,Z+=q}return(M<0||W==N)&&(Q.size=W,Q.start=B,Q.skip=Z),Q.size>4?Q:void 0}function _(N,M,I){let{id:W,start:B,end:Z,size:R}=a;if(a.next(),R>=0&&W4){let V=a.pos-(R-4);for(;a.pos>V;)I=_(N,M,I)}M[--I]=Q,M[--I]=Z-N,M[--I]=B-N,M[--I]=W}else R==-3?u=W:R==-4&&(f=W);return I}let S=[],C=[];for(;a.pos>0;)d(t.start||0,t.bufferStart||0,S,C,-1,0);let E=(e=t.length)!==null&&e!==void 0?e:S.length?C[0]+S[0].length:0;return new Fn(l[t.topID],S.reverse(),C.reverse(),E)}const HL=new WeakMap;function Dk(t,e){if(!t.isAnonymous||e instanceof gu||e.type!=t)return 1;let n=HL.get(e);if(n==null){n=1;for(let i of e.children){if(i.type!=t||!(i instanceof Fn)){n=1;break}n+=Dk(t,i)}HL.set(e,n)}return n}function $4(t,e,n,i,r,o,s,a,l){let u=0;for(let m=i;m=f)break;M+=I}if(C==E+1){if(M>f){let I=m[E];g(I.children,I.positions,0,I.children.length,y[E]+S);continue}d.push(m[E])}else{let I=y[C-1]+m[C-1].length-N;d.push($4(t,m,y,E,C,N,I,null,l))}h.push(N+S-o)}}return g(e,n,i,r,0),(a||l)(d,h,s)}class QL{constructor(){this.map=new WeakMap}setBuffer(e,n,i){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(n,i)}getBuffer(e,n){let i=this.map.get(e);return i&&i.get(n)}set(e,n){e instanceof ga?this.setBuffer(e.context.buffer,e.index,n):e instanceof Or&&this.map.set(e.tree,n)}get(e){return e instanceof ga?this.getBuffer(e.context.buffer,e.index):e instanceof Or?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class rl{constructor(e,n,i,r,o=!1,s=!1){this.from=e,this.to=n,this.tree=i,this.offset=r,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],i=!1){let r=[new rl(0,e.length,e,0,!1,i)];for(let o of n)o.to>e.length&&r.push(o);return r}static applyChanges(e,n,i=128){if(!n.length)return e;let r=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,u=0;;a++){let f=a=i)for(;s&&s.from=h.from||d<=h.to||u){let g=Math.max(h.from,l)-u,m=Math.min(h.to,d)-u;h=g>=m?null:new rl(g,m,h.tree,h.offset+u,a>0,!!f)}if(h&&r.push(h),s.to>d)break;s=onew os(r.from,r.to)):[new os(0,0)]:[new os(0,e.length)],this.createParse(e,n||[],i)}parse(e,n,i){let r=this.startParse(e,n,i);for(;;){let o=r.advance();if(o)return o}}}class Txe{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function $xe(t){return(e,n,i,r)=>new Nxe(e,t,n,i,r)}class ZL{constructor(e,n,i,r,o){this.parser=e,this.parse=n,this.overlay=i,this.target=r,this.from=o}}function qL(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class Mxe{constructor(e,n,i,r,o,s,a){this.parser=e,this.predicate=n,this.mounts=i,this.index=r,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const M4=new Et({perNode:!0});class Nxe{constructor(e,n,i,r,o){this.nest=n,this.input=i,this.fragments=r,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new Fn(i.type,i.children,i.positions,i.length,i.propValues.concat([[M4,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[Et.mounted.id]=new Nm(n,e.overlay,e.parser),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n=this.stoppedAt)a=!1;else if(e.hasNode(r)){if(n){let u=n.mounts.find(f=>f.frag.from<=r.from&&f.frag.to>=r.to&&f.mount.overlay);if(u)for(let f of u.mount.overlay){let d=f.from+u.pos,h=f.to+u.pos;d>=r.from&&h<=r.to&&!n.ranges.some(g=>g.fromd)&&n.ranges.push({from:d,to:h})}}a=!1}else if(i&&(s=Axe(i.ranges,r.from,r.to)))a=s!=2;else if(!r.type.isAnonymous&&(o=this.nest(r,this.input))&&(r.fromnew os(d.from-r.from,d.to-r.from)):null,r.tree,f.length?f[0].from:r.from)),o.overlay?f.length&&(i={ranges:f,depth:0,prev:i}):a=!1}}else if(n&&(l=n.predicate(r))&&(l===!0&&(l=new os(r.from,r.to)),l.from=0&&n.ranges[u].to==l.from?n.ranges[u]={from:n.ranges[u].from,to:l.to}:n.ranges.push(l)}if(a&&r.firstChild())n&&n.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(n&&!--n.depth){let u=XL(this.ranges,n.ranges);u.length&&(qL(u),this.inner.splice(n.index,0,new ZL(n.parser,n.parser.startParse(this.input,GL(n.mounts,u),u),n.ranges.map(f=>new os(f.from-n.start,f.to-n.start)),n.target,u[0].from))),n=n.prev}i&&!--i.depth&&(i=i.prev)}}}}function Axe(t,e,n){for(let i of t){if(i.from>=n)break;if(i.to>e)return i.from<=e&&i.to>=n?2:1}return 0}function YL(t,e,n,i,r,o){if(e=e&&n.enter(i,1,ln.IgnoreOverlays|ln.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof Fn)n=n.children[0];else break}return!1}}let Dxe=class{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(n=i.tree.prop(M4))!==null&&n!==void 0?n:i.to,this.inner=new VL(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(M4))!==null&&e!==void 0?e:n.to,this.inner=new VL(n.tree,-n.offset)}}findMounts(e,n){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let o=this.inner.cursor.node;o;o=o.parent){let s=(i=o.tree)===null||i===void 0?void 0:i.prop(Et.mounted);if(s&&s.parser==n)for(let a=this.fragI;a=o.to)break;l.tree==this.curFrag.tree&&r.push({frag:l,pos:o.from-l.offset,mount:s})}}}return r}};function XL(t,e){let n=null,i=e;for(let r=1,o=0;r=a)break;l.to<=s||(n||(i=n=e.slice()),l.froma&&n.splice(o+1,0,new os(a,l.to))):l.to>a?n[o--]=new os(a,l.to):n.splice(o--,1))}}return i}function Ixe(t,e,n,i){let r=0,o=0,s=!1,a=!1,l=-1e9,u=[];for(;;){let f=r==t.length?1e9:s?t[r].to:t[r].from,d=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let h=Math.max(l,n),g=Math.min(f,d,i);hnew os(h.from+i,h.to+i)),d=Ixe(e,f,l,u);for(let h=0,g=l;;h++){let m=h==d.length,y=m?u:d[h].from;if(y>g&&n.push(new rl(g,y,r.tree,-s,o.from>=g||o.openStart,o.to<=y||o.openEnd)),m)break;g=d[h].to}}else n.push(new rl(l,u,r.tree,-s,o.from>=s||o.openStart,o.to<=a||o.openEnd))}return n}let Lxe=0;class ss{constructor(e,n,i,r){this.name=e,this.set=n,this.base=i,this.modified=r,this.id=Lxe++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let i=typeof e=="string"?e:"?";if(e instanceof ss&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new ss(i,[],null,[]);if(r.set.push(r),n)for(let o of n.set)r.set.push(o);return r}static defineModifier(e){let n=new Ik(e);return i=>i.modified.indexOf(n)>-1?i:Ik.get(i.base||i,i.modified.concat(n).sort((r,o)=>r.id-o.id))}}let Rxe=0;class Ik{constructor(e){this.name=e,this.instances=[],this.id=Rxe++}static get(e,n){if(!n.length)return e;let i=n[0].instances.find(a=>a.base==e&&jxe(n,a.modified));if(i)return i;let r=[],o=new ss(e.name,r,e,n);for(let a of n)a.instances.push(o);let s=Fxe(n);for(let a of e.set)if(!a.modified.length)for(let l of s)r.push(Ik.get(a,l));return o}}function jxe(t,e){return t.length==e.length&&t.every((n,i)=>n==e[i])}function Fxe(t){let e=[[]];for(let n=0;ni.length-n.length)}function Lk(t){let e=Object.create(null);for(let n in t){let i=t[n];Array.isArray(i)||(i=[i]);for(let r of n.split(" "))if(r){let o=[],s=2,a=r;for(let d=0;;){if(a=="..."&&d>0&&d+3==r.length){s=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+r);if(o.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),d+=h[0].length,d==r.length)break;let g=r[d++];if(d==r.length&&g=="!"){s=0;break}if(g!="/")throw new RangeError("Invalid path: "+r);a=r.slice(d)}let l=o.length-1,u=o[l];if(!u)throw new RangeError("Invalid path: "+r);let f=new Pm(i,s,l>0?o.slice(0,l):null);e[u]=f.sort(e[u])}}return KL.add(e)}const KL=new Et({combine(t,e){let n,i,r;for(;t||e;){if(!t||e&&t.depth>=e.depth?(r=e,e=e.next):(r=t,t=t.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let o=new Pm(r.tags,r.mode,r.context);n?n.next=o:i=o,n=o}return i}});class Pm{constructor(e,n,i,r){this.tags=e,this.mode=n,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let s=r;for(let a of o)for(let l of a.set){let u=n[l.id];if(u){s=s?s+" "+u:u;break}}return s},scope:i}}function zxe(t,e){let n=null;for(let i of t){let r=i.style(e);r&&(n=n?n+" "+r:r)}return n}function Bxe(t,e,n,i=0,r=t.length){let o=new Wxe(i,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),i,r,"",o.highlighters),o.flush(r)}class Wxe{constructor(e,n,i){this.at=e,this.highlighters=n,this.span=i,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,i,r,o){let{type:s,from:a,to:l}=e;if(a>=i||l<=n)return;s.isTop&&(o=this.highlighters.filter(g=>!g.scope||g.scope(s)));let u=r,f=Hxe(e)||Pm.empty,d=zxe(o,f.tags);if(d&&(u&&(u+=" "),u+=d,f.mode==1&&(r+=(r?" ":"")+d)),this.startSpan(Math.max(n,a),u),f.opaque)return;let h=e.tree&&e.tree.prop(Et.mounted);if(h&&h.overlay){let g=e.node.enter(h.overlay[0].from+a,1),m=this.highlighters.filter(x=>!x.scope||x.scope(h.tree.type)),y=e.firstChild();for(let x=0,_=a;;x++){let S=x=C||!e.nextSibling())););if(!S||C>i)break;_=S.to+a,_>n&&(this.highlightRange(g.cursor(),Math.max(n,S.from+a),Math.min(i,_),"",m),this.startSpan(Math.min(i,_),u))}y&&e.parent()}else if(e.firstChild()){h&&(r="");do if(!(e.to<=n)){if(e.from>=i)break;this.highlightRange(e,n,i,r,o),this.startSpan(Math.min(i,e.to),u)}while(e.nextSibling());e.parent()}}}function Hxe(t){let e=t.type.prop(KL);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Me=ss.define,Rk=Me(),mu=Me(),eR=Me(mu),tR=Me(mu),vu=Me(),jk=Me(vu),N4=Me(vu),ma=Me(),qc=Me(ma),va=Me(),ba=Me(),A4=Me(),Dm=Me(A4),Fk=Me(),X={comment:Rk,lineComment:Me(Rk),blockComment:Me(Rk),docComment:Me(Rk),name:mu,variableName:Me(mu),typeName:eR,tagName:Me(eR),propertyName:tR,attributeName:Me(tR),className:Me(mu),labelName:Me(mu),namespace:Me(mu),macroName:Me(mu),literal:vu,string:jk,docString:Me(jk),character:Me(jk),attributeValue:Me(jk),number:N4,integer:Me(N4),float:Me(N4),bool:Me(vu),regexp:Me(vu),escape:Me(vu),color:Me(vu),url:Me(vu),keyword:va,self:Me(va),null:Me(va),atom:Me(va),unit:Me(va),modifier:Me(va),operatorKeyword:Me(va),controlKeyword:Me(va),definitionKeyword:Me(va),moduleKeyword:Me(va),operator:ba,derefOperator:Me(ba),arithmeticOperator:Me(ba),logicOperator:Me(ba),bitwiseOperator:Me(ba),compareOperator:Me(ba),updateOperator:Me(ba),definitionOperator:Me(ba),typeOperator:Me(ba),controlOperator:Me(ba),punctuation:A4,separator:Me(A4),bracket:Dm,angleBracket:Me(Dm),squareBracket:Me(Dm),paren:Me(Dm),brace:Me(Dm),content:ma,heading:qc,heading1:Me(qc),heading2:Me(qc),heading3:Me(qc),heading4:Me(qc),heading5:Me(qc),heading6:Me(qc),contentSeparator:Me(ma),list:Me(ma),quote:Me(ma),emphasis:Me(ma),strong:Me(ma),link:Me(ma),monospace:Me(ma),strikethrough:Me(ma),inserted:Me(),deleted:Me(),changed:Me(),invalid:Me(),meta:Fk,documentMeta:Me(Fk),annotation:Me(Fk),processingInstruction:Me(Fk),definition:ss.defineModifier("definition"),constant:ss.defineModifier("constant"),function:ss.defineModifier("function"),standard:ss.defineModifier("standard"),local:ss.defineModifier("local"),special:ss.defineModifier("special")};for(let t in X){let e=X[t];e instanceof ss&&(e.name=t)}JL([{tag:X.link,class:"tok-link"},{tag:X.heading,class:"tok-heading"},{tag:X.emphasis,class:"tok-emphasis"},{tag:X.strong,class:"tok-strong"},{tag:X.keyword,class:"tok-keyword"},{tag:X.atom,class:"tok-atom"},{tag:X.bool,class:"tok-bool"},{tag:X.url,class:"tok-url"},{tag:X.labelName,class:"tok-labelName"},{tag:X.inserted,class:"tok-inserted"},{tag:X.deleted,class:"tok-deleted"},{tag:X.literal,class:"tok-literal"},{tag:X.string,class:"tok-string"},{tag:X.number,class:"tok-number"},{tag:[X.regexp,X.escape,X.special(X.string)],class:"tok-string2"},{tag:X.variableName,class:"tok-variableName"},{tag:X.local(X.variableName),class:"tok-variableName tok-local"},{tag:X.definition(X.variableName),class:"tok-variableName tok-definition"},{tag:X.special(X.variableName),class:"tok-variableName2"},{tag:X.definition(X.propertyName),class:"tok-propertyName tok-definition"},{tag:X.typeName,class:"tok-typeName"},{tag:X.namespace,class:"tok-namespace"},{tag:X.className,class:"tok-className"},{tag:X.macroName,class:"tok-macroName"},{tag:X.propertyName,class:"tok-propertyName"},{tag:X.operator,class:"tok-operator"},{tag:X.comment,class:"tok-comment"},{tag:X.meta,class:"tok-meta"},{tag:X.invalid,class:"tok-invalid"},{tag:X.punctuation,class:"tok-punctuation"}]);var P4;const Gd=new Et;function nR(t){return Qe.define({combine:t?e=>e.concat(t):void 0})}const D4=new Et;class Ds{constructor(e,n,i=[],r=""){this.data=e,this.name=r,jt.prototype.hasOwnProperty("tree")||Object.defineProperty(jt.prototype,"tree",{get(){return Gn(this)}}),this.parser=n,this.extension=[bu.of(this),jt.languageData.of((o,s,a)=>{let l=iR(o,s,a),u=l.type.prop(Gd);if(!u)return[];let f=o.facet(u),d=l.type.prop(D4);if(d){let h=l.resolve(s-l.from,a);for(let g of d)if(g.test(h,o)){let m=o.facet(g.facet);return g.type=="replace"?m:m.concat(f)}}return f})].concat(i)}isActiveAt(e,n,i=-1){return iR(e,n,i).type.prop(Gd)==this.data}findRegions(e){let n=e.facet(bu);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let i=[],r=(o,s)=>{if(o.prop(Gd)==this.data){i.push({from:s,to:s+o.length});return}let a=o.prop(Et.mounted);if(a){if(a.tree.prop(Gd)==this.data){if(a.overlay)for(let l of a.overlay)i.push({from:l.from+s,to:l.to+s});else i.push({from:s,to:s+o.length});return}else if(a.overlay){let l=i.length;if(r(a.tree,a.overlay[0].from+s),i.length>l)return}}for(let l=0;li.isTop?n:void 0)]}),e.name)}configure(e,n){return new Kd(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Gn(t){let e=t.field(Ds.state,!1);return e?e.tree:Fn.empty}class Qxe{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-i,n-i)}}let Im=null;class zk{constructor(e,n,i=[],r,o,s,a,l){this.parser=e,this.state=n,this.fragments=i,this.tree=r,this.treeLen=o,this.viewport=s,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,i){return new zk(e,n,[],Fn.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Qxe(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Fn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(rl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Im;Im=this;try{return e()}finally{Im=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=rR(e,n.from,n.to);return e}changes(e,n){let{fragments:i,tree:r,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((u,f,d,h)=>l.push({fromA:u,toA:f,fromB:d,toB:h})),i=rl.applyChanges(i,l),r=Fn.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let f=e.mapPos(u.from,1),d=e.mapPos(u.to,-1);fe.from&&(this.fragments=rR(this.fragments,r,o),this.skipped.splice(i--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends UL{createParse(n,i,r){let o=r[0].from,s=r[r.length-1].to;return{parsedPos:o,advance(){let l=Im;if(l){for(let u of r)l.tempSkipped.push(u);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=s,new Fn(Br.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Im}}function rR(t,e,n){return rl.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Jd{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new Jd(n)}static init(e){let n=Math.min(3e3,e.doc.length),i=zk.create(e.facet(bu).parser,e,{from:0,to:n});return i.work(20,n)||i.takeTree(),new Jd(i)}}Ds.state=zi.define({create:Jd.init,update(t,e){for(let n of e.effects)if(n.is(Ds.setState))return n.value;return e.startState.facet(bu)!=e.state.facet(bu)?Jd.init(e.state):t.apply(e)}});let oR=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(oR=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const I4=typeof navigator<"u"&&(!((P4=navigator.scheduling)===null||P4===void 0)&&P4.isInputPending)?()=>navigator.scheduling.isInputPending():null,Uxe=li.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Ds.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ds.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=oR(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEndr+1e3,l=o.context.work(()=>I4&&I4()||Date.now()>s,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Ds.setState.of(new Jd(o.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>is(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),bu=Qe.define({combine(t){return t.length?t[0]:null},enables:t=>[Ds.state,Uxe,Te.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class L4{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Zxe=Qe.define(),Lm=Qe.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Bk(t){let e=t.facet(Lm);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Rm(t,e){let n="",i=t.tabSize,r=t.facet(Lm)[0];if(r==" "){for(;e>=i;)n+=" ",e-=i;r=" "}for(let o=0;o=e?qxe(t,n,e):null}class Wk{constructor(e,n={}){this.state=e,this.options=n,this.unit=Bk(e)}lineAt(e,n=1){let i=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:o}=this.options;return r!=null&&r>=i.from&&r<=i.to?o&&r==e?{text:"",from:e}:(n<0?r-1&&(o+=s-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,n=e.length){return Qd(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:i,from:r}=this.lineAt(e,n),o=this.options.overrideIndentation;if(o){let s=o(r);if(s>-1)return s}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Hk=new Et;function qxe(t,e,n){let i=e.resolveStack(n),r=i.node.enterUnfinishedNodesBefore(n);if(r!=i.node){let o=[];for(let s=r;s!=i.node;s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)i={node:o[s],next:i}}return sR(i,t,n)}function sR(t,e,n){for(let i=t;i;i=i.next){let r=Vxe(i.node);if(r)return r(j4.create(e,n,i))}return 0}function Yxe(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Vxe(t){let e=t.type.prop(Hk);if(e)return e;let n=t.firstChild,i;if(n&&(i=n.type.prop(Et.closedBy))){let r=t.lastChild,o=r&&i.indexOf(r.name)>-1;return s=>aR(s,!0,1,void 0,o&&!Yxe(s)?r.from:void 0)}return t.parent==null?Xxe:null}function Xxe(){return 0}class j4 extends Wk{constructor(e,n,i){super(e.state,e.options),this.base=e,this.pos=n,this.context=i}get node(){return this.context.node}static create(e,n,i){return new j4(e,n,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(n.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Gxe(i,e))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}continue(){return sR(this.context.next,this.base,this.pos)}}function Gxe(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Kxe(t){let e=t.node,n=e.childAfter(e.from),i=e.lastChild;if(!n)return null;let r=t.options.simulateBreak,o=t.state.doc.lineAt(n.from),s=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==i)return null;if(!l.type.isSkipped)return l.fromaR(i,e,n,t)}function aR(t,e,n,i,r){let o=t.textAfter,s=o.match(/^\s*/)[0].length,a=i&&o.slice(s,s+i.length)==i||r==t.pos+s,l=e?Kxe(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const e2e=t=>t.baseIndent;function Qk({except:t,units:e=1}={}){return n=>{let i=t&&t.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const t2e=200;function n2e(){return jt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:i}=t.newSelection.main,r=n.lineAt(i);if(i>r.from+t2e)return t;let o=n.sliceString(r.from,i);if(!e.some(u=>u.test(o)))return t;let{state:s}=t,a=-1,l=[];for(let{head:u}of s.selection.ranges){let f=s.doc.lineAt(u);if(f.from==a)continue;a=f.from;let d=R4(s,f.from);if(d==null)continue;let h=/^\s*/.exec(f.text)[0],g=Rm(s,d);h!=g&&l.push({from:f.from,to:f.from+h.length,insert:g})}return l.length?[t,{changes:l,sequential:!0}]:t})}const i2e=Qe.define(),Uk=new Et;function lR(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(o&&a.from=e&&u.to>n&&(o=u)}}return o}function o2e(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function Zk(t,e,n){for(let i of t.facet(i2e)){let r=i(t,e,n);if(r)return r}return r2e(t,e,n)}function uR(t,e){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);return n>=i?void 0:{from:n,to:i}}const qk=_t.define({map:uR}),jm=_t.define({map:uR});function cR(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(i=>i.from<=n&&i.to>=n)||e.push(t.lineBlockAt(n));return e}const Yc=zi.define({create(){return it.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)if(n.is(qk)&&!s2e(t,n.value.from,n.value.to)){let{preparePlaceholder:i}=e.state.facet(hR),r=i?it.replace({widget:new f2e(i(e.state,n.value))}):mR;t=t.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(jm)&&(t=t.update({filter:(i,r)=>n.value.from!=i||n.value.to!=r,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:i}=e.selection.main;t.between(i,i,(r,o)=>{ri&&(n=!0)}),n&&(t=t.update({filterFrom:i,filterTo:i,filter:(r,o)=>o<=i||r>=i}))}return t},provide:t=>Te.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(i,r)=>{n.push(i,r)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{(!r||r.from>o)&&(r={from:o,to:s})}),r}function s2e(t,e,n){let i=!1;return t.between(e,e,(r,o)=>{r==e&&o==n&&(i=!0)}),i}function fR(t,e){return t.field(Yc,!1)?e:e.concat(_t.appendConfig.of(pR()))}const a2e=t=>{for(let e of cR(t)){let n=Zk(t.state,e.from,e.to);if(n)return t.dispatch({effects:fR(t.state,[qk.of(n),dR(t,n)])}),!0}return!1},l2e=t=>{if(!t.state.field(Yc,!1))return!1;let e=[];for(let n of cR(t)){let i=Yk(t.state,n.from,n.to);i&&e.push(jm.of(i),dR(t,i,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function dR(t,e,n=!0){let i=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return Te.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${t.state.phrase("to")} ${r}.`)}const u2e=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:a2e},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:l2e},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,n=[];for(let i=0;i{let e=t.state.field(Yc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(i,r)=>{n.push(jm.of({from:i,to:r}))}),t.dispatch({effects:n}),!0}}],c2e={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},hR=Qe.define({combine(t){return fa(t,c2e)}});function pR(t){return[Yc,p2e]}function gR(t,e){let{state:n}=t,i=n.facet(hR),r=s=>{let a=t.lineBlockAt(t.posAtDOM(s.target)),l=Yk(t.state,a.from,a.to);l&&t.dispatch({effects:jm.of(l)}),s.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,r,e);let o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}const mR=it.replace({widget:new class extends da{toDOM(t){return gR(t,null)}}});class f2e extends da{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return gR(e,this.value)}}const d2e={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class F4 extends il{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function h2e(t={}){let e=Object.assign(Object.assign({},d2e),t),n=new F4(e,!0),i=new F4(e,!1),r=li.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(bu)!=s.state.facet(bu)||s.startState.field(Yc,!1)!=s.state.field(Yc,!1)||Gn(s.startState)!=Gn(s.state)||e.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let a=new au;for(let l of s.viewportLineBlocks){let u=Yk(s.state,l.from,l.to)?i:Zk(s.state,l.from,l.to)?n:null;u&&a.add(l.from,l.from,u)}return a.finish()}}),{domEventHandlers:o}=e;return[r,hxe({class:"cm-foldGutter",markers(s){var a;return((a=s.plugin(r))===null||a===void 0?void 0:a.markers)||zt.empty},initialSpacer(){return new F4(e,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:(s,a,l)=>{if(o.click&&o.click(s,a,l))return!0;let u=Yk(s.state,a.from,a.to);if(u)return s.dispatch({effects:jm.of(u)}),!0;let f=Zk(s.state,a.from,a.to);return f?(s.dispatch({effects:qk.of(f)}),!0):!1}})}),pR()]}const p2e=Te.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ol{constructor(e,n){this.specs=e;let i;function r(a){let l=lu.newName();return(i||(i=Object.create(null)))["."+l]=a,l}const o=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,s=n.scope;this.scope=s instanceof Ds?a=>a.prop(Gd)==s.data:s?a=>a==s:void 0,this.style=JL(e.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:o}).style,this.module=i?new lu(i):null,this.themeType=n.themeType}static define(e,n){return new ol(e,n||{})}}const z4=Qe.define(),vR=Qe.define({combine(t){return t.length?[t[0]]:null}});function B4(t){let e=t.facet(z4);return e.length?e:t.facet(vR)}function Fm(t,e){let n=[m2e],i;return t instanceof ol&&(t.module&&n.push(Te.styleModule.of(t.module)),i=t.themeType),e!=null&&e.fallback?n.push(vR.of(t)):i?n.push(z4.computeN([Te.darkTheme],r=>r.facet(Te.darkTheme)==(i=="dark")?[t]:[])):n.push(z4.of(t)),n}class g2e{constructor(e){this.markCache=Object.create(null),this.tree=Gn(e.state),this.decorations=this.buildDeco(e,B4(e.state))}update(e){let n=Gn(e.state),i=B4(e.state),r=i!=B4(e.startState);n.length{i.add(s,a,this.markCache[l]||(this.markCache[l]=it.mark({class:l})))},r,o);return i.finish()}}const m2e=Hc.high(li.fromClass(g2e,{decorations:t=>t.decorations})),bR=ol.define([{tag:X.meta,color:"#404740"},{tag:X.link,textDecoration:"underline"},{tag:X.heading,textDecoration:"underline",fontWeight:"bold"},{tag:X.emphasis,fontStyle:"italic"},{tag:X.strong,fontWeight:"bold"},{tag:X.strikethrough,textDecoration:"line-through"},{tag:X.keyword,color:"#708"},{tag:[X.atom,X.bool,X.url,X.contentSeparator,X.labelName],color:"#219"},{tag:[X.literal,X.inserted],color:"#164"},{tag:[X.string,X.deleted],color:"#a11"},{tag:[X.regexp,X.escape,X.special(X.string)],color:"#e40"},{tag:X.definition(X.variableName),color:"#00f"},{tag:X.local(X.variableName),color:"#30a"},{tag:[X.typeName,X.namespace],color:"#085"},{tag:X.className,color:"#167"},{tag:[X.special(X.variableName),X.macroName],color:"#256"},{tag:X.definition(X.propertyName),color:"#00c"},{tag:X.comment,color:"#940"},{tag:X.invalid,color:"#f00"}]),v2e=Te.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),kR=1e4,yR="()[]{}",wR=Qe.define({combine(t){return fa(t,{afterCursor:!0,brackets:yR,maxScanDistance:kR,renderMatch:y2e})}}),b2e=it.mark({class:"cm-matchingBracket"}),k2e=it.mark({class:"cm-nonmatchingBracket"});function y2e(t){let e=[],n=t.matched?b2e:k2e;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const w2e=[zi.define({create(){return it.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],i=e.state.facet(wR);for(let r of e.state.selection.ranges){if(!r.empty)continue;let o=ka(e.state,r.head,-1,i)||r.head>0&&ka(e.state,r.head-1,1,i)||i.afterCursor&&(ka(e.state,r.head,1,i)||r.headTe.decorations.from(t)}),v2e];function x2e(t={}){return[wR.of(t),w2e]}const xR=new Et;function W4(t,e,n){let i=t.prop(e<0?Et.openedBy:Et.closedBy);if(i)return i;if(t.name.length==1){let r=n.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[n[r+e]]}return null}function H4(t){let e=t.type.prop(xR);return e?e(t.node):t}function ka(t,e,n,i={}){let r=i.maxScanDistance||kR,o=i.brackets||yR,s=Gn(t),a=s.resolveInner(e,n);for(let l=a;l;l=l.parent){let u=W4(l.type,n,o);if(u&&l.from0?e>=f.from&&ef.from&&e<=f.to))return _2e(t,e,n,l,f,u,o)}}return O2e(t,e,n,s,a.type,r,o)}function _2e(t,e,n,i,r,o,s){let a=i.parent,l={from:r.from,to:r.to},u=0,f=a==null?void 0:a.cursor();if(f&&(n<0?f.childBefore(i.from):f.childAfter(i.to)))do if(n<0?f.to<=i.from:f.from>=i.to){if(u==0&&o.indexOf(f.type.name)>-1&&f.from0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},f=t.doc.iterRange(e,n>0?t.doc.length:0),d=0;for(let h=0;!f.next().done&&h<=o;){let g=f.value;n<0&&(h+=g.length);let m=e+h*n;for(let y=n>0?0:g.length-1,x=n>0?g.length:-1;y!=x;y+=n){let _=s.indexOf(g[y]);if(!(_<0||i.resolveInner(m+y,1).type!=r))if(_%2==0==n>0)d++;else{if(d==1)return{start:u,end:{from:m+y,to:m+y+1},matched:_>>1==l>>1};d--}}n>0&&(h+=g.length)}return f.done?{start:u,matched:!1}:null}const S2e=Object.create(null),_R=[Br.none],OR=[],SR=Object.create(null),C2e=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])C2e[t]=E2e(S2e,e);function Q4(t,e){OR.indexOf(t)>-1||(OR.push(t),console.warn(e))}function E2e(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let u of a.split(".")){let f=t[u]||X[u];f?typeof f=="function"?l.length?l=l.map(f):Q4(u,`Modifier ${u} used at start of tag`):l.length?Q4(u,`Tag ${u} used as modifier`):l=Array.isArray(f)?f:[f]:Q4(u,`Unknown highlighting tag ${u}`)}for(let u of l)n.push(u)}if(!n.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+n.map(a=>a.id),o=SR[r];if(o)return o.id;let s=SR[r]=Br.define({id:_R.length,name:i,props:[Lk({[i]:n})]});return _R.push(s),s.id}mn.RTL,mn.LTR;const T2e=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),i=Z4(t.state,n.from);return i.line?$2e(t):i.block?N2e(t):!1};function U4(t,e){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=t(e,n);return r?(i(n.update(r)),!0):!1}}const $2e=U4(D2e,0),M2e=U4(CR,0),N2e=U4((t,e)=>CR(t,e,P2e(e)),0);function Z4(t,e){let n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}const zm=50;function A2e(t,{open:e,close:n},i,r){let o=t.sliceDoc(i-zm,i),s=t.sliceDoc(r,r+zm),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,u=o.length-a;if(o.slice(u-e.length,u)==e&&s.slice(l,l+n.length)==n)return{open:{pos:i-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let f,d;r-i<=2*zm?f=d=t.sliceDoc(i,r):(f=t.sliceDoc(i,i+zm),d=t.sliceDoc(r-zm,r));let h=/^\s*/.exec(f)[0].length,g=/\s*$/.exec(d)[0].length,m=d.length-g-n.length;return f.slice(h,h+e.length)==e&&d.slice(m,m+n.length)==n?{open:{pos:i+h+e.length,margin:/\s/.test(f.charAt(h+e.length))?1:0},close:{pos:r-g-n.length,margin:/\s/.test(d.charAt(m-1))?1:0}}:null}function P2e(t){let e=[];for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),r=n.to<=i.to?i:t.doc.lineAt(n.to),o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function CR(t,e,n=e.selection.ranges){let i=n.map(o=>Z4(e,o.from).block);if(!i.every(o=>o))return null;let r=n.map((o,s)=>A2e(e,i[s],o.from,o.to));if(t!=2&&!r.every(o=>o))return{changes:e.changes(n.map((o,s)=>r[s]?[]:[{from:o.from,insert:i[s].open+" "},{from:o.to,insert:" "+i[s].close}]))};if(t!=1&&r.some(o=>o)){let o=[];for(let s=0,a;sr&&(o==s||s>d.from)){r=d.from;let h=/^\s*/.exec(d.text)[0].length,g=h==d.length,m=d.text.slice(h,h+u.length)==u?h:-1;ho.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:u,empty:f,single:d}of i)(d||!f)&&o.push({from:a.from+u,insert:l+" "});let s=e.changes(o);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of i)if(a>=0){let u=s.from+a,f=u+l.length;s.text[f-s.from]==" "&&f++,o.push({from:u,to:f})}return{changes:o}}return null}const q4=ca.define(),I2e=ca.define(),L2e=Qe.define(),ER=Qe.define({combine(t){return fa(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(i,r)=>e(i,r)||n(i,r)})}}),TR=zi.define({create(){return ya.empty},update(t,e){let n=e.state.facet(ER),i=e.annotation(q4);if(i){let l=lo.fromTransaction(e,i.selection),u=i.side,f=u==0?t.undone:t.done;return l?f=Gk(f,f.length,n.minDepth,l):f=NR(f,e.startState.selection),new ya(u==0?i.rest:f,u==0?f:i.rest)}let r=e.annotation(I2e);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(jr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=lo.fromTransaction(e),s=e.annotation(jr.time),a=e.annotation(jr.userEvent);return o?t=t.addChanges(o,s,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,s,a,n.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new ya(t.done.map(lo.fromJSON),t.undone.map(lo.fromJSON))}});function Vk(t={}){return[TR,ER.of(t),Te.domEventHandlers({beforeinput(e,n){let i=e.inputType=="historyUndo"?$R:e.inputType=="historyRedo"?Y4:null;return i?(e.preventDefault(),i(n)):!1}})]}function Xk(t,e){return function({state:n,dispatch:i}){if(!e&&n.readOnly)return!1;let r=n.field(TR,!1);if(!r)return!1;let o=r.pop(t,n,e);return o?(i(o),!0):!1}}const $R=Xk(0,!1),Y4=Xk(1,!1),R2e=Xk(0,!0),j2e=Xk(1,!0);class lo{constructor(e,n,i,r,o){this.changes=e,this.effects=n,this.mapped=i,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new lo(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new lo(e.changes&&Ci.fromJSON(e.changes),[],e.mapped&&ua.fromJSON(e.mapped),e.startSelection&&he.fromJSON(e.startSelection),e.selectionsAfter.map(he.fromJSON))}static fromTransaction(e,n){let i=as;for(let r of e.startState.facet(L2e)){let o=r(e);o.length&&(i=i.concat(o))}return!i.length&&e.changes.empty?null:new lo(e.changes.invert(e.startState.doc),i,void 0,n||e.startState.selection,as)}static selection(e){return new lo(void 0,as,void 0,void 0,e)}}function Gk(t,e,n,i){let r=e+1>n+20?e-n-1:0,o=t.slice(r,e);return o.push(i),o}function F2e(t,e){let n=[],i=!1;return t.iterChangedRanges((r,o)=>n.push(r,o)),e.iterChangedRanges((r,o,s,a)=>{for(let l=0;l=u&&s<=f&&(i=!0)}}),i}function z2e(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,i)=>n.empty!=e.ranges[i].empty).length===0}function MR(t,e){return t.length?e.length?t.concat(e):t:e}const as=[],B2e=200;function NR(t,e){if(t.length){let n=t[t.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-B2e));return i.length&&i[i.length-1].eq(e)?t:(i.push(e),Gk(t,t.length-1,1e9,n.setSelAfter(i)))}else return[lo.selection([e])]}function W2e(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function V4(t,e){if(!t.length)return t;let n=t.length,i=as;for(;n;){let r=H2e(t[n-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let o=t.slice(0,n);return o[n-1]=r,o}else e=r.mapped,n--,i=r.selectionsAfter}return i.length?[lo.selection(i)]:as}function H2e(t,e,n){let i=MR(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):as,n);if(!t.changes)return lo.selection(i);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new lo(r,_t.mapEffects(t.effects,e),s,t.startSelection.map(o),i)}const Q2e=/^(input\.type|delete)($|\.)/;class ya{constructor(e,n,i=0,r=void 0){this.done=e,this.undone=n,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new ya(this.done,this.undone):this}addChanges(e,n,i,r,o){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!i||Q2e.test(i))&&(!a.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Kk(n,e))}function Sr(t){return t.textDirectionAt(t.state.selection.main.head)==mn.LTR}const DR=t=>PR(t,!Sr(t)),IR=t=>PR(t,Sr(t));function LR(t,e){return Is(t,n=>n.empty?t.moveByGroup(n,e):Kk(n,e))}const U2e=t=>LR(t,!Sr(t)),Z2e=t=>LR(t,Sr(t));function q2e(t,e,n){if(e.type.prop(n))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Jk(t,e,n){let i=Gn(t).resolveInner(e.head),r=n?Et.closedBy:Et.openedBy;for(let l=e.head;;){let u=n?i.childAfter(l):i.childBefore(l);if(!u)break;q2e(t,u,r)?i=u:l=n?u.to:u.from}let o=i.type.prop(r),s,a;return o&&(s=n?ka(t,i.from,1):ka(t,i.to,-1))&&s.matched?a=n?s.end.to:s.end.from:a=n?i.to:i.from,he.cursor(a,n?-1:1)}const Y2e=t=>Is(t,e=>Jk(t.state,e,!Sr(t))),V2e=t=>Is(t,e=>Jk(t.state,e,Sr(t)));function RR(t,e){return Is(t,n=>{if(!n.empty)return Kk(n,e);let i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)})}const jR=t=>RR(t,!1),FR=t=>RR(t,!0);function zR(t){let e=t.scrollDOM.clientHeights.empty?t.moveVertically(s,e,n.height):Kk(s,e));if(r.eq(i.selection))return!1;let o;if(n.selfScroll){let s=t.coordsAtPos(i.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,u=a.bottom-n.marginBottom;s&&s.top>l&&s.bottomBR(t,!1),X4=t=>BR(t,!0);function ku(t,e,n){let i=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?i.to:i.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==i.from&&i.length){let o=/^\s*/.exec(t.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(r=he.cursor(i.from+o))}return r}const X2e=t=>Is(t,e=>ku(t,e,!0)),G2e=t=>Is(t,e=>ku(t,e,!1)),K2e=t=>Is(t,e=>ku(t,e,!Sr(t))),J2e=t=>Is(t,e=>ku(t,e,Sr(t))),e_e=t=>Is(t,e=>he.cursor(t.lineBlockAt(e.head).from,1)),t_e=t=>Is(t,e=>he.cursor(t.lineBlockAt(e.head).to,-1));function n_e(t,e,n){let i=!1,r=eh(t.selection,o=>{let s=ka(t,o.head,-1)||ka(t,o.head,1)||o.head>0&&ka(t,o.head-1,1)||o.headn_e(t,e);function ls(t,e){let n=eh(t.state.selection,i=>{let r=e(i);return he.range(i.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(wa(t.state,n)),!0)}function HR(t,e){return ls(t,n=>t.moveByChar(n,e))}const QR=t=>HR(t,!Sr(t)),UR=t=>HR(t,Sr(t));function ZR(t,e){return ls(t,n=>t.moveByGroup(n,e))}const r_e=t=>ZR(t,!Sr(t)),o_e=t=>ZR(t,Sr(t)),s_e=t=>ls(t,e=>Jk(t.state,e,!Sr(t))),a_e=t=>ls(t,e=>Jk(t.state,e,Sr(t)));function qR(t,e){return ls(t,n=>t.moveVertically(n,e))}const YR=t=>qR(t,!1),VR=t=>qR(t,!0);function XR(t,e){return ls(t,n=>t.moveVertically(n,e,zR(t).height))}const GR=t=>XR(t,!1),KR=t=>XR(t,!0),l_e=t=>ls(t,e=>ku(t,e,!0)),u_e=t=>ls(t,e=>ku(t,e,!1)),c_e=t=>ls(t,e=>ku(t,e,!Sr(t))),f_e=t=>ls(t,e=>ku(t,e,Sr(t))),d_e=t=>ls(t,e=>he.cursor(t.lineBlockAt(e.head).from)),h_e=t=>ls(t,e=>he.cursor(t.lineBlockAt(e.head).to)),JR=({state:t,dispatch:e})=>(e(wa(t,{anchor:0})),!0),ej=({state:t,dispatch:e})=>(e(wa(t,{anchor:t.doc.length})),!0),tj=({state:t,dispatch:e})=>(e(wa(t,{anchor:t.selection.main.anchor,head:0})),!0),nj=({state:t,dispatch:e})=>(e(wa(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),p_e=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),g_e=({state:t,dispatch:e})=>{let n=ty(t).map(({from:i,to:r})=>he.range(i,Math.min(r+1,t.doc.length)));return e(t.update({selection:he.create(n),userEvent:"select"})),!0},m_e=({state:t,dispatch:e})=>{let n=eh(t.selection,i=>{var r;let o=Gn(t).resolveStack(i.from,1);for(let s=o;s;s=s.next){let{node:a}=s;if((a.from=i.to||a.to>i.to&&a.from<=i.from)&&(!((r=a.parent)===null||r===void 0)&&r.parent))return he.range(a.to,a.from)}return i});return e(wa(t,n)),!0},v_e=({state:t,dispatch:e})=>{let n=t.selection,i=null;return n.ranges.length>1?i=he.create([n.main]):n.main.empty||(i=he.create([he.cursor(n.main.head)])),i?(e(wa(t,i)),!0):!1};function Bm(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:i}=t,r=i.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=e(o);ls&&(n="delete.forward",l=ey(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=ey(t,s,!1),a=ey(t,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:he.cursor(s,sr(t)))i.between(e,e,(r,o)=>{re&&(e=n?o:r)});return e}const ij=(t,e)=>Bm(t,n=>{let i=n.from,{state:r}=t,o=r.doc.lineAt(i),s,a;if(!e&&i>o.from&&iij(t,!1),rj=t=>ij(t,!0),oj=(t,e)=>Bm(t,n=>{let i=n.head,{state:r}=t,o=r.doc.lineAt(i),s=r.charCategorizer(i);for(let a=null;;){if(i==(e?o.to:o.from)){i==n.head&&o.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let l=Ki(o.text,i-o.from,e)+o.from,u=o.text.slice(Math.min(i,l)-o.from,Math.max(i,l)-o.from),f=s(u);if(a!=null&&f!=a)break;(u!=" "||i!=n.head)&&(a=f),i=l}return i}),sj=t=>oj(t,!1),b_e=t=>oj(t,!0),k_e=t=>Bm(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headBm(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),w_e=t=>Bm(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:Yt.of(["",""])},range:he.cursor(i.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},__e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(i=>{if(!i.empty||i.from==0||i.from==t.doc.length)return{range:i};let r=i.from,o=t.doc.lineAt(r),s=r==o.from?r-1:Ki(o.text,r-o.from,!1)+o.from,a=r==o.to?r+1:Ki(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:t.doc.slice(r,a).append(t.doc.slice(s,r))},range:he.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ty(t){let e=[],n=-1;for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),o=t.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=t.doc.lineAt(i.to-1)),n>=r.number){let s=e[e.length-1];s.to=o.to,s.ranges.push(i)}else e.push({from:r.from,to:o.to,ranges:[i]});n=o.number+1}return e}function aj(t,e,n){if(t.readOnly)return!1;let i=[],r=[];for(let o of ty(t)){if(n?o.to==t.doc.length:o.from==0)continue;let s=t.doc.lineAt(n?o.to+1:o.from-1),a=s.length+1;if(n){i.push({from:o.to,to:s.to},{from:o.from,insert:s.text+t.lineBreak});for(let l of o.ranges)r.push(he.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{i.push({from:s.from,to:o.from},{from:o.to,insert:t.lineBreak+s.text});for(let l of o.ranges)r.push(he.range(l.anchor-a,l.head-a))}}return i.length?(e(t.update({changes:i,scrollIntoView:!0,selection:he.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const O_e=({state:t,dispatch:e})=>aj(t,e,!1),S_e=({state:t,dispatch:e})=>aj(t,e,!0);function lj(t,e,n){if(t.readOnly)return!1;let i=[];for(let r of ty(t))n?i.push({from:r.from,insert:t.doc.slice(r.from,r.to)+t.lineBreak}):i.push({from:r.to,insert:t.lineBreak+t.doc.slice(r.from,r.to)});return e(t.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const C_e=({state:t,dispatch:e})=>lj(t,e,!1),E_e=({state:t,dispatch:e})=>lj(t,e,!0),T_e=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(ty(e).map(({from:r,to:o})=>(r>0?r--:ot.moveVertically(r,!0)).map(n);return t.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function $_e(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Gn(t).resolveInner(e),i=n.childBefore(e),r=n.childAfter(e),o;return i&&r&&i.to<=e&&r.from>=e&&(o=i.type.prop(Et.closedBy))&&o.indexOf(r.name)>-1&&t.doc.lineAt(i.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const M_e=uj(!1),N_e=uj(!0);function uj(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:o,to:s}=r,a=e.doc.lineAt(o),l=!t&&o==s&&$_e(e,o);t&&(o=s=(s<=a.to?a:e.doc.lineAt(s)).to);let u=new Wk(e,{simulateBreak:o,simulateDoubleBreak:!!l}),f=R4(u,o);for(f==null&&(f=Qd(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));sa.from&&o{let r=[];for(let s=i.from;s<=i.to;){let a=t.doc.lineAt(s);a.number>n&&(i.empty||i.to>a.from)&&(e(a,r,i),n=a.number),s=a.to+1}let o=t.changes(r);return{changes:r,range:he.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}const A_e=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),i=new Wk(t,{overrideIndentation:o=>{let s=n[o];return s??-1}}),r=K4(t,(o,s,a)=>{let l=R4(i,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let u=/^\s*/.exec(o.text)[0],f=Rm(t,l);(u!=f||a.fromt.readOnly?!1:(e(t.update(K4(t,(n,i)=>{i.push({from:n.from,insert:t.facet(Lm)})}),{userEvent:"input.indent"})),!0),fj=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(K4(t,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let o=Qd(r,t.tabSize),s=0,a=Rm(t,Math.max(0,o-Bk(t)));for(;s({mac:t.key,run:t.run,shift:t.shift}))),dj=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Y2e,shift:s_e},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:V2e,shift:a_e},{key:"Alt-ArrowUp",run:O_e},{key:"Shift-Alt-ArrowUp",run:C_e},{key:"Alt-ArrowDown",run:S_e},{key:"Shift-Alt-ArrowDown",run:E_e},{key:"Escape",run:v_e},{key:"Mod-Enter",run:N_e},{key:"Alt-l",mac:"Ctrl-l",run:g_e},{key:"Mod-i",run:m_e,preventDefault:!0},{key:"Mod-[",run:fj},{key:"Mod-]",run:cj},{key:"Mod-Alt-\\",run:A_e},{key:"Shift-Mod-k",run:T_e},{key:"Shift-Mod-\\",run:i_e},{key:"Mod-/",run:T2e},{key:"Alt-A",run:M2e}].concat(J4),D_e={key:"Tab",run:cj,shift:fj};function un(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];typeof r=="string"?t.setAttribute(i,r):r!=null&&(t[i]=r)}e++}for(;et.normalize("NFKD"):t=>t;class th{constructor(e,n,i=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,r),this.bufferStart=i,this.normalize=o?a=>o(pj(a)):pj,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ji(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=kS(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=ns(e);let r=this.normalize(n);for(let o=0,s=i;;o++){let a=r.charCodeAt(o),l=this.match(a,s);if(o==r.length-1){if(l)return this.value=l,this;break}s==i&&othis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let i=this.curLineStart+n.index,r=i+n[0].length;if(this.matchPos=ny(this.text,r+(i==r?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||r.to<=n){let a=new nh(n,e.sliceString(n,i));return tC.set(e,a),a}if(r.from==n&&r.to==i)return r;let{text:o,from:s}=r;return s>n&&(o=e.sliceString(n,s)+o,s=n),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let i=this.flat.from+n.index,r=i+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,match:n},this.matchPos=ny(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=nh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(mj.prototype[Symbol.iterator]=vj.prototype[Symbol.iterator]=function(){return this});function I_e(t){try{return new RegExp(t,eC),!0}catch{return!1}}function ny(t,e){if(e>=t.length)return e;let n=t.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function nC(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=un("input",{class:"cm-textfield",name:"line",value:e}),i=un("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:iy.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),r())},onsubmit:o=>{o.preventDefault(),r()}},un("label",t.state.phrase("Go to line"),": ",n)," ",un("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function r(){let o=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!o)return;let{state:s}=t,a=s.doc.lineAt(s.selection.main.head),[,l,u,f,d]=o,h=f?+f.slice(1):0,g=u?+u:a.number;if(u&&d){let x=g/100;l&&(x=x*(l=="-"?-1:1)+a.number/s.doc.lines),g=Math.round(s.doc.lines*x)}else u&&l&&(g=g*(l=="-"?-1:1)+a.number);let m=s.doc.line(Math.max(1,Math.min(s.doc.lines,g))),y=he.cursor(m.from+Math.max(0,Math.min(h,m.length)));t.dispatch({effects:[iy.of(!1),Te.scrollIntoView(y.from,{y:"center"})],selection:y}),t.focus()}return{dom:i}}const iy=_t.define(),bj=zi.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(iy)&&(t=n.value);return t},provide:t=>$m.from(t,e=>e?nC:null)}),L_e=t=>{let e=Tm(t,nC);if(!e){let n=[iy.of(!0)];t.state.field(bj,!1)==null&&n.push(_t.appendConfig.of([bj,R_e])),t.dispatch({effects:n}),e=Tm(t,nC)}return e&&e.dom.querySelector("input").select(),!0},R_e=Te.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),j_e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},F_e=Qe.define({combine(t){return fa(t,j_e,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function z_e(t){return[U_e,Q_e]}const B_e=it.mark({class:"cm-selectionMatch"}),W_e=it.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function kj(t,e,n,i){return(n==0||t(e.sliceDoc(n-1,n))!=Nn.Word)&&(i==e.doc.length||t(e.sliceDoc(i,i+1))!=Nn.Word)}function H_e(t,e,n,i){return t(e.sliceDoc(n,n+1))==Nn.Word&&t(e.sliceDoc(i-1,i))==Nn.Word}const Q_e=li.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(F_e),{state:n}=t,i=n.selection;if(i.ranges.length>1)return it.none;let r=i.main,o,s=null;if(r.empty){if(!e.highlightWordAroundCursor)return it.none;let l=n.wordAt(r.head);if(!l)return it.none;s=n.charCategorizer(r.head),o=n.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l200)return it.none;if(e.wholeWords){if(o=n.sliceDoc(r.from,r.to),s=n.charCategorizer(r.head),!(kj(s,n,r.from,r.to)&&H_e(s,n,r.from,r.to)))return it.none}else if(o=n.sliceDoc(r.from,r.to).trim(),!o)return it.none}let a=[];for(let l of t.visibleRanges){let u=new th(n.doc,o,l.from,l.to);for(;!u.next().done;){let{from:f,to:d}=u.value;if((!s||kj(s,n,f,d))&&(r.empty&&f<=r.from&&d>=r.to?a.push(W_e.range(f,d)):(f>=r.to||d<=r.from)&&a.push(B_e.range(f,d)),a.length>e.maxMatches))return it.none}}return it.set(a)}},{decorations:t=>t.decorations}),U_e=Te.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Z_e=({state:t,dispatch:e})=>{let{selection:n}=t,i=he.create(n.ranges.map(r=>t.wordAt(r.head)||he.cursor(r.head)),n.mainIndex);return i.eq(n)?!1:(e(t.update({selection:i})),!0)};function q_e(t,e){let{main:n,ranges:i}=t.selection,r=t.wordAt(n.head),o=r&&r.from==n.from&&r.to==n.to;for(let s=!1,a=new th(t.doc,e,i[i.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new th(t.doc,e,0,Math.max(0,i[i.length-1].from-1)),s=!0}else{if(s&&i.some(l=>l.from==a.value.from))continue;if(o){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Y_e=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(o=>o.from===o.to))return Z_e({state:t,dispatch:e});let i=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=i))return!1;let r=q_e(t,i);return r?(e(t.update({selection:t.selection.addRange(he.range(r.from,r.to),!1),effects:Te.scrollIntoView(r.to)})),!0):!1},ih=Qe.define({combine(t){return fa(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new s3e(e),scrollToMatch:e=>Te.scrollIntoView(e)})}});class yj{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||I_e(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new K_e(this):new X_e(this)}getCursor(e,n=0,i){let r=e.doc?e:jt.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?oh(this,r,n,i):rh(this,r,n,i)}}class wj{constructor(e){this.spec=e}}function rh(t,e,n,i){return new th(e.doc,t.unquoted,n,i,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?V_e(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function V_e(t,e){return(n,i,r,o)=>((o>n||o+r.length=n)return null;r.push(i.value)}return r}highlight(e,n,i,r){let o=rh(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}function oh(t,e,n,i){return new mj(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?G_e(e.charCategorizer(e.selection.main.head)):void 0},n,i)}function ry(t,e){return t.slice(Ki(t,e,!1),e)}function oy(t,e){return t.slice(e,Ki(t,e))}function G_e(t){return(e,n,i)=>!i[0].length||(t(ry(i.input,i.index))!=Nn.Word||t(oy(i.input,i.index))!=Nn.Word)&&(t(oy(i.input,i.index+i[0].length))!=Nn.Word||t(ry(i.input,i.index+i[0].length))!=Nn.Word)}class K_e extends wj{nextMatch(e,n,i){let r=oh(this.spec,e,i,e.doc.length).next();return r.done&&(r=oh(this.spec,e,0,n).next()),r.done?null:r.value}prevMatchInRange(e,n,i){for(let r=1;;r++){let o=Math.max(n,i-r*1e4),s=oh(this.spec,e,o,i),a=null;for(;!s.next().done;)a=s.value;if(a&&(o==n||a.from>o+10))return a;if(o==n)return null}}prevMatch(e,n,i){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(n,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=n)return null;r.push(i.value)}return r}highlight(e,n,i,r){let o=oh(this.spec,e,Math.max(0,n-250),Math.min(i+250,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}}const Wm=_t.define(),iC=_t.define(),yu=zi.define({create(t){return new rC(sC(t).create(),null)},update(t,e){for(let n of e.effects)n.is(Wm)?t=new rC(n.value.create(),t.panel):n.is(iC)&&(t=new rC(t.query,n.value?oC:null));return t},provide:t=>$m.from(t,e=>e.panel)});class rC{constructor(e,n){this.query=e,this.panel=n}}const J_e=it.mark({class:"cm-searchMatch"}),e3e=it.mark({class:"cm-searchMatch cm-searchMatch-selected"}),t3e=li.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(yu))}update(t){let e=t.state.field(yu);(e!=t.startState.field(yu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return it.none;let{view:n}=this,i=new au;for(let r=0,o=n.visibleRanges,s=o.length;ro[r+1].from-2*250;)l=o[++r].to;t.highlight(n.state,a,l,(u,f)=>{let d=n.state.selection.ranges.some(h=>h.from==u&&h.to==f);i.add(u,f,d?e3e:J_e)})}return i.finish()}},{decorations:t=>t.decorations});function Hm(t){return e=>{let n=e.state.field(yu,!1);return n&&n.query.spec.valid?t(e,n):Sj(e)}}const sy=Hm((t,{query:e})=>{let{to:n}=t.state.selection.main,i=e.nextMatch(t.state,n,n);if(!i)return!1;let r=he.single(i.from,i.to),o=t.state.facet(ih);return t.dispatch({selection:r,effects:[aC(t,i),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Oj(t),!0}),ay=Hm((t,{query:e})=>{let{state:n}=t,{from:i}=n.selection.main,r=e.prevMatch(n,i,i);if(!r)return!1;let o=he.single(r.from,r.to),s=t.state.facet(ih);return t.dispatch({selection:o,effects:[aC(t,r),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),Oj(t),!0}),n3e=Hm((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:he.create(n.map(i=>he.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),i3e=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,o=[],s=0;for(let a=new th(t.doc,t.sliceDoc(i,r));!a.next().done;){if(o.length>1e3)return!1;a.value.from==i&&(s=o.length),o.push(he.range(a.value.from,a.value.to))}return e(t.update({selection:he.create(o,s),userEvent:"select.search.matches"})),!0},xj=Hm((t,{query:e})=>{let{state:n}=t,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let o=e.nextMatch(n,i,i);if(!o)return!1;let s=[],a,l,u=[];if(o.from==i&&o.to==r&&(l=n.toText(e.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=e.nextMatch(n,o.from,o.to),u.push(Te.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))),o){let f=s.length==0||s[0].from>=o.to?0:o.to-o.from-l.length;a=he.single(o.from-f,o.to-f),u.push(aC(t,o)),u.push(n.facet(ih).scrollToMatch(a.main,t))}return t.dispatch({changes:s,selection:a,effects:u,userEvent:"input.replace"}),!0}),r3e=Hm((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(r=>{let{from:o,to:s}=r;return{from:o,to:s,insert:e.getReplacement(r)}});if(!n.length)return!1;let i=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Te.announce.of(i),userEvent:"input.replace.all"}),!0});function oC(t){return t.state.facet(ih).createPanel(t)}function sC(t,e){var n,i,r,o,s;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let u=t.facet(ih);return new yj({search:((n=e==null?void 0:e.literal)!==null&&n!==void 0?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:u.caseSensitive,literal:(r=e==null?void 0:e.literal)!==null&&r!==void 0?r:u.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:u.regexp,wholeWord:(s=e==null?void 0:e.wholeWord)!==null&&s!==void 0?s:u.wholeWord})}function _j(t){let e=Tm(t,oC);return e&&e.dom.querySelector("[main-field]")}function Oj(t){let e=_j(t);e&&e==t.root.activeElement&&e.select()}const Sj=t=>{let e=t.state.field(yu,!1);if(e&&e.panel){let n=_j(t);if(n&&n!=t.root.activeElement){let i=sC(t.state,e.query.spec);i.valid&&t.dispatch({effects:Wm.of(i)}),n.focus(),n.select()}}else t.dispatch({effects:[iC.of(!0),e?Wm.of(sC(t.state,e.query.spec)):_t.appendConfig.of(l3e)]});return!0},Cj=t=>{let e=t.state.field(yu,!1);if(!e||!e.panel)return!1;let n=Tm(t,oC);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:iC.of(!1)}),!0},o3e=[{key:"Mod-f",run:Sj,scope:"editor search-panel"},{key:"F3",run:sy,shift:ay,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:sy,shift:ay,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Cj,scope:"editor search-panel"},{key:"Mod-Shift-l",run:i3e},{key:"Mod-Alt-g",run:L_e},{key:"Mod-d",run:Y_e,preventDefault:!0}];class s3e{constructor(e){this.view=e;let n=this.query=e.state.field(yu).query.spec;this.commit=this.commit.bind(this),this.searchField=un("input",{value:n.search,placeholder:Mo(e,"Find"),"aria-label":Mo(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=un("input",{value:n.replace,placeholder:Mo(e,"Replace"),"aria-label":Mo(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=un("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=un("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=un("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function i(r,o,s){return un("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=un("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>sy(e),[Mo(e,"next")]),i("prev",()=>ay(e),[Mo(e,"previous")]),i("select",()=>n3e(e),[Mo(e,"all")]),un("label",null,[this.caseField,Mo(e,"match case")]),un("label",null,[this.reField,Mo(e,"regexp")]),un("label",null,[this.wordField,Mo(e,"by word")]),...e.state.readOnly?[]:[un("br"),this.replaceField,i("replace",()=>xj(e),[Mo(e,"replace")]),i("replaceAll",()=>r3e(e),[Mo(e,"replace all")])],un("button",{name:"close",onclick:()=>Cj(e),"aria-label":Mo(e,"close"),type:"button"},["×"])])}commit(){let e=new yj({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Wm.of(e)}))}keydown(e){Owe(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ay:sy)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),xj(this.view))}update(e){for(let n of e.transactions)for(let i of n.effects)i.is(Wm)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ih).top}}function Mo(t,e){return t.state.phrase(e)}const ly=30,uy=/[\s\.,:;?!]/;function aC(t,{from:e,to:n}){let i=t.state.doc.lineAt(e),r=t.state.doc.lineAt(n).to,o=Math.max(i.from,e-ly),s=Math.min(r,n+ly),a=t.state.sliceDoc(o,s);if(o!=i.from){for(let l=0;la.length-ly;l--)if(!uy.test(a[l-1])&&uy.test(a[l])){a=a.slice(0,l);break}}return Te.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${i.number}.`)}const a3e=Te.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),l3e=[yu,Hc.low(t3e),a3e];class Ej{constructor(e,n,i){this.state=e,this.pos=n,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let n=Gn(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),i=Math.max(n.from,this.pos-250),r=n.text.slice(i-n.from,this.pos-n.from),o=r.search(Nj(e,!1));return o<0?null:{from:i+o,to:this.pos,text:r.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,n){e=="abort"&&this.abortListeners&&this.abortListeners.push(n)}}function Tj(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function u3e(t){let e=Object.create(null),n=Object.create(null);for(let{label:r}of t){e[r[0]]=!0;for(let o=1;otypeof r=="string"?{label:r}:r),[n,i]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:u3e(e);return r=>{let o=r.matchBefore(i);return o||r.explicit?{from:o?o.from:r.pos,options:e,validFor:n}:null}}function c3e(t,e){return n=>{for(let i=Gn(n.state).resolveInner(n.pos,-1);i;i=i.parent){if(t.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(n)}}class Mj{constructor(e,n,i,r){this.completion=e,this.source=n,this.match=i,this.score=r}}function wu(t){return t.selection.main.from}function Nj(t,e){var n;let{source:i}=t,r=e&&i[0]!="^",o=i[i.length-1]!="$";return!r&&!o?t:new RegExp(`${r?"^":""}(?:${i})${o?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const Aj=ca.define();function f3e(t,e,n,i){let{main:r}=t.selection,o=n-r.from,s=i-r.from;return Object.assign(Object.assign({},t.changeByRange(a=>a!=r&&n!=i&&t.sliceDoc(a.from+o,a.from+s)!=t.sliceDoc(n,i)?{range:a}:{changes:{from:a.from+o,to:i==r.from?a.to:a.from+s,insert:e},range:he.cursor(a.from+o+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const Pj=new WeakMap;function d3e(t){if(!Array.isArray(t))return t;let e=Pj.get(t);return e||Pj.set(t,e=$j(t)),e}const cy=_t.define(),Qm=_t.define();class h3e{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&N<=57||N>=97&&N<=122?2:N>=65&&N<=90?1:0:(M=kS(N))!=M.toLowerCase()?1:M!=M.toUpperCase()?2:0;(!S||I==1&&x||E==0&&I!=0)&&(n[d]==N||i[d]==N&&(h=!0)?s[d++]=S:s.length&&(_=!1)),E=I,S+=ns(N)}return d==l&&s[0]==0&&_?this.result(-100+(h?-200:0),s,e):g==l&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):g==l?this.ret(-900-e.length,[m,y]):d==l?this.result(-100+(h?-200:0)+-700+(_?0:-1100),s,e):n.length==2?!1:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,n,i){let r=[],o=0;for(let s of n){let a=s+(this.astral?ns(Ji(i,s)):1);o&&r[o-1]==s?r[o-1]=a:(r[o++]=s,r[o++]=a)}return this.ret(e-i.length,r)}}const ir=Qe.define({combine(t){return fa(t,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:p3e,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>i=>Dj(e(i),n(i)),optionClass:(e,n)=>i=>Dj(e(i),n(i)),addToOptions:(e,n)=>e.concat(n)})}});function Dj(t,e){return t?e?t+" "+e:t:e}function p3e(t,e,n,i,r,o){let s=t.textDirection==mn.RTL,a=s,l=!1,u="top",f,d,h=e.left-r.left,g=r.right-e.right,m=i.right-i.left,y=i.bottom-i.top;if(a&&h=y||S>e.top?f=n.bottom-e.top:(u="bottom",f=e.bottom-n.top)}let x=(e.bottom-e.top)/o.offsetHeight,_=(e.right-e.left)/o.offsetWidth;return{style:`${u}: ${f/x}px; max-width: ${d/_}px`,class:"cm-completionInfo-"+(l?s?"left-narrow":"right-narrow":a?"left":"right")}}function g3e(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),n.type&&i.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(n,i,r,o){let s=document.createElement("span");s.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let u=0;ul&&s.appendChild(document.createTextNode(a.slice(l,f)));let h=s.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(f,d))),h.className="cm-completionMatchedText",l=d}return ln.position-i.position).map(n=>n.render)}function lC(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let r=Math.floor(e/n);return{from:r*n,to:(r+1)*n}}let i=Math.floor((t-e)/n);return{from:t-(i+1)*n,to:t-i*n}}class m3e{constructor(e,n,i){this.view=e,this.stateField=n,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=e.state.field(n),{options:o,selected:s}=r.open,a=e.state.facet(ir);this.optionContent=g3e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=lC(o.length,s,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:u}=e.state.field(n).open;for(let f=l.target,d;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(d=/-(\d+)$/.exec(f.id))&&+d[1]{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(ir).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Qm.of(null)})}),this.showOptions(o,r.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let i=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=r){let{options:o,selected:s,disabled:a}=i.open;(!r.open||r.open.options!=o)&&(this.range=lC(o.length,s,e.state.facet(ir).maxRenderedOptions),this.showOptions(o,i.id)),this.updateSel(),a!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of n.split(" "))i&&this.dom.classList.add(i);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected=this.range.to)&&(this.range=lC(n.options.length,n.selected,this.view.state.facet(ir).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:r}=i;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(i);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(s,i)}).catch(s=>is(this.view.state,s,"completion info")):this.addInfoPane(o,i)}}addInfoPane(e,n){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:o}=e;i.appendChild(r),this.infoDestroy=o||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let i=this.list.firstChild,r=this.range.from;i;i=i.nextSibling,r++)i.nodeName!="LI"||!i.id?r--:r==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),n=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return n&&b3e(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),o=this.space;if(!o){let s=this.dom.ownerDocument.defaultView||window;o={left:0,top:0,right:s.innerWidth,bottom:s.innerHeight}}return r.top>Math.min(o.bottom,n.bottom)-10||r.bottomi.from||i.from==0))if(o=h,typeof u!="string"&&u.header)r.appendChild(u.header(u));else{let g=r.appendChild(document.createElement("completion-section"));g.textContent=h}}const f=r.appendChild(document.createElement("li"));f.id=n+"-"+s,f.setAttribute("role","option");let d=this.optionClass(a);d&&(f.className=d);for(let h of this.optionContent){let g=h(a,this.view.state,this.view,l);g&&f.appendChild(g)}}return i.from&&r.classList.add("cm-completionListIncompleteTop"),i.tonew m3e(n,t,e)}function b3e(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.height/t.offsetHeight;i.topn.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/r)}function Ij(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function k3e(t,e){let n=[],i=null,r=l=>{n.push(l);let{section:u}=l.completion;if(u){i||(i=[]);let f=typeof u=="string"?u:u.name;i.some(d=>d.name==f)||i.push(typeof u=="string"?{name:f}:u)}};for(let l of t)if(l.hasResult()){let u=l.result.getMatch;if(l.result.filter===!1)for(let f of l.result.options)r(new Mj(f,l.source,u?u(f):[],1e9-n.length));else{let f=new h3e(e.sliceDoc(l.from,l.to));for(let d of l.result.options)if(f.match(d.label)){let h=d.displayLabel?u?u(d,f.matched):[]:f.matched;r(new Mj(d,l.source,h,f.score+(d.boost||0)))}}}if(i){let l=Object.create(null),u=0,f=(d,h)=>{var g,m;return((g=d.rank)!==null&&g!==void 0?g:1e9)-((m=h.rank)!==null&&m!==void 0?m:1e9)||(d.namef.score-u.score||a(u.completion,f.completion))){let u=l.completion;!s||s.label!=u.label||s.detail!=u.detail||s.type!=null&&u.type!=null&&s.type!=u.type||s.apply!=u.apply||s.boost!=u.boost?o.push(l):Ij(l.completion)>Ij(s)&&(o[o.length-1]=l),s=l.completion}return o}class sh{constructor(e,n,i,r,o,s){this.options=e,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=o,this.disabled=s}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new sh(this.options,Lj(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,i,r,o){let s=k3e(e,n);if(!s.length)return r&&e.some(l=>l.state==1)?new sh(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;let a=n.facet(ir).selectOnOpen?0:-1;if(r&&r.selected!=a&&r.selected!=-1){let l=r.options[r.selected].completion;for(let u=0;uu.hasResult()?Math.min(l,u.from):l,1e8),create:O3e,above:o.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new sh(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class fy{constructor(e,n,i){this.active=e,this.id=n,this.open=i}static start(){return new fy(x3e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,i=n.facet(ir),o=(i.override||n.languageDataAt("autocomplete",wu(n)).map(d3e)).map(a=>(this.active.find(u=>u.source==a)||new uo(a,this.active.some(u=>u.state!=0)?1:0)).update(e,i));o.length==this.active.length&&o.every((a,l)=>a==this.active[l])&&(o=this.active);let s=this.open;s&&e.docChanged&&(s=s.map(e.changes)),e.selection||o.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!y3e(o,this.active)?s=sh.build(o,n,this.id,s,i):s&&s.disabled&&!o.some(a=>a.state==1)&&(s=null),!s&&o.every(a=>a.state!=1)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new uo(a.source,0):a));for(let a of e.effects)a.is(jj)&&(s=s&&s.setSelected(a.value,this.id));return o==this.active&&s==this.open?this:new fy(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:w3e}}function y3e(t,e){if(t==e)return!0;for(let n=0,i=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const x3e=[];function uC(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class uo{constructor(e,n,i=-1){this.source=e,this.state=n,this.explicitPos=i}hasResult(){return!1}update(e,n){let i=uC(e),r=this;i?r=r.handleUserEvent(e,i,n):e.docChanged?r=r.handleChange(e):e.selection&&r.state!=0&&(r=new uo(r.source,0));for(let o of e.effects)if(o.is(cy))r=new uo(r.source,1,o.value?wu(e.state):-1);else if(o.is(Qm))r=new uo(r.source,0);else if(o.is(Rj))for(let s of o.value)s.source==r.source&&(r=s);return r}handleUserEvent(e,n,i){return n=="delete"||!i.activateOnTyping?this.map(e.changes):new uo(this.source,1)}handleChange(e){return e.changes.touchesRange(wu(e.startState))?new uo(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new uo(this.source,this.state,e.mapPos(this.explicitPos))}}class ah extends uo{constructor(e,n,i,r,o){super(e,2,n),this.result=i,this.from=r,this.to=o}hasResult(){return!0}handleUserEvent(e,n,i){var r;let o=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),a=wu(e.state);if((this.explicitPos<0?a<=o:as||n=="delete"&&wu(e.startState)==this.from)return new uo(this.source,n=="input"&&i.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),u;return _3e(this.result.validFor,e.state,o,s)?new ah(this.source,l,this.result,o,s):this.result.update&&(u=this.result.update(this.result,o,s,new Ej(e.state,a,l>=0)))?new ah(this.source,l,u,u.from,(r=u.to)!==null&&r!==void 0?r:wu(e.state)):new uo(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new uo(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ah(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function _3e(t,e,n,i){if(!t)return!1;let r=e.sliceDoc(n,i);return typeof t=="function"?t(r,n,i,e):Nj(t,!0).test(r)}const Rj=_t.define({map(t,e){return t.map(n=>n.map(e))}}),jj=_t.define(),No=zi.define({create(){return fy.start()},update(t,e){return t.update(e)},provide:t=>[y4.from(t,e=>e.tooltip),Te.contentAttributes.from(t,e=>e.attrs)]});function Fj(t,e){const n=e.completion.apply||e.completion.label;let i=t.state.field(No).active.find(r=>r.source==e.source);return i instanceof ah?(typeof n=="string"?t.dispatch(Object.assign(Object.assign({},f3e(t.state,n,i.from,i.to)),{annotations:Aj.of(e.completion)})):n(t,e.completion,i.from,i.to),!0):!1}const O3e=v3e(No,Fj);function dy(t,e="option"){return n=>{let i=n.state.field(No,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+r*(t?1:-1):t?0:s-1;return a<0?a=e=="page"?0:s-1:a>=s&&(a=e=="page"?s-1:0),n.dispatch({effects:jj.of(a)}),!0}}const S3e=t=>{let e=t.state.field(No,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(No,!1)?(t.dispatch({effects:cy.of(!0)}),!0):!1,E3e=t=>{let e=t.state.field(No,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Qm.of(null)}),!0)};class T3e{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const $3e=50,M3e=1e3,N3e=li.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(No).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(No);if(!t.selectionSet&&!t.docChanged&&t.startState.field(No)==e)return;let n=t.transactions.some(r=>(r.selection||r.docChanged)&&!uC(r));for(let r=0;r$3e&&Date.now()-o.time>M3e){for(let s of o.context.abortListeners)try{s()}catch(a){is(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(r=>r.effects.some(o=>o.is(cy)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.state.facet(ir).activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.state==1&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let r of t.transactions)uC(r)=="input"?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(No);for(let n of e.active)n.state==1&&!this.running.some(i=>i.active.source==n.source)&&this.startQuery(n)}startQuery(t){let{state:e}=this.view,n=wu(e),i=new Ej(e,n,t.explicitPos==n),r=new T3e(t,i);this.running.push(r),Promise.resolve(t.source(i)).then(o=>{r.context.aborted||(r.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Qm.of(null)}),is(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ir).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(ir);for(let i=0;is.source==r.active.source);if(o&&o.state==1)if(r.done==null){let s=new uo(r.active.source,0);for(let a of r.updates)s=s.update(a,n);s.state!=1&&e.push(s)}else this.startQuery(o)}e.length&&this.view.dispatch({effects:Rj.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(No,!1);if(e&&e.tooltip&&this.view.state.facet(ir).closeOnBlur){let n=e.open&&EL(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Qm.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:cy.of(!1)}),20),this.composing=0}}}),zj=Te.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class A3e{constructor(e,n,i,r){this.field=e,this.line=n,this.from=i,this.to=r}}class cC{constructor(e,n,i){this.field=e,this.from=n,this.to=i}map(e){let n=e.mapPos(this.from,-1,er.TrackDel),i=e.mapPos(this.to,1,er.TrackDel);return n==null||i==null?null:new cC(this.field,n,i)}}class fC{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let i=[],r=[n],o=e.doc.lineAt(n),s=/^\s*/.exec(o.text)[0];for(let l of this.lines){if(i.length){let u=s,f=/^\t*/.exec(l)[0].length;for(let d=0;dnew cC(l.field,r[l.line]+l.from,r[l.line]+l.to));return{text:i,ranges:a}}static parse(e){let n=[],i=[],r=[],o;for(let s of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let a=o[1]?+o[1]:null,l=o[2]||o[3]||"",u=-1;for(let f=0;f=u&&d.field++}r.push(new A3e(u,i.length,o.index,o.index+l.length)),s=s.slice(0,o.index)+l+s.slice(o.index+o[0].length)}for(let a;a=/\\([{}])/.exec(s);){s=s.slice(0,a.index)+a[1]+s.slice(a.index+a[0].length);for(let l of r)l.line==i.length&&l.from>a.index&&(l.from--,l.to--)}i.push(s)}return new fC(i,r)}}let P3e=it.widget({widget:new class extends da{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),D3e=it.mark({class:"cm-snippetField"});class lh{constructor(e,n){this.ranges=e,this.active=n,this.deco=it.set(e.map(i=>(i.from==i.to?P3e:D3e).range(i.from,i.to)))}map(e){let n=[];for(let i of this.ranges){let r=i.map(e);if(!r)return null;n.push(r)}return new lh(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(i=>i.field==this.active&&i.from<=n.from&&i.to>=n.to))}}const Um=_t.define({map(t,e){return t&&t.map(e)}}),I3e=_t.define(),Zm=zi.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Um))return n.value;if(n.is(I3e)&&t)return new lh(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Te.decorations.from(t,e=>e?e.deco:it.none)});function dC(t,e){return he.create(t.filter(n=>n.field==e).map(n=>he.range(n.from,n.to)))}function L3e(t){let e=fC.parse(t);return(n,i,r,o)=>{let{text:s,ranges:a}=e.instantiate(n.state,r),l={changes:{from:r,to:o,insert:Yt.of(s)},scrollIntoView:!0,annotations:i?[Aj.of(i),jr.userEvent.of("input.complete")]:void 0};if(a.length&&(l.selection=dC(a,0)),a.some(u=>u.field>0)){let u=new lh(a,0),f=l.effects=[Um.of(u)];n.state.field(Zm,!1)===void 0&&f.push(_t.appendConfig.of([Zm,j3e,F3e,zj]))}n.dispatch(n.state.update(l))}}function Bj(t){return({state:e,dispatch:n})=>{let i=e.field(Zm,!1);if(!i||t<0&&i.active==0)return!1;let r=i.active+t,o=t>0&&!i.ranges.some(s=>s.field==r+t);return n(e.update({selection:dC(i.ranges,r),effects:Um.of(o?null:new lh(i.ranges,r)),scrollIntoView:!0})),!0}}const R3e=[{key:"Tab",run:Bj(1),shift:Bj(-1)},{key:"Escape",run:({state:t,dispatch:e})=>t.field(Zm,!1)?(e(t.update({effects:Um.of(null)})),!0):!1}],Wj=Qe.define({combine(t){return t.length?t[0]:R3e}}),j3e=Hc.highest(nl.compute([Wj],t=>t.facet(Wj)));function co(t,e){return Object.assign(Object.assign({},e),{apply:L3e(t)})}const F3e=Te.domEventHandlers({mousedown(t,e){let n=e.state.field(Zm,!1),i;if(!n||(i=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let r=n.ranges.find(o=>o.from<=i&&o.to>=i);return!r||r.field==n.active?!1:(e.dispatch({selection:dC(n.ranges,r.field),effects:Um.of(n.ranges.some(o=>o.field>r.field)?new lh(n.ranges,r.field):null),scrollIntoView:!0}),!0)}}),qm={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Vc=_t.define({map(t,e){let n=e.mapPos(t,-1,er.TrackAfter);return n??void 0}}),hC=new class extends Qc{};hC.startSide=1,hC.endSide=-1;const Hj=zi.define({create(){return zt.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:i=>i>=n.from&&i<=n.to})}for(let n of e.effects)n.is(Vc)&&(t=t.update({add:[hC.range(n.value,n.value+1)]}));return t}});function Qj(){return[B3e,Hj]}const pC="()[]{}<>";function Uj(t){for(let e=0;e{if((z3e?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(i.length>2||i.length==2&&ns(Ji(i,0))==1||e!=r.from||n!=r.to)return!1;let o=W3e(t.state,i);return o?(t.dispatch(o),!0):!1}),qj=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Zj(t,t.selection.main.head).brackets||qm.brackets,r=null,o=t.changeByRange(s=>{if(s.empty){let a=H3e(t.doc,s.head);for(let l of i)if(l==a&&hy(t.doc,s.head)==Uj(Ji(l,0)))return{changes:{from:s.head-l.length,to:s.head+l.length},range:he.cursor(s.head-l.length)}}return{range:r=s}});return r||e(t.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function W3e(t,e){let n=Zj(t,t.selection.main.head),i=n.brackets||qm.brackets;for(let r of i){let o=Uj(Ji(r,0));if(e==r)return o==r?Z3e(t,r,i.indexOf(r+r+r)>-1,n):Q3e(t,r,o,n.before||qm.before);if(e==o&&Yj(t,t.selection.main.from))return U3e(t,r,o)}return null}function Yj(t,e){let n=!1;return t.field(Hj).between(0,t.doc.length,i=>{i==e&&(n=!0)}),n}function hy(t,e){let n=t.sliceString(e,e+2);return n.slice(0,ns(Ji(n,0)))}function H3e(t,e){let n=t.sliceString(e-2,e);return ns(Ji(n,0))==n.length?n:n.slice(1)}function Q3e(t,e,n,i){let r=null,o=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:Vc.of(s.to+e.length),range:he.range(s.anchor+e.length,s.head+e.length)};let a=hy(t.doc,s.head);return!a||/\s/.test(a)||i.indexOf(a)>-1?{changes:{insert:e+n,from:s.head},effects:Vc.of(s.head+e.length),range:he.cursor(s.head+e.length)}:{range:r=s}});return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function U3e(t,e,n){let i=null,r=t.changeByRange(o=>o.empty&&hy(t.doc,o.head)==n?{changes:{from:o.head,to:o.head+n.length,insert:n},range:he.cursor(o.head+n.length)}:i={range:o});return i?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Z3e(t,e,n,i){let r=i.stringPrefixes||qm.stringPrefixes,o=null,s=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Vc.of(a.to+e.length),range:he.range(a.anchor+e.length,a.head+e.length)};let l=a.head,u=hy(t.doc,l),f;if(u==e){if(Vj(t,l))return{changes:{insert:e+e,from:l},effects:Vc.of(l+e.length),range:he.cursor(l+e.length)};if(Yj(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:he.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(f=Xj(t,l-2*e.length,r))>-1&&Vj(t,f))return{changes:{insert:e+e+e+e,from:l},effects:Vc.of(l+e.length),range:he.cursor(l+e.length)};if(t.charCategorizer(l)(u)!=Nn.Word&&Xj(t,l,r)>-1&&!q3e(t,l,e,r))return{changes:{insert:e+e,from:l},effects:Vc.of(l+e.length),range:he.cursor(l+e.length)}}return{range:o=a}});return o?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Vj(t,e){let n=Gn(t).resolveInner(e+1);return n.parent&&n.from==e}function q3e(t,e,n,i){let r=Gn(t).resolveInner(e,-1),o=i.reduce((s,a)=>Math.max(s,a.length),0);for(let s=0;s<5;s++){let a=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+o)),l=a.indexOf(n);if(!l||l>-1&&i.indexOf(a.slice(0,l))>-1){let f=r.firstChild;for(;f&&f.from==r.from&&f.to-f.from>n.length+l;){if(t.sliceDoc(f.to-n.length,f.to)==n)return!1;f=f.firstChild}return!0}let u=r.to==e&&r.parent;if(!u)break;r=u}return!1}function Xj(t,e,n){let i=t.charCategorizer(e);if(i(t.sliceDoc(e-1,e))!=Nn.Word)return e;for(let r of n){let o=e-r.length;if(t.sliceDoc(o,e)==r&&i(t.sliceDoc(o-1,o))!=Nn.Word)return o}return-1}function Y3e(t={}){return[No,ir.of(t),N3e,V3e,zj]}const Gj=[{key:"Ctrl-Space",run:C3e},{key:"Escape",run:E3e},{key:"ArrowDown",run:dy(!0)},{key:"ArrowUp",run:dy(!1)},{key:"PageDown",run:dy(!0,"page")},{key:"PageUp",run:dy(!1,"page")},{key:"Enter",run:S3e}],V3e=Hc.highest(nl.computeN([ir],t=>t.facet(ir).defaultKeymap?[Gj]:[]));class X3e{constructor(e,n,i){this.from=e,this.to=n,this.diagnostic=i}}class Xc{constructor(e,n,i){this.diagnostics=e,this.panel=n,this.selected=i}static init(e,n,i){let r=e,o=i.facet(tF).markerFilter;o&&(r=o(r));let s=it.set(r.map(a=>a.from==a.to||a.from==a.to-1&&i.doc.lineAt(a.from).to==a.from?it.widget({widget:new rOe(a),diagnostic:a}).range(a.from):it.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Xc(s,n,uh(s))}}function uh(t,e=null,n=0){let i=null;return t.between(n,1e9,(r,o,{spec:s})=>{if(!(e&&s.diagnostic!=e))return i=new X3e(r,o,s.diagnostic),!1}),i}function G3e(t,e){let n=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(i=>i.is(Kj))||t.changes.touchesRange(n.from,n.to))}function K3e(t,e){return t.field(Ao,!1)?e:e.concat(_t.appendConfig.of(aOe))}const Kj=_t.define(),gC=_t.define(),Jj=_t.define(),Ao=zi.define({create(){return new Xc(it.none,null,null)},update(t,e){if(e.docChanged){let n=t.diagnostics.map(e.changes),i=null;if(t.selected){let r=e.changes.mapPos(t.selected.from,1);i=uh(n,t.selected.diagnostic,r)||uh(n,null,r)}t=new Xc(n,t.panel,i)}for(let n of e.effects)n.is(Kj)?t=Xc.init(n.value,t.panel,e.state):n.is(gC)?t=new Xc(t.diagnostics,n.value?py.open:null,t.selected):n.is(Jj)&&(t=new Xc(t.diagnostics,t.panel,n.value));return t},provide:t=>[$m.from(t,e=>e.panel),Te.decorations.from(t,e=>e.diagnostics)]}),J3e=it.mark({class:"cm-lintRange cm-lintRange-active"});function eOe(t,e,n){let{diagnostics:i}=t.state.field(Ao),r=[],o=2e8,s=0;i.between(e-(n<0?1:0),e+(n>0?1:0),(l,u,{spec:f})=>{e>=l&&e<=u&&(l==u||(e>l||n>0)&&(eiF(t,n,!1)))}const nOe=t=>{let e=t.state.field(Ao,!1);(!e||!e.panel)&&t.dispatch({effects:K3e(t.state,[gC.of(!0)])});let n=Tm(t,py.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},eF=t=>{let e=t.state.field(Ao,!1);return!e||!e.panel?!1:(t.dispatch({effects:gC.of(!1)}),!0)},iOe=[{key:"Mod-Shift-m",run:nOe,preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(Ao,!1);if(!e)return!1;let n=t.state.selection.main,i=e.diagnostics.iter(n.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==n.from&&i.to==n.to)?!1:(t.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)}}],tF=Qe.define({combine(t){return Object.assign({sources:t.map(e=>e.source)},fa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,n)=>e?n?i=>e(i)||n(i):e:n}))}});function nF(t){let e=[];if(t)e:for(let{name:n}of t){for(let i=0;io.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function iF(t,e,n){var i;let r=n?nF(e.actions):[];return un("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},un("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(i=e.actions)===null||i===void 0?void 0:i.map((o,s)=>{let a=!1,l=h=>{if(h.preventDefault(),a)return;a=!0;let g=uh(t.state.field(Ao).diagnostics,e);g&&o.apply(t,g.from,g.to)},{name:u}=o,f=r[s]?u.indexOf(r[s]):-1,d=f<0?u:[u.slice(0,f),un("u",u.slice(f,f+1)),u.slice(f+1)];return un("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${u}${f<0?"":` (access key "${r[s]})"`}.`},d)}),e.source&&un("div",{class:"cm-diagnosticSource"},e.source))}class rOe extends da{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return un("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class rF{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=iF(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class py{constructor(e){this.view=e,this.items=[];let n=r=>{if(r.keyCode==27)eF(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=nF(o.actions);for(let a=0;a{for(let o=0;oeF(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ao).selected;if(!e)return-1;for(let n=0;n{let u=-1,f;for(let d=i;di&&(this.items.splice(i,u-i),r=!0)),n&&f.diagnostic==n.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),o=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),i++});i({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{let l=a.height/this.list.offsetHeight;s.topa.bottom&&(this.list.scrollTop+=(s.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function n(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)n();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ao),i=uh(n.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Jj.of(i)})}static open(e){return new py(e)}}function oOe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function gy(t){return oOe(``,'width="6" height="3"')}const sOe=Te.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:gy("#d11")},".cm-lintRange-warning":{backgroundImage:gy("orange")},".cm-lintRange-info":{backgroundImage:gy("#999")},".cm-lintRange-hint":{backgroundImage:gy("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),aOe=[Ao,Te.decorations.compute([Ao],t=>{let{selected:e,panel:n}=t.field(Ao);return!e||!n||e.from==e.to?it.none:it.set([J3e.range(e.from,e.to)])}),cxe(eOe,{hideOn:G3e}),sOe];var oF=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,i=[];e.closeBracketsKeymap!==!1&&(i=i.concat(qj)),e.defaultKeymap!==!1&&(i=i.concat(dj)),e.searchKeymap!==!1&&(i=i.concat(o3e)),e.historyKeymap!==!1&&(i=i.concat(AR)),e.foldKeymap!==!1&&(i=i.concat(u2e)),e.completionKeymap!==!1&&(i=i.concat(Gj)),e.lintKeymap!==!1&&(i=i.concat(iOe));var r=[];return e.lineNumbers!==!1&&r.push(O4()),e.highlightActiveLineGutter!==!1&&r.push(wxe()),e.highlightSpecialChars!==!1&&r.push(xL()),e.history!==!1&&r.push(Vk()),e.foldGutter!==!1&&r.push(h2e()),e.drawSelection!==!1&&r.push(vL()),e.dropCursor!==!1&&r.push(Dwe()),e.allowMultipleSelections!==!1&&r.push(jt.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(n2e()),e.syntaxHighlighting!==!1&&r.push(Fm(bR,{fallback:!0})),e.bracketMatching!==!1&&r.push(x2e()),e.closeBrackets!==!1&&r.push(Qj()),e.autocompletion!==!1&&r.push(Y3e()),e.rectangularSelection!==!1&&r.push(Jwe()),n!==!1&&r.push(nxe()),e.highlightActiveLine!==!1&&r.push(Uwe()),e.highlightSelectionMatches!==!1&&r.push(z_e()),e.tabSize&&typeof e.tabSize=="number"&&r.push(Lm.of(" ".repeat(e.tabSize))),r.concat([nl.of(i.flat())]).filter(Boolean)},sF=function(e){e===void 0&&(e={});var n=[];e.defaultKeymap!==!1&&(n=n.concat(dj)),e.historyKeymap!==!1&&(n=n.concat(AR));var i=[];return e.highlightSpecialChars!==!1&&i.push(xL()),e.history!==!1&&i.push(Vk()),e.drawSelection!==!1&&i.push(vL()),e.syntaxHighlighting!==!1&&i.push(Fm(bR,{fallback:!0})),i.concat([nl.of(n.flat())]).filter(Boolean)};const lOe="#e5c07b",aF="#e06c75",uOe="#56b6c2",cOe="#ffffff",my="#abb2bf",mC="#7d8799",fOe="#61afef",dOe="#98c379",lF="#d19a66",hOe="#c678dd",pOe="#21252b",uF="#2c313a",cF="#282c34",vC="#353a42",gOe="#3E4451",fF="#528bff",mOe=Te.theme({"&":{color:my,backgroundColor:cF},".cm-content":{caretColor:fF},".cm-cursor, .cm-dropCursor":{borderLeftColor:fF},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:gOe},".cm-panels":{backgroundColor:pOe,color:my},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:cF,color:mC,border:"none"},".cm-activeLineGutter":{backgroundColor:uF},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:vC},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:vC,borderBottomColor:vC},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:uF,color:my}}},{dark:!0}),vOe=ol.define([{tag:X.keyword,color:hOe},{tag:[X.name,X.deleted,X.character,X.propertyName,X.macroName],color:aF},{tag:[X.function(X.variableName),X.labelName],color:fOe},{tag:[X.color,X.constant(X.name),X.standard(X.name)],color:lF},{tag:[X.definition(X.name),X.separator],color:my},{tag:[X.typeName,X.className,X.number,X.changed,X.annotation,X.modifier,X.self,X.namespace],color:lOe},{tag:[X.operator,X.operatorKeyword,X.url,X.escape,X.regexp,X.link,X.special(X.string)],color:uOe},{tag:[X.meta,X.comment],color:mC},{tag:X.strong,fontWeight:"bold"},{tag:X.emphasis,fontStyle:"italic"},{tag:X.strikethrough,textDecoration:"line-through"},{tag:X.link,color:mC,textDecoration:"underline"},{tag:X.heading,fontWeight:"bold",color:aF},{tag:[X.atom,X.bool,X.special(X.variableName)],color:lF},{tag:[X.processingInstruction,X.string,X.inserted],color:dOe},{tag:X.invalid,color:cOe}]),bOe=[mOe,Fm(vOe)];var kOe=Te.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),yOe=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:i=!0,readOnly:r=!1,theme:o="light",placeholder:s="",basicSetup:a=!0}=e,l=[];switch(n&&l.unshift(nl.of([D_e])),a&&(typeof a=="boolean"?l.unshift(oF()):l.unshift(oF(a))),s&&l.unshift(Vwe(s)),o){case"light":l.push(kOe);break;case"dark":l.push(bOe);break;case"none":break;default:l.push(o);break}return i===!1&&l.push(Te.editable.of(!1)),r&&l.push(jt.readOnly.of(!0)),[...l]},wOe=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)}),dF=ca.define(),xOe=[];function _Oe(t){var{value:e,selection:n,onChange:i,onStatistics:r,onCreateEditor:o,onUpdate:s,extensions:a=xOe,autoFocus:l,theme:u="light",height:f=null,minHeight:d=null,maxHeight:h=null,width:g=null,minWidth:m=null,maxWidth:y=null,placeholder:x="",editable:_=!0,readOnly:S=!1,indentWithTab:C=!0,basicSetup:E=!0,root:N,initialState:M}=t,[I,W]=T.useState(),[B,Z]=T.useState(),[R,Q]=T.useState(),V=Te.theme({"&":{height:f,minHeight:d,maxHeight:h,width:g,minWidth:m,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),H=Te.updateListener.of(Y=>{if(Y.docChanged&&typeof i=="function"&&!Y.transactions.some(oe=>oe.annotation(dF))){var K=Y.state.doc,te=K.toString();i(te,Y)}r&&r(wOe(Y))}),j=yOe({theme:u,editable:_,readOnly:S,placeholder:x,indentWithTab:C,basicSetup:E}),q=[H,V,...j];return s&&typeof s=="function"&&q.push(Te.updateListener.of(s)),q=q.concat(a),T.useEffect(()=>{if(I&&!R){var Y={doc:e,selection:n,extensions:q},K=M?jt.fromJSON(M.json,Y,M.fields):jt.create(Y);if(Q(K),!B){var te=new Te({state:K,parent:I,root:N});Z(te),o&&o(te,K)}}return()=>{B&&(Q(void 0),Z(void 0))}},[I,R]),T.useEffect(()=>W(t.container),[t.container]),T.useEffect(()=>()=>{B&&(B.destroy(),Z(void 0))},[B]),T.useEffect(()=>{l&&B&&B.focus()},[l,B]),T.useEffect(()=>{B&&B.dispatch({effects:_t.reconfigure.of(q)})},[u,a,f,d,h,g,m,y,x,_,S,C,E,i,s]),T.useEffect(()=>{if(e!==void 0){var Y=B?B.state.doc.toString():"";B&&e!==Y&&B.dispatch({changes:{from:0,to:Y.length,insert:e||""},annotations:[dF.of(!0)]})}},[e,B]),{state:R,setState:Q,view:B,setView:Z,container:I,setContainer:W}}var OOe=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],bC=T.forwardRef((t,e)=>{var{className:n,value:i="",selection:r,extensions:o=[],onChange:s,onStatistics:a,onCreateEditor:l,onUpdate:u,autoFocus:f,theme:d="light",height:h,minHeight:g,maxHeight:m,width:y,minWidth:x,maxWidth:_,basicSetup:S,placeholder:C,indentWithTab:E,editable:N,readOnly:M,root:I,initialState:W}=t,B=$ke(t,OOe),Z=T.useRef(null),{state:R,view:Q,container:V}=_Oe({container:Z.current,root:I,value:i,autoFocus:f,theme:d,height:h,minHeight:g,maxHeight:m,width:y,minWidth:x,maxWidth:_,basicSetup:S,placeholder:C,indentWithTab:E,editable:N,readOnly:M,selection:r,onChange:s,onStatistics:a,onCreateEditor:l,onUpdate:u,extensions:o,initialState:W});if(T.useImperativeHandle(e,()=>({editor:Z.current,state:R,view:Q}),[Z,V,R,Q]),typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var H=typeof d=="string"?"cm-theme-"+d:"cm-theme";return k.jsx("div",bS({ref:Z,className:""+H+(n?" "+n:"")},B))});bC.displayName="CodeMirror";function Gc({children:t,to:e,className:n,...i}){const{darkMode:r}=T.useContext(ft),o=e||document.body;if(!o)return t;function s(a){a.stopPropagation()}return Xs.createPortal(k.jsx("div",{className:"koenig-lexical",style:{width:"fit-content"},"data-kg-portal":!0,onMouseDown:s,...i,children:k.jsx("div",{className:`${r?"dark":""} ${n||""}`,children:t})}),o)}const hF={categories:[{id:"people",emojis:["grinning","smiley","smile","grin","laughing","sweat_smile","rolling_on_the_floor_laughing","joy","slightly_smiling_face","upside_down_face","melting_face","wink","blush","innocent","smiling_face_with_3_hearts","heart_eyes","star-struck","kissing_heart","kissing","relaxed","kissing_closed_eyes","kissing_smiling_eyes","smiling_face_with_tear","yum","stuck_out_tongue","stuck_out_tongue_winking_eye","zany_face","stuck_out_tongue_closed_eyes","money_mouth_face","hugging_face","face_with_hand_over_mouth","face_with_open_eyes_and_hand_over_mouth","face_with_peeking_eye","shushing_face","thinking_face","saluting_face","zipper_mouth_face","face_with_raised_eyebrow","neutral_face","expressionless","no_mouth","dotted_line_face","face_in_clouds","smirk","unamused","face_with_rolling_eyes","grimacing","face_exhaling","lying_face","shaking_face","relieved","pensive","sleepy","drooling_face","sleeping","mask","face_with_thermometer","face_with_head_bandage","nauseated_face","face_vomiting","sneezing_face","hot_face","cold_face","woozy_face","dizzy_face","face_with_spiral_eyes","exploding_head","face_with_cowboy_hat","partying_face","disguised_face","sunglasses","nerd_face","face_with_monocle","confused","face_with_diagonal_mouth","worried","slightly_frowning_face","white_frowning_face","open_mouth","hushed","astonished","flushed","pleading_face","face_holding_back_tears","frowning","anguished","fearful","cold_sweat","disappointed_relieved","cry","sob","scream","confounded","persevere","disappointed","sweat","weary","tired_face","yawning_face","triumph","rage","angry","face_with_symbols_on_mouth","smiling_imp","imp","skull","skull_and_crossbones","hankey","clown_face","japanese_ogre","japanese_goblin","ghost","alien","space_invader","wave","raised_back_of_hand","raised_hand_with_fingers_splayed","hand","spock-hand","rightwards_hand","leftwards_hand","palm_down_hand","palm_up_hand","leftwards_pushing_hand","rightwards_pushing_hand","ok_hand","pinched_fingers","pinching_hand","v","crossed_fingers","hand_with_index_finger_and_thumb_crossed","i_love_you_hand_sign","the_horns","call_me_hand","point_left","point_right","point_up_2","middle_finger","point_down","point_up","index_pointing_at_the_viewer","+1","-1","fist","facepunch","left-facing_fist","right-facing_fist","clap","raised_hands","heart_hands","open_hands","palms_up_together","handshake","pray","writing_hand","nail_care","selfie","muscle","mechanical_arm","mechanical_leg","leg","foot","ear","ear_with_hearing_aid","nose","brain","anatomical_heart","lungs","tooth","bone","eyes","eye","tongue","lips","biting_lip","baby","child","boy","girl","adult","person_with_blond_hair","man","bearded_person","man_with_beard","woman_with_beard","red_haired_man","curly_haired_man","white_haired_man","bald_man","woman","red_haired_woman","red_haired_person","curly_haired_woman","curly_haired_person","white_haired_woman","white_haired_person","bald_woman","bald_person","blond-haired-woman","blond-haired-man","older_adult","older_man","older_woman","person_frowning","man-frowning","woman-frowning","person_with_pouting_face","man-pouting","woman-pouting","no_good","man-gesturing-no","woman-gesturing-no","ok_woman","man-gesturing-ok","woman-gesturing-ok","information_desk_person","man-tipping-hand","woman-tipping-hand","raising_hand","man-raising-hand","woman-raising-hand","deaf_person","deaf_man","deaf_woman","bow","man-bowing","woman-bowing","face_palm","man-facepalming","woman-facepalming","shrug","man-shrugging","woman-shrugging","health_worker","male-doctor","female-doctor","student","male-student","female-student","teacher","male-teacher","female-teacher","judge","male-judge","female-judge","farmer","male-farmer","female-farmer","cook","male-cook","female-cook","mechanic","male-mechanic","female-mechanic","factory_worker","male-factory-worker","female-factory-worker","office_worker","male-office-worker","female-office-worker","scientist","male-scientist","female-scientist","technologist","male-technologist","female-technologist","singer","male-singer","female-singer","artist","male-artist","female-artist","pilot","male-pilot","female-pilot","astronaut","male-astronaut","female-astronaut","firefighter","male-firefighter","female-firefighter","cop","male-police-officer","female-police-officer","sleuth_or_spy","male-detective","female-detective","guardsman","male-guard","female-guard","ninja","construction_worker","male-construction-worker","female-construction-worker","person_with_crown","prince","princess","man_with_turban","man-wearing-turban","woman-wearing-turban","man_with_gua_pi_mao","person_with_headscarf","person_in_tuxedo","man_in_tuxedo","woman_in_tuxedo","bride_with_veil","man_with_veil","woman_with_veil","pregnant_woman","pregnant_man","pregnant_person","breast-feeding","woman_feeding_baby","man_feeding_baby","person_feeding_baby","angel","santa","mrs_claus","mx_claus","superhero","male_superhero","female_superhero","supervillain","male_supervillain","female_supervillain","mage","male_mage","female_mage","fairy","male_fairy","female_fairy","vampire","male_vampire","female_vampire","merperson","merman","mermaid","elf","male_elf","female_elf","genie","male_genie","female_genie","zombie","male_zombie","female_zombie","troll","massage","man-getting-massage","woman-getting-massage","haircut","man-getting-haircut","woman-getting-haircut","walking","man-walking","woman-walking","standing_person","man_standing","woman_standing","kneeling_person","man_kneeling","woman_kneeling","person_with_probing_cane","man_with_probing_cane","woman_with_probing_cane","person_in_motorized_wheelchair","man_in_motorized_wheelchair","woman_in_motorized_wheelchair","person_in_manual_wheelchair","man_in_manual_wheelchair","woman_in_manual_wheelchair","runner","man-running","woman-running","dancer","man_dancing","man_in_business_suit_levitating","dancers","men-with-bunny-ears-partying","women-with-bunny-ears-partying","person_in_steamy_room","man_in_steamy_room","woman_in_steamy_room","person_climbing","man_climbing","woman_climbing","fencer","horse_racing","skier","snowboarder","golfer","man-golfing","woman-golfing","surfer","man-surfing","woman-surfing","rowboat","man-rowing-boat","woman-rowing-boat","swimmer","man-swimming","woman-swimming","person_with_ball","man-bouncing-ball","woman-bouncing-ball","weight_lifter","man-lifting-weights","woman-lifting-weights","bicyclist","man-biking","woman-biking","mountain_bicyclist","man-mountain-biking","woman-mountain-biking","person_doing_cartwheel","man-cartwheeling","woman-cartwheeling","wrestlers","man-wrestling","woman-wrestling","water_polo","man-playing-water-polo","woman-playing-water-polo","handball","man-playing-handball","woman-playing-handball","juggling","man-juggling","woman-juggling","person_in_lotus_position","man_in_lotus_position","woman_in_lotus_position","bath","sleeping_accommodation","people_holding_hands","two_women_holding_hands","man_and_woman_holding_hands","two_men_holding_hands","couplekiss","woman-kiss-man","man-kiss-man","woman-kiss-woman","couple_with_heart","woman-heart-man","man-heart-man","woman-heart-woman","family","man-woman-boy","man-woman-girl","man-woman-girl-boy","man-woman-boy-boy","man-woman-girl-girl","man-man-boy","man-man-girl","man-man-girl-boy","man-man-boy-boy","man-man-girl-girl","woman-woman-boy","woman-woman-girl","woman-woman-girl-boy","woman-woman-boy-boy","woman-woman-girl-girl","man-boy","man-boy-boy","man-girl","man-girl-boy","man-girl-girl","woman-boy","woman-boy-boy","woman-girl","woman-girl-boy","woman-girl-girl","speaking_head_in_silhouette","bust_in_silhouette","busts_in_silhouette","people_hugging","footprints","robot_face","smiley_cat","smile_cat","joy_cat","heart_eyes_cat","smirk_cat","kissing_cat","scream_cat","crying_cat_face","pouting_cat","see_no_evil","hear_no_evil","speak_no_evil","love_letter","cupid","gift_heart","sparkling_heart","heartpulse","heartbeat","revolving_hearts","two_hearts","heart_decoration","heavy_heart_exclamation_mark_ornament","broken_heart","heart_on_fire","mending_heart","heart","pink_heart","orange_heart","yellow_heart","green_heart","blue_heart","light_blue_heart","purple_heart","brown_heart","black_heart","grey_heart","white_heart","kiss","100","anger","boom","dizzy","sweat_drops","dash","hole","speech_balloon","eye-in-speech-bubble","left_speech_bubble","right_anger_bubble","thought_balloon","zzz"]},{id:"nature",emojis:["monkey_face","monkey","gorilla","orangutan","dog","dog2","guide_dog","service_dog","poodle","wolf","fox_face","raccoon","cat","cat2","black_cat","lion_face","tiger","tiger2","leopard","horse","moose","donkey","racehorse","unicorn_face","zebra_face","deer","bison","cow","ox","water_buffalo","cow2","pig","pig2","boar","pig_nose","ram","sheep","goat","dromedary_camel","camel","llama","giraffe_face","elephant","mammoth","rhinoceros","hippopotamus","mouse","mouse2","rat","hamster","rabbit","rabbit2","chipmunk","beaver","hedgehog","bat","bear","polar_bear","koala","panda_face","sloth","otter","skunk","kangaroo","badger","feet","turkey","chicken","rooster","hatching_chick","baby_chick","hatched_chick","bird","penguin","dove_of_peace","eagle","duck","swan","owl","dodo","feather","flamingo","peacock","parrot","wing","black_bird","goose","frog","crocodile","turtle","lizard","snake","dragon_face","dragon","sauropod","t-rex","whale","whale2","dolphin","seal","fish","tropical_fish","blowfish","shark","octopus","shell","coral","jellyfish","snail","butterfly","bug","ant","bee","beetle","ladybug","cricket","cockroach","spider","spider_web","scorpion","mosquito","fly","worm","microbe","bouquet","cherry_blossom","white_flower","lotus","rosette","rose","wilted_flower","hibiscus","sunflower","blossom","tulip","hyacinth","seedling","potted_plant","evergreen_tree","deciduous_tree","palm_tree","cactus","ear_of_rice","herb","shamrock","four_leaf_clover","maple_leaf","fallen_leaf","leaves","empty_nest","nest_with_eggs","mushroom"]},{id:"foods",emojis:["grapes","melon","watermelon","tangerine","lemon","banana","pineapple","mango","apple","green_apple","pear","peach","cherries","strawberry","blueberries","kiwifruit","tomato","olive","coconut","avocado","eggplant","potato","carrot","corn","hot_pepper","bell_pepper","cucumber","leafy_green","broccoli","garlic","onion","peanuts","beans","chestnut","ginger_root","pea_pod","bread","croissant","baguette_bread","flatbread","pretzel","bagel","pancakes","waffle","cheese_wedge","meat_on_bone","poultry_leg","cut_of_meat","bacon","hamburger","fries","pizza","hotdog","sandwich","taco","burrito","tamale","stuffed_flatbread","falafel","egg","fried_egg","shallow_pan_of_food","stew","fondue","bowl_with_spoon","green_salad","popcorn","butter","salt","canned_food","bento","rice_cracker","rice_ball","rice","curry","ramen","spaghetti","sweet_potato","oden","sushi","fried_shrimp","fish_cake","moon_cake","dango","dumpling","fortune_cookie","takeout_box","crab","lobster","shrimp","squid","oyster","icecream","shaved_ice","ice_cream","doughnut","cookie","birthday","cake","cupcake","pie","chocolate_bar","candy","lollipop","custard","honey_pot","baby_bottle","glass_of_milk","coffee","teapot","tea","sake","champagne","wine_glass","cocktail","tropical_drink","beer","beers","clinking_glasses","tumbler_glass","pouring_liquid","cup_with_straw","bubble_tea","beverage_box","mate_drink","ice_cube","chopsticks","knife_fork_plate","fork_and_knife","spoon","hocho","jar","amphora"]},{id:"activity",emojis:["jack_o_lantern","christmas_tree","fireworks","sparkler","firecracker","sparkles","balloon","tada","confetti_ball","tanabata_tree","bamboo","dolls","flags","wind_chime","rice_scene","red_envelope","ribbon","gift","reminder_ribbon","admission_tickets","ticket","medal","trophy","sports_medal","first_place_medal","second_place_medal","third_place_medal","soccer","baseball","softball","basketball","volleyball","football","rugby_football","tennis","flying_disc","bowling","cricket_bat_and_ball","field_hockey_stick_and_ball","ice_hockey_stick_and_puck","lacrosse","table_tennis_paddle_and_ball","badminton_racquet_and_shuttlecock","boxing_glove","martial_arts_uniform","goal_net","golf","ice_skate","fishing_pole_and_fish","diving_mask","running_shirt_with_sash","ski","sled","curling_stone","dart","yo-yo","kite","gun","8ball","crystal_ball","magic_wand","video_game","joystick","slot_machine","game_die","jigsaw","teddy_bear","pinata","mirror_ball","nesting_dolls","spades","hearts","diamonds","clubs","chess_pawn","black_joker","mahjong","flower_playing_cards","performing_arts","frame_with_picture","art","thread","sewing_needle","yarn","knot"]},{id:"places",emojis:["earth_africa","earth_americas","earth_asia","globe_with_meridians","world_map","japan","compass","snow_capped_mountain","mountain","volcano","mount_fuji","camping","beach_with_umbrella","desert","desert_island","national_park","stadium","classical_building","building_construction","bricks","rock","wood","hut","house_buildings","derelict_house_building","house","house_with_garden","office","post_office","european_post_office","hospital","bank","hotel","love_hotel","convenience_store","school","department_store","factory","japanese_castle","european_castle","wedding","tokyo_tower","statue_of_liberty","church","mosque","hindu_temple","synagogue","shinto_shrine","kaaba","fountain","tent","foggy","night_with_stars","cityscape","sunrise_over_mountains","sunrise","city_sunset","city_sunrise","bridge_at_night","hotsprings","carousel_horse","playground_slide","ferris_wheel","roller_coaster","barber","circus_tent","steam_locomotive","railway_car","bullettrain_side","bullettrain_front","train2","metro","light_rail","station","tram","monorail","mountain_railway","train","bus","oncoming_bus","trolleybus","minibus","ambulance","fire_engine","police_car","oncoming_police_car","taxi","oncoming_taxi","car","oncoming_automobile","blue_car","pickup_truck","truck","articulated_lorry","tractor","racing_car","racing_motorcycle","motor_scooter","manual_wheelchair","motorized_wheelchair","auto_rickshaw","bike","scooter","skateboard","roller_skate","busstop","motorway","railway_track","oil_drum","fuelpump","wheel","rotating_light","traffic_light","vertical_traffic_light","octagonal_sign","construction","anchor","ring_buoy","boat","canoe","speedboat","passenger_ship","ferry","motor_boat","ship","airplane","small_airplane","airplane_departure","airplane_arriving","parachute","seat","helicopter","suspension_railway","mountain_cableway","aerial_tramway","satellite","rocket","flying_saucer","bellhop_bell","luggage","hourglass","hourglass_flowing_sand","watch","alarm_clock","stopwatch","timer_clock","mantelpiece_clock","clock12","clock1230","clock1","clock130","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","clock10","clock1030","clock11","clock1130","new_moon","waxing_crescent_moon","first_quarter_moon","moon","full_moon","waning_gibbous_moon","last_quarter_moon","waning_crescent_moon","crescent_moon","new_moon_with_face","first_quarter_moon_with_face","last_quarter_moon_with_face","thermometer","sunny","full_moon_with_face","sun_with_face","ringed_planet","star","star2","stars","milky_way","cloud","partly_sunny","thunder_cloud_and_rain","mostly_sunny","barely_sunny","partly_sunny_rain","rain_cloud","snow_cloud","lightning","tornado","fog","wind_blowing_face","cyclone","rainbow","closed_umbrella","umbrella","umbrella_with_rain_drops","umbrella_on_ground","zap","snowflake","snowman","snowman_without_snow","comet","fire","droplet","ocean"]},{id:"objects",emojis:["eyeglasses","dark_sunglasses","goggles","lab_coat","safety_vest","necktie","shirt","jeans","scarf","gloves","coat","socks","dress","kimono","sari","one-piece_swimsuit","briefs","shorts","bikini","womans_clothes","folding_hand_fan","purse","handbag","pouch","shopping_bags","school_satchel","thong_sandal","mans_shoe","athletic_shoe","hiking_boot","womans_flat_shoe","high_heel","sandal","ballet_shoes","boot","hair_pick","crown","womans_hat","tophat","mortar_board","billed_cap","military_helmet","helmet_with_white_cross","prayer_beads","lipstick","ring","gem","mute","speaker","sound","loud_sound","loudspeaker","mega","postal_horn","bell","no_bell","musical_score","musical_note","notes","studio_microphone","level_slider","control_knobs","microphone","headphones","radio","saxophone","accordion","guitar","musical_keyboard","trumpet","violin","banjo","drum_with_drumsticks","long_drum","maracas","flute","iphone","calling","phone","telephone_receiver","pager","fax","battery","low_battery","electric_plug","computer","desktop_computer","printer","keyboard","three_button_mouse","trackball","minidisc","floppy_disk","cd","dvd","abacus","movie_camera","film_frames","film_projector","clapper","tv","camera","camera_with_flash","video_camera","vhs","mag","mag_right","candle","bulb","flashlight","izakaya_lantern","diya_lamp","notebook_with_decorative_cover","closed_book","book","green_book","blue_book","orange_book","books","notebook","ledger","page_with_curl","scroll","page_facing_up","newspaper","rolled_up_newspaper","bookmark_tabs","bookmark","label","moneybag","coin","yen","dollar","euro","pound","money_with_wings","credit_card","receipt","chart","email","e-mail","incoming_envelope","envelope_with_arrow","outbox_tray","inbox_tray","package","mailbox","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","postbox","ballot_box_with_ballot","pencil2","black_nib","lower_left_fountain_pen","lower_left_ballpoint_pen","lower_left_paintbrush","lower_left_crayon","memo","briefcase","file_folder","open_file_folder","card_index_dividers","date","calendar","spiral_note_pad","spiral_calendar_pad","card_index","chart_with_upwards_trend","chart_with_downwards_trend","bar_chart","clipboard","pushpin","round_pushpin","paperclip","linked_paperclips","straight_ruler","triangular_ruler","scissors","card_file_box","file_cabinet","wastebasket","lock","unlock","lock_with_ink_pen","closed_lock_with_key","key","old_key","hammer","axe","pick","hammer_and_pick","hammer_and_wrench","dagger_knife","crossed_swords","bomb","boomerang","bow_and_arrow","shield","carpentry_saw","wrench","screwdriver","nut_and_bolt","gear","compression","scales","probing_cane","link","chains","hook","toolbox","magnet","ladder","alembic","test_tube","petri_dish","dna","microscope","telescope","satellite_antenna","syringe","drop_of_blood","pill","adhesive_bandage","crutch","stethoscope","x-ray","door","elevator","mirror","window","bed","couch_and_lamp","chair","toilet","plunger","shower","bathtub","mouse_trap","razor","lotion_bottle","safety_pin","broom","basket","roll_of_paper","bucket","soap","bubbles","toothbrush","sponge","fire_extinguisher","shopping_trolley","smoking","coffin","headstone","funeral_urn","nazar_amulet","hamsa","moyai","placard","identification_card"]},{id:"symbols",emojis:["atm","put_litter_in_its_place","potable_water","wheelchair","mens","womens","restroom","baby_symbol","wc","passport_control","customs","baggage_claim","left_luggage","warning","children_crossing","no_entry","no_entry_sign","no_bicycles","no_smoking","do_not_litter","non-potable_water","no_pedestrians","no_mobile_phones","underage","radioactive_sign","biohazard_sign","arrow_up","arrow_upper_right","arrow_right","arrow_lower_right","arrow_down","arrow_lower_left","arrow_left","arrow_upper_left","arrow_up_down","left_right_arrow","leftwards_arrow_with_hook","arrow_right_hook","arrow_heading_up","arrow_heading_down","arrows_clockwise","arrows_counterclockwise","back","end","on","soon","top","place_of_worship","atom_symbol","om_symbol","star_of_david","wheel_of_dharma","yin_yang","latin_cross","orthodox_cross","star_and_crescent","peace_symbol","menorah_with_nine_branches","six_pointed_star","khanda","aries","taurus","gemini","cancer","leo","virgo","libra","scorpius","sagittarius","capricorn","aquarius","pisces","ophiuchus","twisted_rightwards_arrows","repeat","repeat_one","arrow_forward","fast_forward","black_right_pointing_double_triangle_with_vertical_bar","black_right_pointing_triangle_with_double_vertical_bar","arrow_backward","rewind","black_left_pointing_double_triangle_with_vertical_bar","arrow_up_small","arrow_double_up","arrow_down_small","arrow_double_down","double_vertical_bar","black_square_for_stop","black_circle_for_record","eject","cinema","low_brightness","high_brightness","signal_strength","wireless","vibration_mode","mobile_phone_off","female_sign","male_sign","transgender_symbol","heavy_multiplication_x","heavy_plus_sign","heavy_minus_sign","heavy_division_sign","heavy_equals_sign","infinity","bangbang","interrobang","question","grey_question","grey_exclamation","exclamation","wavy_dash","currency_exchange","heavy_dollar_sign","medical_symbol","recycle","fleur_de_lis","trident","name_badge","beginner","o","white_check_mark","ballot_box_with_check","heavy_check_mark","x","negative_squared_cross_mark","curly_loop","loop","part_alternation_mark","eight_spoked_asterisk","eight_pointed_black_star","sparkle","copyright","registered","tm","hash","keycap_star","zero","one","two","three","four","five","six","seven","eight","nine","keycap_ten","capital_abcd","abcd","1234","symbols","abc","a","ab","b","cl","cool","free","information_source","id","m","new","ng","o2","ok","parking","sos","up","vs","koko","sa","u6708","u6709","u6307","ideograph_advantage","u5272","u7121","u7981","accept","u7533","u5408","u7a7a","congratulations","secret","u55b6","u6e80","red_circle","large_orange_circle","large_yellow_circle","large_green_circle","large_blue_circle","large_purple_circle","large_brown_circle","black_circle","white_circle","large_red_square","large_orange_square","large_yellow_square","large_green_square","large_blue_square","large_purple_square","large_brown_square","black_large_square","white_large_square","black_medium_square","white_medium_square","black_medium_small_square","white_medium_small_square","black_small_square","white_small_square","large_orange_diamond","large_blue_diamond","small_orange_diamond","small_blue_diamond","small_red_triangle","small_red_triangle_down","diamond_shape_with_a_dot_inside","radio_button","white_square_button","black_square_button"]},{id:"flags",emojis:["checkered_flag","cn","crossed_flags","de","es","flag-ac","flag-ad","flag-ae","flag-af","flag-ag","flag-ai","flag-al","flag-am","flag-ao","flag-aq","flag-ar","flag-as","flag-at","flag-au","flag-aw","flag-ax","flag-az","flag-ba","flag-bb","flag-bd","flag-be","flag-bf","flag-bg","flag-bh","flag-bi","flag-bj","flag-bl","flag-bm","flag-bn","flag-bo","flag-bq","flag-br","flag-bs","flag-bt","flag-bv","flag-bw","flag-by","flag-bz","flag-ca","flag-cc","flag-cd","flag-cf","flag-cg","flag-ch","flag-ci","flag-ck","flag-cl","flag-cm","flag-co","flag-cp","flag-cr","flag-cu","flag-cv","flag-cw","flag-cx","flag-cy","flag-cz","flag-dg","flag-dj","flag-dk","flag-dm","flag-do","flag-dz","flag-ea","flag-ec","flag-ee","flag-eg","flag-eh","flag-england","flag-er","flag-et","flag-eu","flag-fi","flag-fj","flag-fk","flag-fm","flag-fo","flag-ga","flag-gd","flag-ge","flag-gf","flag-gg","flag-gh","flag-gi","flag-gl","flag-gm","flag-gn","flag-gp","flag-gq","flag-gr","flag-gs","flag-gt","flag-gu","flag-gw","flag-gy","flag-hk","flag-hm","flag-hn","flag-hr","flag-ht","flag-hu","flag-ic","flag-id","flag-ie","flag-il","flag-im","flag-in","flag-io","flag-iq","flag-ir","flag-is","flag-je","flag-jm","flag-jo","flag-ke","flag-kg","flag-kh","flag-ki","flag-km","flag-kn","flag-kp","flag-kw","flag-ky","flag-kz","flag-la","flag-lb","flag-lc","flag-li","flag-lk","flag-lr","flag-ls","flag-lt","flag-lu","flag-lv","flag-ly","flag-ma","flag-mc","flag-md","flag-me","flag-mf","flag-mg","flag-mh","flag-mk","flag-ml","flag-mm","flag-mn","flag-mo","flag-mp","flag-mq","flag-mr","flag-ms","flag-mt","flag-mu","flag-mv","flag-mw","flag-mx","flag-my","flag-mz","flag-na","flag-nc","flag-ne","flag-nf","flag-ng","flag-ni","flag-nl","flag-no","flag-np","flag-nr","flag-nu","flag-nz","flag-om","flag-pa","flag-pe","flag-pf","flag-pg","flag-ph","flag-pk","flag-pl","flag-pm","flag-pn","flag-pr","flag-ps","flag-pt","flag-pw","flag-py","flag-qa","flag-re","flag-ro","flag-rs","flag-rw","flag-sa","flag-sb","flag-sc","flag-scotland","flag-sd","flag-se","flag-sg","flag-sh","flag-si","flag-sj","flag-sk","flag-sl","flag-sm","flag-sn","flag-so","flag-sr","flag-ss","flag-st","flag-sv","flag-sx","flag-sy","flag-sz","flag-ta","flag-tc","flag-td","flag-tf","flag-tg","flag-th","flag-tj","flag-tk","flag-tl","flag-tm","flag-tn","flag-to","flag-tr","flag-tt","flag-tv","flag-tw","flag-tz","flag-ua","flag-ug","flag-um","flag-un","flag-uy","flag-uz","flag-va","flag-vc","flag-ve","flag-vg","flag-vi","flag-vn","flag-vu","flag-wales","flag-wf","flag-ws","flag-xk","flag-ye","flag-yt","flag-za","flag-zm","flag-zw","fr","gb","it","jp","kr","pirate_flag","rainbow-flag","ru","transgender_flag","triangular_flag_on_post","us","waving_black_flag","waving_white_flag"]}],emojis:{100:{id:"100",name:"Hundred Points",keywords:["100","score","perfect","numbers","century","exam","quiz","test","pass"],skins:[{unified:"1f4af",native:"💯"}],version:1},1234:{id:"1234",name:"Input Numbers",keywords:["1234","blue","square","1","2","3","4"],skins:[{unified:"1f522",native:"🔢"}],version:1},grinning:{id:"grinning",name:"Grinning Face",emoticons:[":D"],keywords:["smile","happy","joy",":D","grin"],skins:[{unified:"1f600",native:"😀"}],version:1},smiley:{id:"smiley",name:"Grinning Face with Big Eyes",emoticons:[":)","=)","=-)"],keywords:["smiley","happy","joy","haha",":D",":)","smile","funny"],skins:[{unified:"1f603",native:"😃"}],version:1},smile:{id:"smile",name:"Grinning Face with Smiling Eyes",emoticons:[":)","C:","c:",":D",":-D"],keywords:["smile","happy","joy","funny","haha","laugh","like",":D",":)"],skins:[{unified:"1f604",native:"😄"}],version:1},grin:{id:"grin",name:"Beaming Face with Smiling Eyes",keywords:["grin","happy","smile","joy","kawaii"],skins:[{unified:"1f601",native:"😁"}],version:1},laughing:{id:"laughing",name:"Grinning Squinting Face",emoticons:[":>",":->"],keywords:["laughing","satisfied","happy","joy","lol","haha","glad","XD","laugh"],skins:[{unified:"1f606",native:"😆"}],version:1},sweat_smile:{id:"sweat_smile",name:"Grinning Face with Sweat",keywords:["smile","hot","happy","laugh","relief"],skins:[{unified:"1f605",native:"😅"}],version:1},rolling_on_the_floor_laughing:{id:"rolling_on_the_floor_laughing",name:"Rolling on the Floor Laughing",keywords:["face","lol","haha","rofl"],skins:[{unified:"1f923",native:"🤣"}],version:3},joy:{id:"joy",name:"Face with Tears of Joy",keywords:["cry","weep","happy","happytears","haha"],skins:[{unified:"1f602",native:"😂"}],version:1},slightly_smiling_face:{id:"slightly_smiling_face",name:"Slightly Smiling Face",emoticons:[":)","(:",":-)"],keywords:["smile"],skins:[{unified:"1f642",native:"🙂"}],version:1},upside_down_face:{id:"upside_down_face",name:"Upside-Down Face",keywords:["upside","down","flipped","silly","smile"],skins:[{unified:"1f643",native:"🙃"}],version:1},melting_face:{id:"melting_face",name:"Melting Face",keywords:["hot","heat"],skins:[{unified:"1fae0",native:"🫠"}],version:14},wink:{id:"wink",name:"Winking Face",emoticons:[";)",";-)"],keywords:["wink","happy","mischievous","secret",";)","smile","eye"],skins:[{unified:"1f609",native:"😉"}],version:1},blush:{id:"blush",name:"Smiling Face with Smiling Eyes",emoticons:[":)"],keywords:["blush","smile","happy","flushed","crush","embarrassed","shy","joy"],skins:[{unified:"1f60a",native:"😊"}],version:1},innocent:{id:"innocent",name:"Smiling Face with Halo",keywords:["innocent","angel","heaven"],skins:[{unified:"1f607",native:"😇"}],version:1},smiling_face_with_3_hearts:{id:"smiling_face_with_3_hearts",name:"Smiling Face with Hearts",keywords:["3","love","like","affection","valentines","infatuation","crush","adore"],skins:[{unified:"1f970",native:"🥰"}],version:11},heart_eyes:{id:"heart_eyes",name:"Smiling Face with Heart-Eyes",keywords:["heart","eyes","love","like","affection","valentines","infatuation","crush"],skins:[{unified:"1f60d",native:"😍"}],version:1},"star-struck":{id:"star-struck",name:"Star-Struck",keywords:["star","struck","grinning","face","with","eyes","smile","starry"],skins:[{unified:"1f929",native:"🤩"}],version:5},kissing_heart:{id:"kissing_heart",name:"Face Blowing a Kiss",emoticons:[":*",":-*"],keywords:["kissing","heart","love","like","affection","valentines","infatuation"],skins:[{unified:"1f618",native:"😘"}],version:1},kissing:{id:"kissing",name:"Kissing Face",keywords:["love","like","3","valentines","infatuation","kiss"],skins:[{unified:"1f617",native:"😗"}],version:1},relaxed:{id:"relaxed",name:"Smiling Face",keywords:["relaxed","blush","massage","happiness"],skins:[{unified:"263a-fe0f",native:"☺️"}],version:1},kissing_closed_eyes:{id:"kissing_closed_eyes",name:"Kissing Face with Closed Eyes",keywords:["love","like","affection","valentines","infatuation","kiss"],skins:[{unified:"1f61a",native:"😚"}],version:1},kissing_smiling_eyes:{id:"kissing_smiling_eyes",name:"Kissing Face with Smiling Eyes",keywords:["affection","valentines","infatuation","kiss"],skins:[{unified:"1f619",native:"😙"}],version:1},smiling_face_with_tear:{id:"smiling_face_with_tear",name:"Smiling Face with Tear",keywords:["sad","cry","pretend"],skins:[{unified:"1f972",native:"🥲"}],version:13},yum:{id:"yum",name:"Face Savoring Food",keywords:["yum","happy","joy","tongue","smile","silly","yummy","nom","delicious","savouring"],skins:[{unified:"1f60b",native:"😋"}],version:1},stuck_out_tongue:{id:"stuck_out_tongue",name:"Face with Tongue",emoticons:[":p",":-p",":P",":-P",":b",":-b"],keywords:["stuck","out","prank","childish","playful","mischievous","smile"],skins:[{unified:"1f61b",native:"😛"}],version:1},stuck_out_tongue_winking_eye:{id:"stuck_out_tongue_winking_eye",name:"Winking Face with Tongue",emoticons:[";p",";-p",";b",";-b",";P",";-P"],keywords:["stuck","out","eye","prank","childish","playful","mischievous","smile","wink"],skins:[{unified:"1f61c",native:"😜"}],version:1},zany_face:{id:"zany_face",name:"Zany Face",keywords:["grinning","with","one","large","and","small","eye","goofy","crazy"],skins:[{unified:"1f92a",native:"🤪"}],version:5},stuck_out_tongue_closed_eyes:{id:"stuck_out_tongue_closed_eyes",name:"Squinting Face with Tongue",keywords:["stuck","out","closed","eyes","prank","playful","mischievous","smile"],skins:[{unified:"1f61d",native:"😝"}],version:1},money_mouth_face:{id:"money_mouth_face",name:"Money-Mouth Face",keywords:["money","mouth","rich","dollar"],skins:[{unified:"1f911",native:"🤑"}],version:1},hugging_face:{id:"hugging_face",name:"Hugging Face",keywords:["smile","hug"],skins:[{unified:"1f917",native:"🤗"}],version:1},face_with_hand_over_mouth:{id:"face_with_hand_over_mouth",name:"Face with Hand over Mouth",keywords:["smiling","eyes","and","covering","whoops","shock","surprise"],skins:[{unified:"1f92d",native:"🤭"}],version:5},face_with_open_eyes_and_hand_over_mouth:{id:"face_with_open_eyes_and_hand_over_mouth",name:"Face with Open Eyes and Hand over Mouth",keywords:["silence","secret","shock","surprise"],skins:[{unified:"1fae2",native:"🫢"}],version:14},face_with_peeking_eye:{id:"face_with_peeking_eye",name:"Face with Peeking Eye",keywords:["scared","frightening","embarrassing","shy"],skins:[{unified:"1fae3",native:"🫣"}],version:14},shushing_face:{id:"shushing_face",name:"Shushing Face",keywords:["with","finger","covering","closed","lips","quiet","shhh"],skins:[{unified:"1f92b",native:"🤫"}],version:5},thinking_face:{id:"thinking_face",name:"Thinking Face",keywords:["hmmm","think","consider"],skins:[{unified:"1f914",native:"🤔"}],version:1},saluting_face:{id:"saluting_face",name:"Saluting Face",keywords:["respect","salute"],skins:[{unified:"1fae1",native:"🫡"}],version:14},zipper_mouth_face:{id:"zipper_mouth_face",name:"Zipper-Mouth Face",keywords:["zipper","mouth","sealed","secret"],skins:[{unified:"1f910",native:"🤐"}],version:1},face_with_raised_eyebrow:{id:"face_with_raised_eyebrow",name:"Face with Raised Eyebrow",keywords:["one","distrust","scepticism","disapproval","disbelief","surprise"],skins:[{unified:"1f928",native:"🤨"}],version:5},neutral_face:{id:"neutral_face",name:"Neutral Face",emoticons:[":|",":-|"],keywords:["indifference","meh",":",""],skins:[{unified:"1f610",native:"😐"}],version:1},expressionless:{id:"expressionless",name:"Expressionless Face",emoticons:["-_-"],keywords:["indifferent","-","","meh","deadpan"],skins:[{unified:"1f611",native:"😑"}],version:1},no_mouth:{id:"no_mouth",name:"Face Without Mouth",keywords:["no","hellokitty"],skins:[{unified:"1f636",native:"😶"}],version:1},dotted_line_face:{id:"dotted_line_face",name:"Dotted Line Face",keywords:["invisible","lonely","isolation","depression"],skins:[{unified:"1fae5",native:"🫥"}],version:14},face_in_clouds:{id:"face_in_clouds",name:"Face in Clouds",keywords:["shower","steam","dream"],skins:[{unified:"1f636-200d-1f32b-fe0f",native:"😶‍🌫️"}],version:13.1},smirk:{id:"smirk",name:"Smirking Face",keywords:["smirk","smile","mean","prank","smug","sarcasm"],skins:[{unified:"1f60f",native:"😏"}],version:1},unamused:{id:"unamused",name:"Unamused Face",emoticons:[":("],keywords:["indifference","bored","straight","serious","sarcasm","unimpressed","skeptical","dubious","side","eye"],skins:[{unified:"1f612",native:"😒"}],version:1},face_with_rolling_eyes:{id:"face_with_rolling_eyes",name:"Face with Rolling Eyes",keywords:["eyeroll","frustrated"],skins:[{unified:"1f644",native:"🙄"}],version:1},grimacing:{id:"grimacing",name:"Grimacing Face",keywords:["grimace","teeth"],skins:[{unified:"1f62c",native:"😬"}],version:1},face_exhaling:{id:"face_exhaling",name:"Face Exhaling",keywords:["relieve","relief","tired","sigh"],skins:[{unified:"1f62e-200d-1f4a8",native:"😮‍💨"}],version:13.1},lying_face:{id:"lying_face",name:"Lying Face",keywords:["lie","pinocchio"],skins:[{unified:"1f925",native:"🤥"}],version:3},shaking_face:{id:"shaking_face",name:"Shaking Face",keywords:["dizzy","shock","blurry","earthquake"],skins:[{unified:"1fae8",native:"🫨"}],version:15},relieved:{id:"relieved",name:"Relieved Face",keywords:["relaxed","phew","massage","happiness"],skins:[{unified:"1f60c",native:"😌"}],version:1},pensive:{id:"pensive",name:"Pensive Face",keywords:["sad","depressed","upset"],skins:[{unified:"1f614",native:"😔"}],version:1},sleepy:{id:"sleepy",name:"Sleepy Face",keywords:["tired","rest","nap"],skins:[{unified:"1f62a",native:"😪"}],version:1},drooling_face:{id:"drooling_face",name:"Drooling Face",keywords:[],skins:[{unified:"1f924",native:"🤤"}],version:3},sleeping:{id:"sleeping",name:"Sleeping Face",keywords:["tired","sleepy","night","zzz"],skins:[{unified:"1f634",native:"😴"}],version:1},mask:{id:"mask",name:"Face with Medical Mask",keywords:["sick","ill","disease","covid"],skins:[{unified:"1f637",native:"😷"}],version:1},face_with_thermometer:{id:"face_with_thermometer",name:"Face with Thermometer",keywords:["sick","temperature","cold","fever","covid"],skins:[{unified:"1f912",native:"🤒"}],version:1},face_with_head_bandage:{id:"face_with_head_bandage",name:"Face with Head-Bandage",keywords:["head","bandage","injured","clumsy","hurt"],skins:[{unified:"1f915",native:"🤕"}],version:1},nauseated_face:{id:"nauseated_face",name:"Nauseated Face",keywords:["vomit","gross","green","sick","throw","up","ill"],skins:[{unified:"1f922",native:"🤢"}],version:3},face_vomiting:{id:"face_vomiting",name:"Face Vomiting",keywords:["with","open","mouth","sick"],skins:[{unified:"1f92e",native:"🤮"}],version:5},sneezing_face:{id:"sneezing_face",name:"Sneezing Face",keywords:["gesundheit","sneeze","sick","allergy"],skins:[{unified:"1f927",native:"🤧"}],version:3},hot_face:{id:"hot_face",name:"Hot Face",keywords:["feverish","heat","red","sweating"],skins:[{unified:"1f975",native:"🥵"}],version:11},cold_face:{id:"cold_face",name:"Cold Face",keywords:["blue","freezing","frozen","frostbite","icicles"],skins:[{unified:"1f976",native:"🥶"}],version:11},woozy_face:{id:"woozy_face",name:"Woozy Face",keywords:["dizzy","intoxicated","tipsy","wavy"],skins:[{unified:"1f974",native:"🥴"}],version:11},dizzy_face:{id:"dizzy_face",name:"Dizzy Face",keywords:["spent","unconscious","xox"],skins:[{unified:"1f635",native:"😵"}],version:1},face_with_spiral_eyes:{id:"face_with_spiral_eyes",name:"Face with Spiral Eyes",keywords:["sick","ill","confused","nauseous","nausea"],skins:[{unified:"1f635-200d-1f4ab",native:"😵‍💫"}],version:13.1},exploding_head:{id:"exploding_head",name:"Exploding Head",keywords:["shocked","face","with","mind","blown"],skins:[{unified:"1f92f",native:"🤯"}],version:5},face_with_cowboy_hat:{id:"face_with_cowboy_hat",name:"Cowboy Hat Face",keywords:["with","cowgirl"],skins:[{unified:"1f920",native:"🤠"}],version:3},partying_face:{id:"partying_face",name:"Partying Face",keywords:["celebration","woohoo"],skins:[{unified:"1f973",native:"🥳"}],version:11},disguised_face:{id:"disguised_face",name:"Disguised Face",keywords:["pretent","brows","glasses","moustache"],skins:[{unified:"1f978",native:"🥸"}],version:13},sunglasses:{id:"sunglasses",name:"Smiling Face with Sunglasses",emoticons:["8)"],keywords:["cool","smile","summer","beach","sunglass"],skins:[{unified:"1f60e",native:"😎"}],version:1},nerd_face:{id:"nerd_face",name:"Nerd Face",keywords:["nerdy","geek","dork"],skins:[{unified:"1f913",native:"🤓"}],version:1},face_with_monocle:{id:"face_with_monocle",name:"Face with Monocle",keywords:["stuffy","wealthy"],skins:[{unified:"1f9d0",native:"🧐"}],version:5},confused:{id:"confused",name:"Confused Face",emoticons:[":\\",":-\\",":/",":-/"],keywords:["indifference","huh","weird","hmmm",":/"],skins:[{unified:"1f615",native:"😕"}],version:1},face_with_diagonal_mouth:{id:"face_with_diagonal_mouth",name:"Face with Diagonal Mouth",keywords:["skeptic","confuse","frustrated","indifferent"],skins:[{unified:"1fae4",native:"🫤"}],version:14},worried:{id:"worried",name:"Worried Face",keywords:["concern","nervous",":("],skins:[{unified:"1f61f",native:"😟"}],version:1},slightly_frowning_face:{id:"slightly_frowning_face",name:"Slightly Frowning Face",keywords:["disappointed","sad","upset"],skins:[{unified:"1f641",native:"🙁"}],version:1},white_frowning_face:{id:"white_frowning_face",name:"Frowning Face",keywords:["white","sad","upset","frown"],skins:[{unified:"2639-fe0f",native:"☹️"}],version:1},open_mouth:{id:"open_mouth",name:"Face with Open Mouth",emoticons:[":o",":-o",":O",":-O"],keywords:["surprise","impressed","wow","whoa",":O"],skins:[{unified:"1f62e",native:"😮"}],version:1},hushed:{id:"hushed",name:"Hushed Face",keywords:["woo","shh"],skins:[{unified:"1f62f",native:"😯"}],version:1},astonished:{id:"astonished",name:"Astonished Face",keywords:["xox","surprised","poisoned"],skins:[{unified:"1f632",native:"😲"}],version:1},flushed:{id:"flushed",name:"Flushed Face",keywords:["blush","shy","flattered"],skins:[{unified:"1f633",native:"😳"}],version:1},pleading_face:{id:"pleading_face",name:"Pleading Face",keywords:["begging","mercy","cry","tears","sad","grievance"],skins:[{unified:"1f97a",native:"🥺"}],version:11},face_holding_back_tears:{id:"face_holding_back_tears",name:"Face Holding Back Tears",keywords:["touched","gratitude","cry"],skins:[{unified:"1f979",native:"🥹"}],version:14},frowning:{id:"frowning",name:"Frowning Face with Open Mouth",keywords:["aw","what"],skins:[{unified:"1f626",native:"😦"}],version:1},anguished:{id:"anguished",name:"Anguished Face",emoticons:["D:"],keywords:["stunned","nervous"],skins:[{unified:"1f627",native:"😧"}],version:1},fearful:{id:"fearful",name:"Fearful Face",keywords:["scared","terrified","nervous"],skins:[{unified:"1f628",native:"😨"}],version:1},cold_sweat:{id:"cold_sweat",name:"Anxious Face with Sweat",keywords:["cold","nervous"],skins:[{unified:"1f630",native:"😰"}],version:1},disappointed_relieved:{id:"disappointed_relieved",name:"Sad but Relieved Face",keywords:["disappointed","phew","sweat","nervous"],skins:[{unified:"1f625",native:"😥"}],version:1},cry:{id:"cry",name:"Crying Face",emoticons:[":'("],keywords:["cry","tears","sad","depressed","upset",":'("],skins:[{unified:"1f622",native:"😢"}],version:1},sob:{id:"sob",name:"Loudly Crying Face",emoticons:[":'("],keywords:["sob","cry","tears","sad","upset","depressed"],skins:[{unified:"1f62d",native:"😭"}],version:1},scream:{id:"scream",name:"Face Screaming in Fear",keywords:["scream","munch","scared","omg"],skins:[{unified:"1f631",native:"😱"}],version:1},confounded:{id:"confounded",name:"Confounded Face",keywords:["confused","sick","unwell","oops",":S"],skins:[{unified:"1f616",native:"😖"}],version:1},persevere:{id:"persevere",name:"Persevering Face",keywords:["persevere","sick","no","upset","oops"],skins:[{unified:"1f623",native:"😣"}],version:1},disappointed:{id:"disappointed",name:"Disappointed Face",emoticons:["):",":(",":-("],keywords:["sad","upset","depressed",":("],skins:[{unified:"1f61e",native:"😞"}],version:1},sweat:{id:"sweat",name:"Face with Cold Sweat",keywords:["downcast","hot","sad","tired","exercise"],skins:[{unified:"1f613",native:"😓"}],version:1},weary:{id:"weary",name:"Weary Face",keywords:["tired","sleepy","sad","frustrated","upset"],skins:[{unified:"1f629",native:"😩"}],version:1},tired_face:{id:"tired_face",name:"Tired Face",keywords:["sick","whine","upset","frustrated"],skins:[{unified:"1f62b",native:"😫"}],version:1},yawning_face:{id:"yawning_face",name:"Yawning Face",keywords:["tired","sleepy"],skins:[{unified:"1f971",native:"🥱"}],version:12},triumph:{id:"triumph",name:"Face with Look of Triumph",keywords:["steam","from","nose","gas","phew","proud","pride"],skins:[{unified:"1f624",native:"😤"}],version:1},rage:{id:"rage",name:"Pouting Face",keywords:["rage","angry","mad","hate","despise"],skins:[{unified:"1f621",native:"😡"}],version:1},angry:{id:"angry",name:"Angry Face",emoticons:[">:(",">:-("],keywords:["mad","annoyed","frustrated"],skins:[{unified:"1f620",native:"😠"}],version:1},face_with_symbols_on_mouth:{id:"face_with_symbols_on_mouth",name:"Face with Symbols on Mouth",keywords:["serious","covering","swearing","cursing","cussing","profanity","expletive"],skins:[{unified:"1f92c",native:"🤬"}],version:5},smiling_imp:{id:"smiling_imp",name:"Smiling Face with Horns",keywords:["imp","devil"],skins:[{unified:"1f608",native:"😈"}],version:1},imp:{id:"imp",name:"Imp",keywords:["angry","face","with","horns","devil"],skins:[{unified:"1f47f",native:"👿"}],version:1},skull:{id:"skull",name:"Skull",keywords:["dead","skeleton","creepy","death"],skins:[{unified:"1f480",native:"💀"}],version:1},skull_and_crossbones:{id:"skull_and_crossbones",name:"Skull and Crossbones",keywords:["poison","danger","deadly","scary","death","pirate","evil"],skins:[{unified:"2620-fe0f",native:"☠️"}],version:1},hankey:{id:"hankey",name:"Pile of Poo",keywords:["hankey","poop","shit","shitface","fail","turd"],skins:[{unified:"1f4a9",native:"💩"}],version:1},clown_face:{id:"clown_face",name:"Clown Face",keywords:[],skins:[{unified:"1f921",native:"🤡"}],version:3},japanese_ogre:{id:"japanese_ogre",name:"Ogre",keywords:["japanese","monster","red","mask","halloween","scary","creepy","devil","demon"],skins:[{unified:"1f479",native:"👹"}],version:1},japanese_goblin:{id:"japanese_goblin",name:"Goblin",keywords:["japanese","red","evil","mask","monster","scary","creepy"],skins:[{unified:"1f47a",native:"👺"}],version:1},ghost:{id:"ghost",name:"Ghost",keywords:["halloween","spooky","scary"],skins:[{unified:"1f47b",native:"👻"}],version:1},alien:{id:"alien",name:"Alien",keywords:["UFO","paul","weird","outer","space"],skins:[{unified:"1f47d",native:"👽"}],version:1},space_invader:{id:"space_invader",name:"Alien Monster",keywords:["space","invader","game","arcade","play"],skins:[{unified:"1f47e",native:"👾"}],version:1},robot_face:{id:"robot_face",name:"Robot",keywords:["face","computer","machine","bot"],skins:[{unified:"1f916",native:"🤖"}],version:1},smiley_cat:{id:"smiley_cat",name:"Grinning Cat",keywords:["smiley","animal","cats","happy","smile"],skins:[{unified:"1f63a",native:"😺"}],version:1},smile_cat:{id:"smile_cat",name:"Grinning Cat with Smiling Eyes",keywords:["smile","animal","cats"],skins:[{unified:"1f638",native:"😸"}],version:1},joy_cat:{id:"joy_cat",name:"Cat with Tears of Joy",keywords:["animal","cats","haha","happy"],skins:[{unified:"1f639",native:"😹"}],version:1},heart_eyes_cat:{id:"heart_eyes_cat",name:"Smiling Cat with Heart-Eyes",keywords:["heart","eyes","animal","love","like","affection","cats","valentines"],skins:[{unified:"1f63b",native:"😻"}],version:1},smirk_cat:{id:"smirk_cat",name:"Cat with Wry Smile",keywords:["smirk","animal","cats"],skins:[{unified:"1f63c",native:"😼"}],version:1},kissing_cat:{id:"kissing_cat",name:"Kissing Cat",keywords:["animal","cats","kiss"],skins:[{unified:"1f63d",native:"😽"}],version:1},scream_cat:{id:"scream_cat",name:"Weary Cat",keywords:["scream","animal","cats","munch","scared"],skins:[{unified:"1f640",native:"🙀"}],version:1},crying_cat_face:{id:"crying_cat_face",name:"Crying Cat",keywords:["face","animal","tears","weep","sad","cats","upset","cry"],skins:[{unified:"1f63f",native:"😿"}],version:1},pouting_cat:{id:"pouting_cat",name:"Pouting Cat",keywords:["animal","cats"],skins:[{unified:"1f63e",native:"😾"}],version:1},see_no_evil:{id:"see_no_evil",name:"See-No-Evil Monkey",keywords:["see","no","evil","animal","nature","haha"],skins:[{unified:"1f648",native:"🙈"}],version:1},hear_no_evil:{id:"hear_no_evil",name:"Hear-No-Evil Monkey",keywords:["hear","no","evil","animal","nature"],skins:[{unified:"1f649",native:"🙉"}],version:1},speak_no_evil:{id:"speak_no_evil",name:"Speak-No-Evil Monkey",keywords:["speak","no","evil","animal","nature","omg"],skins:[{unified:"1f64a",native:"🙊"}],version:1},love_letter:{id:"love_letter",name:"Love Letter",keywords:["email","like","affection","envelope","valentines"],skins:[{unified:"1f48c",native:"💌"}],version:1},cupid:{id:"cupid",name:"Heart with Arrow",keywords:["cupid","love","like","affection","valentines"],skins:[{unified:"1f498",native:"💘"}],version:1},gift_heart:{id:"gift_heart",name:"Heart with Ribbon",keywords:["gift","love","valentines"],skins:[{unified:"1f49d",native:"💝"}],version:1},sparkling_heart:{id:"sparkling_heart",name:"Sparkling Heart",keywords:["love","like","affection","valentines"],skins:[{unified:"1f496",native:"💖"}],version:1},heartpulse:{id:"heartpulse",name:"Growing Heart",keywords:["heartpulse","like","love","affection","valentines","pink"],skins:[{unified:"1f497",native:"💗"}],version:1},heartbeat:{id:"heartbeat",name:"Beating Heart",keywords:["heartbeat","love","like","affection","valentines","pink"],skins:[{unified:"1f493",native:"💓"}],version:1},revolving_hearts:{id:"revolving_hearts",name:"Revolving Hearts",keywords:["love","like","affection","valentines"],skins:[{unified:"1f49e",native:"💞"}],version:1},two_hearts:{id:"two_hearts",name:"Two Hearts",keywords:["love","like","affection","valentines","heart"],skins:[{unified:"1f495",native:"💕"}],version:1},heart_decoration:{id:"heart_decoration",name:"Heart Decoration",keywords:["purple","square","love","like"],skins:[{unified:"1f49f",native:"💟"}],version:1},heavy_heart_exclamation_mark_ornament:{id:"heavy_heart_exclamation_mark_ornament",name:"Heart Exclamation",keywords:["heavy","mark","ornament","decoration","love"],skins:[{unified:"2763-fe0f",native:"❣️"}],version:1},broken_heart:{id:"broken_heart",name:"Broken Heart",emoticons:["{const r="[^"+t+"\\s]",s=new RegExp("["+t+"]((?:"+r+"){0,"+n+"})$").exec(i);if(s!==null){const a=s[1];if(a.length>=e)return{leadOffset:s.index,matchingString:a,replaceableString:s[0]}}return null},[n,e,t])}var xu={},vy={},pF=T;function COe(t){let e=new URLSearchParams;e.append("code",t);for(let n=1;n{const e=document.getElementById("typeahead-menu");if(e){var n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),0>n.top&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})}};function $Oe(t){var e=Bi.$getSelection();if(!Bi.$isRangeSelection(e)||!e.isCollapsed())return null;var n=e.anchor;if(n.type!=="text"||(e=n.getNode(),!e.isSimpleText()))return null;n=n.offset;let i=e.getTextContent().slice(0,n);var r=t.matchingString;t=t.replaceableString.length;for(let s=t;s<=r.length;s++)i.substr(-s)===r.substr(0,s)&&(t=s);if(t=n-t,0>t)return null;let o;return t===0?[o]=e.splitText(n):[,o]=e.splitText(t,n),o}function MOe(t,e){let n=getComputedStyle(t),i=n.position==="absolute";if(e=e?/(auto|scroll|hidden)/:/(auto|scroll)/,n.position==="fixed")return document.body;for(;t=t.parentElement;)if(n=getComputedStyle(t),(!i||n.position!=="static")&&e.test(n.overflow+n.overflowY+n.overflowX))return t;return document.body}function bF(t,e){return t=t.getBoundingClientRect(),e=e.getBoundingClientRect(),t.top>e.top&&t.top{if(e!=null&&t!=null){let o=r.getRootElement(),s=o!=null?MOe(o,!1):document.body,a=!1,l=bF(e,s),u=function(){a||(window.requestAnimationFrame(function(){n(),a=!1}),a=!0);const d=bF(e,s);d!==l&&(l=d,i!=null&&i(d))},f=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",u,{capture:!0,passive:!0}),f.observe(e),()=>{f.unobserve(e),window.removeEventListener("resize",n),document.removeEventListener("scroll",u,!0)}}},[e,r,i,n,t])}let yF=Bi.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function NOe({close:t,editor:e,anchorElementRef:n,resolution:i,options:r,menuRenderFn:o,onSelectOption:s,shouldSplitNodeWithQuery:a=!1,commandPriority:l=Bi.COMMAND_PRIORITY_LOW}){let[u,f]=zn.useState(null);zn.useEffect(()=>{f(0)},[i.match&&i.match.matchingString]);let d=zn.useCallback(m=>{e.update(()=>{const y=i.match!=null&&a?$Oe(i.match):null;s(m,y,t,i.match?i.match.matchingString:"")})},[e,a,i.match,s,t]),h=zn.useCallback(m=>{const y=e.getRootElement();y!==null&&(y.setAttribute("aria-activedescendant","typeahead-item-"+m),f(m))},[e]);zn.useEffect(()=>()=>{let m=e.getRootElement();m!==null&&m.removeAttribute("aria-activedescendant")},[e]),EOe(()=>{r===null?f(null):u===null&&h(0)},[r,u,h]),zn.useEffect(()=>mF.mergeRegister(e.registerCommand(yF,({option:m})=>m.ref&&m.ref.current!=null?(vF(m.ref.current),!0):!1,l)),[e,h,l]),zn.useEffect(()=>mF.mergeRegister(e.registerCommand(Bi.KEY_ARROW_DOWN_COMMAND,m=>{if(r!==null&&r.length&&u!==null){let y=u!==r.length-1?u+1:0;h(y);let x=r[y];x.ref!=null&&x.ref.current&&e.dispatchCommand(yF,{index:y,option:x}),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),e.registerCommand(Bi.KEY_ARROW_UP_COMMAND,m=>{if(r!==null&&r.length&&u!==null){var y=u!==0?u-1:r.length-1;h(y),y=r[y],y.ref!=null&&y.ref.current&&vF(y.ref.current),m.preventDefault(),m.stopImmediatePropagation()}return!0},l),e.registerCommand(Bi.KEY_ESCAPE_COMMAND,m=>(m.preventDefault(),m.stopImmediatePropagation(),t(),!0),l),e.registerCommand(Bi.KEY_TAB_COMMAND,m=>r===null||u===null||r[u]==null?!1:(m.preventDefault(),m.stopImmediatePropagation(),d(r[u]),!0),l),e.registerCommand(Bi.KEY_ENTER_COMMAND,m=>r===null||u===null||r[u]==null?!1:(m!==null&&(m.preventDefault(),m.stopImmediatePropagation()),d(r[u]),!0),l)),[d,t,e,r,u,h,l]);let g=zn.useMemo(()=>({options:r,selectOptionAndCleanUp:d,selectedIndex:u,setHighlightedIndex:f}),[d,u,r]);return o(n,g,i.match?i.match.matchingString:"")}function AOe(t,e,n,i=document.body){let[r]=kC.useLexicalComposerContext(),o=zn.useRef(document.createElement("div")),s=zn.useCallback(()=>{o.current.style.top=o.current.style.bottom;const l=r.getRootElement(),u=o.current;var f=u.firstChild;if(l!==null&&t!==null){const{left:h,top:g,width:m,height:y}=t.getRect();if(u.style.top=`${g+window.pageYOffset+o.current.offsetHeight+3}px`,u.style.left=`${h+window.pageXOffset}px`,u.style.height=`${y}px`,u.style.width=`${m}px`,f!==null){f.style.top=`${g}`;var d=f.getBoundingClientRect();f=d.height,d=d.width;const x=l.getBoundingClientRect();h+d>x.right&&(u.style.left=`${x.right-d+window.pageXOffset}px`),(g+f>window.innerHeight||g+f>x.bottom)&&g-x.top>f&&(u.style.top=`${g-f+window.pageYOffset-y}px`)}u.isConnected||(n!=null&&(u.className=n),u.setAttribute("aria-label","Typeahead menu"),u.setAttribute("id","typeahead-menu"),u.setAttribute("role","listbox"),u.style.display="block",u.style.position="absolute",i.append(u)),o.current=u,l.setAttribute("aria-controls","typeahead-menu")}},[r,t,n,i]);zn.useEffect(()=>{let l=r.getRootElement();if(t!==null)return s(),()=>{l!==null&&l.removeAttribute("aria-controls");let u=o.current;u!==null&&u.isConnected&&u.remove()}},[r,s,t]);let a=zn.useCallback(l=>{t!==null&&(l||e(null))},[t,e]);return kF(t,o.current,s,a),o}function POe(t,e,n){var i=n.getSelection();if(i===null||!i.isCollapsed||(n=i.anchorNode,i=i.anchorOffset,n==null||i==null))return!1;try{e.setStart(n,t),e.setEnd(n,i)}catch{return!1}return!0}function DOe(t){let e=null;return t.getEditorState().read(()=>{var n=Bi.$getSelection();if(Bi.$isRangeSelection(n)){var i=n.anchor;i.type!=="text"?e=null:(n=i.getNode(),n.isSimpleText()?(i=i.offset,e=n.getTextContent().slice(0,i)):e=null)}}),e}function IOe(t,e){return e!==0?!1:t.getEditorState().read(()=>{var n=Bi.$getSelection();return Bi.$isRangeSelection(n)?(n=n.anchor.getNode().getPreviousSibling(),Bi.$isTextNode(n)&&n.isTextEntity()):!1})}function LOe(t){zn.startTransition?zn.startTransition(t):t()}let ROe=Bi.createCommand("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");xu.LexicalTypeaheadMenuPlugin=function({options:t,onQueryChange:e,onSelectOption:n,onOpen:i,onClose:r,menuRenderFn:o,triggerFn:s,anchorClassName:a,commandPriority:l=Bi.COMMAND_PRIORITY_LOW,parent:u}){let[f]=kC.useLexicalComposerContext(),[d,h]=zn.useState(null);a=AOe(d,h,a,u);let g=zn.useCallback(()=>{h(null),r!=null&&d!==null&&r()},[r,d]),m=zn.useCallback(y=>{h(y),i!=null&&d===null&&i(y)},[i,d]);return zn.useEffect(()=>{let y=f.registerUpdateListener(()=>{f.getEditorState().read(()=>{const x=f._window||window,_=x.document.createRange(),S=Bi.$getSelection(),C=DOe(f);if(Bi.$isRangeSelection(S)&&S.isCollapsed()&&C!==null&&_!==null){var E=s(C,f);e(E?E.matchingString:null),E===null||IOe(f,E.leadOffset)||POe(E.leadOffset,_,x)===null?g():LOe(()=>m({getRect:()=>_.getBoundingClientRect(),match:E}))}else g()})});return()=>{y()}},[f,s,e,d,g,m]),d===null||f===null?null:zn.createElement(NOe,{close:g,resolution:d,editor:f,anchorElementRef:a,options:t,menuRenderFn:o,shouldSplitNodeWithQuery:!0,onSelectOption:n,commandPriority:l})},xu.MenuOption=TOe,xu.PUNCTUATION=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`,xu.SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND=ROe,xu.getScrollParent=function(t,e){let n=getComputedStyle(t),i=n.position==="absolute";if(e=e?/(auto|scroll|hidden)/:/(auto|scroll)/,n.position==="fixed")return document.body;for(;t=t.parentElement;)if(n=getComputedStyle(t),(!i||n.position!=="static")&&e.test(n.overflow+n.overflowY+n.overflowX))return t;return document.body},xu.useBasicTypeaheadTriggerMatch=function(t,{minLength:e=1,maxLength:n=75}){return zn.useCallback(i=>{if(i=new RegExp("(^|\\s|\\()(["+t+"]((?:[^"+(t+`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;\\s]){0,`)+n+"}))$").exec(i),i!==null){let r=i[1],o=i[3];if(o.length>=e)return{leadOffset:i.index+r.length,matchingString:o,replaceableString:i[2]}}return null},[n,e,t])},xu.useDynamicPositioning=kF;var jOe=xu;function wF(t){return t&&t.__esModule?t.default:t}function us(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var by,ct,xF,Ym,_F,OF,ky={},SF=[],FOe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _u(t,e){for(var n in e)t[n]=e[n];return t}function CF(t){var e=t.parentNode;e&&e.removeChild(t)}function yC(t,e,n){var i,r,o,s={};for(o in e)o=="key"?i=e[o]:o=="ref"?r=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?by.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return yy(t,s,i,r,null)}function yy(t,e,n,i,r){var o={type:t,props:e,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:r??++xF};return r==null&&ct.vnode!=null&&ct.vnode(o),o}function sl(){return{current:null}}function ch(t){return t.children}function xa(t,e){this.props=t,this.context=e}function fh(t,e){if(e==null)return t.__?fh(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e0?yy(g.type,g.props,g.key,null,g.__v):g)!=null){if(g.__=n,g.__b=n.__b+1,(h=_[f])===null||h&&g.key==h.key&&g.type===h.type)_[f]=void 0;else for(d=0;d{let t=null;try{navigator.userAgent.includes("jsdom")||(t=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}))}catch{}if(!t)return()=>!1;const e=25,n=20,i=Math.floor(e/2);return t.font=i+"px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=n*2,t.canvas.height=e,r=>{t.clearRect(0,0,n*2,e),t.fillStyle="#FF0000",t.fillText(r,0,22),t.fillStyle="#0000FF",t.fillText(r,n,22);const o=t.getImageData(0,0,n,e).data,s=o.length;let a=0;for(;a=s)return!1;const l=n+a/4%n,u=Math.floor(a/4/n),f=t.getImageData(l,u,1,1).data;return!(o[a]!==f[0]||o[a+2]!==f[2]||t.measureText(r).width>=n)}})();var zF={latestVersion:qOe,noCountryFlags:YOe};const _C=["+1","grinning","kissing_heart","heart_eyes","laughing","stuck_out_tongue_winking_eye","sweat_smile","joy","scream","disappointed","unamused","weary","sob","sunglasses","heart"];let rr=null;function XOe(t){rr||(rr=Ou.get("frequently")||{});const e=t.id||t;e&&(rr[e]||(rr[e]=0),rr[e]+=1,Ou.set("last",e),Ou.set("frequently",rr))}function GOe({maxFrequentRows:t,perLine:e}){if(!t)return[];rr||(rr=Ou.get("frequently"));let n=[];if(!rr){rr={};for(let o in _C.slice(0,e)){const s=_C[o];rr[s]=e-o,n.push(s)}return n}const i=t*e,r=Ou.get("last");for(let o in rr)n.push(o);if(n.sort((o,s)=>{const a=rr[s],l=rr[o];return a==l?o.localeCompare(s):a-l}),n.length>i){const o=n.slice(i);n=n.slice(0,i);for(let s of o)s!=r&&delete rr[s];r&&n.indexOf(r)==-1&&(delete rr[n[n.length-1]],n.splice(-1,1,r)),Ou.set("frequently",rr)}return n}var BF={add:XOe,get:GOe,DEFAULTS:_C},WF={};WF=JSON.parse('{"search":"Search","search_no_results_1":"Oh no!","search_no_results_2":"That emoji couldn’t be found","pick":"Pick an emoji…","add_custom":"Add custom emoji","categories":{"activity":"Activity","custom":"Custom","flags":"Flags","foods":"Food & Drink","frequent":"Frequently used","nature":"Animals & Nature","objects":"Objects","people":"Smileys & People","places":"Travel & Places","search":"Search Results","symbols":"Symbols"},"skins":{"1":"Default","2":"Light","3":"Medium-Light","4":"Medium","5":"Medium-Dark","6":"Dark","choose":"Choose default skin tone"}}');var al={autoFocus:{value:!1},dynamicWidth:{value:!1},emojiButtonColors:{value:null},emojiButtonRadius:{value:"100%"},emojiButtonSize:{value:36},emojiSize:{value:24},emojiVersion:{value:15,choices:[1,2,3,4,5,11,12,12.1,13,13.1,14,15]},exceptEmojis:{value:[]},icons:{value:"auto",choices:["auto","outline","solid"]},locale:{value:"en",choices:["en","ar","be","cs","de","es","fa","fi","fr","hi","it","ja","ko","nl","pl","pt","ru","sa","tr","uk","vi","zh"]},maxFrequentRows:{value:4},navPosition:{value:"top",choices:["top","bottom","none"]},noCountryFlags:{value:!1},noResultsEmoji:{value:null},perLine:{value:9},previewEmoji:{value:null},previewPosition:{value:"bottom",choices:["top","bottom","none"]},searchPosition:{value:"sticky",choices:["sticky","static","none"]},set:{value:"native",choices:["native","apple","facebook","google","twitter"]},skin:{value:1,choices:[1,2,3,4,5,6]},skinTonePosition:{value:"preview",choices:["preview","search","none"]},theme:{value:"auto",choices:["auto","light","dark"]},categories:null,categoryIcons:null,custom:null,data:null,i18n:null,getImageURL:null,getSpritesheetURL:null,onAddCustomEmoji:null,onClickOutside:null,onEmojiSelect:null,stickySearch:{deprecated:!0,value:!0}};let Cr=null,At=null;const OC={};async function HF(t){if(OC[t])return OC[t];const n=await(await fetch(t)).json();return OC[t]=n,n}let SC=null,QF=null,UF=!1;function Vm(t,{caller:e}={}){return SC||(SC=new Promise(n=>{QF=n})),t?KOe(t):e&&!UF&&console.warn(`\`${e}\` requires data to be initialized first. Promise will be pending until \`init\` is called.`),SC}async function KOe(t){UF=!0;let{emojiVersion:e,set:n,locale:i}=t;if(e||(e=al.emojiVersion.value),n||(n=al.set.value),i||(i=al.locale.value),At)At.categories=At.categories.filter(l=>!l.name);else{At=(typeof t.data=="function"?await t.data():t.data)||await HF(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/sets/${e}/${n}.json`),At.emoticons={},At.natives={},At.categories.unshift({id:"frequent",emojis:[]});for(const l in At.aliases){const u=At.aliases[l],f=At.emojis[u];f&&(f.aliases||(f.aliases=[]),f.aliases.push(l))}At.originalCategories=At.categories}if(Cr=(typeof t.i18n=="function"?await t.i18n():t.i18n)||(i=="en"?wF(WF):await HF(`https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/i18n/${i}.json`)),t.custom)for(let l in t.custom){l=parseInt(l);const u=t.custom[l],f=t.custom[l-1];if(!(!u.emojis||!u.emojis.length)){u.id||(u.id=`custom_${l+1}`),u.name||(u.name=Cr.categories.custom),f&&!u.icon&&(u.target=f.target||f),At.categories.push(u);for(const d of u.emojis)At.emojis[d.id]=d}}t.categories&&(At.categories=At.originalCategories.filter(l=>t.categories.indexOf(l.id)!=-1).sort((l,u)=>{const f=t.categories.indexOf(l.id),d=t.categories.indexOf(u.id);return f-d}));let r=null,o=null;n=="native"&&(r=zF.latestVersion(),o=t.noCountryFlags||zF.noCountryFlags());let s=At.categories.length,a=!1;for(;s--;){const l=At.categories[s];if(l.id=="frequent"){let{maxFrequentRows:d,perLine:h}=t;d=d>=0?d:al.maxFrequentRows.value,h||(h=al.perLine.value),l.emojis=BF.get({maxFrequentRows:d,perLine:h})}if(!l.emojis||!l.emojis.length){At.categories.splice(s,1);continue}const{categoryIcons:u}=t;if(u){const d=u[l.id];d&&!l.icon&&(l.icon=d)}let f=l.emojis.length;for(;f--;){const d=l.emojis[f],h=d.id?d:At.emojis[d],g=()=>{l.emojis.splice(f,1)};if(!h||t.exceptEmojis&&t.exceptEmojis.includes(h.id)){g();continue}if(r&&h.version>r){g();continue}if(o&&l.id=="flags"&&!iSe.includes(h.id)){g();continue}if(!h.search){if(a=!0,h.search=","+[[h.id,!1],[h.name,!0],[h.keywords,!1],[h.emoticons,!1]].map(([y,x])=>{if(y)return(Array.isArray(y)?y:[y]).map(_=>(x?_.split(/[-|_|\s]+/):[_]).map(S=>S.toLowerCase())).flat()}).flat().filter(y=>y&&y.trim()).join(","),h.emoticons)for(const y of h.emoticons)At.emoticons[y]||(At.emoticons[y]=h.id);let m=0;for(const y of h.skins){if(!y)continue;m++;const{native:x}=y;x&&(At.natives[x]=h.id,h.search+=`,${x}`);const _=m==1?"":`:skin-tone-${m}:`;y.shortcodes=`:${h.id}:${_}`}}}}a&&_a.reset(),QF()}function ZF(t,e,n){t||(t={});const i={};for(let r in e)i[r]=qF(r,t,e,n);return i}function qF(t,e,n,i){const r=n[t];let o=i&&i.getAttribute(t)||(e[t]!=null&&e[t]!=null?e[t]:null);return r&&(o!=null&&r.value&&typeof r.value!=typeof o&&(typeof r.value=="boolean"?o=o!="false":o=r.value.constructor(o)),r.transform&&o&&(o=r.transform(o)),(o==null||r.choices&&r.choices.indexOf(o)==-1)&&(o=r.value)),o}const JOe=/^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/;let CC=null;function eSe(t){return t.id?t:At.emojis[t]||At.emojis[At.aliases[t]]||At.emojis[At.natives[t]]}function tSe(){CC=null}async function nSe(t,{maxResults:e,caller:n}={}){if(!t||!t.trim().length)return null;e||(e=90),await Vm(null,{caller:n||"SearchIndex.search"});const i=t.toLowerCase().replace(/(\w)-/,"$1 ").split(/[\s|,]+/).filter((a,l,u)=>a.trim()&&u.indexOf(a)==l);if(!i.length)return;let r=CC||(CC=Object.values(At.emojis)),o,s;for(const a of i){if(!r.length)break;o=[],s={};for(const l of r){if(!l.search)continue;const u=l.search.indexOf(`,${a}`);u!=-1&&(o.push(l),s[l.id]||(s[l.id]=0),s[l.id]+=l.id==a?0:u+1)}r=o}return o.length<2||(o.sort((a,l)=>{const u=s[a.id],f=s[l.id];return u==f?a.id.localeCompare(l.id):u-f}),o.length>e&&(o=o.slice(0,e))),o}var _a={search:nSe,get:eSe,reset:tSe,SHORTCODES_REGEX:JOe};const iSe=["checkered_flag","crossed_flags","pirate_flag","rainbow-flag","transgender_flag","triangular_flag_on_post","waving_black_flag","waving_white_flag"];function rSe(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>n==e[i])}async function oSe(t=1){for(let e in[...Array(t).keys()])await new Promise(requestAnimationFrame)}function sSe(t,{skinIndex:e=0}={}){const n=t.skins[e]||(e=0,t.skins[e]),i={id:t.id,name:t.name,native:n.native,unified:n.unified,keywords:t.keywords,shortcodes:n.shortcodes||t.shortcodes};return t.skins.length>1&&(i.skin=e+1),n.src&&(i.src=n.src),t.aliases&&t.aliases.length&&(i.aliases=t.aliases),t.emoticons&&t.emoticons.length&&(i.emoticons=t.emoticons),i}var Oy={categories:{activity:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:me("path",{d:"M12 0C5.373 0 0 5.372 0 12c0 6.627 5.373 12 12 12 6.628 0 12-5.373 12-12 0-6.628-5.372-12-12-12m9.949 11H17.05c.224-2.527 1.232-4.773 1.968-6.113A9.966 9.966 0 0 1 21.949 11M13 11V2.051a9.945 9.945 0 0 1 4.432 1.564c-.858 1.491-2.156 4.22-2.392 7.385H13zm-2 0H8.961c-.238-3.165-1.536-5.894-2.393-7.385A9.95 9.95 0 0 1 11 2.051V11zm0 2v8.949a9.937 9.937 0 0 1-4.432-1.564c.857-1.492 2.155-4.221 2.393-7.385H11zm4.04 0c.236 3.164 1.534 5.893 2.392 7.385A9.92 9.92 0 0 1 13 21.949V13h2.04zM4.982 4.887C5.718 6.227 6.726 8.473 6.951 11h-4.9a9.977 9.977 0 0 1 2.931-6.113M2.051 13h4.9c-.226 2.527-1.233 4.771-1.969 6.113A9.972 9.972 0 0 1 2.051 13m16.967 6.113c-.735-1.342-1.744-3.586-1.968-6.113h4.899a9.961 9.961 0 0 1-2.931 6.113"})}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:me("path",{d:"M16.17 337.5c0 44.98 7.565 83.54 13.98 107.9C35.22 464.3 50.46 496 174.9 496c9.566 0 19.59-.4707 29.84-1.271L17.33 307.3C16.53 317.6 16.17 327.7 16.17 337.5zM495.8 174.5c0-44.98-7.565-83.53-13.98-107.9c-4.688-17.54-18.34-31.23-36.04-35.95C435.5 27.91 392.9 16 337 16c-9.564 0-19.59 .4707-29.84 1.271l187.5 187.5C495.5 194.4 495.8 184.3 495.8 174.5zM26.77 248.8l236.3 236.3c142-36.1 203.9-150.4 222.2-221.1L248.9 26.87C106.9 62.96 45.07 177.2 26.77 248.8zM256 335.1c0 9.141-7.474 16-16 16c-4.094 0-8.188-1.564-11.31-4.689L164.7 283.3C161.6 280.2 160 276.1 160 271.1c0-8.529 6.865-16 16-16c4.095 0 8.189 1.562 11.31 4.688l64.01 64C254.4 327.8 256 331.9 256 335.1zM304 287.1c0 9.141-7.474 16-16 16c-4.094 0-8.188-1.564-11.31-4.689L212.7 235.3C209.6 232.2 208 228.1 208 223.1c0-9.141 7.473-16 16-16c4.094 0 8.188 1.562 11.31 4.688l64.01 64.01C302.5 279.8 304 283.9 304 287.1zM256 175.1c0-9.141 7.473-16 16-16c4.094 0 8.188 1.562 11.31 4.688l64.01 64.01c3.125 3.125 4.688 7.219 4.688 11.31c0 9.133-7.468 16-16 16c-4.094 0-8.189-1.562-11.31-4.688l-64.01-64.01C257.6 184.2 256 180.1 256 175.1z"})})},custom:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:me("path",{d:"M417.1 368c-5.937 10.27-16.69 16-27.75 16c-5.422 0-10.92-1.375-15.97-4.281L256 311.4V448c0 17.67-14.33 32-31.1 32S192 465.7 192 448V311.4l-118.3 68.29C68.67 382.6 63.17 384 57.75 384c-11.06 0-21.81-5.734-27.75-16c-8.828-15.31-3.594-34.88 11.72-43.72L159.1 256L41.72 187.7C26.41 178.9 21.17 159.3 29.1 144C36.63 132.5 49.26 126.7 61.65 128.2C65.78 128.7 69.88 130.1 73.72 132.3L192 200.6V64c0-17.67 14.33-32 32-32S256 46.33 256 64v136.6l118.3-68.29c3.838-2.213 7.939-3.539 12.07-4.051C398.7 126.7 411.4 132.5 417.1 144c8.828 15.31 3.594 34.88-11.72 43.72L288 256l118.3 68.28C421.6 333.1 426.8 352.7 417.1 368z"})}),flags:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:me("path",{d:"M0 0l6.084 24H8L1.916 0zM21 5h-4l-1-4H4l3 12h3l1 4h13L21 5zM6.563 3h7.875l2 8H8.563l-2-8zm8.832 10l-2.856 1.904L12.063 13h3.332zM19 13l-1.5-6h1.938l2 8H16l3-2z"})}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:me("path",{d:"M64 496C64 504.8 56.75 512 48 512h-32C7.25 512 0 504.8 0 496V32c0-17.75 14.25-32 32-32s32 14.25 32 32V496zM476.3 0c-6.365 0-13.01 1.35-19.34 4.233c-45.69 20.86-79.56 27.94-107.8 27.94c-59.96 0-94.81-31.86-163.9-31.87C160.9 .3055 131.6 4.867 96 15.75v350.5c32-9.984 59.87-14.1 84.85-14.1c73.63 0 124.9 31.78 198.6 31.78c31.91 0 68.02-5.971 111.1-23.09C504.1 355.9 512 344.4 512 332.1V30.73C512 11.1 495.3 0 476.3 0z"})})},foods:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:me("path",{d:"M17 4.978c-1.838 0-2.876.396-3.68.934.513-1.172 1.768-2.934 4.68-2.934a1 1 0 0 0 0-2c-2.921 0-4.629 1.365-5.547 2.512-.064.078-.119.162-.18.244C11.73 1.838 10.798.023 9.207.023 8.579.022 7.85.306 7 .978 5.027 2.54 5.329 3.902 6.492 4.999 3.609 5.222 0 7.352 0 12.969c0 4.582 4.961 11.009 9 11.009 1.975 0 2.371-.486 3-1 .629.514 1.025 1 3 1 4.039 0 9-6.418 9-11 0-5.953-4.055-8-7-8M8.242 2.546c.641-.508.943-.523.965-.523.426.169.975 1.405 1.357 3.055-1.527-.629-2.741-1.352-2.98-1.846.059-.112.241-.356.658-.686M15 21.978c-1.08 0-1.21-.109-1.559-.402l-.176-.146c-.367-.302-.816-.452-1.266-.452s-.898.15-1.266.452l-.176.146c-.347.292-.477.402-1.557.402-2.813 0-7-5.389-7-9.009 0-5.823 4.488-5.991 5-5.991 1.939 0 2.484.471 3.387 1.251l.323.276a1.995 1.995 0 0 0 2.58 0l.323-.276c.902-.78 1.447-1.251 3.387-1.251.512 0 5 .168 5 6 0 3.617-4.187 9-7 9"})}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:me("path",{d:"M481.9 270.1C490.9 279.1 496 291.3 496 304C496 316.7 490.9 328.9 481.9 337.9C472.9 346.9 460.7 352 448 352H64C51.27 352 39.06 346.9 30.06 337.9C21.06 328.9 16 316.7 16 304C16 291.3 21.06 279.1 30.06 270.1C39.06 261.1 51.27 256 64 256H448C460.7 256 472.9 261.1 481.9 270.1zM475.3 388.7C478.3 391.7 480 395.8 480 400V416C480 432.1 473.3 449.3 461.3 461.3C449.3 473.3 432.1 480 416 480H96C79.03 480 62.75 473.3 50.75 461.3C38.74 449.3 32 432.1 32 416V400C32 395.8 33.69 391.7 36.69 388.7C39.69 385.7 43.76 384 48 384H464C468.2 384 472.3 385.7 475.3 388.7zM50.39 220.8C45.93 218.6 42.03 215.5 38.97 211.6C35.91 207.7 33.79 203.2 32.75 198.4C31.71 193.5 31.8 188.5 32.99 183.7C54.98 97.02 146.5 32 256 32C365.5 32 457 97.02 479 183.7C480.2 188.5 480.3 193.5 479.2 198.4C478.2 203.2 476.1 207.7 473 211.6C469.1 215.5 466.1 218.6 461.6 220.8C457.2 222.9 452.3 224 447.3 224H64.67C59.73 224 54.84 222.9 50.39 220.8zM372.7 116.7C369.7 119.7 368 123.8 368 128C368 131.2 368.9 134.3 370.7 136.9C372.5 139.5 374.1 141.6 377.9 142.8C380.8 143.1 384 144.3 387.1 143.7C390.2 143.1 393.1 141.6 395.3 139.3C397.6 137.1 399.1 134.2 399.7 131.1C400.3 128 399.1 124.8 398.8 121.9C397.6 118.1 395.5 116.5 392.9 114.7C390.3 112.9 387.2 111.1 384 111.1C379.8 111.1 375.7 113.7 372.7 116.7V116.7zM244.7 84.69C241.7 87.69 240 91.76 240 96C240 99.16 240.9 102.3 242.7 104.9C244.5 107.5 246.1 109.6 249.9 110.8C252.8 111.1 256 112.3 259.1 111.7C262.2 111.1 265.1 109.6 267.3 107.3C269.6 105.1 271.1 102.2 271.7 99.12C272.3 96.02 271.1 92.8 270.8 89.88C269.6 86.95 267.5 84.45 264.9 82.7C262.3 80.94 259.2 79.1 256 79.1C251.8 79.1 247.7 81.69 244.7 84.69V84.69zM116.7 116.7C113.7 119.7 112 123.8 112 128C112 131.2 112.9 134.3 114.7 136.9C116.5 139.5 118.1 141.6 121.9 142.8C124.8 143.1 128 144.3 131.1 143.7C134.2 143.1 137.1 141.6 139.3 139.3C141.6 137.1 143.1 134.2 143.7 131.1C144.3 128 143.1 124.8 142.8 121.9C141.6 118.1 139.5 116.5 136.9 114.7C134.3 112.9 131.2 111.1 128 111.1C123.8 111.1 119.7 113.7 116.7 116.7L116.7 116.7z"})})},frequent:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[me("path",{d:"M13 4h-2l-.001 7H9v2h2v2h2v-2h4v-2h-4z"}),me("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"})]}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:me("path",{d:"M256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512zM232 256C232 264 236 271.5 242.7 275.1L338.7 339.1C349.7 347.3 364.6 344.3 371.1 333.3C379.3 322.3 376.3 307.4 365.3 300L280 243.2V120C280 106.7 269.3 96 255.1 96C242.7 96 231.1 106.7 231.1 120L232 256z"})})},nature:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[me("path",{d:"M15.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 15.5 8M8.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 8.5 8"}),me("path",{d:"M18.933 0h-.027c-.97 0-2.138.787-3.018 1.497-1.274-.374-2.612-.51-3.887-.51-1.285 0-2.616.133-3.874.517C7.245.79 6.069 0 5.093 0h-.027C3.352 0 .07 2.67.002 7.026c-.039 2.479.276 4.238 1.04 5.013.254.258.882.677 1.295.882.191 3.177.922 5.238 2.536 6.38.897.637 2.187.949 3.2 1.102C8.04 20.6 8 20.795 8 21c0 1.773 2.35 3 4 3 1.648 0 4-1.227 4-3 0-.201-.038-.393-.072-.586 2.573-.385 5.435-1.877 5.925-7.587.396-.22.887-.568 1.104-.788.763-.774 1.079-2.534 1.04-5.013C23.929 2.67 20.646 0 18.933 0M3.223 9.135c-.237.281-.837 1.155-.884 1.238-.15-.41-.368-1.349-.337-3.291.051-3.281 2.478-4.972 3.091-5.031.256.015.731.27 1.265.646-1.11 1.171-2.275 2.915-2.352 5.125-.133.546-.398.858-.783 1.313M12 22c-.901 0-1.954-.693-2-1 0-.654.475-1.236 1-1.602V20a1 1 0 1 0 2 0v-.602c.524.365 1 .947 1 1.602-.046.307-1.099 1-2 1m3-3.48v.02a4.752 4.752 0 0 0-1.262-1.02c1.092-.516 2.239-1.334 2.239-2.217 0-1.842-1.781-2.195-3.977-2.195-2.196 0-3.978.354-3.978 2.195 0 .883 1.148 1.701 2.238 2.217A4.8 4.8 0 0 0 9 18.539v-.025c-1-.076-2.182-.281-2.973-.842-1.301-.92-1.838-3.045-1.853-6.478l.023-.041c.496-.826 1.49-1.45 1.804-3.102 0-2.047 1.357-3.631 2.362-4.522C9.37 3.178 10.555 3 11.948 3c1.447 0 2.685.192 3.733.57 1 .9 2.316 2.465 2.316 4.48.313 1.651 1.307 2.275 1.803 3.102.035.058.068.117.102.178-.059 5.967-1.949 7.01-4.902 7.19m6.628-8.202c-.037-.065-.074-.13-.113-.195a7.587 7.587 0 0 0-.739-.987c-.385-.455-.648-.768-.782-1.313-.076-2.209-1.241-3.954-2.353-5.124.531-.376 1.004-.63 1.261-.647.636.071 3.044 1.764 3.096 5.031.027 1.81-.347 3.218-.37 3.235"})]}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:me("path",{d:"M332.7 19.85C334.6 8.395 344.5 0 356.1 0C363.6 0 370.6 3.52 375.1 9.502L392 32H444.1C456.8 32 469.1 37.06 478.1 46.06L496 64H552C565.3 64 576 74.75 576 88V112C576 156.2 540.2 192 496 192H426.7L421.6 222.5L309.6 158.5L332.7 19.85zM448 64C439.2 64 432 71.16 432 80C432 88.84 439.2 96 448 96C456.8 96 464 88.84 464 80C464 71.16 456.8 64 448 64zM416 256.1V480C416 497.7 401.7 512 384 512H352C334.3 512 320 497.7 320 480V364.8C295.1 377.1 268.8 384 240 384C211.2 384 184 377.1 160 364.8V480C160 497.7 145.7 512 128 512H96C78.33 512 64 497.7 64 480V249.8C35.23 238.9 12.64 214.5 4.836 183.3L.9558 167.8C-3.331 150.6 7.094 133.2 24.24 128.1C41.38 124.7 58.76 135.1 63.05 152.2L66.93 167.8C70.49 182 83.29 191.1 97.97 191.1H303.8L416 256.1z"})})},objects:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[me("path",{d:"M12 0a9 9 0 0 0-5 16.482V21s2.035 3 5 3 5-3 5-3v-4.518A9 9 0 0 0 12 0zm0 2c3.86 0 7 3.141 7 7s-3.14 7-7 7-7-3.141-7-7 3.14-7 7-7zM9 17.477c.94.332 1.946.523 3 .523s2.06-.19 3-.523v.834c-.91.436-1.925.689-3 .689a6.924 6.924 0 0 1-3-.69v-.833zm.236 3.07A8.854 8.854 0 0 0 12 21c.965 0 1.888-.167 2.758-.451C14.155 21.173 13.153 22 12 22c-1.102 0-2.117-.789-2.764-1.453z"}),me("path",{d:"M14.745 12.449h-.004c-.852-.024-1.188-.858-1.577-1.824-.421-1.061-.703-1.561-1.182-1.566h-.009c-.481 0-.783.497-1.235 1.537-.436.982-.801 1.811-1.636 1.791l-.276-.043c-.565-.171-.853-.691-1.284-1.794-.125-.313-.202-.632-.27-.913-.051-.213-.127-.53-.195-.634C7.067 9.004 7.039 9 6.99 9A1 1 0 0 1 7 7h.01c1.662.017 2.015 1.373 2.198 2.134.486-.981 1.304-2.058 2.797-2.075 1.531.018 2.28 1.153 2.731 2.141l.002-.008C14.944 8.424 15.327 7 16.979 7h.032A1 1 0 1 1 17 9h-.011c-.149.076-.256.474-.319.709a6.484 6.484 0 0 1-.311.951c-.429.973-.79 1.789-1.614 1.789"})]}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:me("path",{d:"M112.1 454.3c0 6.297 1.816 12.44 5.284 17.69l17.14 25.69c5.25 7.875 17.17 14.28 26.64 14.28h61.67c9.438 0 21.36-6.401 26.61-14.28l17.08-25.68c2.938-4.438 5.348-12.37 5.348-17.7L272 415.1h-160L112.1 454.3zM191.4 .0132C89.44 .3257 16 82.97 16 175.1c0 44.38 16.44 84.84 43.56 115.8c16.53 18.84 42.34 58.23 52.22 91.45c.0313 .25 .0938 .5166 .125 .7823h160.2c.0313-.2656 .0938-.5166 .125-.7823c9.875-33.22 35.69-72.61 52.22-91.45C351.6 260.8 368 220.4 368 175.1C368 78.61 288.9-.2837 191.4 .0132zM192 96.01c-44.13 0-80 35.89-80 79.1C112 184.8 104.8 192 96 192S80 184.8 80 176c0-61.76 50.25-111.1 112-111.1c8.844 0 16 7.159 16 16S200.8 96.01 192 96.01z"})})},people:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[me("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"}),me("path",{d:"M8 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 8 7M16 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 16 7M15.232 15c-.693 1.195-1.87 2-3.349 2-1.477 0-2.655-.805-3.347-2H15m3-2H6a6 6 0 1 0 12 0"})]}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:me("path",{d:"M0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256zM256 432C332.1 432 396.2 382 415.2 314.1C419.1 300.4 407.8 288 393.6 288H118.4C104.2 288 92.92 300.4 96.76 314.1C115.8 382 179.9 432 256 432V432zM176.4 160C158.7 160 144.4 174.3 144.4 192C144.4 209.7 158.7 224 176.4 224C194 224 208.4 209.7 208.4 192C208.4 174.3 194 160 176.4 160zM336.4 224C354 224 368.4 209.7 368.4 192C368.4 174.3 354 160 336.4 160C318.7 160 304.4 174.3 304.4 192C304.4 209.7 318.7 224 336.4 224z"})})},places:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[me("path",{d:"M6.5 12C5.122 12 4 13.121 4 14.5S5.122 17 6.5 17 9 15.879 9 14.5 7.878 12 6.5 12m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5M17.5 12c-1.378 0-2.5 1.121-2.5 2.5s1.122 2.5 2.5 2.5 2.5-1.121 2.5-2.5-1.122-2.5-2.5-2.5m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5"}),me("path",{d:"M22.482 9.494l-1.039-.346L21.4 9h.6c.552 0 1-.439 1-.992 0-.006-.003-.008-.003-.008H23c0-1-.889-2-1.984-2h-.642l-.731-1.717C19.262 3.012 18.091 2 16.764 2H7.236C5.909 2 4.738 3.012 4.357 4.283L3.626 6h-.642C1.889 6 1 7 1 8h.003S1 8.002 1 8.008C1 8.561 1.448 9 2 9h.6l-.043.148-1.039.346a2.001 2.001 0 0 0-1.359 2.097l.751 7.508a1 1 0 0 0 .994.901H3v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h6v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h1.096a.999.999 0 0 0 .994-.901l.751-7.508a2.001 2.001 0 0 0-1.359-2.097M6.273 4.857C6.402 4.43 6.788 4 7.236 4h9.527c.448 0 .834.43.963.857L19.313 9H4.688l1.585-4.143zM7 21H5v-1h2v1zm12 0h-2v-1h2v1zm2.189-3H2.811l-.662-6.607L3 11h18l.852.393L21.189 18z"})]}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:me("path",{d:"M39.61 196.8L74.8 96.29C88.27 57.78 124.6 32 165.4 32H346.6C387.4 32 423.7 57.78 437.2 96.29L472.4 196.8C495.6 206.4 512 229.3 512 256V448C512 465.7 497.7 480 480 480H448C430.3 480 416 465.7 416 448V400H96V448C96 465.7 81.67 480 64 480H32C14.33 480 0 465.7 0 448V256C0 229.3 16.36 206.4 39.61 196.8V196.8zM109.1 192H402.9L376.8 117.4C372.3 104.6 360.2 96 346.6 96H165.4C151.8 96 139.7 104.6 135.2 117.4L109.1 192zM96 256C78.33 256 64 270.3 64 288C64 305.7 78.33 320 96 320C113.7 320 128 305.7 128 288C128 270.3 113.7 256 96 256zM416 320C433.7 320 448 305.7 448 288C448 270.3 433.7 256 416 256C398.3 256 384 270.3 384 288C384 305.7 398.3 320 416 320z"})})},symbols:{outline:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:me("path",{d:"M0 0h11v2H0zM4 11h3V6h4V4H0v2h4zM15.5 17c1.381 0 2.5-1.116 2.5-2.493s-1.119-2.493-2.5-2.493S13 13.13 13 14.507 14.119 17 15.5 17m0-2.986c.276 0 .5.222.5.493 0 .272-.224.493-.5.493s-.5-.221-.5-.493.224-.493.5-.493M21.5 19.014c-1.381 0-2.5 1.116-2.5 2.493S20.119 24 21.5 24s2.5-1.116 2.5-2.493-1.119-2.493-2.5-2.493m0 2.986a.497.497 0 0 1-.5-.493c0-.271.224-.493.5-.493s.5.222.5.493a.497.497 0 0 1-.5.493M22 13l-9 9 1.513 1.5 8.99-9.009zM17 11c2.209 0 4-1.119 4-2.5V2s.985-.161 1.498.949C23.01 4.055 23 6 23 6s1-1.119 1-3.135C24-.02 21 0 21 0h-2v6.347A5.853 5.853 0 0 0 17 6c-2.209 0-4 1.119-4 2.5s1.791 2.5 4 2.5M10.297 20.482l-1.475-1.585a47.54 47.54 0 0 1-1.442 1.129c-.307-.288-.989-1.016-2.045-2.183.902-.836 1.479-1.466 1.729-1.892s.376-.871.376-1.336c0-.592-.273-1.178-.818-1.759-.546-.581-1.329-.871-2.349-.871-1.008 0-1.79.293-2.344.879-.556.587-.832 1.181-.832 1.784 0 .813.419 1.748 1.256 2.805-.847.614-1.444 1.208-1.794 1.784a3.465 3.465 0 0 0-.523 1.833c0 .857.308 1.56.924 2.107.616.549 1.423.823 2.42.823 1.173 0 2.444-.379 3.813-1.137L8.235 24h2.819l-2.09-2.383 1.333-1.135zm-6.736-6.389a1.02 1.02 0 0 1 .73-.286c.31 0 .559.085.747.254a.849.849 0 0 1 .283.659c0 .518-.419 1.112-1.257 1.784-.536-.651-.805-1.231-.805-1.742a.901.901 0 0 1 .302-.669M3.74 22c-.427 0-.778-.116-1.057-.349-.279-.232-.418-.487-.418-.766 0-.594.509-1.288 1.527-2.083.968 1.134 1.717 1.946 2.248 2.438-.921.507-1.686.76-2.3.76"})}),solid:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:me("path",{d:"M500.3 7.251C507.7 13.33 512 22.41 512 31.1V175.1C512 202.5 483.3 223.1 447.1 223.1C412.7 223.1 383.1 202.5 383.1 175.1C383.1 149.5 412.7 127.1 447.1 127.1V71.03L351.1 90.23V207.1C351.1 234.5 323.3 255.1 287.1 255.1C252.7 255.1 223.1 234.5 223.1 207.1C223.1 181.5 252.7 159.1 287.1 159.1V63.1C287.1 48.74 298.8 35.61 313.7 32.62L473.7 .6198C483.1-1.261 492.9 1.173 500.3 7.251H500.3zM74.66 303.1L86.5 286.2C92.43 277.3 102.4 271.1 113.1 271.1H174.9C185.6 271.1 195.6 277.3 201.5 286.2L213.3 303.1H239.1C266.5 303.1 287.1 325.5 287.1 351.1V463.1C287.1 490.5 266.5 511.1 239.1 511.1H47.1C21.49 511.1-.0019 490.5-.0019 463.1V351.1C-.0019 325.5 21.49 303.1 47.1 303.1H74.66zM143.1 359.1C117.5 359.1 95.1 381.5 95.1 407.1C95.1 434.5 117.5 455.1 143.1 455.1C170.5 455.1 191.1 434.5 191.1 407.1C191.1 381.5 170.5 359.1 143.1 359.1zM440.3 367.1H496C502.7 367.1 508.6 372.1 510.1 378.4C513.3 384.6 511.6 391.7 506.5 396L378.5 508C372.9 512.1 364.6 513.3 358.6 508.9C352.6 504.6 350.3 496.6 353.3 489.7L391.7 399.1H336C329.3 399.1 323.4 395.9 321 389.6C318.7 383.4 320.4 376.3 325.5 371.1L453.5 259.1C459.1 255 467.4 254.7 473.4 259.1C479.4 263.4 481.6 271.4 478.7 278.3L440.3 367.1zM116.7 219.1L19.85 119.2C-8.112 90.26-6.614 42.31 24.85 15.34C51.82-8.137 93.26-3.642 118.2 21.83L128.2 32.32L137.7 21.83C162.7-3.642 203.6-8.137 231.6 15.34C262.6 42.31 264.1 90.26 236.1 119.2L139.7 219.1C133.2 225.6 122.7 225.6 116.7 219.1H116.7z"})})}},search:{loupe:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:me("path",{d:"M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12z"})}),delete:me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:me("path",{d:"M10 8.586L2.929 1.515 1.515 2.929 8.586 10l-7.071 7.071 1.414 1.414L10 11.414l7.071 7.071 1.414-1.414L11.414 10l7.071-7.071-1.414-1.414L10 8.586z"})})}};function EC(t){let{id:e,skin:n,emoji:i}=t;if(t.shortcodes){const a=t.shortcodes.match(_a.SHORTCODES_REGEX);a&&(e=a[1],a[2]&&(n=a[2]))}if(i||(i=_a.get(e||t.native)),!i)return t.fallback;const r=i.skins[n-1]||i.skins[0],o=r.src||(t.set!="native"&&!t.spritesheet?typeof t.getImageURL=="function"?t.getImageURL(t.set,r.unified):`https://cdn.jsdelivr.net/npm/emoji-datasource-${t.set}@15.0.1/img/${t.set}/64/${r.unified}.png`:void 0),s=typeof t.getSpritesheetURL=="function"?t.getSpritesheetURL(t.set):`https://cdn.jsdelivr.net/npm/emoji-datasource-${t.set}@15.0.1/img/${t.set}/sheets-256/64.png`;return me("span",{class:"emoji-mart-emoji","data-emoji-set":t.set,children:o?me("img",{style:{maxWidth:t.size||"1em",maxHeight:t.size||"1em",display:"inline-block"},alt:r.native||r.shortcodes,src:o}):t.set=="native"?me("span",{style:{fontSize:t.size,fontFamily:'"EmojiMart", "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Android Emoji"'},children:r.native}):me("span",{style:{display:"block",width:t.size,height:t.size,backgroundImage:`url(${s})`,backgroundSize:`${100*At.sheet.cols}% ${100*At.sheet.rows}%`,backgroundPosition:`${100/(At.sheet.cols-1)*r.x}% ${100/(At.sheet.rows-1)*r.y}%`}})})}const aSe=typeof window<"u"&&window.HTMLElement?window.HTMLElement:Object;class YF extends aSe{static get observedAttributes(){return Object.keys(this.Props)}update(e={}){for(let n in e)this.attributeChangedCallback(n,null,e[n])}attributeChangedCallback(e,n,i){if(!this.component)return;const r=qF(e,{[e]:i},this.constructor.Props,this);this.component.componentWillReceiveProps?this.component.componentWillReceiveProps({[e]:r}):(this.component.props[e]=r,this.component.forceUpdate())}disconnectedCallback(){this.disconnected=!0,this.component&&this.component.unregister&&this.component.unregister()}constructor(e={}){if(super(),this.props=e,e.parent||e.ref){let n=null;const i=e.parent||(n=e.ref&&e.ref.current);n&&(n.innerHTML=""),i&&i.appendChild(this)}}}class lSe extends YF{setShadow(){this.attachShadow({mode:"open"})}injectStyles(e){if(!e)return;const n=document.createElement("style");n.textContent=e,this.shadowRoot.insertBefore(n,this.shadowRoot.firstChild)}constructor(e,{styles:n}={}){super(e),this.setShadow(),this.injectStyles(n)}}var VF={fallback:"",id:"",native:"",shortcodes:"",size:{value:"",transform:t=>/\D/.test(t)?t:`${t}px`},set:al.set,skin:al.skin};class XF extends YF{async connectedCallback(){const e=ZF(this.props,VF,this);e.element=this,e.ref=n=>{this.component=n},await Vm(),!this.disconnected&&jF(me(EC,{...e}),this)}constructor(e){super(e)}}us(XF,"Props",VF),typeof customElements<"u"&&!customElements.get("em-emoji")&&customElements.define("em-emoji",XF);var GF,TC=[],KF=ct.__b,JF=ct.__r,ez=ct.diffed,tz=ct.__c,nz=ct.unmount;function uSe(){var t;for(TC.sort(function(e,n){return e.__v.__b-n.__v.__b});t=TC.pop();)if(t.__P)try{t.__H.__h.forEach(Sy),t.__H.__h.forEach($C),t.__H.__h=[]}catch(e){t.__H.__h=[],ct.__e(e,t.__v)}}ct.__b=function(t){KF&&KF(t)},ct.__r=function(t){JF&&JF(t);var e=t.__c.__H;e&&(e.__h.forEach(Sy),e.__h.forEach($C),e.__h=[])},ct.diffed=function(t){ez&&ez(t);var e=t.__c;e&&e.__H&&e.__H.__h.length&&(TC.push(e)!==1&&GF===ct.requestAnimationFrame||((GF=ct.requestAnimationFrame)||function(n){var i,r=function(){clearTimeout(o),iz&&cancelAnimationFrame(i),setTimeout(n)},o=setTimeout(r,100);iz&&(i=requestAnimationFrame(r))})(uSe))},ct.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Sy),n.__h=n.__h.filter(function(i){return!i.__||$C(i)})}catch(i){e.some(function(r){r.__h&&(r.__h=[])}),e=[],ct.__e(i,n.__v)}}),tz&&tz(t,e)},ct.unmount=function(t){nz&&nz(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(i){try{Sy(i)}catch(r){e=r}}),e&&ct.__e(e,n.__v))};var iz=typeof requestAnimationFrame=="function";function Sy(t){var e=t.__c;typeof e=="function"&&(t.__c=void 0,e())}function $C(t){t.__c=t.__()}function cSe(t,e){for(var n in e)t[n]=e[n];return t}function rz(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var i in e)if(i!=="__source"&&t[i]!==e[i])return!0;return!1}function Cy(t){this.props=t}(Cy.prototype=new xa).isPureReactComponent=!0,Cy.prototype.shouldComponentUpdate=function(t,e){return rz(this.props,t)||rz(this.state,e)};var oz=ct.__b;ct.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),oz&&oz(t)};var fSe=ct.__e;ct.__e=function(t,e,n){if(t.then){for(var i,r=e;r=r.__;)if((i=r.__c)&&i.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),i.__c(t,e)}fSe(t,e,n)};var sz=ct.unmount;function MC(){this.__u=0,this.t=null,this.__b=null}function az(t){var e=t.__.__c;return e&&e.__e&&e.__e(t)}function Ey(){this.u=null,this.o=null}ct.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&t.__h===!0&&(t.type=null),sz&&sz(t)},(MC.prototype=new xa).__c=function(t,e){var n=e.__c,i=this;i.t==null&&(i.t=[]),i.t.push(n);var r=az(i.__v),o=!1,s=function(){o||(o=!0,n.__R=null,r?r(a):a())};n.__R=s;var a=function(){if(!--i.__u){if(i.state.__e){var u=i.state.__e;i.__v.__k[0]=function d(h,g,m){return h&&(h.__v=null,h.__k=h.__k&&h.__k.map(function(y){return d(y,g,m)}),h.__c&&h.__c.__P===g&&(h.__e&&m.insertBefore(h.__e,h.__d),h.__c.__e=!0,h.__c.__P=m)),h}(u,u.__c.__P,u.__c.__O)}var f;for(i.setState({__e:i.__b=null});f=i.t.pop();)f.forceUpdate()}},l=e.__h===!0;i.__u++||l||i.setState({__e:i.__b=i.__v.__k[0]}),t.then(s,s)},MC.prototype.componentWillUnmount=function(){this.t=[]},MC.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=function o(s,a,l){return s&&(s.__c&&s.__c.__H&&(s.__c.__H.__.forEach(function(u){typeof u.__c=="function"&&u.__c()}),s.__c.__H=null),(s=cSe({},s)).__c!=null&&(s.__c.__P===l&&(s.__c.__P=a),s.__c=null),s.__k=s.__k&&s.__k.map(function(u){return o(u,a,l)})),s}(this.__b,n,i.__O=i.__P)}this.__b=null}var r=e.__e&&yC(ch,null,t.fallback);return r&&(r.__h=null),[yC(ch,null,e.__e?null:t.children),r]};var lz=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]{const r=n.name||Cr.categories[n.id],o=!this.props.unfocused&&n.id==this.state.categoryId;return o&&(e=i),me("button",{"aria-label":r,"aria-selected":o||void 0,title:r,type:"button",class:"flex flex-grow flex-center",onMouseDown:s=>s.preventDefault(),onClick:()=>{this.props.onClick({category:n,i})},children:this.renderIcon(n)})}),me("div",{class:"bar",style:{width:`${100/this.categories.length}%`,opacity:e==null?0:1,transform:this.props.dir==="rtl"?`scaleX(-1) translateX(${e*100}%)`:`translateX(${e*100}%)`}})]})})}constructor(){super(),this.categories=At.categories.filter(e=>!e.target),this.state={categoryId:this.categories[0].id}}}class wSe extends Cy{shouldComponentUpdate(e){for(let n in e)if(n!="children"&&e[n]!=this.props[n])return!0;return!1}render(){return this.props.children}}const Ty={rowsPerRender:10};class xSe extends xa{getInitialState(e=this.props){return{skin:Ou.get("skin")||e.skin,theme:this.initTheme(e.theme)}}componentWillMount(){this.dir=Cr.rtl?"rtl":"ltr",this.refs={menu:sl(),navigation:sl(),scroll:sl(),search:sl(),searchInput:sl(),skinToneButton:sl(),skinToneRadio:sl()},this.initGrid(),this.props.stickySearch==!1&&this.props.searchPosition=="sticky"&&(console.warn("[EmojiMart] Deprecation warning: `stickySearch` has been renamed `searchPosition`."),this.props.searchPosition="static")}componentDidMount(){if(this.register(),this.shadowRoot=this.base.parentNode,this.props.autoFocus){const{searchInput:e}=this.refs;e.current&&e.current.focus()}}componentWillReceiveProps(e){this.nextState||(this.nextState={});for(const n in e)this.nextState[n]=e[n];clearTimeout(this.nextStateTimer),this.nextStateTimer=setTimeout(()=>{let n=!1;for(const r in this.nextState)this.props[r]=this.nextState[r],(r==="custom"||r==="categories")&&(n=!0);delete this.nextState;const i=this.getInitialState();if(n)return this.reset(i);this.setState(i)})}componentWillUnmount(){this.unregister()}async reset(e={}){await Vm(this.props),this.initGrid(),this.unobserve(),this.setState(e,()=>{this.observeCategories(),this.observeRows()})}register(){document.addEventListener("click",this.handleClickOutside),this.observe()}unregister(){var e;document.removeEventListener("click",this.handleClickOutside),(e=this.darkMedia)==null||e.removeEventListener("change",this.darkMediaCallback),this.unobserve()}observe(){this.observeCategories(),this.observeRows()}unobserve({except:e=[]}={}){Array.isArray(e)||(e=[e]);for(const n of this.observers)e.includes(n)||n.disconnect();this.observers=[].concat(e)}initGrid(){const{categories:e}=At;this.refs.categories=new Map;const n=At.categories.map(r=>r.id).join(",");this.navKey&&this.navKey!=n&&this.refs.scroll.current&&(this.refs.scroll.current.scrollTop=0),this.navKey=n,this.grid=[],this.grid.setsize=0;const i=(r,o)=>{const s=[];s.__categoryId=o.id,s.__index=r.length,this.grid.push(s);const a=this.grid.length-1,l=a%Ty.rowsPerRender?{}:sl();return l.index=a,l.posinset=this.grid.setsize+1,r.push(l),s};for(let r of e){const o=[];let s=i(o,r);for(let a of r.emojis)s.length==this.getPerLine()&&(s=i(o,r)),this.grid.setsize+=1,s.push(a);this.refs.categories.set(r.id,{root:sl(),rows:o})}}initTheme(e){if(e!="auto")return e;if(!this.darkMedia){if(this.darkMedia=matchMedia("(prefers-color-scheme: dark)"),this.darkMedia.media.match(/^not/))return"light";this.darkMedia.addEventListener("change",this.darkMediaCallback)}return this.darkMedia.matches?"dark":"light"}initDynamicPerLine(e=this.props){if(!e.dynamicWidth)return;const{element:n,emojiButtonSize:i}=e,r=()=>{const{width:s}=n.getBoundingClientRect();return Math.floor(s/i)},o=new ResizeObserver(()=>{this.unobserve({except:o}),this.setState({perLine:r()},()=>{this.initGrid(),this.forceUpdate(()=>{this.observeCategories(),this.observeRows()})})});return o.observe(n),this.observers.push(o),r()}getPerLine(){return this.state.perLine||this.props.perLine}getEmojiByPos([e,n]){const i=this.state.searchResults||this.grid,r=i[e]&&i[e][n];if(r)return _a.get(r)}observeCategories(){const e=this.refs.navigation.current;if(!e)return;const n=new Map,i=s=>{s!=e.state.categoryId&&e.setState({categoryId:s})},r={root:this.refs.scroll.current,threshold:[0,1]},o=new IntersectionObserver(s=>{for(const l of s){const u=l.target.dataset.id;n.set(u,l.intersectionRatio)}const a=[...n];for(const[l,u]of a)if(u){i(l);break}},r);for(const{root:s}of this.refs.categories.values())o.observe(s.current);this.observers.push(o)}observeRows(){const e={...this.state.visibleRows},n=new IntersectionObserver(i=>{for(const r of i){const o=parseInt(r.target.dataset.index);r.isIntersecting?e[o]=!0:delete e[o]}this.setState({visibleRows:e})},{root:this.refs.scroll.current,rootMargin:`${this.props.emojiButtonSize*(Ty.rowsPerRender+5)}px 0px ${this.props.emojiButtonSize*Ty.rowsPerRender}px`});for(const{rows:i}of this.refs.categories.values())for(const r of i)r.current&&n.observe(r.current);this.observers.push(n)}preventDefault(e){e.preventDefault()}unfocusSearch(){const e=this.refs.searchInput.current;e&&e.blur()}navigate({e,input:n,left:i,right:r,up:o,down:s}){const a=this.state.searchResults||this.grid;if(!a.length)return;let[l,u]=this.state.pos;const f=(()=>{if(l==0&&u==0&&!e.repeat&&(i||o))return null;if(l==-1)return!e.repeat&&(r||s)&&n.selectionStart==n.value.length?[0,0]:null;if(i||r){let d=a[l];const h=i?-1:1;if(u+=h,!d[u]){if(l+=h,d=a[l],!d)return l=i?0:a.length-1,u=i?0:a[l].length-1,[l,u];u=i?d.length-1:0}return[l,u]}if(o||s){l+=o?-1:1;const d=a[l];return d?(d[u]||(u=d.length-1),[l,u]):(l=o?0:a.length-1,u=o?0:a[l].length-1,[l,u])}})();if(f)e.preventDefault();else{this.state.pos[0]>-1&&this.setState({pos:[-1,-1]});return}this.setState({pos:f,keyboard:!0},()=>{this.scrollTo({row:f[0]})})}scrollTo({categoryId:e,row:n}){const i=this.state.searchResults||this.grid;if(!i.length)return;const r=this.refs.scroll.current,o=r.getBoundingClientRect();let s=0;if(n>=0&&(e=i[n].__categoryId),e&&(s=(this.refs[e]||this.refs.categories.get(e).root).current.getBoundingClientRect().top-(o.top-r.scrollTop)+1),n>=0)if(!n)s=0;else{const a=i[n].__index,l=s+a*this.props.emojiButtonSize,u=l+this.props.emojiButtonSize+this.props.emojiButtonSize*.88;if(lr.scrollTop+o.height)s=u-o.height;else return}this.ignoreMouse(),r.scrollTop=s}ignoreMouse(){this.mouseIsIgnored=!0,clearTimeout(this.ignoreMouseTimer),this.ignoreMouseTimer=setTimeout(()=>{delete this.mouseIsIgnored},100)}handleEmojiOver(e){this.mouseIsIgnored||this.state.showSkins||this.setState({pos:e||[-1,-1],keyboard:!1})}handleEmojiClick({e,emoji:n,pos:i}){if(this.props.onEmojiSelect&&(!n&&i&&(n=this.getEmojiByPos(i)),n)){const r=sSe(n,{skinIndex:this.state.skin-1});this.props.maxFrequentRows&&BF.add(r,this.props),this.props.onEmojiSelect(r,e)}}closeSkins(){this.state.showSkins&&(this.setState({showSkins:null,tempSkin:null}),this.base.removeEventListener("click",this.handleBaseClick),this.base.removeEventListener("keydown",this.handleBaseKeydown))}handleSkinMouseOver(e){this.setState({tempSkin:e})}handleSkinClick(e){this.ignoreMouse(),this.closeSkins(),this.setState({skin:e,tempSkin:null}),Ou.set("skin",e)}renderNav(){return me(ySe,{ref:this.refs.navigation,icons:this.props.icons,theme:this.state.theme,dir:this.dir,unfocused:!!this.state.searchResults,position:this.props.navPosition,onClick:this.handleCategoryClick},this.navKey)}renderPreview(){const e=this.getEmojiByPos(this.state.pos),n=this.state.searchResults&&!this.state.searchResults.length;return me("div",{id:"preview",class:"flex flex-middle",dir:this.dir,"data-position":this.props.previewPosition,children:[me("div",{class:"flex flex-middle flex-grow",children:[me("div",{class:"flex flex-auto flex-middle flex-center",style:{height:this.props.emojiButtonSize,fontSize:this.props.emojiButtonSize},children:me(EC,{emoji:e,id:n?this.props.noResultsEmoji||"cry":this.props.previewEmoji||(this.props.previewPosition=="top"?"point_down":"point_up"),set:this.props.set,size:this.props.emojiButtonSize,skin:this.state.tempSkin||this.state.skin,spritesheet:!0,getSpritesheetURL:this.props.getSpritesheetURL})}),me("div",{class:`margin-${this.dir[0]}`,children:e||n?me("div",{class:`padding-${this.dir[2]} align-${this.dir[0]}`,children:[me("div",{class:"preview-title ellipsis",children:e?e.name:Cr.search_no_results_1}),me("div",{class:"preview-subtitle ellipsis color-c",children:e?e.skins[0].shortcodes:Cr.search_no_results_2})]}):me("div",{class:"preview-placeholder color-c",children:Cr.pick})})]}),!e&&this.props.skinTonePosition=="preview"&&this.renderSkinToneButton()]})}renderEmojiButton(e,{pos:n,posinset:i,grid:r}){const o=this.props.emojiButtonSize,s=this.state.tempSkin||this.state.skin,l=(e.skins[s-1]||e.skins[0]).native,u=rSe(this.state.pos,n),f=n.concat(e.id).join("");return me(wSe,{selected:u,skin:s,size:o,children:me("button",{"aria-label":l,"aria-selected":u||void 0,"aria-posinset":i,"aria-setsize":r.setsize,"data-keyboard":this.state.keyboard,title:this.props.previewPosition=="none"?e.name:void 0,type:"button",class:"flex flex-center flex-middle",tabindex:"-1",onClick:d=>this.handleEmojiClick({e:d,emoji:e}),onMouseEnter:()=>this.handleEmojiOver(n),onMouseLeave:()=>this.handleEmojiOver(),style:{width:this.props.emojiButtonSize,height:this.props.emojiButtonSize,fontSize:this.props.emojiSize,lineHeight:0},children:[me("div",{"aria-hidden":"true",class:"background",style:{borderRadius:this.props.emojiButtonRadius,backgroundColor:this.props.emojiButtonColors?this.props.emojiButtonColors[(i-1)%this.props.emojiButtonColors.length]:void 0}}),me(EC,{emoji:e,set:this.props.set,size:this.props.emojiSize,skin:s,spritesheet:!0,getSpritesheetURL:this.props.getSpritesheetURL})]})},f)}renderSearch(){const e=this.props.previewPosition=="none"||this.props.skinTonePosition=="search";return me("div",{children:[me("div",{class:"spacer"}),me("div",{class:"flex flex-middle",children:[me("div",{class:"search relative flex-grow",children:[me("input",{type:"search",ref:this.refs.searchInput,placeholder:Cr.search,onClick:this.handleSearchClick,onInput:this.handleSearchInput,onKeyDown:this.handleSearchKeyDown,autoComplete:"off"}),me("span",{class:"icon loupe flex",children:Oy.search.loupe}),this.state.searchResults&&me("button",{title:"Clear","aria-label":"Clear",type:"button",class:"icon delete flex",onClick:this.clearSearch,onMouseDown:this.preventDefault,children:Oy.search.delete})]}),e&&this.renderSkinToneButton()]})]})}renderSearchResults(){const{searchResults:e}=this.state;return e?me("div",{class:"category",ref:this.refs.search,children:[me("div",{class:`sticky padding-small align-${this.dir[0]}`,children:Cr.categories.search}),me("div",{children:e.length?e.map((n,i)=>me("div",{class:"flex",children:n.map((r,o)=>this.renderEmojiButton(r,{pos:[i,o],posinset:i*this.props.perLine+o+1,grid:e}))})):me("div",{class:`padding-small align-${this.dir[0]}`,children:this.props.onAddCustomEmoji&&me("a",{onClick:this.props.onAddCustomEmoji,children:Cr.add_custom})})})]}):null}renderCategories(){const{categories:e}=At,n=!!this.state.searchResults,i=this.getPerLine();return me("div",{style:{visibility:n?"hidden":void 0,display:n?"none":void 0,height:"100%"},children:e.map(r=>{const{root:o,rows:s}=this.refs.categories.get(r.id);return me("div",{"data-id":r.target?r.target.id:r.id,class:"category",ref:o,children:[me("div",{class:`sticky padding-small align-${this.dir[0]}`,children:r.name||Cr.categories[r.id]}),me("div",{class:"relative",style:{height:s.length*this.props.emojiButtonSize},children:s.map((a,l)=>{const u=a.index-a.index%Ty.rowsPerRender,f=this.state.visibleRows[u],d="current"in a?a:void 0;if(!f&&!d)return null;const h=l*i,g=h+i,m=r.emojis.slice(h,g);return m.length{if(!y)return me("div",{style:{width:this.props.emojiButtonSize,height:this.props.emojiButtonSize}});const _=_a.get(y);return this.renderEmojiButton(_,{pos:[a.index,x],posinset:a.posinset+x,grid:this.grid})})},a.index)})})]})})})}renderSkinToneButton(){return this.props.skinTonePosition=="none"?null:me("div",{class:"flex flex-auto flex-center flex-middle",style:{position:"relative",width:this.props.emojiButtonSize,height:this.props.emojiButtonSize},children:me("button",{type:"button",ref:this.refs.skinToneButton,class:"skin-tone-button flex flex-auto flex-center flex-middle","aria-selected":this.state.showSkins?"":void 0,"aria-label":Cr.skins.choose,title:Cr.skins.choose,onClick:this.openSkins,style:{width:this.props.emojiSize,height:this.props.emojiSize},children:me("span",{class:`skin-tone skin-tone-${this.state.skin}`})})})}renderLiveRegion(){const e=this.getEmojiByPos(this.state.pos),n=e?e.name:"";return me("div",{"aria-live":"polite",class:"sr-only",children:n})}renderSkins(){const n=this.refs.skinToneButton.current.getBoundingClientRect(),i=this.base.getBoundingClientRect(),r={};return this.dir=="ltr"?r.right=i.right-n.right-3:r.left=n.left-i.left-3,this.props.previewPosition=="bottom"&&this.props.skinTonePosition=="preview"?r.bottom=i.bottom-n.top+6:(r.top=n.bottom-i.top+3,r.bottom="auto"),me("div",{ref:this.refs.menu,role:"radiogroup",dir:this.dir,"aria-label":Cr.skins.choose,class:"menu hidden","data-position":r.top?"top":"bottom",style:r,children:[...Array(6).keys()].map(o=>{const s=o+1,a=this.state.skin==s;return me("div",{children:[me("input",{type:"radio",name:"skin-tone",value:s,"aria-label":Cr.skins[s],ref:a?this.refs.skinToneRadio:null,defaultChecked:a,onChange:()=>this.handleSkinMouseOver(s),onKeyDown:l=>{(l.code=="Enter"||l.code=="Space"||l.code=="Tab")&&(l.preventDefault(),this.handleSkinClick(s))}}),me("button",{"aria-hidden":"true",tabindex:"-1",onClick:()=>this.handleSkinClick(s),onMouseEnter:()=>this.handleSkinMouseOver(s),onMouseLeave:()=>this.handleSkinMouseOver(),class:"option flex flex-grow flex-middle",children:[me("span",{class:`skin-tone skin-tone-${s}`}),me("span",{class:"margin-small-lr",children:Cr.skins[s]})]})]})})})}render(){const e=this.props.perLine*this.props.emojiButtonSize;return me("section",{id:"root",class:"flex flex-column",dir:this.dir,style:{width:this.props.dynamicWidth?"100%":`calc(${e}px + (var(--padding) + var(--sidebar-width)))`},"data-emoji-set":this.props.set,"data-theme":this.state.theme,"data-menu":this.state.showSkins?"":void 0,children:[this.props.previewPosition=="top"&&this.renderPreview(),this.props.navPosition=="top"&&this.renderNav(),this.props.searchPosition=="sticky"&&me("div",{class:"padding-lr",children:this.renderSearch()}),me("div",{ref:this.refs.scroll,class:"scroll flex-grow padding-lr",children:me("div",{style:{width:this.props.dynamicWidth?"100%":e,height:"100%"},children:[this.props.searchPosition=="static"&&this.renderSearch(),this.renderSearchResults(),this.renderCategories()]})}),this.props.navPosition=="bottom"&&this.renderNav(),this.props.previewPosition=="bottom"&&this.renderPreview(),this.state.showSkins&&this.renderSkins(),this.renderLiveRegion()]})}constructor(e){super(),us(this,"darkMediaCallback",()=>{this.props.theme=="auto"&&this.setState({theme:this.darkMedia.matches?"dark":"light"})}),us(this,"handleClickOutside",n=>{const{element:i}=this.props;n.target!=i&&(this.state.showSkins&&this.closeSkins(),this.props.onClickOutside&&this.props.onClickOutside(n))}),us(this,"handleBaseClick",n=>{this.state.showSkins&&(n.target.closest(".menu")||(n.preventDefault(),n.stopImmediatePropagation(),this.closeSkins()))}),us(this,"handleBaseKeydown",n=>{this.state.showSkins&&n.key=="Escape"&&(n.preventDefault(),n.stopImmediatePropagation(),this.closeSkins())}),us(this,"handleSearchClick",()=>{this.getEmojiByPos(this.state.pos)&&this.setState({pos:[-1,-1]})}),us(this,"handleSearchInput",async()=>{const n=this.refs.searchInput.current;if(!n)return;const{value:i}=n,r=await _a.search(i),o=()=>{this.refs.scroll.current&&(this.refs.scroll.current.scrollTop=0)};if(!r)return this.setState({searchResults:r,pos:[-1,-1]},o);const s=n.selectionStart==n.value.length?[0,0]:[-1,-1],a=[];a.setsize=r.length;let l=null;for(let u of r)(!a.length||l.length==this.getPerLine())&&(l=[],l.__categoryId="search",l.__index=a.length,a.push(l)),l.push(u);this.ignoreMouse(),this.setState({searchResults:a,pos:s},o)}),us(this,"handleSearchKeyDown",n=>{const i=n.currentTarget;switch(n.stopImmediatePropagation(),n.key){case"ArrowLeft":this.navigate({e:n,input:i,left:!0});break;case"ArrowRight":this.navigate({e:n,input:i,right:!0});break;case"ArrowUp":this.navigate({e:n,input:i,up:!0});break;case"ArrowDown":this.navigate({e:n,input:i,down:!0});break;case"Enter":n.preventDefault(),this.handleEmojiClick({e:n,pos:this.state.pos});break;case"Escape":n.preventDefault(),this.state.searchResults?this.clearSearch():this.unfocusSearch();break}}),us(this,"clearSearch",()=>{const n=this.refs.searchInput.current;n&&(n.value="",n.focus(),this.handleSearchInput())}),us(this,"handleCategoryClick",({category:n,i})=>{this.scrollTo(i==0?{row:-1}:{categoryId:n.id})}),us(this,"openSkins",n=>{const{currentTarget:i}=n,r=i.getBoundingClientRect();this.setState({showSkins:r},async()=>{await oSe(2);const o=this.refs.menu.current;o&&(o.classList.remove("hidden"),this.refs.skinToneRadio.current.focus(),this.base.addEventListener("click",this.handleBaseClick,!0),this.base.addEventListener("keydown",this.handleBaseKeydown,!0))})}),this.observers=[],this.state={pos:[-1,-1],perLine:this.initDynamicPerLine(e),visibleRows:{0:!0},...this.getInitialState(e)}}}class NC extends lSe{async connectedCallback(){const e=ZF(this.props,al,this);e.element=this,e.ref=n=>{this.component=n},await Vm(e),!this.disconnected&&jF(me(xSe,{...e}),this.shadowRoot)}constructor(e){super(e,{styles:wF(hz)})}}us(NC,"Props",al),typeof customElements<"u"&&!customElements.get("em-emoji-picker")&&customElements.define("em-emoji-picker",NC);var hz={};hz=`:host { + width: min-content; + height: 435px; + min-height: 230px; + border-radius: var(--border-radius); + box-shadow: var(--shadow); + --border-radius: 10px; + --category-icon-size: 18px; + --font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif; + --font-size: 15px; + --preview-placeholder-size: 21px; + --preview-title-size: 1.1em; + --preview-subtitle-size: .9em; + --shadow-color: 0deg 0% 0%; + --shadow: .3px .5px 2.7px hsl(var(--shadow-color) / .14), .4px .8px 1px -3.2px hsl(var(--shadow-color) / .14), 1px 2px 2.5px -4.5px hsl(var(--shadow-color) / .14); + display: flex; +} + +[data-theme="light"] { + --em-rgb-color: var(--rgb-color, 34, 36, 39); + --em-rgb-accent: var(--rgb-accent, 34, 102, 237); + --em-rgb-background: var(--rgb-background, 255, 255, 255); + --em-rgb-input: var(--rgb-input, 255, 255, 255); + --em-color-border: var(--color-border, rgba(0, 0, 0, .05)); + --em-color-border-over: var(--color-border-over, rgba(0, 0, 0, .1)); +} + +[data-theme="dark"] { + --em-rgb-color: var(--rgb-color, 222, 222, 221); + --em-rgb-accent: var(--rgb-accent, 58, 130, 247); + --em-rgb-background: var(--rgb-background, 21, 22, 23); + --em-rgb-input: var(--rgb-input, 0, 0, 0); + --em-color-border: var(--color-border, rgba(255, 255, 255, .1)); + --em-color-border-over: var(--color-border-over, rgba(255, 255, 255, .2)); +} + +#root { + --color-a: rgb(var(--em-rgb-color)); + --color-b: rgba(var(--em-rgb-color), .65); + --color-c: rgba(var(--em-rgb-color), .45); + --padding: 12px; + --padding-small: calc(var(--padding) / 2); + --sidebar-width: 16px; + --duration: 225ms; + --duration-fast: 125ms; + --duration-instant: 50ms; + --easing: cubic-bezier(.4, 0, .2, 1); + width: 100%; + text-align: left; + border-radius: var(--border-radius); + background-color: rgb(var(--em-rgb-background)); + position: relative; +} + +@media (prefers-reduced-motion) { + #root { + --duration: 0; + --duration-fast: 0; + --duration-instant: 0; + } +} + +#root[data-menu] button { + cursor: auto; +} + +#root[data-menu] .menu button { + cursor: pointer; +} + +:host, #root, input, button { + color: rgb(var(--em-rgb-color)); + font-family: var(--font-family); + font-size: var(--font-size); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + line-height: normal; +} + +*, :before, :after { + box-sizing: border-box; + min-width: 0; + margin: 0; + padding: 0; +} + +.relative { + position: relative; +} + +.flex { + display: flex; +} + +.flex-auto { + flex: none; +} + +.flex-center { + justify-content: center; +} + +.flex-column { + flex-direction: column; +} + +.flex-grow { + flex: auto; +} + +.flex-middle { + align-items: center; +} + +.flex-wrap { + flex-wrap: wrap; +} + +.padding { + padding: var(--padding); +} + +.padding-t { + padding-top: var(--padding); +} + +.padding-lr { + padding-left: var(--padding); + padding-right: var(--padding); +} + +.padding-r { + padding-right: var(--padding); +} + +.padding-small { + padding: var(--padding-small); +} + +.padding-small-b { + padding-bottom: var(--padding-small); +} + +.padding-small-lr { + padding-left: var(--padding-small); + padding-right: var(--padding-small); +} + +.margin { + margin: var(--padding); +} + +.margin-r { + margin-right: var(--padding); +} + +.margin-l { + margin-left: var(--padding); +} + +.margin-small-l { + margin-left: var(--padding-small); +} + +.margin-small-lr { + margin-left: var(--padding-small); + margin-right: var(--padding-small); +} + +.align-l { + text-align: left; +} + +.align-r { + text-align: right; +} + +.color-a { + color: var(--color-a); +} + +.color-b { + color: var(--color-b); +} + +.color-c { + color: var(--color-c); +} + +.ellipsis { + white-space: nowrap; + max-width: 100%; + width: auto; + text-overflow: ellipsis; + overflow: hidden; +} + +.sr-only { + width: 1px; + height: 1px; + position: absolute; + top: auto; + left: -10000px; + overflow: hidden; +} + +a { + cursor: pointer; + color: rgb(var(--em-rgb-accent)); +} + +a:hover { + text-decoration: underline; +} + +.spacer { + height: 10px; +} + +[dir="rtl"] .scroll { + padding-left: 0; + padding-right: var(--padding); +} + +.scroll { + padding-right: 0; + overflow-x: hidden; + overflow-y: auto; +} + +.scroll::-webkit-scrollbar { + width: var(--sidebar-width); + height: var(--sidebar-width); +} + +.scroll::-webkit-scrollbar-track { + border: 0; +} + +.scroll::-webkit-scrollbar-button { + width: 0; + height: 0; + display: none; +} + +.scroll::-webkit-scrollbar-corner { + background-color: rgba(0, 0, 0, 0); +} + +.scroll::-webkit-scrollbar-thumb { + min-height: 20%; + min-height: 65px; + border: 4px solid rgb(var(--em-rgb-background)); + border-radius: 8px; +} + +.scroll::-webkit-scrollbar-thumb:hover { + background-color: var(--em-color-border-over) !important; +} + +.scroll:hover::-webkit-scrollbar-thumb { + background-color: var(--em-color-border); +} + +.sticky { + z-index: 1; + background-color: rgba(var(--em-rgb-background), .9); + -webkit-backdrop-filter: blur(4px); + backdrop-filter: blur(4px); + font-weight: 500; + position: sticky; + top: -1px; +} + +[dir="rtl"] .search input[type="search"] { + padding: 10px 2.2em 10px 2em; +} + +[dir="rtl"] .search .loupe { + left: auto; + right: .7em; +} + +[dir="rtl"] .search .delete { + left: .7em; + right: auto; +} + +.search { + z-index: 2; + position: relative; +} + +.search input, .search button { + font-size: calc(var(--font-size) - 1px); +} + +.search input[type="search"] { + width: 100%; + background-color: var(--em-color-border); + transition-duration: var(--duration); + transition-property: background-color, box-shadow; + transition-timing-function: var(--easing); + border: 0; + border-radius: 10px; + outline: 0; + padding: 10px 2em 10px 2.2em; + display: block; +} + +.search input[type="search"]::-ms-input-placeholder { + color: inherit; + opacity: .6; +} + +.search input[type="search"]::placeholder { + color: inherit; + opacity: .6; +} + +.search input[type="search"], .search input[type="search"]::-webkit-search-decoration, .search input[type="search"]::-webkit-search-cancel-button, .search input[type="search"]::-webkit-search-results-button, .search input[type="search"]::-webkit-search-results-decoration { + -webkit-appearance: none; + -ms-appearance: none; + appearance: none; +} + +.search input[type="search"]:focus { + background-color: rgb(var(--em-rgb-input)); + box-shadow: inset 0 0 0 1px rgb(var(--em-rgb-accent)), 0 1px 3px rgba(65, 69, 73, .2); +} + +.search .icon { + z-index: 1; + color: rgba(var(--em-rgb-color), .7); + position: absolute; + top: 50%; + transform: translateY(-50%); +} + +.search .loupe { + pointer-events: none; + left: .7em; +} + +.search .delete { + right: .7em; +} + +svg { + fill: currentColor; + width: 1em; + height: 1em; +} + +button { + -webkit-appearance: none; + -ms-appearance: none; + appearance: none; + cursor: pointer; + color: currentColor; + background-color: rgba(0, 0, 0, 0); + border: 0; +} + +#nav { + z-index: 2; + padding-top: 12px; + padding-bottom: 12px; + padding-right: var(--sidebar-width); + position: relative; +} + +#nav button { + color: var(--color-b); + transition: color var(--duration) var(--easing); +} + +#nav button:hover { + color: var(--color-a); +} + +#nav svg, #nav img { + width: var(--category-icon-size); + height: var(--category-icon-size); +} + +#nav[dir="rtl"] .bar { + left: auto; + right: 0; +} + +#nav .bar { + width: 100%; + height: 3px; + background-color: rgb(var(--em-rgb-accent)); + transition: transform var(--duration) var(--easing); + border-radius: 3px 3px 0 0; + position: absolute; + bottom: -12px; + left: 0; +} + +#nav button[aria-selected] { + color: rgb(var(--em-rgb-accent)); +} + +#preview { + z-index: 2; + padding: calc(var(--padding) + 4px) var(--padding); + padding-right: var(--sidebar-width); + position: relative; +} + +#preview .preview-placeholder { + font-size: var(--preview-placeholder-size); +} + +#preview .preview-title { + font-size: var(--preview-title-size); +} + +#preview .preview-subtitle { + font-size: var(--preview-subtitle-size); +} + +#nav:before, #preview:before { + content: ""; + height: 2px; + position: absolute; + left: 0; + right: 0; +} + +#nav[data-position="top"]:before, #preview[data-position="top"]:before { + background: linear-gradient(to bottom, var(--em-color-border), transparent); + top: 100%; +} + +#nav[data-position="bottom"]:before, #preview[data-position="bottom"]:before { + background: linear-gradient(to top, var(--em-color-border), transparent); + bottom: 100%; +} + +.category:last-child { + min-height: calc(100% + 1px); +} + +.category button { + font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, sans-serif; + position: relative; +} + +.category button > * { + position: relative; +} + +.category button .background { + opacity: 0; + background-color: var(--em-color-border); + transition: opacity var(--duration-fast) var(--easing) var(--duration-instant); + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; +} + +.category button:hover .background { + transition-duration: var(--duration-instant); + transition-delay: 0s; +} + +.category button[aria-selected] .background { + opacity: 1; +} + +.category button[data-keyboard] .background { + transition: none; +} + +.row { + width: 100%; + position: absolute; + top: 0; + left: 0; +} + +.skin-tone-button { + border: 1px solid rgba(0, 0, 0, 0); + border-radius: 100%; +} + +.skin-tone-button:hover { + border-color: var(--em-color-border); +} + +.skin-tone-button:active .skin-tone { + transform: scale(.85) !important; +} + +.skin-tone-button .skin-tone { + transition: transform var(--duration) var(--easing); +} + +.skin-tone-button[aria-selected] { + background-color: var(--em-color-border); + border-top-color: rgba(0, 0, 0, .05); + border-bottom-color: rgba(0, 0, 0, 0); + border-left-width: 0; + border-right-width: 0; +} + +.skin-tone-button[aria-selected] .skin-tone { + transform: scale(.9); +} + +.menu { + z-index: 2; + white-space: nowrap; + border: 1px solid var(--em-color-border); + background-color: rgba(var(--em-rgb-background), .9); + -webkit-backdrop-filter: blur(4px); + backdrop-filter: blur(4px); + transition-property: opacity, transform; + transition-duration: var(--duration); + transition-timing-function: var(--easing); + border-radius: 10px; + padding: 4px; + position: absolute; + box-shadow: 1px 1px 5px rgba(0, 0, 0, .05); +} + +.menu.hidden { + opacity: 0; +} + +.menu[data-position="bottom"] { + transform-origin: 100% 100%; +} + +.menu[data-position="bottom"].hidden { + transform: scale(.9)rotate(-3deg)translateY(5%); +} + +.menu[data-position="top"] { + transform-origin: 100% 0; +} + +.menu[data-position="top"].hidden { + transform: scale(.9)rotate(3deg)translateY(-5%); +} + +.menu input[type="radio"] { + clip: rect(0 0 0 0); + width: 1px; + height: 1px; + border: 0; + margin: 0; + padding: 0; + position: absolute; + overflow: hidden; +} + +.menu input[type="radio"]:checked + .option { + box-shadow: 0 0 0 2px rgb(var(--em-rgb-accent)); +} + +.option { + width: 100%; + border-radius: 6px; + padding: 4px 6px; +} + +.option:hover { + color: #fff; + background-color: rgb(var(--em-rgb-accent)); +} + +.skin-tone { + width: 16px; + height: 16px; + border-radius: 100%; + display: inline-block; + position: relative; + overflow: hidden; +} + +.skin-tone:after { + content: ""; + mix-blend-mode: overlay; + background: linear-gradient(rgba(255, 255, 255, .2), rgba(0, 0, 0, 0)); + border: 1px solid rgba(0, 0, 0, .8); + border-radius: 100%; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + box-shadow: inset 0 -2px 3px #000, inset 0 1px 2px #fff; +} + +.skin-tone-1 { + background-color: #ffc93a; +} + +.skin-tone-2 { + background-color: #ffdab7; +} + +.skin-tone-3 { + background-color: #e7b98f; +} + +.skin-tone-4 { + background-color: #c88c61; +} + +.skin-tone-5 { + background-color: #a46134; +} + +.skin-tone-6 { + background-color: #5d4437; +} + +[data-index] { + justify-content: space-between; +} + +[data-emoji-set="twitter"] .skin-tone:after { + box-shadow: none; + border-color: rgba(0, 0, 0, .5); +} + +[data-emoji-set="twitter"] .skin-tone-1 { + background-color: #fade72; +} + +[data-emoji-set="twitter"] .skin-tone-2 { + background-color: #f3dfd0; +} + +[data-emoji-set="twitter"] .skin-tone-3 { + background-color: #eed3a8; +} + +[data-emoji-set="twitter"] .skin-tone-4 { + background-color: #cfad8d; +} + +[data-emoji-set="twitter"] .skin-tone-5 { + background-color: #a8805d; +} + +[data-emoji-set="twitter"] .skin-tone-6 { + background-color: #765542; +} + +[data-emoji-set="google"] .skin-tone:after { + box-shadow: inset 0 0 2px 2px rgba(0, 0, 0, .4); +} + +[data-emoji-set="google"] .skin-tone-1 { + background-color: #f5c748; +} + +[data-emoji-set="google"] .skin-tone-2 { + background-color: #f1d5aa; +} + +[data-emoji-set="google"] .skin-tone-3 { + background-color: #d4b48d; +} + +[data-emoji-set="google"] .skin-tone-4 { + background-color: #aa876b; +} + +[data-emoji-set="google"] .skin-tone-5 { + background-color: #916544; +} + +[data-emoji-set="google"] .skin-tone-6 { + background-color: #61493f; +} + +[data-emoji-set="facebook"] .skin-tone:after { + border-color: rgba(0, 0, 0, .4); + box-shadow: inset 0 -2px 3px #000, inset 0 1px 4px #fff; +} + +[data-emoji-set="facebook"] .skin-tone-1 { + background-color: #f5c748; +} + +[data-emoji-set="facebook"] .skin-tone-2 { + background-color: #f1d5aa; +} + +[data-emoji-set="facebook"] .skin-tone-3 { + background-color: #d4b48d; +} + +[data-emoji-set="facebook"] .skin-tone-4 { + background-color: #aa876b; +} + +[data-emoji-set="facebook"] .skin-tone-5 { + background-color: #916544; +} + +[data-emoji-set="facebook"] .skin-tone-6 { + background-color: #61493f; +} + +`,Vm({data:hF});const _Se=function({index:t,isSelected:e,onClick:n,onMouseEnter:i,emoji:r}){const o=T.useRef(null);return r.ref=o,k.jsxs("li",{ref:r.ref,"aria-selected":e,className:`mb-0 flex cursor-pointer items-center gap-2 whitespace-nowrap rounded-md px-2 py-1 font-sans text-sm leading-[1.65] tracking-wide text-grey-800 dark:text-grey-200 ${e?"bg-grey-100 text-grey-900 dark:bg-grey-900 dark:text-white":""}`,"data-testid":"emoji-option-"+t,id:"emoji-option-"+t,role:"option",tabIndex:-1,onClick:n,onMouseEnter:i,children:[k.jsx("span",{className:"font-serif text-lg",children:r.skins[0].native}),k.jsx("span",{className:"truncate",children:r.id})]},r.id)};function $y(){const[t]=Oe.useLexicalComposerContext(),[e,n]=T.useState(null),[i,r]=T.useState(null),o=SOe(":",{minLength:1}),s=()=>t.getEditorState().read(()=>{const d=A.$getSelection().anchor.getNode();return!!(d&&A.$isTextNode(d)&&d.hasFormat("code"))});T.useEffect(()=>ut.mergeRegister(t.registerCommand(A.KEY_DOWN_COMMAND,async f=>{if(!e)return!1;if(f.key===":"){if(s()===!0)return!1;const d=await _a.search(e);if(d.length===0)return;if((d==null?void 0:d[0].id)===e)return a(d[0]),f.preventDefault(),!0}return!1},A.COMMAND_PRIORITY_HIGH)));const a=T.useCallback(f=>{t.update(()=>{const d=A.$getSelection();if(!A.$isRangeSelection(d)||f===null)return;const h=d.anchor.getNode(),g=f.id.length+1;h.spliceText(d.anchor.offset-g,g,f.skins[0].native,!0).setFormat(d.format),ui("Emoji Inserted",{method:"completed"})})},[t]);T.useEffect(()=>{if(!e){r(null);return}async function f(){let d=[];[")","-)"].includes(e)?d=await _a.search("smile"):["(","-("].includes(e)?d=await _a.search("frown"):d=await _a.search(e),r(d)}f()},[e]);const l=T.useCallback((f,d,h)=>{t.update(()=>{const g=A.$getSelection();if(!A.$isRangeSelection(g)||f===null)return;d&&d.remove();const m=A.$createTextNode(f.skins[0].native);m.setFormat(g.format),g.insertNodes([m]),h(),ui("Emoji Inserted",{method:"selected"})})},[t]);T.useEffect(()=>{const f=d=>{d.key==="Escape"&&r(null)};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)});function u(){return{marginTop:`${window.getSelection().getRangeAt(0).getBoundingClientRect().height}px`}}return k.jsx(jOe.LexicalTypeaheadMenuPlugin,{menuRenderFn:(f,{selectedIndex:d,selectOptionAndCleanUp:h,setHighlightedIndex:g})=>f.current===null||!i||i.length===0?null:k.jsx(Gc,{className:"w-[240px]",to:f.current,children:k.jsx("ul",{className:"relative z-10 max-h-[214px] select-none scroll-p-2 list-none overflow-y-auto rounded-md bg-white p-1 shadow-md dark:bg-grey-950","data-testid":"emoji-menu",style:u(),children:i.map((m,y)=>k.jsx("div",{children:k.jsx(_Se,{emoji:m,index:y,isSelected:d===y,onClick:x=>{g(y),h(m),x.stopPropagation(),x.preventDefault()},onMouseEnter:()=>{g(y)}})},m.id))})}),options:i,triggerFn:o,onQueryChange:n,onSelectOption:l})}const OSe=({text:t="Type here"})=>k.jsx("div",{className:"pointer-events-none absolute left-0 top-0 !m-0 min-w-full cursor-text font-sans text-sm font-normal leading-[24px] tracking-wide text-grey-500 dark:text-grey-800",children:t});function SSe({parentEditor:t}){const[e]=Oe.useLexicalComposerContext(),{setCaptionHasFocus:n,captionHasFocus:i,nodeKey:r,isSelected:o}=T.useContext(rn),s=T.useCallback(a=>{o&&(a.target.matches("input, textarea")||!i&&a.key.length===1&&!a.ctrlKey&&!a.metaKey&&!a.altKey&&e.focus())},[e,i,o]);return T.useEffect(()=>(document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}),[s,e]),T.useEffect(()=>ut.mergeRegister(e.registerCommand(A.FOCUS_COMMAND,()=>(n(!0),!1),A.COMMAND_PRIORITY_LOW),e.registerCommand(A.BLUR_COMMAND,()=>(n(!1),!1),A.COMMAND_PRIORITY_LOW),e.registerCommand(A.KEY_ENTER_COMMAND,a=>document.querySelector("#typeahead-menu")||a.shiftKey?!1:(a._fromNested=!0,e._parentEditor.dispatchCommand(A.KEY_ENTER_COMMAND,a),!0),A.COMMAND_PRIORITY_LOW),e.registerCommand(A.KEY_ARROW_DOWN_COMMAND,a=>document.querySelector("#typeahead-menu")?!1:(a._fromCaptionEditor=!0,e._parentEditor.dispatchCommand(A.KEY_ARROW_DOWN_COMMAND,a),!0),A.COMMAND_PRIORITY_HIGH),e.registerCommand(A.KEY_ARROW_UP_COMMAND,a=>document.querySelector("#typeahead-menu")?!1:(a._fromCaptionEditor=!0,e._parentEditor.dispatchCommand(A.KEY_ARROW_UP_COMMAND,a),!0),A.COMMAND_PRIORITY_HIGH)),[e,n,t,r]),null}const CSe=({paragraphs:t=1,captionEditor:e,captionEditorInitialState:n,placeholderText:i,className:r="koenig-lexical-caption"})=>{const[o]=Oe.useLexicalComposerContext();return k.jsx(ZT,{initialEditor:e,initialEditorState:n,initialNodes:Qi,children:k.jsxs(D0,{className:r,markdownTransformers:sE,placeholder:k.jsx(OSe,{text:i}),children:[k.jsx(SSe,{parentEditor:o}),k.jsx(O1,{paragraphs:t}),k.jsx($y,{})]})})};function My({value:t,onChange:e,...n}){const i=r=>{e(r)};return k.jsx("input",{defaultValue:t,onChange:i,...n})}var Su={},Wr=A;function AC(t,e=!0){return t?!1:(t=pz(),e&&(t=t.trim()),t==="")}function pz(){return Wr.$getRoot().getTextContent()}function gz(t){if(!AC(t,!1))return!1;t=Wr.$getRoot().getChildren();let e=t.length;if(1gz(t)},Su.$findTextIntersectionFromCharacters=function(t,e){var n=t.getFirstChild();t=0;e:for(;n!==null;){if(Wr.$isElementNode(n)){var i=n.getFirstChild();if(i!==null){n=i;continue}}else if(Wr.$isTextNode(n)){if(i=n.getTextContentSize(),t+i>e)return{node:n,offset:e-t};t+=i}if(i=n.getNextSibling(),i!==null)n=i;else{for(n=n.getParent();n!==null;){if(i=n.getNextSibling(),i!==null){n=i;continue e}n=n.getParent()}break}}return null},Su.$isRootTextContentEmpty=AC,Su.$isRootTextContentEmptyCurry=function(t,e){return()=>AC(t,e)},Su.$rootTextContent=pz,Su.registerLexicalTextEntity=function(t,e,n,i){let r=s=>{const a=Wr.$createTextNode(s.getTextContent());a.setFormat(s.getFormat()),s.replace(a)},o=t.registerNodeTransform(Wr.TextNode,s=>{if(s.isSimpleText()){var a=s.getPreviousSibling(),l=s.getTextContent(),u=s;if(Wr.$isTextNode(a)){var f=a.getTextContent(),d=e(f+l);if(a instanceof n){if(d===null||a.getLatest().__mode!==0){r(a);return}if(d=d.end-f.length,0{var a=s.getTextContent();const l=e(a);l===null||l.start!==0?r(s):a.length>l.end?s.splitText(l.end):(a=s.getPreviousSibling(),Wr.$isTextNode(a)&&a.isTextEntity()&&(r(a),r(s)),a=s.getNextSibling(),Wr.$isTextNode(a)&&a.isTextEntity()&&(r(a),s instanceof n&&r(s)))}),[o,t]};var cs=Su;function fs(t){return(t._pendingEditorState||t.getEditorState()).read(cs.$canShowPlaceholderCurry(!1))}function ESe({captionEditor:t,captionEditorInitialState:e,placeholder:n,dataTestId:i}){return k.jsx("div",{className:"m-0 w-full px-9 text-center","data-testid":i,"data-kg-allow-clickthrough":!0,children:k.jsx(CSe,{captionEditor:t,captionEditorInitialState:e,placeholderText:n})})}function TSe({value:t,placeholder:e,onChange:n,readOnly:i,dataTestId:r,autoFocus:o=!0}){const s=a=>{n==null||n(a.target.value)};return k.jsx(My,{autoFocus:o,className:"not-kg-prose w-full bg-transparent px-9 text-center font-sans text-sm font-normal leading-[1.625] tracking-wide text-grey-800 placeholder:text-grey-500 dark:text-grey-500 dark:placeholder:text-grey-800","data-testid":r,placeholder:e,readOnly:i,value:t,"data-koenig-dnd-disabled":!0,onChange:s})}function $Se({isEditingAlt:t,onClick:e}){return k.jsx("button",{className:`absolute bottom-0 right-0 m-2 cursor-pointer rounded-md border px-1 font-sans text-[1.3rem] font-normal leading-7 tracking-wide transition-all duration-100 ${t?"border-green bg-green text-white":"border-grey text-grey"} `,"data-testid":"alt-toggle-button",name:"alt-toggle-button",type:"button",onClick:e,children:"Alt"})}function dh({altText:t,altTextPlaceholder:e,setAltText:n,captionEditor:i,captionEditorInitialState:r,captionPlaceholder:o,isSelected:s,readOnly:a,dataTestId:l}){const[u,f]=T.useState(!1),d=m=>{m.stopPropagation(),f(!u)};T.useEffect(()=>{s||f(!1)},[s,f]);const h=fs(i),g=n&&s;return(s||!h)&&k.jsxs("figcaption",{className:"flex min-h-[40px] w-full p-2",children:[u?k.jsx(TSe,{dataTestId:l,placeholder:e,readOnly:a,value:t,onChange:n}):k.jsx(ESe,{captionEditor:i,captionEditorInitialState:r,dataTestId:l,placeholder:o}),g&&k.jsx($Se,{isEditingAlt:u,onClick:d})]})}class Ny{constructor(e,n,i,r,o,s,a,l,u,f=0,d){this.p=e,this.stack=n,this.state=i,this.reducePos=r,this.pos=o,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=u,this.lookAhead=f,this.parent=d}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,i=0){let r=e.parser.context;return new Ny(e,[],n,i,i,0,[],0,r?new mz(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let i=e>>19,r=e&65535,{parser:o}=this.p,s=o.dynamicPrecedence(r);if(s&&(this.score+=s),i==0){this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,n,i,r=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==i)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,n,i,r);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0)for(;s>0&&this.buffer[s-2]>i;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,r>4&&(r-=4);this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=i,this.buffer[s+3]=r}}shift(e,n,i,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(n,i),n<=this.p.parser.maxNode&&this.buffer.push(n,i,r,4);else{let o=e,{parser:s}=this.p;(r>this.pos||n<=s.maxNode)&&(this.pos=r,s.stateFlag(o,1)||(this.reducePos=r)),this.pushState(o,i),this.shiftContext(n,i),n<=s.maxNode&&this.buffer.push(n,i,r,4)}}apply(e,n,i,r){e&65536?this.reduce(e):this.shift(e,n,i,r)}useNode(e,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(n,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let i=e.buffer.slice(n),r=e.bufferBase+n;for(;e&&r==e.bufferBase;)e=e.parent;return new Ny(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,i?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new MSe(this);;){let i=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(i==0)return!1;if(!(i&65536))return!0;n.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let r=[];for(let o=0,s;ol&1&&a==s)||r.push(n[o],s)}n=r}let i=[];for(let r=0;r>19,r=n&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],r,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],i=(r,o)=>{if(!n.includes(r))return n.push(r),e.allActions(r,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-o;if(a>1){let l=s&65535,u=this.stack.length-a*3;if(u>=0&&e.getGoto(this.stack[u],l,!1)>=0)return a<<19|65536|l}}else{let a=i(s,o+1);if(a!=null)return a}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class mz{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class MSe{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class Ay{constructor(e,n,i){this.stack=e,this.pos=n,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new Ay(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Ay(this.stack,this.pos,this.index)}}function Xm(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let i=0,r=0;i=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),o+=l,a)break;o*=46}n?n[r++]=o:n=new e(o)}return n}class Py{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const vz=new Py;class NSe{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=vz,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let i=this.range,r=this.rangeIndex,o=this.pos+e;for(;oi.to:o>=i.to;){if(r==this.ranges.length-1)return null;let s=this.ranges[++r];o+=s.from-i.to,i=s}return o}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,i,r;if(n>=0&&n=this.chunk2Pos&&ia.to&&(this.chunk2=this.chunk2.slice(0,a.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(e,n=0){let i=n?this.resolveOffset(n,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=vz,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let i="";for(let r of this.ranges){if(r.from>=n)break;r.to>e&&(i+=this.input.read(Math.max(r.from,e),Math.min(r.to,n)))}return i}}class hh{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:i}=n.p;bz(this.data,e,n,this.id,i.data,i.tokenPrecTable)}}hh.prototype.contextual=hh.prototype.fallback=hh.prototype.extend=!1;class Dy{constructor(e,n,i){this.precTable=n,this.elseToken=i,this.data=typeof e=="string"?Xm(e):e}token(e,n){let i=e.pos,r=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(bz(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(o||r++,s==null)break;e.reset(s,e.token)}r&&(e.reset(i,e.token),e.acceptToken(this.elseToken,r))}}Dy.prototype.contextual=hh.prototype.fallback=hh.prototype.extend=!1;class Ls{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function bz(t,e,n,i,r,o){let s=0,a=1<0){let m=t[g];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||ASe(m,e.token.value,r,o))){e.acceptToken(m);break}}let f=e.next,d=0,h=t[s+2];if(e.next<0&&h>d&&t[u+h*3-3]==65535){s=t[u+h*3-1];continue e}for(;d>1,m=u+g+(g<<1),y=t[m],x=t[m+1]||65536;if(f=x)d=g+1;else{s=t[m+2],e.advance();continue e}}break}}function kz(t,e,n){for(let i=e,r;(r=t[i])!=65535;i++)if(r==n)return i-e;return-1}function ASe(t,e,n,i){let r=kz(n,i,e);return r<0||kz(n,i,t)e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:t.length}}class PSe{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?yz(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?yz(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=s,null;if(o instanceof Fn){if(s==e){if(s=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class DSe{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Py)}getActions(e){let n=0,i=null,{parser:r}=e.p,{tokenizers:o}=r,s=r.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let u=0;ud.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let h=n;if(d.extended>-1&&(n=this.addActions(e,d.extended,d.end,n)),n=this.addActions(e,d.value,d.end,n),!f.extend&&(i=d,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!i&&e.pos==this.stream.end&&(i=new Py,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,n=this.addActions(e,i.value,i.end,n)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Py,{pos:i,p:r}=e;return n.start=i,n.end=Math.min(i+1,r.stream.end),n.value=i==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(e,n,i){let r=this.stream.clipPos(i.pos);if(n.token(this.stream.reset(r,e),i),e.value>-1){let{parser:o}=i.p;for(let s=0;s=0&&i.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,n,i,r){for(let o=0;oe.bufferLength*4?new PSe(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,i=this.stacks=[],r,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;sn)i.push(a);else{if(this.advanceStack(a,i,e))continue;{r||(r=[],o=[]),r.push(a);let l=this.tokens.getMainToken(a);o.push(l.value,l.end)}}break}}if(!i.length){let s=r&&RSe(r);if(s)return Po&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Po&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&r){let s=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,i);if(s)return Po&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(i.length>s)for(i.sort((a,l)=>l.score-a.score);i.length>s;)i.pop();i.some(a=>a.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let s=0;s500&&u.buffer.length>500)if((a.score-u.score||a.buffer.length-u.buffer.length)>0)i.splice(l--,1);else{i.splice(s--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let s=1;s ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,f=u?e.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let h=this.parser.nodeSet.types[d.type.id]==d.type?o.getGoto(e.state,d.type.id):-1;if(h>-1&&d.length&&(!u||(d.prop(Et.contextHash)||0)==f))return e.useNode(d,h),Po&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof Fn)||d.children.length==0||d.positions[0]>0)break;let g=d.children[0];if(g instanceof Fn&&d.positions[0]==0)d=g;else break}}let a=o.stateSlot(e.state,4);if(a>0)return e.reduce(a),Po&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let u=0;ur?n.push(m):i.push(m)}return!1}advanceFully(e,n){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return wz(e,n),!0}}runRecovery(e,n,i){let r=null,o=!1;for(let s=0;s ":"";if(a.deadEnd&&(o||(o=!0,a.restart(),Po&&console.log(f+this.stackID(a)+" (restarted)"),this.advanceFully(a,i))))continue;let d=a.split(),h=f;for(let g=0;d.forceReduce()&&g<10&&(Po&&console.log(h+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,i));g++)Po&&(h=this.stackID(d)+" -> ");for(let g of a.recoverByInsert(l))Po&&console.log(f+this.stackID(g)+" (via recover-insert)"),this.advanceFully(g,i);this.stream.end>a.pos?(u==a.pos&&(u++,l=0),a.recoverByDelete(l,u),Po&&console.log(f+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),wz(a,i)):(!r||r.scoret;class xz{constructor(e){this.start=e.start,this.shift=e.shift||DC,this.reduce=e.reduce||DC,this.reuse=e.reuse||DC,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ph extends UL{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;ae.topRules[a][1]),r=[];for(let a=0;a=0)o(f,l,a[u++]);else{let d=a[u+-f];for(let h=-f;h>0;h--)o(a[u++],l,d);u++}}}this.nodeSet=new S4(n.map((a,l)=>Br.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:i.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=RL;let s=Xm(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new hh(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,i){let r=new ISe(this,e,n,i);for(let o of this.wrappers)r=o(r,e,n,i);return r}getGoto(e,n,i=!1){let r=this.goto;if(n>=r[0])return-1;for(let o=r[n+1];;){let s=r[o++],a=s&1,l=r[o++];if(a&&i)return l;for(let u=o+(s>>1);o0}validAction(e,n){return!!this.allActions(e,i=>i==n?!0:null)}allActions(e,n){let i=this.stateSlot(e,4),r=i?n(i):void 0;for(let o=this.stateSlot(e,1);r==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=ll(this.data,o+2);else break;r=n(ll(this.data,o+1))}return r}nextStates(e){let n=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ll(this.data,i+2);else break;if(!(this.data[i+2]&1)){let r=this.data[i+1];n.some((o,s)=>s&1&&o==r)||n.push(this.data[i],r)}}return n}configure(e){let n=Object.assign(Object.create(ph.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=i}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(i=>{let r=e.tokenizers.find(o=>o.from==i);return r?r.to:i})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((i,r)=>{let o=e.specializers.find(a=>a.from==i.external);if(!o)return i;let s=Object.assign(Object.assign({},i),{external:o.to});return n.specializers[r]=_z(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),i=n.map(()=>!1);if(e)for(let o of e.split(" ")){let s=n.indexOf(o);s>=0&&(i[s]=!0)}let r=null;for(let o=0;oi)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,i)<<1|e}return t.get}const jSe=101,Oz=1,FSe=102,zSe=103,Sz=2,Cz=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],BSe=58,WSe=40,Ez=95,HSe=91,Iy=45,QSe=46,USe=35,ZSe=37,qSe=38,YSe=92,VSe=10;function Gm(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Tz(t){return t>=48&&t<=57}const XSe=new Ls((t,e)=>{for(let n=!1,i=0,r=0;;r++){let{next:o}=t;if(Gm(o)||o==Iy||o==Ez||n&&Tz(o))!n&&(o!=Iy||r>0)&&(n=!0),i===r&&o==Iy&&i++,t.advance();else if(o==YSe&&t.peek(1)!=VSe)t.advance(),t.next>-1&&t.advance(),n=!0;else{n&&t.acceptToken(o==WSe?FSe:i==2&&e.canShift(Sz)?Sz:zSe);break}}}),GSe=new Ls(t=>{if(Cz.includes(t.peek(-1))){let{next:e}=t;(Gm(e)||e==Ez||e==USe||e==QSe||e==HSe||e==BSe&&Gm(t.peek(1))||e==Iy||e==qSe)&&t.acceptToken(jSe)}}),KSe=new Ls(t=>{if(!Cz.includes(t.peek(-1))){let{next:e}=t;if(e==ZSe&&(t.advance(),t.acceptToken(Oz)),Gm(e)){do t.advance();while(Gm(t.next)||Tz(t.next));t.acceptToken(Oz)}}}),JSe=Lk({"AtKeyword import charset namespace keyframes media supports":X.definitionKeyword,"from to selector":X.keyword,NamespaceName:X.namespace,KeyframeName:X.labelName,KeyframeRangeName:X.operatorKeyword,TagName:X.tagName,ClassName:X.className,PseudoClassName:X.constant(X.className),IdName:X.labelName,"FeatureName PropertyName":X.propertyName,AttributeName:X.attributeName,NumberLiteral:X.number,KeywordQuery:X.keyword,UnaryQueryOp:X.operatorKeyword,"CallTag ValueName":X.atom,VariableName:X.variableName,Callee:X.operatorKeyword,Unit:X.unit,"UniversalSelector NestingSelector":X.definitionOperator,MatchOp:X.compareOperator,"ChildOp SiblingOp, LogicOp":X.logicOperator,BinOp:X.arithmeticOperator,Important:X.modifier,Comment:X.blockComment,ColorLiteral:X.color,"ParenthesizedContent StringLiteral":X.string,":":X.punctuation,"PseudoOp #":X.derefOperator,"; ,":X.separator,"( )":X.paren,"[ ]":X.squareBracket,"{ }":X.brace}),e4e={__proto__:null,lang:34,"nth-child":34,"nth-last-child":34,"nth-of-type":34,"nth-last-of-type":34,dir:34,"host-context":34,url:62,"url-prefix":62,domain:62,regexp:62,selector:140},t4e={__proto__:null,"@import":120,"@media":144,"@charset":148,"@namespace":152,"@keyframes":158,"@supports":170},n4e={__proto__:null,not:134,only:134},i4e=ph.deserialize({version:14,states:":|QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$[QXO'#CaO$fQ[O'#CiO$qQ[O'#DUO$vQ[O'#DXOOQP'#Eo'#EoO${QdO'#DhO%jQ[O'#DuO${QdO'#DwO%{Q[O'#DyO&WQ[O'#D|O&`Q[O'#ESO&nQ[O'#EUOOQS'#En'#EnOOQS'#EX'#EXQYQ[OOO&uQXO'#CdO'jQWO'#DdO'oQWO'#EtO'zQ[O'#EtQOQWOOP(UO#tO'#C_POOO)C@^)C@^OOQP'#Ch'#ChOOQP,59Q,59QO#kQ[O,59QO(aQ[O,59TO$qQ[O,59pO$vQ[O,59sO(lQ[O,59vO(lQ[O,59xO(lQ[O,59yO(lQ[O'#E^O)WQWO,58{O)`Q[O'#DcOOQS,58{,58{OOQP'#Cl'#ClOOQO'#DS'#DSOOQP,59T,59TO)gQWO,59TO)lQWO,59TOOQP'#DW'#DWOOQP,59p,59pOOQO'#DY'#DYO)qQ`O,59sOOQS'#Cq'#CqO${QdO'#CrO)yQvO'#CtO+ZQtO,5:SOOQO'#Cy'#CyO)lQWO'#CxO+oQWO'#CzO+tQ[O'#DPOOQS'#Eq'#EqOOQO'#Dk'#DkO+|Q[O'#DrO,[QWO'#EuO&`Q[O'#DpO,jQWO'#DsOOQO'#Ev'#EvO)ZQWO,5:aO,oQpO,5:cOOQS'#D{'#D{O,wQWO,5:eO,|Q[O,5:eOOQO'#EO'#EOO-UQWO,5:hO-ZQWO,5:nO-cQWO,5:pOOQS-E8V-E8VO-kQdO,5:OO-{Q[O'#E`O.YQWO,5;`O.YQWO,5;`POOO'#EW'#EWP.eO#tO,58yPOOO,58y,58yOOQP1G.l1G.lOOQP1G.o1G.oO)gQWO1G.oO)lQWO1G.oOOQP1G/[1G/[O.pQ`O1G/_O/ZQXO1G/bO/qQXO1G/dO0XQXO1G/eO0oQXO,5:xOOQO-E8[-E8[OOQS1G.g1G.gO0yQWO,59}O1OQ[O'#DTO1VQdO'#CpOOQP1G/_1G/_O${QdO1G/_O1^QpO,59^OOQS,59`,59`O${QdO,59bO1fQWO1G/nOOQS,59d,59dO1kQ!bO,59fOOQS'#DQ'#DQOOQS'#EZ'#EZO1vQ[O,59kOOQS,59k,59kO2OQWO'#DkO2ZQWO,5:WO2`QWO,5:^O&`Q[O,5:YO2hQ[O'#EaO3PQWO,5;aO3[QWO,5:[O(lQ[O,5:_OOQS1G/{1G/{OOQS1G/}1G/}OOQS1G0P1G0PO3mQWO1G0PO3rQdO'#EPOOQS1G0S1G0SOOQS1G0Y1G0YOOQS1G0[1G0[O3}QtO1G/jOOQO1G/j1G/jOOQO,5:z,5:zO4eQ[O,5:zOOQO-E8^-E8^O4rQWO1G0zPOOO-E8U-E8UPOOO1G.e1G.eOOQP7+$Z7+$ZOOQP7+$y7+$yO${QdO7+$yOOQS1G/i1G/iO4}QXO'#EsO5XQWO,59oO5^QtO'#EYO6UQdO'#EpO6`QWO,59[O6eQpO7+$yOOQS1G.x1G.xOOQS1G.|1G.|OOQS7+%Y7+%YOOQS1G/Q1G/QO6mQWO1G/QOOQS-E8X-E8XOOQS1G/V1G/VO${QdO1G/rOOQO1G/x1G/xOOQO1G/t1G/tO6rQWO,5:{OOQO-E8_-E8_O7QQXO1G/yOOQS7+%k7+%kO7XQYO'#CtOOQO'#ER'#ERO7dQ`O'#EQOOQO'#EQ'#EQO7oQWO'#EbO7wQdO,5:kOOQS,5:k,5:kO8SQtO'#E_O${QdO'#E_O9TQdO7+%UOOQO7+%U7+%UOOQO1G0f1G0fO9hQpO<PAN>PO;nQXO,5:wOOQO-E8Z-E8ZO;xQdO,5:vOOQO-E8Y-E8YOOQO<T![;'S%^;'S;=`%o<%lO%^l;TUp`Oy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^l;nYp`#f[Oy%^z!Q%^!Q![;g![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^l[[p`#f[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^n?VSu^Oy%^z;'S%^;'S;=`%o<%lO%^l?hWkWOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^n@VUZQOy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^~@nTkWOy%^z{@}{;'S%^;'S;=`%o<%lO%^~AUSp`#^~Oy%^z;'S%^;'S;=`%o<%lO%^lAg[#f[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU^QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S_Qp`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!Z^Oy%^z;'S%^;'S;=`%o<%lO%^dCoS}SOy%^z;'S%^;'S;=`%o<%lO%^bDQU!PQOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS!PQp`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[!]Qp`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^nFfSr^Oy%^z;'S%^;'S;=`%o<%lO%^nFwSq^Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUp`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!cQp`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!UUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!T^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!SQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[GSe,KSe,XSe,1,2,3,4,new Dy("m~RRYZ[z{a~~g~aO#`~~dP!P!Qg~lO#a~~",28,107)],topRules:{StyleSheet:[0,4],Styles:[1,87]},specialized:[{term:102,get:t=>e4e[t]||-1},{term:59,get:t=>t4e[t]||-1},{term:103,get:t=>n4e[t]||-1}],tokenPrec:1246});let IC=null;function LC(){if(!IC&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],n=new Set;for(let i in t)i!="cssText"&&i!="cssFloat"&&typeof t[i]=="string"&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),n.has(i)||(e.push(i),n.add(i)));IC=e.sort().map(i=>({type:"property",label:i,apply:i+": "}))}return IC||[]}const $z=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),Mz=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),r4e=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),o4e=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),ul=/^(\w[\w-]*|-\w[\w-]*|)$/,s4e=/^-(-[\w-]*)?$/;function a4e(t,e){var n;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let i=(n=t.parent)===null||n===void 0?void 0:n.firstChild;return(i==null?void 0:i.name)!="Callee"?!1:e.sliceString(i.from,i.to)=="var"}const Nz=new QL,l4e=["Declaration"];function u4e(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function Az(t,e,n){if(e.to-e.from>4096){let i=Nz.get(e);if(i)return i;let r=[],o=new Set,s=e.cursor(ln.IncludeAnonymous);if(s.firstChild())do for(let a of Az(t,s.node,n))o.has(a.label)||(o.add(a.label),r.push(a));while(s.nextSibling());return Nz.set(e,r),r}else{let i=[],r=new Set;return e.cursor().iterate(o=>{var s;if(n(o)&&o.matchContext(l4e)&&((s=o.node.nextSibling)===null||s===void 0?void 0:s.name)==":"){let a=t.sliceString(o.from,o.to);r.has(a)||(r.add(a),i.push({label:a,type:"variable"}))}}),i}}const c4e=(t=>e=>{let{state:n,pos:i}=e,r=Gn(n).resolveInner(i,-1),o=r.type.isError&&r.from==r.to-1&&n.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(o||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:LC(),validFor:ul};if(r.name=="ValueName")return{from:r.from,options:Mz,validFor:ul};if(r.name=="PseudoClassName")return{from:r.from,options:$z,validFor:ul};if(t(r)||(e.explicit||o)&&a4e(r,n.doc))return{from:t(r)||o?r.from:i,options:Az(n.doc,u4e(r),t),validFor:s4e};if(r.name=="TagName"){for(let{parent:l}=r;l;l=l.parent)if(l.name=="Block")return{from:r.from,options:LC(),validFor:ul};return{from:r.from,options:r4e,validFor:ul}}if(r.name=="AtKeyword")return{from:r.from,options:o4e,validFor:ul};if(!e.explicit)return null;let s=r.resolve(i),a=s.childBefore(i);return a&&a.name==":"&&s.name=="PseudoClassSelector"?{from:i,options:$z,validFor:ul}:a&&a.name==":"&&s.name=="Declaration"||s.name=="ArgList"?{from:i,options:Mz,validFor:ul}:s.name=="Block"||s.name=="Styles"?{from:i,options:LC(),validFor:ul}:null})(t=>t.name=="VariableName"),Ly=Kd.define({name:"css",parser:i4e.configure({props:[Hk.add({Declaration:Qk()}),Uk.add({"Block KeyframeList":lR})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Pz(){return new L4(Ly,Ly.data.of({autocomplete:c4e}))}const f4e=55,d4e=1,h4e=56,p4e=2,g4e=57,m4e=3,Dz=4,v4e=5,RC=6,Iz=7,Lz=8,Rz=9,jz=10,b4e=11,k4e=12,y4e=13,jC=58,w4e=14,x4e=15,Fz=59,zz=21,_4e=23,Bz=24,O4e=25,FC=27,Wz=28,S4e=29,C4e=32,E4e=35,T4e=37,$4e=38,M4e=0,N4e=1,A4e={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},P4e={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Hz={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function D4e(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}let Qz=null,Uz=null,Zz=0;function zC(t,e){let n=t.pos+e;if(Zz==n&&Uz==t)return Qz;let i=t.peek(e),r="";for(;D4e(i);)r+=String.fromCharCode(i),i=t.peek(++e);return Uz=t,Zz=n,Qz=r?r.toLowerCase():i==I4e||i==L4e?void 0:null}const qz=60,Ry=62,BC=47,I4e=63,L4e=33,R4e=45;function Yz(t,e){this.name=t,this.parent=e}const j4e=[RC,jz,Iz,Lz,Rz],F4e=new xz({start:null,shift(t,e,n,i){return j4e.indexOf(e)>-1?new Yz(zC(i,1)||"",t):t},reduce(t,e){return e==zz&&t?t.parent:t},reuse(t,e,n,i){let r=e.type.id;return r==RC||r==T4e?new Yz(zC(i,1)||"",t):t},strict:!1}),z4e=new Ls((t,e)=>{if(t.next!=qz){t.next<0&&e.context&&t.acceptToken(jC);return}t.advance();let n=t.next==BC;n&&t.advance();let i=zC(t,0);if(i===void 0)return;if(!i)return t.acceptToken(n?x4e:w4e);let r=e.context?e.context.name:null;if(n){if(i==r)return t.acceptToken(b4e);if(r&&P4e[r])return t.acceptToken(jC,-2);if(e.dialectEnabled(M4e))return t.acceptToken(k4e);for(let o=e.context;o;o=o.parent)if(o.name==i)return;t.acceptToken(y4e)}else{if(i=="script")return t.acceptToken(Iz);if(i=="style")return t.acceptToken(Lz);if(i=="textarea")return t.acceptToken(Rz);if(A4e.hasOwnProperty(i))return t.acceptToken(jz);r&&Hz[r]&&Hz[r][i]?t.acceptToken(jC,-1):t.acceptToken(RC)}},{contextual:!0}),B4e=new Ls(t=>{for(let e=0,n=0;;n++){if(t.next<0){n&&t.acceptToken(Fz);break}if(t.next==R4e)e++;else if(t.next==Ry&&e>=2){n>=3&&t.acceptToken(Fz,-2);break}else e=0;t.advance()}});function W4e(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}const H4e=new Ls((t,e)=>{if(t.next==BC&&t.peek(1)==Ry){let n=e.dialectEnabled(N4e)||W4e(e.context);t.acceptToken(n?v4e:Dz,2)}else t.next==Ry&&t.acceptToken(Dz,1)});function WC(t,e,n){let i=2+t.length;return new Ls(r=>{for(let o=0,s=0,a=0;;a++){if(r.next<0){a&&r.acceptToken(e);break}if(o==0&&r.next==qz||o==1&&r.next==BC||o>=2&&os?r.acceptToken(e,-s):r.acceptToken(n,-(s-2));break}else if((r.next==10||r.next==13)&&a){r.acceptToken(e,1);break}else o=s=0;r.advance()}})}const Q4e=WC("script",f4e,d4e),U4e=WC("style",h4e,p4e),Z4e=WC("textarea",g4e,m4e),q4e=Lk({"Text RawText IncompleteTag IncompleteCloseTag":X.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":X.angleBracket,TagName:X.tagName,"MismatchedCloseTag/TagName":[X.tagName,X.invalid],AttributeName:X.attributeName,"AttributeValue UnquotedAttributeValue":X.attributeValue,Is:X.definitionOperator,"EntityReference CharacterReference":X.character,Comment:X.blockComment,ProcessingInst:X.processingInstruction,DoctypeDecl:X.documentMeta}),Y4e=ph.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:F4e,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[q4e],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let u=a.type.id;if(u==S4e)return HC(a,l,n);if(u==C4e)return HC(a,l,i);if(u==E4e)return HC(a,l,r);if(u==zz&&o.length){let f=a.node,d=f.firstChild,h=d&&Xz(d,l),g;if(h){for(let m of o)if(m.tag==h&&(!m.attrs||m.attrs(g||(g=Vz(d,l))))){let y=f.lastChild,x=y.type.id==$4e?y.from:f.to;if(x>d.to)return{parser:m.parser,overlay:[{from:d.to,to:x}]}}}}if(s&&u==Bz){let f=a.node,d;if(d=f.firstChild){let h=s[l.read(d.from,d.to)];if(h)for(let g of h){if(g.tagName&&g.tagName!=Xz(f.parent,l))continue;let m=f.lastChild;if(m.type.id==FC){let y=m.from+1,x=m.lastChild,_=m.to-(x&&x.isError?0:1);if(_>y)return{parser:g.parser,overlay:[{from:y,to:_}]}}else if(m.type.id==Wz)return{parser:g.parser,overlay:[{from:m.from,to:m.to}]}}}}return null})}const V4e=309,Kz=1,X4e=2,G4e=3,K4e=310,J4e=312,eCe=313,tCe=4,nCe=5,iCe=0,QC=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Jz=125,rCe=59,UC=47,oCe=42,sCe=43,aCe=45,lCe=60,uCe=44,cCe=new xz({start:!1,shift(t,e){return e==tCe||e==nCe||e==J4e?t:e==eCe},strict:!1}),fCe=new Ls((t,e)=>{let{next:n}=t;(n==Jz||n==-1||e.context)&&t.acceptToken(K4e)},{contextual:!0,fallback:!0}),dCe=new Ls((t,e)=>{let{next:n}=t,i;QC.indexOf(n)>-1||n==UC&&((i=t.peek(1))==UC||i==oCe)||n!=Jz&&n!=rCe&&n!=-1&&!e.context&&t.acceptToken(V4e)},{contextual:!0}),hCe=new Ls((t,e)=>{let{next:n}=t;if((n==sCe||n==aCe)&&(t.advance(),n==t.next)){t.advance();let i=!e.context&&e.canShift(Kz);t.acceptToken(i?Kz:X4e)}},{contextual:!0});function ZC(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}const pCe=new Ls((t,e)=>{if(t.next!=lCe||!e.dialectEnabled(iCe)||(t.advance(),t.next==UC))return;let n=0;for(;QC.indexOf(t.next)>-1;)t.advance(),n++;if(ZC(t.next,!0)){for(t.advance(),n++;ZC(t.next,!1);)t.advance(),n++;for(;QC.indexOf(t.next)>-1;)t.advance(),n++;if(t.next==uCe)return;for(let i=0;;i++){if(i==7){if(!ZC(t.next,!0))return;break}if(t.next!="extends".charCodeAt(i))break;t.advance(),n++}}t.acceptToken(G4e,-n)}),gCe=Lk({"get set async static":X.modifier,"for while do if else switch try catch finally return throw break continue default case":X.controlKeyword,"in of await yield void typeof delete instanceof":X.operatorKeyword,"let var const using function class extends":X.definitionKeyword,"import export from":X.moduleKeyword,"with debugger as new":X.keyword,TemplateString:X.special(X.string),super:X.atom,BooleanLiteral:X.bool,this:X.self,null:X.null,Star:X.modifier,VariableName:X.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":X.function(X.variableName),VariableDefinition:X.definition(X.variableName),Label:X.labelName,PropertyName:X.propertyName,PrivatePropertyName:X.special(X.propertyName),"CallExpression/MemberExpression/PropertyName":X.function(X.propertyName),"FunctionDeclaration/VariableDefinition":X.function(X.definition(X.variableName)),"ClassDeclaration/VariableDefinition":X.definition(X.className),PropertyDefinition:X.definition(X.propertyName),PrivatePropertyDefinition:X.definition(X.special(X.propertyName)),UpdateOp:X.updateOperator,"LineComment Hashbang":X.lineComment,BlockComment:X.blockComment,Number:X.number,String:X.string,Escape:X.escape,ArithOp:X.arithmeticOperator,LogicOp:X.logicOperator,BitOp:X.bitwiseOperator,CompareOp:X.compareOperator,RegExp:X.regexp,Equals:X.definitionOperator,Arrow:X.function(X.punctuation),": Spread":X.punctuation,"( )":X.paren,"[ ]":X.squareBracket,"{ }":X.brace,"InterpolationStart InterpolationEnd":X.special(X.brace),".":X.derefOperator,", ;":X.separator,"@":X.meta,TypeName:X.typeName,TypeDefinition:X.definition(X.typeName),"type enum interface implements namespace module declare":X.definitionKeyword,"abstract global Privacy readonly override":X.modifier,"is keyof unique infer":X.operatorKeyword,JSXAttributeValue:X.attributeValue,JSXText:X.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":X.angleBracket,"JSXIdentifier JSXNameSpacedName":X.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":X.attributeName,"JSXBuiltin/JSXIdentifier":X.standard(X.tagName)}),mCe={__proto__:null,export:18,as:23,from:31,default:34,async:39,function:40,extends:52,this:56,true:64,false:64,null:76,void:80,typeof:84,super:102,new:136,delete:152,yield:161,await:165,class:170,public:227,private:227,protected:227,readonly:229,instanceof:248,satisfies:251,in:252,const:254,import:286,keyof:339,unique:343,infer:349,is:385,abstract:405,implements:407,type:409,let:412,var:414,using:417,interface:423,enum:427,namespace:433,module:435,declare:439,global:443,for:462,of:471,while:474,with:478,do:482,if:486,else:488,switch:492,case:498,try:504,catch:508,finally:512,return:516,throw:520,break:524,continue:528,debugger:532},vCe={__proto__:null,async:123,get:125,set:127,declare:187,public:189,private:189,protected:189,static:191,abstract:193,override:195,readonly:201,accessor:203,new:389},bCe={__proto__:null,"<":143},kCe=ph.deserialize({version:14,states:"$RQWO'#CdO>cQWO'#H[O>kQWO'#HbO>kQWO'#HdO`Q^O'#HfO>kQWO'#HhO>kQWO'#HkO>pQWO'#HqO>uQ07iO'#HwO%[Q^O'#HyO?QQ07iO'#H{O?]Q07iO'#H}O9kQ07hO'#IPO?hQ08SO'#ChO@jQ`O'#DiQOQWOOO%[Q^O'#EPOAQQWO'#ESO:RQ7[O'#EjOA]QWO'#EjOAhQpO'#FbOOQU'#Cf'#CfOOQ07`'#Dn'#DnOOQ07`'#Jm'#JmO%[Q^O'#JmOOQO'#Jq'#JqOOQO'#Ib'#IbOBhQ`O'#EcOOQ07`'#Eb'#EbOCdQ07pO'#EcOCnQ`O'#EVOOQO'#Jp'#JpODSQ`O'#JqOEaQ`O'#EVOCnQ`O'#EcPEnO!0LbO'#CaPOOO)CDu)CDuOOOO'#IX'#IXOEyO!bO,59TOOQ07b,59T,59TOOOO'#IY'#IYOFXO#tO,59TO%[Q^O'#D`OOOO'#I['#I[OFgO?MpO,59xOOQ07b,59x,59xOFuQ^O'#I]OGYQWO'#JkOI[QrO'#JkO+}Q^O'#JkOIcQWO,5:OOIyQWO'#ElOJWQWO'#JyOJcQWO'#JxOJcQWO'#JxOJkQWO,5;YOJpQWO'#JwOOQ07f,5:Z,5:ZOJwQ^O,5:ZOLxQ08SO,5:eOMiQWO,5:mONSQ07hO'#JvONZQWO'#JuO9ZQWO'#JuONoQWO'#JuONwQWO,5;XON|QWO'#JuO!#UQrO'#JjOOQ07b'#Ch'#ChO%[Q^O'#ERO!#tQpO,5:rOOQO'#Jr'#JrOOQO-EmOOQU'#J`'#J`OOQU,5>n,5>nOOQU-EpQWO'#HQO9aQWO'#HSO!CgQWO'#HSO:RQ7[O'#HUO!ClQWO'#HUOOQU,5=j,5=jO!CqQWO'#HVO!DSQWO'#CnO!DXQWO,59OO!DcQWO,59OO!FhQ^O,59OOOQU,59O,59OO!FxQ07hO,59OO%[Q^O,59OO!ITQ^O'#H^OOQU'#H_'#H_OOQU'#H`'#H`O`Q^O,5=vO!IkQWO,5=vO`Q^O,5=|O`Q^O,5>OO!IpQWO,5>QO`Q^O,5>SO!IuQWO,5>VO!IzQ^O,5>]OOQU,5>c,5>cO%[Q^O,5>cO9kQ07hO,5>eOOQU,5>g,5>gO!NUQWO,5>gOOQU,5>i,5>iO!NUQWO,5>iOOQU,5>k,5>kO!NZQ`O'#D[O%[Q^O'#JmO!NxQ`O'#JmO# gQ`O'#DjO# xQ`O'#DjO#$ZQ^O'#DjO#$bQWO'#JlO#$jQWO,5:TO#$oQWO'#EpO#$}QWO'#JzO#%VQWO,5;ZO#%[Q`O'#DjO#%iQ`O'#EUOOQ07b,5:n,5:nO%[Q^O,5:nO#%pQWO,5:nO>pQWO,5;UO!@}Q`O,5;UO!AVQ7[O,5;UO:RQ7[O,5;UO#%xQWO,5@XO#%}Q$ISO,5:rOOQO-E<`-E<`O#'TQ07pO,5:}OCnQ`O,5:qO#'_Q`O,5:qOCnQ`O,5:}O!@rQ07hO,5:qOOQ07`'#Ef'#EfOOQO,5:},5:}O%[Q^O,5:}O#'lQ07hO,5:}O#'wQ07hO,5:}O!@}Q`O,5:qOOQO,5;T,5;TO#(VQ07hO,5:}POOO'#IV'#IVP#(kO!0LbO,58{POOO,58{,58{OOOO-EwO+}Q^O,5>wOOQO,5>},5>}O#)VQ^O'#I]OOQO-EpQ08SO1G0{O#>wQ08SO1G0{O#@oQ08SO1G0{O#CoQ(CYO'#ChO#EmQ(CYO1G1^O#EtQ(CYO'#JjO!,lQWO1G1dO#FUQ08SO,5?TOOQ07`-EkQWO1G3lO$2^Q^O1G3nO$6bQ^O'#HmOOQU1G3q1G3qO$6oQWO'#HsO>pQWO'#HuOOQU1G3w1G3wO$6wQ^O1G3wO9kQ07hO1G3}OOQU1G4P1G4POOQ07`'#GY'#GYO9kQ07hO1G4RO9kQ07hO1G4TO$;OQWO,5@XO!*fQ^O,5;[O9ZQWO,5;[O>pQWO,5:UO!*fQ^O,5:UO!@}Q`O,5:UO$;TQ(CYO,5:UOOQO,5;[,5;[O$;_Q`O'#I^O$;uQWO,5@WOOQ07b1G/o1G/oO$;}Q`O'#IdO$pQWO1G0pO!@}Q`O1G0pO!AVQ7[O1G0pOOQ07`1G5s1G5sO!@rQ07hO1G0]OOQO1G0i1G0iO%[Q^O1G0iO$wO$>TQWO1G5qO$>]QWO1G6OO$>eQrO1G6PO9ZQWO,5>}O$>oQ08SO1G5|O%[Q^O1G5|O$?PQ07hO1G5|O$?bQWO1G5{O$?bQWO1G5{O9ZQWO1G5{O$?jQWO,5?QO9ZQWO,5?QOOQO,5?Q,5?QO$@OQWO,5?QO$'TQWO,5?QOOQO-EXOOQU,5>X,5>XO%[Q^O'#HnO%7^QWO'#HpOOQU,5>_,5>_O9ZQWO,5>_OOQU,5>a,5>aOOQU7+)c7+)cOOQU7+)i7+)iOOQU7+)m7+)mOOQU7+)o7+)oO%7cQ`O1G5sO%7wQ(CYO1G0vO%8RQWO1G0vOOQO1G/p1G/pO%8^Q(CYO1G/pO>pQWO1G/pO!*fQ^O'#DjOOQO,5>x,5>xOOQO-E<[-E<[OOQO,5?O,5?OOOQO-EpQWO7+&[O!@}Q`O7+&[OOQO7+%w7+%wO$=gQ08SO7+&TOOQO7+&T7+&TO%[Q^O7+&TO%8hQ07hO7+&TO!@rQ07hO7+%wO!@}Q`O7+%wO%8sQ07hO7+&TO%9RQ08SO7++hO%[Q^O7++hO%9cQWO7++gO%9cQWO7++gOOQO1G4l1G4lO9ZQWO1G4lO%9kQWO1G4lOOQO7+%|7+%|O#%sQWO<tQ08SO1G2ZO%AVQ08SO1G2mO%CbQ08SO1G2oO%EmQ7[O,5>yOOQO-E<]-E<]O%EwQrO,5>zO%[Q^O,5>zOOQO-E<^-E<^O%FRQWO1G5uOOQ07b<YOOQU,5>[,5>[O&5cQWO1G3yO9ZQWO7+&bO!*fQ^O7+&bOOQO7+%[7+%[O&5hQ(CYO1G6PO>pQWO7+%[OOQ07b<pQWO<pQWO7+)eO'&gQWO<}AN>}O%[Q^OAN?ZOOQO<eQ(CYOG26}O!*fQ^O'#DyO1PQWO'#EWO'@ZQrO'#JiO!*fQ^O'#DqO'@bQ^O'#D}O'@iQrO'#ChO'CPQrO'#ChO!*fQ^O'#EPO'CaQ^O,5;VO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O'#IiO'EdQWO,5a#@O#@^#@d#Ax#BW#Cr#DQ#DW#D^#Dd#Dn#Dt#Dz#EU#Eh#EnPPPPPPPPPP#EtPPPPPPP#Fi#Ip#KP#KW#K`PPPP$!d$%Z$+r$+u$+x$,q$,t$,w$-O$-WPP$-^$-b$.Y$/X$/]$/qPP$/u$/{$0PP$0S$0W$0Z$1P$1h$2P$2T$2W$2Z$2a$2d$2h$2lR!{RoqOXst!Z#c%j&m&o&p&r,h,m1w1zY!uQ'Z-Y1[5]Q%pvQ%xyQ&P|Q&e!VS'R!e-QQ'a!iS'g!r!xS*c$|*hQ+f%yQ+s&RQ,X&_Q-W'YQ-b'bQ-j'hQ/|*jQ1f,YR;Y:g%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%j%p%}&f&i&m&o&p&r&v'O']'m'}(P(V(^(r(v(z)y+O+S,e,h,m-^-f-t-z.l.s0[0a0q1_1o1p1r1t1w1z1|2m2s3Z5Y5d5t5u5x6]7w7|8]8gS#p]:d!r)[$[$m'S)n,y,|.{2]3p5W6S9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]Q*u%ZQ+k%{Q,Z&bQ,b&jQ.c;QQ0h+^Q0l+`Q0w+lQ1n,`Q2{.[Q4v0rQ5k1gQ6i3PQ6u;RQ7h4wR8m6j&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%j%p%}&f&i&j&m&o&p&r&v'O'S']'m'}(P(V(^(r(v(z)n)y+O+S+^,e,h,m,y,|-^-f-t-z.[.l.s.{0[0a0q1_1o1p1r1t1w1z1|2]2m2s3P3Z3p5W5Y5d5t5u5x6S6]6j7w7|8]8g9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]t!nQ!r!u!x!y'R'Y'Z'g'h'i-Q-W-Y-j1[5]5_$v$si#u#w$c$d$x${%O%Q%[%]%a)u){)}*P*R*Y*`*p*q+]+`+w+z.Z.i/Z/j/k/m0Q0S0^1R1U1^3O3x4S4[4f4n4p5c6g7T7^7y8j8w9[9n:O:W:y:z:|:};O;P;S;T;U;V;W;X;_;`;a;b;c;d;g;h;i;j;k;l;m;n;q;r < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:371,context:cCe,nodeProps:[["isolate",-8,4,5,13,33,35,48,50,52,""],["group",-26,8,16,18,65,201,205,209,210,212,215,218,228,230,236,238,240,242,245,251,257,259,261,263,265,267,268,"Statement",-32,12,13,28,31,32,38,48,51,52,54,59,67,75,79,81,83,84,106,107,116,117,134,137,139,140,141,142,144,145,164,165,167,"Expression",-23,27,29,33,37,39,41,168,170,172,173,175,176,177,179,180,181,183,184,185,195,197,199,200,"Type",-3,87,99,105,"ClassItem"],["openedBy",22,"<",34,"InterpolationStart",53,"[",57,"{",72,"(",157,"JSXStartCloseTag"],["closedBy",23,">",36,"InterpolationEnd",47,"]",58,"}",73,")",162,"JSXEndTag"]],propSources:[gCe],skippedNodes:[0,4,5,271],repeatNodeCount:37,tokenData:"$Fj(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Ns!`!a$#_!a!b$(l!b!c$,k!c!}Er!}#O$-u#O#P$/P#P#Q$4h#Q#R$5r#R#SEr#S#T$7P#T#o$8Z#o#p$q#r#s$?}#s$f%Z$f$g+g$g#BYEr#BY#BZ$AX#BZ$ISEr$IS$I_$AX$I_$I|Er$I|$I}$Dd$I}$JO$Dd$JO$JTEr$JT$JU$AX$JU$KVEr$KV$KW$AX$KW&FUEr&FU&FV$AX&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AX?HUOEr(n%d_$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$f&j(OpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(OpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Op(R!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$f&j(Op(R!b't(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST(P#S$f&j'u(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$f&j(Op(R!b'u(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$f&j!o$Ip(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/|3l_'}$(n$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$f&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$a`$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$a``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$a`$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(R!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$a`(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k#%|:hh$f&j(Op(R!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXVS$f&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSVSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWVS(R!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]VS$f&j(OpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWVS(OpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYVS(Op(R!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$f&j!USOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$f&j!USO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!USOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!US#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$f&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$f&j(R!b!USOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ(R!b!USOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb(R!b!USOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX(R!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$f&j(R!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$f&j(Op(R!bo$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#mCe[t]||-1},{term:334,get:t=>vCe[t]||-1},{term:70,get:t=>bCe[t]||-1}],tokenPrec:14626}),eB=[co("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),co("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),co("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),co("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),co("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),co(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:"try",detail:"/ catch block",type:"keyword"}),co("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),co(`if (\${}) { + \${} +} else { + \${} +}`,{label:"if",detail:"/ else block",type:"keyword"}),co(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:"class",detail:"definition",type:"keyword"}),co('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),co('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],yCe=eB.concat([co("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),co("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),co("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),tB=new QL,nB=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Km(t){return(e,n)=>{let i=e.node.getChild("VariableDefinition");return i&&n(i,t),!0}}const wCe=["FunctionDeclaration"],xCe={FunctionDeclaration:Km("function"),ClassDeclaration:Km("class"),ClassExpression:()=>!0,EnumDeclaration:Km("constant"),TypeAliasDeclaration:Km("type"),NamespaceDeclaration:Km("namespace"),VariableDefinition(t,e){t.matchContext(wCe)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function iB(t,e){let n=tB.get(e);if(n)return n;let i=[],r=!0;function o(s,a){let l=t.sliceString(s.from,s.to);i.push({label:l,type:a})}return e.cursor(ln.IncludeAnonymous).iterate(s=>{if(r)r=!1;else if(s.name){let a=xCe[s.name];if(a&&a(s,o)||nB.has(s.name))return!1}else if(s.to-s.from>8192){for(let a of iB(t,s.node))i.push(a);return!1}}),tB.set(e,i),i}const rB=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,oB=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function _Ce(t){let e=Gn(t.state).resolveInner(t.pos,-1);if(oB.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&rB.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let i=[];for(let r=e;r;r=r.parent)nB.has(r.name)&&(i=i.concat(iB(t.state.doc,r)));return{options:i,from:n?e.from:t.pos,validFor:rB}}const Oa=Kd.define({name:"javascript",parser:kCe.configure({props:[Hk.add({IfStatement:Qk({except:/^\s*({|else\b)/}),TryStatement:Qk({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:e2e,SwitchBody:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:i?1:2)*t.unit},Block:Jxe({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Qk({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Uk.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":lR,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),sB={test:t=>/^JSX/.test(t.name),facet:nR({commentTokens:{block:{open:"{/*",close:"*/}"}}})},aB=Oa.configure({dialect:"ts"},"typescript"),lB=Oa.configure({dialect:"jsx",props:[D4.add(t=>t.isTop?[sB]:void 0)]}),uB=Oa.configure({dialect:"jsx ts",props:[D4.add(t=>t.isTop?[sB]:void 0)]},"typescript");let cB=t=>({label:t,type:"keyword"});const fB="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(cB),OCe=fB.concat(["declare","implements","private","protected","public"].map(cB));function qC(t={}){let e=t.jsx?t.typescript?uB:lB:t.typescript?aB:Oa,n=t.typescript?yCe.concat(OCe):eB.concat(fB);return new L4(e,[Oa.data.of({autocomplete:c3e(oB,$j(n))}),Oa.data.of({autocomplete:_Ce}),t.jsx?ECe:[]])}function SCe(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function dB(t,e,n=t.length){for(let i=e==null?void 0:e.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return t.sliceString(i.from,Math.min(i.to,n));return""}const CCe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),ECe=Te.inputHandler.of((t,e,n,i,r)=>{if((CCe?t.composing:t.compositionStarted)||t.state.readOnly||e!=n||i!=">"&&i!="/"||!Oa.isActiveAt(t.state,e,-1))return!1;let o=r(),{state:s}=o,a=s.changeByRange(l=>{var u;let{head:f}=l,d=Gn(s).resolveInner(f-1,-1),h;if(d.name=="JSXStartTag"&&(d=d.parent),!(s.doc.sliceString(f-1,f)!=i||d.name=="JSXAttributeValue"&&d.to>f)){if(i==">"&&d.name=="JSXFragmentTag")return{range:l,changes:{from:f,insert:""}};if(i=="/"&&d.name=="JSXStartCloseTag"){let g=d.parent,m=g.parent;if(m&&g.from==f-2&&((h=dB(s.doc,m.firstChild,f))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let y=`${h}>`;return{range:he.cursor(f+y.length,-1),changes:{from:f,insert:y}}}}else if(i==">"){let g=SCe(d);if(g&&g.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(s.doc.sliceString(f,f+2))&&(h=dB(s.doc,g,f)))return{range:l,changes:{from:f,insert:``}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Jm=["_blank","_self","_top","_parent"],YC=["ascii","utf-8","utf-16","latin1","latin1"],VC=["get","post","put","delete"],XC=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Do=["true","false"],Ge={},TCe={a:{attrs:{href:null,ping:null,type:null,media:null,target:Jm,hreflang:null}},abbr:Ge,address:Ge,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Ge,aside:Ge,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Ge,base:{attrs:{href:null,target:Jm}},bdi:Ge,bdo:Ge,blockquote:{attrs:{cite:null}},body:Ge,br:Ge,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:XC,formmethod:VC,formnovalidate:["novalidate"],formtarget:Jm,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Ge,center:Ge,cite:Ge,code:Ge,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Ge,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Ge,div:Ge,dl:Ge,dt:Ge,em:Ge,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Ge,figure:Ge,footer:Ge,form:{attrs:{action:null,name:null,"accept-charset":YC,autocomplete:["on","off"],enctype:XC,method:VC,novalidate:["novalidate"],target:Jm}},h1:Ge,h2:Ge,h3:Ge,h4:Ge,h5:Ge,h6:Ge,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Ge,hgroup:Ge,hr:Ge,html:{attrs:{manifest:null}},i:Ge,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:XC,formmethod:VC,formnovalidate:["novalidate"],formtarget:Jm,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Ge,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Ge,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Ge,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:YC,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Ge,noscript:Ge,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Ge,param:{attrs:{name:null,value:null}},pre:Ge,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Ge,rt:Ge,ruby:Ge,samp:Ge,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:YC}},section:Ge,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Ge,source:{attrs:{src:null,type:null,media:null}},span:Ge,strong:Ge,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Ge,summary:Ge,sup:Ge,table:Ge,tbody:Ge,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Ge,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Ge,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Ge,time:{attrs:{datetime:null}},title:Ge,tr:Ge,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Ge,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Ge},hB={accesskey:null,class:null,contenteditable:Do,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Do,autocorrect:Do,autocapitalize:Do,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Do,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Do,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Do,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Do,"aria-hidden":Do,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Do,"aria-multiselectable":Do,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Do,"aria-relevant":null,"aria-required":Do,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},pB="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of pB)hB[t]=null;class jy{constructor(e,n){this.tags={...TCe,...e},this.globalAttrs={...hB,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}jy.default=new jy;function gh(t,e,n=t.length){if(!e)return"";let i=e.firstChild,r=i&&i.getChild("TagName");return r?t.sliceString(r.from,Math.min(r.to,n)):""}function mh(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function gB(t,e,n){let i=n.tags[gh(t,mh(e))];return(i==null?void 0:i.children)||n.allTags}function GC(t,e){let n=[];for(let i=mh(e);i&&!i.type.isTop;i=mh(i.parent)){let r=gh(t,i);if(r&&i.lastChild.name=="CloseTag")break;r&&n.indexOf(r)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&n.push(r)}return n}const mB=/^[:\-\.\w\u00b7-\uffff]*$/;function vB(t,e,n,i,r){let o=/\s*>/.test(t.sliceDoc(r,r+5))?"":">",s=mh(n,n.name=="StartTag"||n.name=="TagName");return{from:i,to:r,options:gB(t.doc,s,e).map(a=>({label:a,type:"type"})).concat(GC(t.doc,n).map((a,l)=>({label:"/"+a,apply:"/"+a+o,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function bB(t,e,n,i){let r=/\s*>/.test(t.sliceDoc(i,i+5))?"":">";return{from:n,to:i,options:GC(t.doc,e).map((o,s)=>({label:o,apply:o+r,type:"type",boost:99-s})),validFor:mB}}function $Ce(t,e,n,i){let r=[],o=0;for(let s of gB(t.doc,n,e))r.push({label:"<"+s,type:"type"});for(let s of GC(t.doc,n))r.push({label:"",type:"type",boost:99-o++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function MCe(t,e,n,i,r){let o=mh(n),s=o?e.tags[gh(t.doc,o)]:null,a=s&&s.attrs?Object.keys(s.attrs):[],l=s&&s.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:r,options:l.map(u=>({label:u,type:"property"})),validFor:mB}}function NCe(t,e,n,i,r){var o;let s=(o=n.parent)===null||o===void 0?void 0:o.getChild("AttributeName"),a=[],l;if(s){let u=t.sliceDoc(s.from,s.to),f=e.globalAttrs[u];if(!f){let d=mh(n),h=d?e.tags[gh(t.doc,d)]:null;f=(h==null?void 0:h.attrs)&&h.attrs[u]}if(f){let d=t.sliceDoc(i,r).toLowerCase(),h='"',g='"';/^['"]/.test(d)?(l=d[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",g=t.sliceDoc(r,r+1)==d[0]?"":d[0],d=d.slice(1),i++):l=/^[^\s<>='"]*$/;for(let m of f)a.push({label:m,apply:h+m+g,type:"constant"})}}return{from:i,to:r,options:a,validFor:l}}function ACe(t,e){let{state:n,pos:i}=e,r=Gn(n).resolveInner(i,-1),o=r.resolve(i);for(let s=i,a;o==r&&(a=r.childBefore(s));){let l=a.lastChild;if(!l||!l.type.isError||l.fromACe(i,r)}const DCe=Oa.parser.configure({top:"SingleExpression"}),kB=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:aB.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:lB.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:uB.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:DCe},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:Oa.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:Ly.parser}],yB=[{name:"style",parser:Ly.parser.configure({top:"Styles"})}].concat(pB.map(t=>({name:t,parser:Oa.parser}))),wB=Kd.define({name:"html",parser:Y4e.configure({props:[Hk.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Fy=wB.configure({wrap:Gz(kB,yB)});function xB(t={}){let e="",n;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(n=Gz((t.nestedLanguages||[]).concat(kB),(t.nestedAttributes||[]).concat(yB)));let i=n?wB.configure({wrap:n,dialect:e}):e?Fy.configure({dialect:e}):Fy;return new L4(i,[Fy.data.of({autocomplete:PCe(t)}),t.autoCloseTags!==!1?ICe:[],qC().support,Pz().support])}const _B=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),ICe=Te.inputHandler.of((t,e,n,i,r)=>{if(t.composing||t.state.readOnly||e!=n||i!=">"&&i!="/"||!Fy.isActiveAt(t.state,e,-1))return!1;let o=r(),{state:s}=o,a=s.changeByRange(l=>{var u,f,d;let h=s.doc.sliceString(l.from-1,l.to)==i,{head:g}=l,m=Gn(s).resolveInner(g,-1),y;if(h&&i==">"&&m.name=="EndTag"){let x=m.parent;if(((f=(u=x.parent)===null||u===void 0?void 0:u.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(y=gh(s.doc,x.parent,g))&&!_B.has(y)){let _=g+(s.doc.sliceString(g,g+1)===">"?1:0),S=``;return{range:l,changes:{from:g,to:_,insert:S}}}}else if(h&&i=="/"&&m.name=="IncompleteCloseTag"){let x=m.parent;if(m.from==g-2&&((d=x.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(y=gh(s.doc,x,g))&&!_B.has(y)){let _=g+(s.doc.sliceString(g,g+1)===">"?1:0),S=`${y}>`;return{range:he.cursor(g+S.length,-1),changes:{from:g,to:_,insert:S}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function OB({code:t,language:e,updateCode:n,updateLanguage:i}){const[r,o]=T.useState(!0),{darkMode:s}=T.useContext(ft);T.useEffect(()=>{const S=()=>{o(!0)};return window.addEventListener("mousemove",S),()=>{window.removeEventListener("mousemove",S)}},[]);const a=T.useCallback(S=>{o(!1),n(S)},[n]),l=T.useCallback(S=>{i(S.target.value)},[i]),u=Te.theme({"&.cm-editor":{background:"transparent"},"&.cm-focused":{outline:"0"},"&.cm-editor .cm-content":{padding:"7px 0"},"&.cm-editor .cm-scroller":{overflow:"auto"},"&.cm-editor .cm-gutters":{background:"none",border:"none",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",color:"#CED4D9",lineHeight:"2.25rem"},"&.cm-editor .cm-gutter":{minHeight:"170px"},"&.cm-editor .cm-lineNumbers":{padding:"0"},"&.cm-editor .cm-foldGutter":{width:"0"},"&.cm-editor .cm-line":{padding:"0 .8rem",color:"#394047",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",fontSize:"1.6rem",lineHeight:"2.25rem"},"&.cm-editor .cm-activeLine, &.cm-editor .cm-activeLineGutter":{background:"none"},"&.cm-editor .cm-cursor, &.cm-editor .cm-dropCursor":{borderLeft:"1.2px solid black"}}),f=Te.theme({"&.cm-editor":{background:"transparent"},"&.cm-focused":{outline:"0"},"&.cm-editor .cm-content":{padding:"7px 0"},"&.cm-editor .cm-scroller":{overflow:"auto"},"&.cm-editor .cm-gutters":{background:"none",border:"none",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",color:"rgb(108, 118, 127);",lineHeight:"2.25rem"},"&.cm-editor .cm-gutter":{minHeight:"170px"},"&.cm-editor .cm-lineNumbers":{padding:"0"},"&.cm-editor .cm-foldGutter":{width:"0"},"&.cm-editor .cm-line":{padding:"0 .8rem",color:"rgb(210, 215, 218)",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",fontSize:"1.6rem",lineHeight:"2.25rem"},"&.cm-editor .cm-activeLine, &.cm-editor .cm-activeLineGutter":{background:"none"},"&.cm-editor .cm-cursor, &.cm-editor .cm-dropCursor":{borderLeft:"1.2px solid white"}}),d=ol.define([{tag:X.keyword,color:"#5A5CAD"},{tag:X.atom,color:"#6C8CD5"},{tag:X.number,color:"#116644"},{tag:X.definition(X.variableName),textDecoration:"underline"},{tag:X.variableName,color:"black"},{tag:X.comment,color:"#0080FF",fontStyle:"italic",background:"rgba(0,0,0,.05)"},{tag:[X.string,X.special(X.brace)],color:"#183691"},{tag:X.meta,color:"yellow"},{tag:X.bracket,color:"#63a35c"},{tag:X.tagName,color:"#63a35c"},{tag:X.attributeName,color:"#795da3"}]),h=ol.define([{tag:X.keyword,color:"#795da3"},{tag:X.atom,color:"#6C8CD5"},{tag:X.number,color:"#63a35c"},{tag:X.definition(X.variableName),textDecoration:"underline"},{tag:X.variableName,color:"white"},{tag:X.comment,color:"#0080FF",fontStyle:"italic",background:"rgba(0,0,0,.05)"},{tag:[X.string,X.special(X.brace)],color:"rgb(72, 110, 225)"},{tag:X.meta,color:"yellow"},{tag:X.bracket,color:"#63a35c"},{tag:X.tagName,color:"#63a35c"},{tag:X.attributeName,color:"#795da3"},{tag:[X.className,X.propertyName],color:"rgb(72, 110, 225)"}]),g=s?f:u,m=s?h:d,y=[Te.lineWrapping,Fm(m),g,O4(),sF({defaultKeymap:!1,history:!1}),nl.of(J4),Vk({joinToEvent:void 0})],_={javascript:qC,js:qC,html:xB,css:Pz}[e==null?void 0:e.toLowerCase().trim()]||null;return _&&y.push(_()),k.jsxs("div",{className:"not-kg-prose min-h-[170px]",children:[k.jsx(bC,{autoFocus:!0,basicSetup:!1,extensions:y,value:t,onChange:a}),k.jsx("input",{"aria-label":"Code card language",className:`z-999 absolute right-1.5 top-1.5 w-1/5 rounded-md border border-grey-300 px-2 py-1 font-sans text-[1.3rem] leading-4 text-grey-900 transition-opacity focus-visible:outline-none dark:border-grey-900 dark:text-grey-400 ${r?"opacity-100":"opacity-0"}`,"data-testid":"code-card-language",placeholder:"Language...",type:"text",value:e,onChange:l})]})}function SB({code:t,darkMode:e,language:n}){const i=e?"rounded-md border border-grey-950 bg-grey-950 px-2 py-[6px] font-mono text-[1.6rem] leading-9 text-grey-400 whitespace-pre-wrap":"rounded-md border border-grey-200 bg-grey-100 px-2 py-[6px] font-mono text-[1.6rem] leading-9 text-grey-900 whitespace-pre-wrap";return k.jsxs("div",{className:"not-kg-prose",children:[k.jsx("pre",{className:i,children:k.jsx("code",{className:n&&`language-${n}`,children:t})}),k.jsx("div",{className:"absolute right-2 top-2 flex items-center justify-center px-1",children:k.jsx("span",{className:"block font-sans text-sm font-medium leading-normal text-grey",children:n})})]})}function CB({captionEditor:t,captionEditorInitialState:e,code:n,darkMode:i,isEditing:r,isSelected:o,language:s,updateCode:a,updateLanguage:l}){return r?k.jsx(OB,{code:n,darkMode:i,language:s,updateCode:a,updateLanguage:l}):k.jsxs(k.Fragment,{children:[k.jsx(SB,{code:n,darkMode:i,language:s}),k.jsx(dh,{captionEditor:t,captionEditorInitialState:e,captionPlaceholder:"Type caption for code block (optional)",dataTestId:"codeblock-caption",isSelected:o})]})}OB.propTypes={code:P.string,language:P.string,updateCode:P.func,updateLanguage:P.func},SB.propTypes={code:P.string,darkMode:P.bool,language:P.string},CB.propTypes={code:P.string,darkMode:P.bool,language:P.string,captionEditor:P.object,captionEditorInitialState:P.object,isEditing:P.bool,isSelected:P.bool,updateCode:P.func,updateLanguage:P.func};const LCe=t=>J.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},J.createElement("path",{d:"M4.47 1.867a4.525 4.525 0 015.02 1.378.4.4 0 01-.618.51 3.725 3.725 0 00-6.597 2.369v.159l.817-.817a.4.4 0 11.565.565l-1.48 1.48a.4.4 0 01-.605 0l-1.48-1.48a.4.4 0 11.565-.565l.818.817v-.16A4.526 4.526 0 014.47 1.868zm5.655 3.107a.4.4 0 01.283.117l1.5 1.5a.4.4 0 01-.566.565l-.822-.822A4.525 4.525 0 012.709 9.23a.4.4 0 01.582-.55 3.725 3.725 0 006.427-2.333l-.81.81a.4.4 0 11-.566-.565l1.5-1.5a.4.4 0 01.283-.117z"})),RCe=({snippets:t,onCreateSnippet:e,onUpdateSnippet:n,value:i,isCreateButtonActive:r,onKeyDown:o,activeMenuItem:s})=>k.jsxs("ul",{className:"absolute mt-[-1px] w-full max-w-[240px] rounded-b border border-grey-200 bg-white shadow-md dark:border-grey-900 dark:bg-grey-950",tabIndex:0,onKeyDown:o,children:[k.jsx("li",{className:"mb-0 block",children:k.jsxs("button",{className:`flex w-full cursor-pointer items-center justify-between px-3 py-2 text-left text-sm font-medium text-green-600 hover:bg-grey-100 dark:hover:bg-black ${r?"bg-grey-100 dark:bg-black":""}`,type:"button",onClick:e,children:[k.jsxs("span",{children:['Create "',i,"“"]}),k.jsx(rv,{className:"size-3 stroke-green-600 stroke-[3px]"})]})}),!!t.length&&k.jsx(jCe,{activeMenuItem:s,list:t,onClick:n})]}),jCe=({list:t=[],onClick:e,activeMenuItem:n})=>k.jsxs("li",{role:"separator",children:[k.jsx("span",{className:"block border-t border-grey-200 px-3 pb-2 pt-3 text-[1.1rem] font-semibold uppercase tracking-wide text-grey-600 dark:border-grey-900 dark:text-grey-800",children:"Replace existing"}),k.jsx("ul",{role:"menu",children:t.map((i,r)=>k.jsx(FCe,{active:n,index:r,name:i.name,onClick:e},i.name))})]}),FCe=({onClick:t,name:e,active:n,index:i})=>k.jsx("li",{className:"mb-1",children:k.jsxs("button",{className:`flex w-full cursor-pointer items-center justify-between px-3 py-2 text-left text-sm hover:bg-grey-100 ${i===n?"bg-grey-100 dark:bg-black":""} dark:hover:bg-black`,type:"button",onClick:()=>t(e),children:[k.jsx("span",{children:e}),k.jsx("div",{className:"size-5 fill-grey-900",children:k.jsx(LCe,{className:"size-4 fill-grey-900 dark:fill-grey-600"})})]})}),vh=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M19 5 5 19m14 0L5 5"})),zCe=({value:t,onChange:e,onClear:n,onKeyDown:i})=>k.jsxs("div",{className:"relative m-0 flex items-center justify-evenly gap-1 rounded-lg bg-white font-sans text-md font-normal text-black shadow-md dark:bg-grey-950",children:[k.jsx("input",{autoComplete:"off",autoFocus:!0,className:`mb-[1px] h-auto w-full bg-white py-1 pl-3 pr-9 font-normal leading-loose text-grey-900 selection:bg-grey/40 dark:bg-grey-950 dark:text-grey-100 dark:placeholder:text-grey-800 ${t?"rounded-b-none rounded-t":"rounded"}`,"data-testid":"snippet-name",placeholder:"Snippet name",value:t,"data-1p-ignore":!0,onChange:e,onKeyDown:i}),k.jsx("button",{"aria-label":"Close",className:"absolute right-3 cursor-pointer",type:"button",onClick:n,children:k.jsx(vh,{className:"size-3 stroke-2 text-grey"})})]});function EB({value:t,onChange:e,onCreateSnippet:n,onUpdateSnippet:i,onClose:r,snippets:o=[]}){const s=T.useRef(null),[a,l]=T.useState(!0),[u,f]=T.useState(-1),[d,h]=T.useState([]);T.useEffect(()=>{const m=o.filter(y=>y.name.toLowerCase().includes(t.toLowerCase()));m.length===0?(l(!0),f(-1)):(l(!1),f(0)),h(m)},[t,o]),T.useEffect(()=>{const m=y=>{s.current&&!s.current.contains(y.target)&&r()};return window.addEventListener("mousedown",m),()=>{window.removeEventListener("mousedown",m)}},[r]);const g=m=>{if((m.key==="Escape"||m.key==="Esc")&&(m.stopPropagation(),r()),m.key==="ArrowDown"||m.key==="Down"){if(m.stopPropagation(),m.preventDefault(),d.length===0)return;if(u===-1&&!a){l(!0);return}const y=u+1;y>d.length-1?(f(-1),l(!0)):(f(y),l(!1))}if(m.key==="ArrowUp"||m.key==="Up"){if(m.stopPropagation(),m.preventDefault(),d.length===0)return;if(a){f(d.length-1),l(!1);return}const y=u-1;y<0?(f(-1),l(!0)):(f(y),l(!1))}m.key==="Enter"&&(a?(m.stopPropagation(),m.preventDefault(),n()):u>-1&&(m.stopPropagation(),m.preventDefault(),i(d[u].name)))};return k.jsxs("div",{ref:s,onClick:m=>m.stopPropagation(),children:[k.jsx(zCe,{value:t,onChange:e,onClear:r,onKeyDown:g}),!!t&&k.jsx(RCe,{activeMenuItem:u,isCreateButtonActive:a,snippets:d,value:t,onCreateSnippet:n,onUpdateSnippet:i})]})}EB.propTypes={value:P.string,onChange:P.func,onCreateSnippet:P.func,onReplaceSnippet:P.func,onClose:P.func,suggestedList:P.arrayOf(P.shape({name:P.string.isRequired,value:P.string.isRequired}))};function Kn({onClose:t,...e}){const{cardConfig:{snippets:n,createSnippet:i},darkMode:r}=T.useContext(ft),[o]=Oe.useLexicalComposerContext(),{selectedCardKey:s}=zc(),[a,l]=T.useState(""),u=d=>{l(d.target.value)},f=d=>{o.update(()=>{if(s){const h=A.$createNodeSelection();h.add(s);const g=Ac.$generateJSONFromSelectedNodes(o,h);i({name:d,value:JSON.stringify(g)}),o.dispatchCommand(Nu,{cardKey:s})}else{const h=A.$getSelection(),g=Ac.$generateJSONFromSelectedNodes(o,h);i({name:d,value:JSON.stringify(g)})}t==null||t(),o.getRootElement().focus()})};return k.jsx(EB,{darkMode:r,snippets:n,value:a,onChange:u,onClose:t,onCreateSnippet:()=>f(a),onUpdateSnippet:d=>f(d),...e})}const BCe=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"m14.2 4.3 5.5 5.5m-11 11L1 23l2.2-7.7L16.856 1.644a2.2 2.2 0 0 1 3.11 0l2.39 2.39a2.2 2.2 0 0 1 0 3.11L8.7 20.8Z"})),WCe=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1.373 13.33A2.528 2.528 0 0 1 1 12c0-.476.13-.94.373-1.33C2.946 8.163 6.819 3 12 3c5.181 0 9.054 5.164 10.627 7.67.243.39.373.854.373 1.33 0 .476-.13.94-.373 1.33C21.054 15.837 17.181 21 12 21c-5.181 0-9.054-5.164-10.627-7.67Z"}),J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z"})),HCe=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1 12h8v10H1V12Zm0 0C1 5 2.75 3.344 6 2m8 10h8m-8 0v10h4m-4-10c0-7 1.75-8.656 5-10m1.7 14.4 1.75-1.4h.35v7"})),QCe=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 25 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1 12h8v10H1V12Zm0 0C1 5 2.75 3.344 6 2m8 10h8m-8 0v10h2m-2-10c0-7 1.75-8.656 5-10m.5 13.583c.517-.311 1.275-.559 1.878-.583 1.195 0 2.22.512 2.22 1.878-.015 2.205-4.098 4.78-4.098 4.78V22h4.098"})),Kc=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1.917 5.583h20.166m-8.02-3.666H9.936a1.375 1.375 0 0 0-1.374 1.375v2.291h6.874V3.292a1.375 1.375 0 0 0-1.374-1.375ZM9.938 17.27v-6.874m4.125 6.874v-6.874"}),J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M18.288 20.818a1.366 1.366 0 0 1-1.366 1.265H7.077a1.366 1.366 0 0 1-1.365-1.265L4.438 5.583h15.125l-1.275 15.235Z"})),zy=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1 21.094 3.913 24 17 10.906 14.125 8 1 21.094ZM11 11l3 3M5.25 4.25a2.5 2.5 0 0 0 2.5-2.5 2.5 2.5 0 0 0 2.5 2.5 2.5 2.5 0 0 0-2.5 2.5 2.5 2.5 0 0 0-2.5-2.5Zm12 0a2.5 2.5 0 0 0 2.5-2.5 2.5 2.5 0 0 0 2.5 2.5 2.5 2.5 0 0 0-2.5 2.5 2.5 2.5 0 0 0-2.5-2.5Zm0 11.99a2.5 2.5 0 0 0 2.5-2.5 2.5 2.5 0 0 0 2.5 2.5 2.5 2.5 0 0 0-2.5 2.5 2.5 2.5 0 0 0-2.5-2.5Z"}));function Cu({label:t,shortcutKeys:e}){return k.jsxs("div",{className:`invisible absolute -top-8 left-1/2 z-[1000] flex -translate-x-1/2 items-center gap-1 whitespace-nowrap rounded-md bg-black py-1 font-sans text-2xs font-medium text-white group-hover:visible dark:bg-grey-900 ${e?"pl-[1rem] pr-1":"px-[1rem]"}`,children:[k.jsx("span",{children:t}),e&&e.map(n=>k.jsx("div",{className:"rounded bg-grey-900 px-2 text-2xs text-white dark:bg-grey-950",children:n},n))]})}const UCe={bold:V8,italic:t9,headingTwo:e9,headingThree:J8,quote:n9,quoteOne:HCe,quoteTwo:QCe,link:f_,imgRegular:Tp,imgWide:$p,imgFull:Ep,imgReplace:i9,add:Y8,edit:BCe,wand:zy,visibility:WCe,snippet:ov,remove:Kc};function Jn({children:t,hide:e,...n}){return e?null:k.jsx("ul",{className:"relative m-0 flex items-center justify-evenly gap-1 rounded-lg bg-white px-1 font-sans text-md font-normal text-black shadow-md dark:bg-grey-950",...n,children:t})}function at({label:t,isActive:e,onClick:n,icon:i,shortcutKeys:r,secondary:o,dataTestId:s,hide:a,...l}){if(a)return null;const u=UCe[i];return k.jsxs("li",{className:"group relative m-0 flex p-0 first:m-0",...l,children:[k.jsx("button",{"aria-label":t,className:`my-1 flex h-8 w-9 cursor-pointer items-center justify-center rounded-md transition hover:bg-grey-200/80 dark:bg-grey-950 dark:hover:bg-grey-900 ${e?"bg-grey-200/80":"bg-white"}`,"data-kg-active":e,"data-testid":s,type:"button",onClick:n,children:k.jsx(u,{className:`size-4 overflow-visible transition ${o?"stroke-2":"stroke-[2.5]"} ${e?"text-green-600 dark:text-green-600":"text-black dark:text-white"}`})}),k.jsx(Cu,{label:t,shortcutKeys:r})]})}function Bn({hide:t}){return t?null:k.jsx("li",{className:"m-0 w-px self-stretch bg-grey-300/80 dark:bg-grey-900"})}function ZCe({nodeKey:t,captionEditor:e,captionEditorInitialState:n,code:i,language:r}){const[o]=Oe.useLexicalComposerContext(),{isEditing:s,setEditing:a,isSelected:l}=T.useContext(rn),{cardConfig:u,darkMode:f}=T.useContext(ft),[d,h]=T.useState(!1),g=x=>{o.update(()=>{const _=A.$getNodeByKey(t);_.code=x})},m=x=>{o.update(()=>{const _=A.$getNodeByKey(t);_.language=x})},y=x=>{x.preventDefault(),x.stopPropagation(),a(!0)};return k.jsxs(k.Fragment,{children:[k.jsx(CB,{captionEditor:e,captionEditorInitialState:n,code:i,darkMode:f,handleToolbarEdit:y,isEditing:s,isSelected:l,language:r,nodeKey:t,updateCode:g,updateLanguage:m}),k.jsx(xt,{"data-kg-card-toolbar":"button",isVisible:d,children:k.jsx(Kn,{onClose:()=>h(!1)})}),k.jsx(xt,{"data-kg-card-toolbar":"button",isVisible:l&&!s,children:k.jsxs(Jn,{children:[k.jsx(at,{dataTestId:"edit-code-card",icon:"edit",isActive:!1,label:"Edit",onClick:y}),k.jsx(Bn,{hide:!u.createSnippet}),k.jsx(at,{dataTestId:"create-snippet",hide:!u.createSnippet,icon:"snippet",isActive:!1,label:"Save as snippet",onClick:()=>h(!0)})]})})]})}function qCe(t,e){const i=new DOMParser().parseFromString(e,"text/html");return Mn.$generateNodesFromDOM(t,i)}function TB({editor:t,initialHtml:e}){return e?t.update(()=>{const n=qCe(t,e);A.$getRoot().select(),A.$getRoot().clear(),A.$insertNodes(n),n.length&&A.$setSelection(null)},{discrete:!0,tag:"history-merge"}):t.update(()=>{A.$getRoot().append(A.$createParagraphNode())},{discrete:!0,tag:"history-merge"}),t.getEditorState()}const YCe=JSON.stringify({root:{children:[{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1}],direction:null,format:"",indent:0,type:"root",version:1}});function vi(t,e,{editor:n,initialEditorState:i=YCe,nodes:r=Qi}={}){if(n)t[e]=n;else{t[e]=A.createEditor({nodes:r});const o=t[e].parseEditorState(i);t[e].setEditorState(o,{tag:"history-merge"})}}function bi(t,e,n){if(!n)return;const i=t[e],r=TB({editor:i,initialHtml:n});i.setEditorState(r,{tag:"history-merge"}),t[`${e}InitialState`]=r}A.createCommand();class By extends Rg{constructor(n={},i){super(n,i);ye(this,"__openInEditMode",!1);ye(this,"__captionEditor");ye(this,"__captionEditorInitialState");const{_openInEditMode:r}=n;this.__openInEditMode=r||!1,vi(this,"__captionEditor",{editor:n.captionEditor,nodes:Qi}),!n.captionEditor&&n.caption&&bi(this,"__captionEditor",`${n.caption}`)}getIcon(){return Eke}clearOpenInEditMode(){const n=this.getWritable();n.__openInEditMode=!1}getDataset(){const n=super.getDataset(),i=this.getLatest();return n.captionEditor=i.__captionEditor,n.captionEditorInitialState=i.__captionEditorInitialState,n}exportJSON(){const n=super.exportJSON();return this.__captionEditor&&this.__captionEditor.getEditorState().read(()=>{const i=Mn.$generateHtmlFromNodes(this.__captionEditor,null),r=si(i);n.caption=r}),n}decorate(){return k.jsx(An,{nodeKey:this.getKey(),wrapperStyle:"code-card",children:k.jsx(ZCe,{captionEditor:this.__captionEditor,captionEditorInitialState:this.__captionEditorInitialState,code:this.code,language:this.language,nodeKey:this.getKey()})})}}function KC(t){return new By(t)}function VCe(t){return t instanceof By}const XCe=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",...t},J.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M22.525 29 3 3h6.475L29 29h-6.475Zm5.557-26L17.789 14.075M3.918 29l10.285-11.067"}));var cl={},$B=ut,fl=A;let GCe=new Set(["http:","https:","mailto:","sms:","tel:"]),Wy=class Mee extends fl.ElementNode{static getType(){return"link"}static clone(e){return new Mee(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,n={},i){super(i);let{target:r=null,rel:o=null,title:s=null}=n;this.__url=e,this.__target=r,this.__rel=o,this.__title=s}createDOM(e){let n=document.createElement("a");return n.href=this.sanitizeUrl(this.__url),this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),this.__title!==null&&(n.title=this.__title),$B.addClassNamesToElement(n,e.theme.link),n}updateDOM(e,n){let i=this.__url,r=this.__target,o=this.__rel,s=this.__title;return i!==e.__url&&(n.href=i),r!==e.__target&&(r?n.target=r:n.removeAttribute("target")),o!==e.__rel&&(o?n.rel=o:n.removeAttribute("rel")),s!==e.__title&&(s?n.title=s:n.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:KCe,priority:1})}}static importJSON(e){let n=e0(e.url,{rel:e.rel,target:e.target,title:e.title});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}sanitizeUrl(e){try{let n=new URL(e);if(!GCe.has(n.protocol))return"about:blank"}catch{}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,n=!0){return e=e0(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),this.insertAfter(e,n),e}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n){if(!fl.$isRangeSelection(n))return!1;e=n.anchor.getNode();let i=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(i)&&0{if(o=o.getParent(),bh(o)){let s=o.getChildren();for(let a=0;a{var l=a.getParent();if(l!==s&&l!==null&&(!fl.$isElementNode(a)||a.isInline()))if(bh(l))s=l,l.setURL(t),n!==void 0&&l.setTarget(n),r!==null&&s.setRel(r),i!==void 0&&s.setTitle(i);else if(l.is(o)||(o=l,s=e0(t,{rel:r,target:n,title:i}),bh(l)?a.getPreviousSibling()===null?l.insertBefore(s):l.insertAfter(s):a.insertBefore(s)),bh(a)){if(!a.is(s)){if(s!==null){l=a.getChildren();for(let u=0;uut.mergeRegister(n.registerCommand(A.KEY_ENTER_COMMAND,i=>(e(i),!1),A.COMMAND_PRIORITY_LOW)),[n,e,t])}function MB({dataTestId:t,value:e,placeholder:n,handleUrlChange:i,handleUrlSubmit:r,hasError:o,handlePasteAsLink:s,handleRetry:a,handleClose:l,isLoading:u}){return T.useEffect(()=>{const f=d=>{d.key==="Escape"&&l()};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[l]),u?k.jsx("div",{className:"flex w-full items-center justify-center rounded-md border border-grey-300 p-2 font-sans text-sm font-normal leading-snug text-grey-900 focus-visible:outline-none dark:border-grey-800 dark:bg-grey-900 dark:placeholder:text-grey-800","data-testid":`${t}-loading-container`,children:k.jsx("div",{className:"-ml-1 mr-3 inline-block size-5 animate-spin rounded-full border-4 border-green/20 text-white after:mt-[11px] after:block after:size-1 after:rounded-full after:bg-green/70 after:content-['']","data-testid":`${t}-loading-spinner`})}):o?k.jsxs("div",{className:"min-width-[500px] flex flex-row items-center justify-between rounded-md border border-grey-300 px-3 py-2 text-sm font-normal leading-snug text-grey-900","data-testid":`${t}-error-container`,children:[k.jsxs("div",{children:[k.jsx("span",{className:"mr-3","data-testid":`${t}-error-message`,children:"Oops, that link didn't work."}),k.jsx("button",{className:"mr-3 cursor-pointer","data-testid":`${t}-error-retry`,type:"button",children:k.jsx("span",{className:"font-semibold underline",onClick:a,children:"Retry"})}),k.jsx("button",{className:"mr-3 cursor-pointer","data-testid":`${t}-error-pasteAsLink`,type:"button",children:k.jsx("span",{className:"font-semibold underline",onClick:()=>s(e),children:"Paste URL as link"})})]}),k.jsx("button",{className:"cursor-pointer p-1","data-testid":`${t}-error-close`,type:"button",onClick:l,children:k.jsx(vh,{className:"size-4 stroke-2 text-grey-400"})})]}):k.jsxs(k.Fragment,{children:[k.jsx(t6e,{value:e,onEnter:r}),k.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-grey-300 p-2 font-sans text-sm font-normal leading-snug text-grey-900 focus-visible:outline-none dark:border-grey-800 dark:bg-grey-950 dark:text-grey-100 dark:placeholder:text-grey-800","data-testid":t,placeholder:n,value:e,onChange:i,onKeyDown:r})]})}function n6e({children:t,waitBeforeShow:e=500}){const[n,i]=T.useState(e===0);return T.useEffect(()=>{if(n)return;const r=setTimeout(()=>{i(!0)},e);return()=>{clearTimeout(r)}},[n,e]),n?t:null}var i6e=$s,r6e=function(){return i6e.Date.now()},o6e=r6e,s6e=/\s/;function a6e(t){for(var e=t.length;e--&&s6e.test(t.charAt(e)););return e}var l6e=a6e,u6e=l6e,c6e=/^\s+/;function f6e(t){return t&&t.slice(0,u6e(t)+1).replace(c6e,"")}var d6e=f6e,h6e=Sd,p6e=Nc,g6e="[object Symbol]";function m6e(t){return typeof t=="symbol"||p6e(t)&&h6e(t)==g6e}var Hy=m6e,v6e=d6e,NB=Ya,b6e=Hy,AB=NaN,k6e=/^[-+]0x[0-9a-f]+$/i,y6e=/^0b[01]+$/i,w6e=/^0o[0-7]+$/i,x6e=parseInt;function _6e(t){if(typeof t=="number")return t;if(b6e(t))return AB;if(NB(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=NB(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=v6e(t);var n=y6e.test(t);return n||w6e.test(t)?x6e(t.slice(2),n?2:8):k6e.test(t)?AB:+t}var O6e=_6e,S6e=Ya,t6=o6e,PB=O6e,C6e="Expected a function",E6e=Math.max,T6e=Math.min;function $6e(t,e,n){var i,r,o,s,a,l,u=0,f=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(C6e);e=PB(e)||0,S6e(n)&&(f=!!n.leading,d="maxWait"in n,o=d?E6e(PB(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function g(M){var I=i,W=r;return i=r=void 0,u=M,s=t.apply(W,I),s}function m(M){return u=M,a=setTimeout(_,e),f?g(M):s}function y(M){var I=M-l,W=M-u,B=e-I;return d?T6e(B,o-W):B}function x(M){var I=M-l,W=M-u;return l===void 0||I>=e||I<0||d&&W>=o}function _(){var M=t6();if(x(M))return S(M);a=setTimeout(_,y(M))}function S(M){return a=void 0,h&&i?g(M):(i=r=void 0,s)}function C(){a!==void 0&&clearTimeout(a),u=0,i=l=r=a=void 0}function E(){return a===void 0?s:S(t6())}function N(){var M=t6(),I=x(M);if(i=arguments,r=this,l=M,I){if(a===void 0)return m(l);if(d)return clearTimeout(a),a=setTimeout(_,e),g(l)}return a===void 0&&(a=setTimeout(_,e)),s}return N.cancel=C,N.flush=E,N}var DB=$6e;const kh=xo(DB);function n6({dataTestId:t,className:e="z-[-1] max-h-[30vh] w-full overflow-y-auto bg-white shadow rounded-lg dark:border-grey-800 dark:bg-grey-900",placementTopClass:n="-top-0.5 -translate-y-full",placementBottomClass:i="mt-0.5",children:r,...o}){const s=T.useRef(null),[a,l]=T.useState("bottom"),u=()=>{if(!s||!s.current)return;const d=s.current.parentNode.getBoundingClientRect().bottom;window.innerHeight-d{u()},[]),T.useEffect(()=>{const f=kh(()=>{u()},250);return window.addEventListener("resize",f,{passive:!0}),()=>{window.removeEventListener("resize",f,{passive:!0})}},[]),k.jsx("ul",{ref:s,className:nt("absolute",a==="top"&&n,a==="bottom"&&i,e),"data-testid":`${t}-dropdown`,...o,children:r})}const M6e="h-9 rounded-lg border border-grey-100 bg-grey-100 dark:bg-grey-900 dark:border-transparent dark:focus:border-green dark:hover:bg-grey-925 dark:focus:bg-grey-925 transition-colors px-3 py-1.5 font-sans text-sm font-normal text-grey-900 focus:border-green focus:bg-white focus:shadow-[0_0_0_2px_rgba(48,207,67,.25)] focus-visible:outline-none dark:text-white dark:selection:bg-grey-800 placeholder:text-grey-500 md:h-[38px] md:py-2 dark:placeholder:text-grey-700";function i6({autoFocus:t,className:e,dataTestId:n,value:i,onChange:r,...o}){const s=T.useRef(null),a=T.useRef(t),[l,u]=T.useState(i),f=T.useCallback(d=>{u(d.target.value),r&&r(d)},[r]);return T.useEffect(()=>{if(u(i),a.current){const d=setTimeout(()=>{s.current&&(a.current=!1,s.current.focus())},0);return()=>clearTimeout(d)}},[i]),k.jsx(k.Fragment,{children:k.jsx("div",{className:"relative",children:k.jsx("input",{ref:s,autoFocus:t,className:`relative w-full ${e||M6e}`,"data-testid":n,value:l,onChange:f,...o})})})}function r6({items:t,getItem:e,onSelect:n,defaultSelected:i}){const r=Math.max(0,t.findIndex(l=>l===i)),[o,s]=T.useState(r);T.useEffect(()=>{o>=t.length&&s(r)},[t,o,r]),T.useEffect(()=>{s(r)},[r]);const a=T.useCallback(l=>{l.key==="ArrowDown"&&(l.preventDefault(),l.stopPropagation(),s(u=>Math.min(u+1,t.length-1))),l.key==="ArrowUp"&&(l.preventDefault(),l.stopPropagation(),s(u=>Math.max(u-1,0))),l.key==="Enter"&&(l.preventDefault(),l.stopPropagation(),n(t[o]))},[t,o,n]);return T.useEffect(()=>(window.addEventListener("keydown",a,{capture:!0}),()=>{window.removeEventListener("keydown",a,{capture:!0})}),[a]),k.jsx(k.Fragment,{children:t.map((l,u)=>e(l,u===o))})}const N6e=({children:t})=>k.jsx(k.Fragment,{children:t});function o6({groups:t,getItem:e,getGroup:n,onSelect:i,defaultSelected:r,isLoading:o}){const s=t.flatMap(g=>g.items),a=Math.max(0,s.findIndex(g=>g===r)),[l,u]=T.useState(a),[f,d]=T.useState(!1);T.useEffect(()=>{l>=s.length&&u(a)},[s,l,a]),T.useEffect(()=>{u(a)},[a]);const h=T.useCallback(g=>{g.key==="ArrowDown"&&(g.preventDefault(),g.stopPropagation(),u(m=>Math.min(m+1,s.length-1)),d(!0)),g.key==="ArrowUp"&&(g.preventDefault(),g.stopPropagation(),u(m=>Math.max(m-1,0)),d(!0)),g.key==="Enter"&&(g.preventDefault(),g.stopPropagation(),i(s[l]))},[s,l,i]);return T.useEffect(()=>(window.addEventListener("keydown",h,{capture:!0}),()=>{window.removeEventListener("keydown",h,{capture:!0})}),[h]),k.jsx(k.Fragment,{children:t.map((g,m)=>k.jsxs(N6e,{children:[n(g,{showSpinner:m===0&&o}),(g.items||[]).map((y,x)=>{const S=t.slice(0,m).reduce((N,M)=>N+M.items.length,0)+x,C=S===l&&!!y.value;return e(y,C,()=>{y.value&&u(S),d(!1)},f)})]},g.label))})}function IB({size:t}){let e="";switch(t){case"mini":e="h-3 w-3";break;default:e="h-5 w-5";break}return k.jsx("div",{className:"","data-testid":"spinner",children:k.jsxs("svg",{className:`${e} animate-spin text-grey-500 dark:text-grey-200`,fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",style:{opacity:"0.3"}}),k.jsx("path",{d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",fill:"currentColor"})]})})}IB.propTypes={colorClass:P.string,size:P.string};function LB({dataTestId:t}){return k.jsx(n6e,{children:k.jsx("li",{className:"mb-0 px-4 py-2 text-left","data-testid":`${t}-loading`,children:k.jsx("span",{className:"block text-sm font-medium leading-tight text-grey-900 dark:text-white",children:"Searching..."})})})}function RB({dataTestId:t,item:e,selected:n,onClick:i,onMouseOver:r,scrollIntoView:o,className:s,selectedClassName:a,children:l}){const u=T.useRef(null);T.useEffect(()=>{n&&o&&u.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[n,o]);const f=h=>{h.preventDefault(),i(e)},d=e.value?"":"pointer-events-none";return k.jsx("li",{ref:u,"aria-selected":n,className:`${n?a:""} ${d} ${s}`,"data-testid":`${t}-listOption`,role:"option",onMouseDownCapture:f,onMouseOver:r,children:l})}function s6({dataTestId:t,group:e,showSpinner:n}){return k.jsx("li",{className:"mb-0 mt-2 flex items-center justify-between border-t border-grey-200 px-4 pb-2 pt-3 text-[1.1rem] font-semibold uppercase tracking-wide text-grey-600 first-of-type:mt-0 first-of-type:border-t-0 dark:border-grey-900","data-testid":`${t}-listGroup`,children:k.jsxs("div",{className:"flex items-center gap-1.5",children:[e.label,n&&k.jsx("span",{className:"ml-px","data-testid":"input-list-spinner",children:k.jsx(IB,{size:"mini"})})]})})}function A6e(){throw new Error(" getItem function prop must be provided")}function jB({autoFocus:t,className:e,inputClassName:n,dropdownClassName:i,dropdownPlacementBottomClass:r,dropdownPlacementTopClass:o,dataTestId:s,listOptions:a,isLoading:l,value:u,placeholder:f,onChange:d,onSelect:h,getItem:g=A6e}){var W;const[m,y]=T.useState(!1),x=()=>{y(!0)},_=()=>{y(!1)},S=(B,{showSpinner:Z}={})=>k.jsx(s6,{dataTestId:s,group:B,showSpinner:Z},B.label),C=B=>{d(B.target.value)},E=B=>{(h||d)(B.value,B.type)},N=a&&((W=a[0])==null?void 0:W.items),M=(l||a&&!!a.length)&&m,I=()=>k.jsxs(n6,{className:i,dataTestId:s,placementBottomClass:r,placementTopClass:o,children:[l&&!(a!=null&&a.length)&&k.jsx(LB,{dataTestId:s}),N?k.jsx(o6,{getGroup:S,getItem:g,groups:a,isLoading:l,onSelect:E}):k.jsx(r6,{getItem:g,items:a,onSelect:E})]});return k.jsx(k.Fragment,{children:k.jsxs("div",{className:`relative z-0 ${e||""}`,children:[k.jsx(i6,{autoFocus:t,className:n,dataTestId:s,placeholder:f,value:u,onBlur:_,onChange:C,onFocus:x}),M&&k.jsx(I,{})]})})}var FB=Od,P6e=jA,D6e=Va,I6e=Hy,zB=FB?FB.prototype:void 0,BB=zB?zB.toString:void 0;function WB(t){if(typeof t=="string")return t;if(D6e(t))return P6e(t,WB)+"";if(I6e(t))return BB?BB.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var L6e=WB,R6e=L6e;function j6e(t){return t==null?"":R6e(t)}var Qy=j6e,F6e=Qy,HB=/[\\^$.*+?()[\]{}|]/g,z6e=RegExp(HB.source);function B6e(t){return t=F6e(t),t&&z6e.test(t)?t.replace(HB,"\\$&"):t}var W6e=B6e;const H6e=xo(W6e);function Q6e({string:t,highlightString:e,shouldHighlight:n=!0}){if(!e||n===!1)return t;const i=t.split(new RegExp(`(${H6e(e)})`,"gi"));return k.jsx(k.Fragment,{children:i.map((r,o)=>r.toLowerCase()===e.toLowerCase()?k.jsx("span",{className:"font-bold",children:r},o):r)})}function a6({dataTestId:t,item:e,highlightString:n,selected:i,onMouseOver:r,scrollIntoView:o,onClick:s}){return k.jsxs(RB,{className:"my-[.2rem] flex cursor-pointer items-center justify-between gap-3 rounded-md px-4 py-2 text-left text-black dark:text-white",dataTestId:t,item:e,scrollIntoView:o,selected:i,selectedClassName:"bg-grey-100 dark:bg-grey-900",onClick:s,onMouseOver:r,children:[k.jsxs("span",{className:"line-clamp-1 flex items-center gap-[.6rem]",children:[e.Icon&&k.jsx(e.Icon,{className:"size-[1.4rem] stroke-[1.5px]"}),k.jsx("span",{className:"block truncate text-sm font-medium leading-snug","data-testid":`${t}-listOption-label`,children:k.jsx(Q6e,{highlightString:n,shouldHighlight:e.highlight,string:e.label})})]}),i&&(e.metaText||e.MetaIcon)&&k.jsxs("span",{className:"flex shrink-0 items-center gap-[.6rem] text-[1.3rem] leading-snug tracking-tight text-grey-600 dark:text-grey-500","data-testid":`${t}-listOption-meta`,children:[k.jsx("span",{title:e.metaIconTitle,children:e.MetaIcon&&k.jsx(e.MetaIcon,{className:"size-[1.4rem]"})}),e.metaText&&k.jsx("span",{children:e.metaText})]})]})}const QB=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},J.createElement("g",null,J.createElement("path",{d:"M0.75 12a11.25 11.25 0 1 0 22.5 0 11.25 11.25 0 1 0 -22.5 0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),J.createElement("path",{d:"M9.88 23.05c-1.57 -2.2 -2.63 -6.33 -2.63 -11S8.31 3.15 9.88 1",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),J.createElement("path",{d:"M14.12 23.05c1.57 -2.2 2.63 -6.33 2.63 -11S15.69 3.15 14.12 1",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),J.createElement("path",{d:"m0.75 12 22.5 0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),J.createElement("path",{d:"m2.05 17.25 19.9 0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),J.createElement("path",{d:"m2.05 6.75 19.9 0",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}))),U6e=100,UB=/^http|^#|^\/|^mailto:|^tel:/;function Z6e(t){return[{label:"Link to web page",items:[{label:t,value:t,Icon:QB,highlight:!1,type:"url"}]}]}function q6e(t){return[{label:"Link to web page",items:[{label:"Enter URL to create link",value:null,Icon:QB,highlight:!1,type:"no-results"}]}]}function ZB(t,{noResultOptions:e,type:n}={}){return!t||!t.length?(e||q6e)():t.map(i=>{const r=i.items.map(o=>({label:o.title,value:o.url,Icon:o.Icon,metaText:o.metaText,MetaIcon:o.MetaIcon,metaIconTitle:o.metaIconTitle,type:n||"internal"}));return{...i,items:r}})}const l6=(t,e,{noResultOptions:n}={})=>{const[i,r]=T.useState([]),[o,s]=T.useState([]),[a,l]=T.useState(!1),u=T.useMemo(()=>async function(g){if(UB.test(g)){s(Z6e(g));return}l(!0);const m=await e(g);m!==void 0&&(s(ZB(m,{noResultOptions:n})),l(!1))},[e,n]),f=T.useMemo(()=>kh(u,U6e),[u]);return T.useEffect(()=>{(async()=>{!t&&l(!0);const g=await e();r(ZB(g,{type:"default"})),!t&&l(!1)})().catch(console.error)},[]),T.useEffect(()=>{UB.test(t)?(f.cancel(),u(t)):f(t)},[t,u,f]),{isSearching:a,listOptions:t?o:i}};function Y6e({dataTestId:t,value:e,placeholder:n,handleUrlChange:i,handleUrlSubmit:r,hasError:o,handlePasteAsLink:s,handleRetry:a,handleClose:l,isLoading:u,searchLinks:f}){const{isSearching:d,listOptions:h}=l6(e,f);if(T.useEffect(()=>{e||ui("Link dropdown: Opened",{context:"bookmark"})},[]),T.useEffect(()=>{const _=S=>{S.key==="Escape"&&l()};return window.addEventListener("keydown",_),()=>{window.removeEventListener("keydown",_)}},[l]),u)return k.jsx("div",{className:"flex w-full items-center justify-center rounded-md border border-grey-300 p-2 font-sans text-sm font-normal leading-snug text-grey-900 focus-visible:outline-none dark:border-grey-800 dark:bg-grey-900 dark:placeholder:text-grey-800","data-testid":`${t}-loading-container`,children:k.jsx("div",{className:"-ml-1 mr-3 inline-block size-5 animate-spin rounded-full border-4 border-green/20 text-white after:mt-[11px] after:block after:size-1 after:rounded-full after:bg-green/70 after:content-['']","data-testid":`${t}-loading-spinner`})});if(o)return k.jsxs("div",{className:"min-width-[500px] flex flex-row items-center justify-between rounded-md border border-grey-300 px-3 py-2 text-sm font-normal leading-snug text-grey-900","data-testid":`${t}-error-container`,children:[k.jsxs("div",{children:[k.jsx("span",{className:"mr-3","data-testid":`${t}-error-message`,children:"Oops, that link didn't work."}),k.jsx("button",{className:"mr-3 cursor-pointer","data-testid":`${t}-error-retry`,type:"button",children:k.jsx("span",{className:"font-semibold underline",onClick:a,children:"Retry"})}),k.jsx("button",{className:"mr-3 cursor-pointer","data-testid":`${t}-error-pasteAsLink`,type:"button",children:k.jsx("span",{className:"font-semibold underline",onClick:()=>s(e),children:"Paste URL as link"})})]}),k.jsx("button",{className:"cursor-pointer p-1","data-testid":`${t}-error-close`,type:"button",onClick:l,children:k.jsx(vh,{className:"size-4 stroke-2 text-grey-400"})})]});const g=async _=>{i(_)},m=(_,S)=>{if(_===null)return;const C=_&&typeof _=="string"?_:_.value;r(C,S)},y=_=>{!_.isComposing&&_.key==="Enter"&&(_.preventDefault(),r(_.target.value))},x=(_,S,C,E)=>k.jsx(a6,{dataTestId:t,highlightString:e,item:_,scrollIntoView:E,selected:S,onClick:m,onMouseOver:C},_.value);return k.jsx("div",{className:"not-kg-prose",onKeyDown:y,children:k.jsx(jB,{autoFocus:!0,dataTestId:t,dropdownClassName:"z-[-1] max-h-[30vh] w-full overflow-y-auto bg-white px-2 py-1 shadow-md dark:bg-grey-950",dropdownPlacementBottomClass:"mt-[.6rem] rounded-md",dropdownPlacementTopClass:"top-[-.6rem] -translate-y-full rounded-md",getItem:x,inputClassName:"w-full rounded-md border border-grey-300 p-2 font-sans text-sm font-normal leading-snug text-grey-900 placeholder:text-grey-500 focus-visible:outline-none dark:border-grey-800 dark:bg-grey-950 dark:text-grey-100 dark:placeholder:text-grey-800",isLoading:d,listOptions:h,placeholder:n,value:e,onChange:g,onSelect:m})})}function qB({author:t,handleClose:e,handlePasteAsLink:n,handleRetry:i,handleUrlChange:r,handleUrlSubmit:o,url:s,urlInputValue:a,urlPlaceholder:l,thumbnail:u,title:f,description:d,icon:h,publisher:g,captionEditor:m,captionEditorInitialState:y,isSelected:x,isLoading:_,urlError:S,searchLinks:C}){const[E,N]=T.useState(!0),M=()=>{N(!1)};return s&&!S&&f?k.jsxs("div",{children:[k.jsxs("div",{className:"not-kg-prose relative flex min-h-[120px] w-full rounded-md border border-grey/40 bg-transparent font-sans dark:border-grey/20","data-testid":"bookmark-container",children:[k.jsxs("div",{className:"flex grow basis-full flex-col items-start justify-start p-5","data-testid":"bookmark-text-container",children:[k.jsx("div",{className:"text-[1.5rem] font-semibold leading-normal tracking-normal text-grey-900 dark:text-grey-100","data-testid":"bookmark-title",children:f}),k.jsx("div",{className:"mt-1 line-clamp-2 max-h-[44px] overflow-y-hidden text-sm font-normal leading-normal text-grey-800 dark:text-grey-600","data-testid":"bookmark-description",children:d}),k.jsxs("div",{className:"mt-[20px] flex items-center text-sm font-medium leading-9 text-grey-900",children:[h&&k.jsx(YB,{src:h}),k.jsx("span",{className:" db max-w-[240px] truncate leading-6 text-grey-900 dark:text-grey-100","data-testid":"bookmark-publisher",children:g}),t&&k.jsx("span",{className:"font-normal text-grey-800 before:mx-1.5 before:text-grey-900 before:content-['•'] dark:text-grey-600 dark:before:text-grey-100","data-testid":"bookmark-author",children:t})]})]}),u&&E&&k.jsx("div",{className:"grow-1 relative m-0 min-w-[33%]","data-testid":"bookmark-thumbnail-container",children:k.jsx("img",{alt:"",className:"absolute inset-0 size-full rounded-r-[.5rem] object-cover","data-testid":"bookmark-thumbnail",src:u,onError:M})}),k.jsx("div",{className:"absolute inset-0 z-50 mt-0"})]}),k.jsx(dh,{captionEditor:m,captionEditorInitialState:y,captionPlaceholder:"Type caption for bookmark (optional)",dataTestId:"bookmark-caption",isSelected:x})]}):typeof C=="function"?k.jsx(Y6e,{dataTestId:"bookmark-url",handleClose:e,handlePasteAsLink:n,handleRetry:i,handleUrlChange:r,handleUrlSubmit:o,hasError:S,isLoading:_,placeholder:l,searchLinks:C,value:a}):k.jsx(MB,{dataTestId:"bookmark-url",handleClose:e,handlePasteAsLink:n,handleRetry:i,handleUrlChange:r,handleUrlSubmit:o,hasError:S,isLoading:_,placeholder:l,value:a})}function YB({src:t}){return k.jsx("img",{alt:"",className:"mr-2 size-5 shrink-0","data-testid":"bookmark-icon",src:t})}qB.propTypes={author:P.string,handleClose:P.func,handlePasteAsLink:P.func,handleRetry:P.func,handleUrlChange:P.func,handleUrlSubmit:P.func,url:P.string,urlInputValue:P.string,urlPlaceholder:P.string,thumbnail:P.string,title:P.string,description:P.string,icon:P.string,publisher:P.string,captionEditor:P.object,captionEditorInitialState:P.object,isSelected:P.bool,isLoading:P.bool,urlError:P.bool,searchLinks:P.func},YB.propTypes={src:P.string};function u6(t,e){if(!t||!e)return!1;try{const n=new URL(t),i=`/${new URL(e).pathname.split("/")[1]}`;return n.hostname===new URL(e).hostname&&n.pathname.startsWith(i)}catch{return!1}}function V6e({author:t,nodeKey:e,url:n,icon:i,title:r,description:o,publisher:s,thumbnail:a,captionEditor:l,captionEditorInitialState:u,createdWithUrl:f}){const[d]=Oe.useLexicalComposerContext(),{cardConfig:h}=T.useContext(ft),{isSelected:g}=T.useContext(rn),[m,y]=T.useState(n),[x,_]=T.useState(!1),[S,C]=T.useState(!1),[E,N]=T.useState(!1),M=H=>{if(typeof H=="string"){y(H);return}y(H.target.value)},I=async(H,j)=>{if(H){if(typeof H=="string"){if((j==="internal"||j==="default")&&ui("Link dropdown: Internal link chosen",{context:"bookmark",fromLatest:j==="default"}),j==="url"){const q=u6(H,h==null?void 0:h.siteUrl)?"internal":"external";ui("Link dropdown: URL entered",{context:"bookmark",target:q})}R(H)}(H==null?void 0:H.key)==="Enter"&&R(H.target.value)}},W=async()=>{C(!1)},B=T.useCallback(()=>{d.update(()=>{const H=A.$getNodeByKey(e),j=A.$createParagraphNode().append(ki.$createLinkNode(m).append(A.$createTextNode(m)));H.replace(j),j.selectEnd()})},[d,e,m]),Z=T.useCallback(()=>{d.update(()=>{const H=A.$getNodeByKey(e),j=H.getNextSibling();if(j&&A.$isParagraphNode(j)&&j.getTextContentSize()===0)H.remove(),j.selectEnd();else{const q=A.$createParagraphNode();H.replace(q),q.selectEnd()}})},[d,e]),R=async H=>{d.getRootElement().focus({preventScroll:!0}),_(!0);let j;try{j=await h.fetchEmbed(H,{type:"bookmark"})}catch{_(!1),C(!0);return}d.update(()=>{const q=A.$getNodeByKey(e);q.url=H,q.author=j.metadata.author,q.icon=j.metadata.icon,q.title=j.metadata.title,q.description=j.metadata.description,q.publisher=j.metadata.publisher,q.thumbnail=j.metadata.thumbnail}),_(!1)},Q=T.useCallback(async()=>{_(!0);let H;try{H=await h.fetchEmbed(n,{type:"bookmark"})}catch{_(!1),C(!0);return}d.update(()=>{const j=A.$getNodeByKey(e);j.url=H.url,j.author=H.metadata.author,j.icon=H.metadata.icon,j.title=H.metadata.title,j.description=H.metadata.description,j.publisher=H.metadata.publisher,j.thumbnail=H.metadata.thumbnail,f&&j.selectNext()}),_(!1)},[]);T.useEffect(()=>{if(f){y(n);try{Q(n)}catch{B(n)}}},[]);const V=typeof(h==null?void 0:h.searchLinks)=="function";return k.jsxs(k.Fragment,{children:[k.jsx(qB,{author:t,captionEditor:l,captionEditorInitialState:u,description:o,handleClose:Z,handlePasteAsLink:B,handleRetry:W,handleUrlChange:M,handleUrlSubmit:I,icon:i,isLoading:x,isSelected:g,publisher:s,searchLinks:h==null?void 0:h.searchLinks,thumbnail:a,title:r,url:n,urlError:S,urlInputValue:m,urlPlaceholder:V?"Paste URL or search posts and pages...":"Paste URL to add bookmark content..."}),k.jsx(xt,{"data-kg-card-toolbar":"bookmark",isVisible:E,children:k.jsx(Kn,{onClose:()=>N(!1)})}),k.jsx(xt,{"data-kg-card-toolbar":"bookmark",isVisible:r&&g&&!E&&h.createSnippet,children:k.jsx(Jn,{children:k.jsx(at,{dataTestId:"create-snippet",hide:!h.createSnippet,icon:"snippet",isActive:!1,label:"Save as snippet",onClick:()=>N(!0)})})})]})}const VB=A.createCommand();class Uy extends Vg{constructor(n={},i){super(n,i);ye(this,"__captionEditor");ye(this,"__captionEditorInitialState");ye(this,"__createdWithUrl");this.__createdWithUrl=!!n.url&&!n.metadata,vi(this,"__captionEditor",{editor:n.captionEditor,nodes:Qi}),!n.captionEditor&&n.caption&&bi(this,"__captionEditor",`${n.caption}`)}getIcon(){return t_}getDataset(){const n=super.getDataset(),i=this.getLatest();return n.captionEditor=i.__captionEditor,n.captionEditorInitialState=i.__captionEditorInitialState,n}exportJSON(){const n=super.exportJSON();return this.__captionEditor&&this.__captionEditor.getEditorState().read(()=>{const i=Mn.$generateHtmlFromNodes(this.__captionEditor,null),r=si(i);n.caption=r}),n}decorate(){return k.jsx(An,{nodeKey:this.getKey(),children:k.jsx(V6e,{author:this.author,captionEditor:this.__captionEditor,captionEditorInitialState:this.__captionEditorInitialState,createdWithUrl:this.__createdWithUrl,description:this.description,icon:this.icon,nodeKey:this.getKey(),publisher:this.publisher,thumbnail:this.thumbnail,title:this.title,url:this.url})})}}ye(Uy,"kgMenu",[{label:"Bookmark",desc:"Embed a link as a visual bookmark",Icon:t_,insertCommand:VB,matches:["bookmark"],queryParams:["url"],priority:4,shortcut:"/bookmark [url]"}]);const c6=t=>new Uy(t);function XB({captionEditor:t,captionEditorInitialState:e,html:n,isSelected:i,urlInputValue:r,urlPlaceholder:o,urlError:s,isLoading:a,handleUrlChange:l,handleUrlSubmit:u,handleRetry:f,handlePasteAsLink:d,handleClose:h}){return n?k.jsxs("div",{children:[k.jsxs("div",{className:"not-kg-prose relative",children:[k.jsx(GB,{dataTestId:"embed-iframe",html:n}),k.jsx("div",{className:"absolute inset-0 z-50 mt-0"})]}),k.jsx(dh,{captionEditor:t,captionEditorInitialState:e,captionPlaceholder:"Type caption for embed (optional)",dataTestId:"embed-caption",isSelected:i})]}):k.jsx(MB,{dataTestId:"embed-url",handleClose:h,handlePasteAsLink:d,handleRetry:f,handleUrlChange:l,handleUrlSubmit:u,hasError:s,isLoading:a,placeholder:o,value:r})}function GB({dataTestId:t,html:e}){const n=T.useRef(null),i=()=>{var u,f,d,h,g,m;const a=(d=(f=(u=n.current)==null?void 0:u.contentDocument)==null?void 0:f.body)==null?void 0:d.firstChild;if(!a)return;if(a.tagName==="IFRAME"){const y=a.getAttribute("width"),x=a.getAttribute("height");if(y&&x&&y.indexOf("%")===-1&&x.indexOf("%")===-1){const _=parseInt(y)/parseInt(x),S=n.current.offsetWidth/_;a.style.height=`${S}px`,n.current.style.height=`${S}px`,a.style.width="100%";return}if(x&&x.indexOf("%")===-1){n.current.style.height=`${x}px`;return}}const l=(m=(g=(h=n.current)==null?void 0:h.contentDocument)==null?void 0:g.scrollingElement)==null?void 0:m.scrollHeight;l&&(n.current.style.height=`${l}px`)},r={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},o=new MutationObserver(i),s=()=>{const a=n.current.contentDocument.body;a.style.display="flex",a.style.margin="0",a.style.justifyContent="center",i(),o.observe(n.current.contentWindow.document,r)};return T.useEffect(()=>{const a=new ResizeObserver(i);return a.observe(n.current),function(){a.disconnect(),o.disconnect()}},[]),k.jsx("iframe",{ref:n,className:"bn miw-100 w-full","data-testid":t,srcDoc:e,tabIndex:-1,title:"embed-card-iframe",onLoad:s})}XB.propTypes={html:P.string,isSelected:P.bool,urlInputValue:P.string,urlPlaceholder:P.string,urlError:P.bool,isLoading:P.bool,handleUrlChange:P.func,handleUrlSubmit:P.func,handleRetry:P.func,handlePasteAsLink:P.func,handleClose:P.func,captionEditor:P.object,captionEditorInitialState:P.object},GB.propTypes={dataTestId:P.string,html:P.string};function X6e({nodeKey:t,url:e,html:n,createdWithUrl:i,embedType:r,metadata:o,captionEditor:s,captionEditorInitialState:a}){const[l]=Oe.useLexicalComposerContext(),{cardConfig:u}=T.useContext(ft),{isSelected:f}=T.useContext(rn),[d,h]=T.useState(""),[g,m]=T.useState(!1),[y,x]=T.useState(!1),[_,S]=T.useState(!1),C=B=>{h(B.target.value)},E=async B=>{B.key==="Enter"&&W(B.target.value)},N=async()=>{x(!1)},M=T.useCallback(B=>{l.update(()=>{const Z=A.$getNodeByKey(t);if(!Z)return;const R=A.$createParagraphNode().append(ki.$createLinkNode(B).append(A.$createTextNode(B)));Z.replace(R),R.getNextSibling()||R.insertAfter(A.$createParagraphNode()),R.selectNext()})},[l,t]),I=T.useCallback(()=>{l.update(()=>{const B=A.$getNodeByKey(t),Z=B.getNextSibling();if(Z&&A.$isParagraphNode(Z)&&Z.getTextContentSize()===0)B.remove(),Z.selectEnd();else{const R=A.$createParagraphNode();B.replace(R),R.selectEnd()}})},[l,t]),W=async B=>{m(!0);let Z;try{if(Z=await u.fetchEmbed(B,{}),Z.type==="bookmark"){l.update(()=>{const R=A.$getNodeByKey(t),Q=c6({url:Z.url,metadata:Z.metadata});R.replace(Q)});return}}catch{if(i){m(!1),M(B);return}m(!1),x(!0);return}l.update(()=>{const R=A.$getNodeByKey(t);R.url=B,R.metadata=Z,R.embedType=Z.type,R.html=Z.html,i&&R.selectNext()}),m(!1)};return T.useEffect(()=>{if(i){h(e);try{W(e)}catch{M(e)}}},[]),k.jsxs(k.Fragment,{children:[k.jsx(XB,{captionEditor:s,captionEditorInitialState:a,handleClose:I,handlePasteAsLink:M,handleRetry:N,handleUrlChange:C,handleUrlSubmit:E,html:n,isLoading:g,isSelected:f,metadata:o,url:e,urlError:y,urlInputValue:d,urlPlaceholder:"Paste URL to add embedded content..."}),k.jsx(xt,{"data-kg-card-toolbar":"embed",isVisible:_,children:k.jsx(Kn,{onClose:()=>S(!1)})}),k.jsx(xt,{"data-kg-card-toolbar":"embed",isVisible:n&&f&&!_&&u.createSnippet,children:k.jsx(Jn,{children:k.jsx(at,{dataTestId:"create-snippet",hide:!u.createSnippet,icon:"snippet",isActive:!1,label:"Save as snippet",onClick:()=>S(!0)})})})]})}const Eu=A.createCommand();class Zy extends em{constructor(n={},i){super(n,i);ye(this,"__captionEditor");ye(this,"__captionEditorInitialState");ye(this,"__createdWithUrl");this.__createdWithUrl=!!n.url&&!n.html,vi(this,"__captionEditor",{editor:n.captionEditor,nodes:Qi}),!n.captionEditor&&n.caption&&bi(this,"__captionEditor",`${n.caption}`)}getIcon(){return h_}getDataset(){const n=super.getDataset(),i=this.getLatest();return n.captionEditor=i.__captionEditor,n.captionEditorInitialState=i.__captionEditorInitialState,n}exportJSON(){const n=super.exportJSON();return this.__captionEditor&&this.__captionEditor.getEditorState().read(()=>{const i=Mn.$generateHtmlFromNodes(this.__captionEditor,null),r=si(i);n.caption=r}),n}decorate(){return k.jsx(An,{nodeKey:this.getKey(),children:k.jsx(X6e,{captionEditor:this.__captionEditor,captionEditorInitialState:this.__captionEditorInitialState,createdWithUrl:this.__createdWithUrl,embedType:this.embedType,html:this.html,metadata:this.metadata,nodeKey:this.getKey(),url:this.url})})}}ye(Zy,"kgMenu",[{section:"Embeds",label:"Other...",desc:"/embed [url]",Icon:h_,insertCommand:Eu,matches:["embed"],queryParams:["url"],priority:100,shortcut:"/embed [url]"},{section:"Embeds",label:"YouTube",desc:"/youtube [video url]",Icon:u9,insertCommand:Eu,queryParams:["url"],matches:["youtube"],priority:1,shortcut:"/youtube [url]"},{section:"Embeds",label:"X (formerly Twitter)",desc:"/twitter [tweet url]",Icon:XCe,insertCommand:Eu,queryParams:["url"],matches:["twitter","x"],priority:2,shortcut:"/twitter [url]"},{section:"Embeds",label:"Vimeo",desc:"/vimeo [video url]",Icon:l9,insertCommand:Eu,queryParams:["url"],matches:["vimeo"],priority:4,shortcut:"/vimeo [url]"},{section:"Embeds",label:"CodePen",desc:"/codepen [pen url]",Icon:X8,insertCommand:Eu,queryParams:["url"],matches:["codepen"],priority:5,shortcut:"/codepen [url]"},{section:"Embeds",label:"Spotify",desc:"/spotify [track or playlist url]",Icon:s9,insertCommand:Eu,queryParams:["url"],matches:["spotify"],priority:6,shortcut:"/spotify [url]"},{section:"Embeds",label:"SoundCloud",desc:"/soundcloud [track or playlist url]",Icon:o9,insertCommand:Eu,queryParams:["url"],matches:["soundcloud"],priority:7,shortcut:"/soundcloud [url]"}]);const KB=t=>new Zy(t),G6e=({selectedNode:t,newNode:e})=>{const n=A.$isParagraphNode(t),i=t.getTextContent()==="";t.insertAfter(e),n&&i&&t.remove();const r=A.$createNodeSelection();if(r.add(e.getKey()),A.$setSelection(r),!e.getNextSibling()){const o=A.$createParagraphNode();e.insertAfter(o)}};var Hr={},Vt=A,Tu=ut;function dl(t){let e=new URLSearchParams;e.append("code",t);for(let n=1;na.append(l)),o=Io(),s=Ur(s),o.append(s),Jc(s,t.getNextSiblings()),n.insertBefore(r),n.insertAfter(o),n.replace(t)}Qr(e),Qr(i)}}}let qy=class Aee extends Vt.ElementNode{static getType(){return"listitem"}static clone(e){return new Aee(e.__value,e.__checked,e.__key)}constructor(e,n,i){super(i),this.__value=e===void 0?1:e,this.__checked=n}createDOM(e){let n=document.createElement("li"),i=this.getParent();return Pt(i)&&i.getListType()==="check"&&sW(n,this,null),n.value=this.__value,oW(n,e.theme,this),n}updateDOM(e,n,i){let r=this.getParent();return Pt(r)&&r.getListType()==="check"&&sW(n,this,e),n.value=this.__value,oW(n,i.theme,this),!1}static transform(){return e=>{let n=e.getParent();Pt(n)&&(Qr(n),bn(e)||dl(144),n.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:e5e,priority:0})}}static importJSON(e){let n=Io();return n.setChecked(e.checked),n.setValue(e.value),n.setFormat(e.format),n.setDirection(e.direction),n}exportDOM(e){return e=this.createDOM(e._config),e.style.textAlign=this.getFormatType(),{element:e}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),version:1}}append(...e){for(let n=0;n{e.append(r)})),this.remove(),i.getChildrenSize()===0&&i.remove(),e}insertAfter(e,n=!0){var i=this.getParentOrThrow();Pt(i)||dl(39);var r=this.getNextSiblings();if(bn(e))return n=super.insertAfter(e,n),e=e.getParentOrThrow(),Pt(e)&&Qr(e),n;if(Pt(e)){for(i=e,e=e.getChildren(),r=e.length-1;0<=r;r--)i=e[r],this.insertAfter(i,n);return i}if(i.insertAfter(e,n),r.length!==0){let o=Ur(i.getListType());r.forEach(s=>o.append(s)),e.insertAfter(o,n)}return e}remove(e){let n=this.getPreviousSibling(),i=this.getNextSibling();super.remove(e),n&&i&&Sa(n)&&Sa(i)?(rW(n.getFirstChild(),i.getFirstChild()),i.remove()):i&&(e=i.getParent(),Pt(e)&&Qr(e))}insertNewAfter(e,n=!0){return e=Io(this.__checked==null?void 0:!1),this.insertAfter(e,n),e}collapseAtStart(e){let n=Vt.$createParagraphNode();this.getChildren().forEach(s=>n.append(s));var i=this.getParentOrThrow(),r=i.getParentOrThrow();let o=bn(r);return i.getChildrenSize()===1?o?(i.remove(),r.select()):(i.insertBefore(n),i.remove(),i=e.anchor,e=e.focus,r=n.getKey(),i.type==="element"&&i.getNode().is(this)&&i.set(r,i.offset,"element"),e.type==="element"&&e.getNode().is(this)&&e.set(r,e.offset,"element")):(i.insertBefore(n),this.remove()),!0}getValue(){return this.getLatest().__value}setValue(e){this.getWritable().__value=e}getChecked(){return this.getLatest().__checked}setChecked(e){this.getWritable().__checked=e}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var e=this.getParent();if(e===null)return this.getLatest().__indent;e=e.getParentOrThrow();let n=0;for(;bn(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e=="number"&&-1Pt(a))?i.push(...s):r.push(...s)),0({conversion:lW,priority:0}),ul:()=>({conversion:lW,priority:0})}}static importJSON(e){let n=Ur(e.listType,e.start);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportDOM(e){return{element:e}=super.exportDOM(e),e&&Tu.isHTMLElement(e)&&(this.__start!==1&&e.setAttribute("start",String(this.__start)),this.__listType==="check"&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let i=0;i{Pt(r)&&e.push(tW(r))})):e.push(tW(n))}return e}function lW(t){let e=t.nodeName.toLowerCase(),n=null;return e==="ol"?n=Ur("number",t.start):e==="ul"&&(n=Tu.isHTMLElement(t)&&t.getAttribute("__lexicallisttype")==="check"?Ur("check"):Ur("bullet")),{after:t5e,node:n}}let uW={ol:"number",ul:"bullet"};function Ur(t,e=1){return Vt.$applyNodeReplacement(new d6(t,e))}function Pt(t){return t instanceof d6}let n5e=Vt.createCommand("INSERT_UNORDERED_LIST_COMMAND"),i5e=Vt.createCommand("INSERT_ORDERED_LIST_COMMAND"),r5e=Vt.createCommand("INSERT_CHECK_LIST_COMMAND"),o5e=Vt.createCommand("REMOVE_LIST_COMMAND");Hr.$createListItemNode=Io,Hr.$createListNode=Ur,Hr.$getListDepth=JB,Hr.$handleListInsertParagraph=function(){var t=Vt.$getSelection();if(!Vt.$isRangeSelection(t)||!t.isCollapsed()||(t=t.anchor.getNode(),!bn(t)||t.getChildrenSize()!==0))return!1;var e=f6(t),n=t.getParent();Pt(n)||dl(40);let i=n.getParent(),r;if(Vt.$isRootOrShadowRoot(i))r=Vt.$createParagraphNode(),e.insertAfter(r);else if(bn(i))r=Io(),i.insertAfter(r);else return!1;if(r.select(),e=t.getNextSiblings(),0{s.remove(),o.append(s)})}return K6e(t),!0},Hr.$isListItemNode=bn,Hr.$isListNode=Pt,Hr.INSERT_CHECK_LIST_COMMAND=r5e,Hr.INSERT_ORDERED_LIST_COMMAND=i5e,Hr.INSERT_UNORDERED_LIST_COMMAND=n5e,Hr.ListItemNode=qy,Hr.ListNode=d6,Hr.REMOVE_LIST_COMMAND=o5e,Hr.insertList=function(t,e){t.update(()=>{var n=Vt.$getSelection();if(n!==null){var i=n.getNodes();n=n.getStartEndPoints(),n===null&&dl(143),[n]=n,n=n.getNode();var r=n.getParent();if(nW(n,i))i=Ur(e),Vt.$isRootOrShadowRoot(r)?(n.replace(i),r=Io(),Vt.$isElementNode(n)&&(r.setFormat(n.getFormatType()),r.setIndent(n.getIndent())),i.append(r)):bn(n)&&(n=n.getParentOrThrow(),Jc(i,n.getChildren()),n.replace(i));else for(n=new Set,r=0;r{let e=Vt.$getSelection();if(Vt.$isRangeSelection(e)){var n=new Set,i=e.getNodes(),r=e.anchor.getNode();if(nW(r,i))n.add(f6(r));else for(r=0;r *")}function g6(t,e=10){const i=t.getRangeAt(0).cloneRange().getClientRects();if(i.length>0){const r=i[1]||i[0],s=p6(t.anchorNode).getBoundingClientRect();return Math.abs(r.top-s.top)<=e}}const s5e=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8.2 5 1 12l7.2 7m7.6-14 7.2 7-7.2 7"}));function a5e({darkMode:t,html:e,updateHtml:n}){const i=T.useCallback(d=>{n(d)},[n]),r=Te.theme({"&.cm-editor":{background:"transparent"},"&.cm-focused":{outline:"0"},"&.cm-editor .cm-content":{padding:"7px 0"},"&.cm-editor .cm-content, &.cm-editor .cm-gutter":{minHeight:"170px"},"&.cm-editor .cm-scroller":{overflow:"auto"},"&.cm-editor .cm-gutters":{background:"none",border:"none",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",color:"#CED4D9",lineHeight:"2.25rem"},"&.cm-editor .cm-lineNumbers":{padding:"0"},"&.cm-editor .cm-foldGutter":{width:"0"},"&.cm-editor .cm-line":{padding:"0 .8rem",color:"#394047",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",fontSize:"1.6rem",lineHeight:"2.25rem"},"&.cm-editor .cm-activeLine, &.cm-editor .cm-activeLineGutter":{background:"none"},"&.cm-editor .cm-cursor, &.cm-editor .cm-dropCursor":{borderLeft:"1.2px solid black"}}),o=Te.theme({"&.cm-editor":{background:"transparent"},"&.cm-focused":{outline:"0"},"&.cm-editor .cm-content":{padding:"7px 0"},"&.cm-editor .cm-content, &.cm-editor .cm-gutter":{minHeight:"170px"},"&.cm-editor .cm-scroller":{overflow:"auto"},"&.cm-editor .cm-gutters":{background:"none",border:"none",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",color:"rgb(108, 118, 127);",lineHeight:"2.25rem"},"&.cm-editor .cm-lineNumbers":{padding:"0"},"&.cm-editor .cm-foldGutter":{width:"0"},"&.cm-editor .cm-line":{padding:"0 .8rem",color:"rgb(210, 215, 218)",fontFamily:"Consolas,Liberation Mono,Menlo,Courier,monospace;",fontSize:"1.6rem",lineHeight:"2.25rem"},"&.cm-editor .cm-activeLine, &.cm-editor .cm-activeLineGutter":{background:"none"},"&.cm-editor .cm-cursor, &.cm-editor .cm-dropCursor":{borderLeft:"1.2px solid white"}}),s=ol.define([{tag:X.keyword,color:"#5A5CAD"},{tag:X.atom,color:"#6C8CD5"},{tag:X.number,color:"#116644"},{tag:X.definition(X.variableName),textDecoration:"underline"},{tag:X.variableName,color:"black"},{tag:X.comment,color:"#0080FF",fontStyle:"italic",background:"rgba(0,0,0,.05)"},{tag:[X.string,X.special(X.brace)],color:"#183691"},{tag:X.meta,color:"yellow"},{tag:X.bracket,color:"#63a35c"},{tag:X.tagName,color:"#63a35c"},{tag:X.attributeName,color:"#795da3"}]),a=ol.define([{tag:X.keyword,color:"#795da3"},{tag:X.atom,color:"#6C8CD5"},{tag:X.number,color:"#63a35c"},{tag:X.definition(X.variableName),textDecoration:"underline"},{tag:X.variableName,color:"white"},{tag:X.comment,color:"#0080FF",fontStyle:"italic",background:"rgba(0,0,0,.05)"},{tag:[X.string,X.special(X.brace)],color:"rgb(72, 110, 225)"},{tag:X.meta,color:"yellow"},{tag:X.bracket,color:"#63a35c"},{tag:X.tagName,color:"#63a35c"},{tag:X.attributeName,color:"#795da3"},{tag:[X.className,X.propertyName],color:"rgb(72, 110, 225)"}]),l=t?o:r,u=t?a:s,f=[Te.lineWrapping,Fm(u),l,O4(),sF({defaultKeymap:!1,history:!1}),nl.of(qj),nl.of(J4),xB(),Qj(),Vk({joinToEvent:void 0})];return k.jsx("div",{className:"not-kg-prose min-h-[170px]",children:k.jsx(bC,{autoFocus:!0,basicSetup:!1,extensions:f,value:e,onChange:i})})}/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:cW,setPrototypeOf:fW,isFrozen:l5e,getPrototypeOf:u5e,getOwnPropertyDescriptor:c5e}=Object;let{freeze:Zr,seal:ds,create:m6}=Object,{apply:v6,construct:b6}=typeof Reflect<"u"&&Reflect;Zr||(Zr=function(e){return e}),ds||(ds=function(e){return e}),v6||(v6=function(e,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o1?n-1:0),r=1;r1?n-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:Vy;fW&&fW(t,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const o=n(r);o!==r&&(l5e(e)||(e[i]=o),r=o)}t[r]=!0}return t}function m5e(t){for(let e=0;e/gm),w5e=ds(/\$\{[\w\W]*/gm),x5e=ds(/^data-[\-\w.\u00B7-\uFFFF]+$/),_5e=ds(/^aria-[\-\w]+$/),vW=ds(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),O5e=ds(/^(?:\w+script|data):/i),S5e=ds(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bW=ds(/^html$/i),C5e=ds(/^[a-z][.\w]*(-[.\w]+)+$/i);var kW=Object.freeze({__proto__:null,ARIA_ATTR:_5e,ATTR_WHITESPACE:S5e,CUSTOM_ELEMENT:C5e,DATA_ATTR:x5e,DOCTYPE_NAME:bW,ERB_EXPR:y5e,IS_ALLOWED_URI:vW,IS_SCRIPT_OR_DATA:O5e,MUSTACHE_EXPR:k5e,TMPLIT_EXPR:w5e});const o0={element:1,text:3,progressingInstruction:7,comment:8,document:9},E5e=function(){return typeof window>"u"?null:window},T5e=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},yW=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function wW(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:E5e();const e=Je=>wW(Je);if(e.version="3.3.0",e.removed=[],!t||!t.document||t.document.nodeType!==o0.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:u,NamedNodeMap:f=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:g}=t,m=l.prototype,y=r0(m,"cloneNode"),x=r0(m,"remove"),_=r0(m,"nextSibling"),S=r0(m,"childNodes"),C=r0(m,"parentNode");if(typeof s=="function"){const Je=n.createElement("template");Je.content&&Je.content.ownerDocument&&(n=Je.content.ownerDocument)}let E,N="";const{implementation:M,createNodeIterator:I,createDocumentFragment:W,getElementsByTagName:B}=n,{importNode:Z}=i;let R=yW();e.isSupported=typeof cW=="function"&&typeof C=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Q,ERB_EXPR:V,TMPLIT_EXPR:H,DATA_ATTR:j,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:Y,ATTR_WHITESPACE:K,CUSTOM_ELEMENT:te}=kW;let{IS_ALLOWED_URI:oe}=kW,ce=null;const U=Dt({},[...hW,...w6,...x6,..._6,...pW]);let F=null;const se=Dt({},[...gW,...O6,...mW,...Xy]);let le=Object.seal(m6(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),pe=null,je=null;const He=Object.seal(m6(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ot=!0,ht=!0,ve=!1,De=!0,st=!1,It=!0,Mt=!1,Wt=!1,Ue=!1,St=!1,Lt=!1,Be=!1,Re=!0,ae=!1;const Ze="user-content-";let Ut=!0,ii=!1,Nt={},On=null;const Zo=Dt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Nl=null;const Al=Dt({},["audio","video","img","source","image","track"]);let Jh=null;const oc=Dt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ep="http://www.w3.org/1998/Math/MathML",ja="http://www.w3.org/2000/svg",eo="http://www.w3.org/1999/xhtml";let sc=eo,qo=!1,tp=null;const rt=Dt({},[ep,ja,eo],k6);let ac=Dt({},["mi","mo","mn","ms","mtext"]),Vi=Dt({},["annotation-xml"]);const Un=Dt({},["title","style","font","a","script"]);let Sn=null;const v2=["application/xhtml+xml","text/html"],bo="text/html";let Cn=null,ri=null;const b2=n.createElement("form"),np=function(ne){return ne instanceof RegExp||ne instanceof Function},Pl=function(){let ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ri&&ri===ne)){if((!ne||typeof ne!="object")&&(ne={}),ne=hl(ne),Sn=v2.indexOf(ne.PARSER_MEDIA_TYPE)===-1?bo:ne.PARSER_MEDIA_TYPE,Cn=Sn==="application/xhtml+xml"?k6:Vy,ce=Rs(ne,"ALLOWED_TAGS")?Dt({},ne.ALLOWED_TAGS,Cn):U,F=Rs(ne,"ALLOWED_ATTR")?Dt({},ne.ALLOWED_ATTR,Cn):se,tp=Rs(ne,"ALLOWED_NAMESPACES")?Dt({},ne.ALLOWED_NAMESPACES,k6):rt,Jh=Rs(ne,"ADD_URI_SAFE_ATTR")?Dt(hl(oc),ne.ADD_URI_SAFE_ATTR,Cn):oc,Nl=Rs(ne,"ADD_DATA_URI_TAGS")?Dt(hl(Al),ne.ADD_DATA_URI_TAGS,Cn):Al,On=Rs(ne,"FORBID_CONTENTS")?Dt({},ne.FORBID_CONTENTS,Cn):Zo,pe=Rs(ne,"FORBID_TAGS")?Dt({},ne.FORBID_TAGS,Cn):hl({}),je=Rs(ne,"FORBID_ATTR")?Dt({},ne.FORBID_ATTR,Cn):hl({}),Nt=Rs(ne,"USE_PROFILES")?ne.USE_PROFILES:!1,ot=ne.ALLOW_ARIA_ATTR!==!1,ht=ne.ALLOW_DATA_ATTR!==!1,ve=ne.ALLOW_UNKNOWN_PROTOCOLS||!1,De=ne.ALLOW_SELF_CLOSE_IN_ATTR!==!1,st=ne.SAFE_FOR_TEMPLATES||!1,It=ne.SAFE_FOR_XML!==!1,Mt=ne.WHOLE_DOCUMENT||!1,St=ne.RETURN_DOM||!1,Lt=ne.RETURN_DOM_FRAGMENT||!1,Be=ne.RETURN_TRUSTED_TYPE||!1,Ue=ne.FORCE_BODY||!1,Re=ne.SANITIZE_DOM!==!1,ae=ne.SANITIZE_NAMED_PROPS||!1,Ut=ne.KEEP_CONTENT!==!1,ii=ne.IN_PLACE||!1,oe=ne.ALLOWED_URI_REGEXP||vW,sc=ne.NAMESPACE||eo,ac=ne.MATHML_TEXT_INTEGRATION_POINTS||ac,Vi=ne.HTML_INTEGRATION_POINTS||Vi,le=ne.CUSTOM_ELEMENT_HANDLING||{},ne.CUSTOM_ELEMENT_HANDLING&&np(ne.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(le.tagNameCheck=ne.CUSTOM_ELEMENT_HANDLING.tagNameCheck),ne.CUSTOM_ELEMENT_HANDLING&&np(ne.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(le.attributeNameCheck=ne.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),ne.CUSTOM_ELEMENT_HANDLING&&typeof ne.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=ne.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),st&&(ht=!1),Lt&&(St=!0),Nt&&(ce=Dt({},pW),F=[],Nt.html===!0&&(Dt(ce,hW),Dt(F,gW)),Nt.svg===!0&&(Dt(ce,w6),Dt(F,O6),Dt(F,Xy)),Nt.svgFilters===!0&&(Dt(ce,x6),Dt(F,O6),Dt(F,Xy)),Nt.mathMl===!0&&(Dt(ce,_6),Dt(F,mW),Dt(F,Xy))),ne.ADD_TAGS&&(typeof ne.ADD_TAGS=="function"?He.tagCheck=ne.ADD_TAGS:(ce===U&&(ce=hl(ce)),Dt(ce,ne.ADD_TAGS,Cn))),ne.ADD_ATTR&&(typeof ne.ADD_ATTR=="function"?He.attributeCheck=ne.ADD_ATTR:(F===se&&(F=hl(F)),Dt(F,ne.ADD_ATTR,Cn))),ne.ADD_URI_SAFE_ATTR&&Dt(Jh,ne.ADD_URI_SAFE_ATTR,Cn),ne.FORBID_CONTENTS&&(On===Zo&&(On=hl(On)),Dt(On,ne.FORBID_CONTENTS,Cn)),Ut&&(ce["#text"]=!0),Mt&&Dt(ce,["html","head","body"]),ce.table&&(Dt(ce,["tbody"]),delete pe.tbody),ne.TRUSTED_TYPES_POLICY){if(typeof ne.TRUSTED_TYPES_POLICY.createHTML!="function")throw i0('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ne.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw i0('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=ne.TRUSTED_TYPES_POLICY,N=E.createHTML("")}else E===void 0&&(E=T5e(g,r)),E!==null&&typeof N=="string"&&(N=E.createHTML(""));Zr&&Zr(ne),ri=ne}},ip=Dt({},[...w6,...x6,...v5e]),S1=Dt({},[..._6,...b5e]),qT=function(ne){let _e=C(ne);(!_e||!_e.tagName)&&(_e={namespaceURI:sc,tagName:"template"});const Fe=Vy(ne.tagName),hn=Vy(_e.tagName);return tp[ne.namespaceURI]?ne.namespaceURI===ja?_e.namespaceURI===eo?Fe==="svg":_e.namespaceURI===ep?Fe==="svg"&&(hn==="annotation-xml"||ac[hn]):!!ip[Fe]:ne.namespaceURI===ep?_e.namespaceURI===eo?Fe==="math":_e.namespaceURI===ja?Fe==="math"&&Vi[hn]:!!S1[Fe]:ne.namespaceURI===eo?_e.namespaceURI===ja&&!Vi[hn]||_e.namespaceURI===ep&&!ac[hn]?!1:!S1[Fe]&&(Un[Fe]||!ip[Fe]):!!(Sn==="application/xhtml+xml"&&tp[ne.namespaceURI]):!1},ko=function(ne){t0(e.removed,{element:ne});try{C(ne).removeChild(ne)}catch{x(ne)}},Dl=function(ne,_e){try{t0(e.removed,{attribute:_e.getAttributeNode(ne),from:_e})}catch{t0(e.removed,{attribute:null,from:_e})}if(_e.removeAttribute(ne),ne==="is")if(St||Lt)try{ko(_e)}catch{}else try{_e.setAttribute(ne,"")}catch{}},rp=function(ne){let _e=null,Fe=null;if(Ue)ne=""+ne;else{const In=y6(ne,/^[\r\n\t ]+/);Fe=In&&In[0]}Sn==="application/xhtml+xml"&&sc===eo&&(ne=''+ne+"");const hn=E?E.createHTML(ne):ne;if(sc===eo)try{_e=new h().parseFromString(hn,Sn)}catch{}if(!_e||!_e.documentElement){_e=M.createDocument(sc,"template",null);try{_e.documentElement.innerHTML=qo?N:hn}catch{}}const Dn=_e.body||_e.documentElement;return ne&&Fe&&Dn.insertBefore(n.createTextNode(Fe),Dn.childNodes[0]||null),sc===eo?B.call(_e,Mt?"html":"body")[0]:Mt?_e.documentElement:Dn},k2=function(ne){return I.call(ne.ownerDocument||ne,ne,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Df=function(ne){return ne instanceof d&&(typeof ne.nodeName!="string"||typeof ne.textContent!="string"||typeof ne.removeChild!="function"||!(ne.attributes instanceof f)||typeof ne.removeAttribute!="function"||typeof ne.setAttribute!="function"||typeof ne.namespaceURI!="string"||typeof ne.insertBefore!="function"||typeof ne.hasChildNodes!="function")},y2=function(ne){return typeof a=="function"&&ne instanceof a};function Qs(Je,ne,_e){Yy(Je,Fe=>{Fe.call(e,ne,_e,ri)})}const op=function(ne){let _e=null;if(Qs(R.beforeSanitizeElements,ne,null),Df(ne))return ko(ne),!0;const Fe=Cn(ne.nodeName);if(Qs(R.uponSanitizeElement,ne,{tagName:Fe,allowedTags:ce}),It&&ne.hasChildNodes()&&!y2(ne.firstElementChild)&&qr(/<[/\w!]/g,ne.innerHTML)&&qr(/<[/\w!]/g,ne.textContent)||ne.nodeType===o0.progressingInstruction||It&&ne.nodeType===o0.comment&&qr(/<[/\w]/g,ne.data))return ko(ne),!0;if(!(He.tagCheck instanceof Function&&He.tagCheck(Fe))&&(!ce[Fe]||pe[Fe])){if(!pe[Fe]&&sp(Fe)&&(le.tagNameCheck instanceof RegExp&&qr(le.tagNameCheck,Fe)||le.tagNameCheck instanceof Function&&le.tagNameCheck(Fe)))return!1;if(Ut&&!On[Fe]){const hn=C(ne)||ne.parentNode,Dn=S(ne)||ne.childNodes;if(Dn&&hn){const In=Dn.length;for(let hr=In-1;hr>=0;--hr){const Zt=y(Dn[hr],!0);Zt.__removalCount=(ne.__removalCount||0)+1,hn.insertBefore(Zt,_(ne))}}}return ko(ne),!0}return ne instanceof l&&!qT(ne)||(Fe==="noscript"||Fe==="noembed"||Fe==="noframes")&&qr(/<\/no(script|embed|frames)/i,ne.innerHTML)?(ko(ne),!0):(st&&ne.nodeType===o0.text&&(_e=ne.textContent,Yy([Q,V,H],hn=>{_e=n0(_e,hn," ")}),ne.textContent!==_e&&(t0(e.removed,{element:ne.cloneNode()}),ne.textContent=_e)),Qs(R.afterSanitizeElements,ne,null),!1)},w2=function(ne,_e,Fe){if(Re&&(_e==="id"||_e==="name")&&(Fe in n||Fe in b2))return!1;if(!(ht&&!je[_e]&&qr(j,_e))){if(!(ot&&qr(q,_e))){if(!(He.attributeCheck instanceof Function&&He.attributeCheck(_e,ne))){if(!F[_e]||je[_e]){if(!(sp(ne)&&(le.tagNameCheck instanceof RegExp&&qr(le.tagNameCheck,ne)||le.tagNameCheck instanceof Function&&le.tagNameCheck(ne))&&(le.attributeNameCheck instanceof RegExp&&qr(le.attributeNameCheck,_e)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(_e,ne))||_e==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&qr(le.tagNameCheck,Fe)||le.tagNameCheck instanceof Function&&le.tagNameCheck(Fe))))return!1}else if(!Jh[_e]){if(!qr(oe,n0(Fe,K,""))){if(!((_e==="src"||_e==="xlink:href"||_e==="href")&&ne!=="script"&&h5e(Fe,"data:")===0&&Nl[ne])){if(!(ve&&!qr(Y,n0(Fe,K,"")))){if(Fe)return!1}}}}}}}return!0},sp=function(ne){return ne!=="annotation-xml"&&y6(ne,te)},Il=function(ne){Qs(R.beforeSanitizeAttributes,ne,null);const{attributes:_e}=ne;if(!_e||Df(ne))return;const Fe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let hn=_e.length;for(;hn--;){const Dn=_e[hn],{name:In,namespaceURI:hr,value:Zt}=Dn,ze=Cn(In),Us=Zt;let di=In==="value"?Us:p5e(Us);if(Fe.attrName=ze,Fe.attrValue=di,Fe.keepAttr=!0,Fe.forceKeepAttr=void 0,Qs(R.uponSanitizeAttribute,ne,Fe),di=Fe.attrValue,ae&&(ze==="id"||ze==="name")&&(Dl(In,ne),di=Ze+di),It&&qr(/((--!?|])>)|<\/(style|title|textarea)/i,di)){Dl(In,ne);continue}if(ze==="attributename"&&y6(di,"href")){Dl(In,ne);continue}if(Fe.forceKeepAttr)continue;if(!Fe.keepAttr){Dl(In,ne);continue}if(!De&&qr(/\/>/i,di)){Dl(In,ne);continue}st&&Yy([Q,V,H],Bt=>{di=n0(di,Bt," ")});const Yo=Cn(ne.nodeName);if(!w2(Yo,ze,di)){Dl(In,ne);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!hr)switch(g.getAttributeType(Yo,ze)){case"TrustedHTML":{di=E.createHTML(di);break}case"TrustedScriptURL":{di=E.createScriptURL(di);break}}if(di!==Us)try{hr?ne.setAttributeNS(hr,In,di):ne.setAttribute(In,di),Df(ne)?ko(ne):dW(e.removed)}catch{Dl(In,ne)}}Qs(R.afterSanitizeAttributes,ne,null)},YT=function Je(ne){let _e=null;const Fe=k2(ne);for(Qs(R.beforeSanitizeShadowDOM,ne,null);_e=Fe.nextNode();)Qs(R.uponSanitizeShadowNode,_e,null),op(_e),Il(_e),_e.content instanceof o&&Je(_e.content);Qs(R.afterSanitizeShadowDOM,ne,null)};return e.sanitize=function(Je){let ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_e=null,Fe=null,hn=null,Dn=null;if(qo=!Je,qo&&(Je=""),typeof Je!="string"&&!y2(Je))if(typeof Je.toString=="function"){if(Je=Je.toString(),typeof Je!="string")throw i0("dirty is not a string, aborting")}else throw i0("toString is not a function");if(!e.isSupported)return Je;if(Wt||Pl(ne),e.removed=[],typeof Je=="string"&&(ii=!1),ii){if(Je.nodeName){const Zt=Cn(Je.nodeName);if(!ce[Zt]||pe[Zt])throw i0("root node is forbidden and cannot be sanitized in-place")}}else if(Je instanceof a)_e=rp(""),Fe=_e.ownerDocument.importNode(Je,!0),Fe.nodeType===o0.element&&Fe.nodeName==="BODY"||Fe.nodeName==="HTML"?_e=Fe:_e.appendChild(Fe);else{if(!St&&!st&&!Mt&&Je.indexOf("<")===-1)return E&&Be?E.createHTML(Je):Je;if(_e=rp(Je),!_e)return St?null:Be?N:""}_e&&Ue&&ko(_e.firstChild);const In=k2(ii?Je:_e);for(;hn=In.nextNode();)op(hn),Il(hn),hn.content instanceof o&&YT(hn.content);if(ii)return Je;if(St){if(Lt)for(Dn=W.call(_e.ownerDocument);_e.firstChild;)Dn.appendChild(_e.firstChild);else Dn=_e;return(F.shadowroot||F.shadowrootmode)&&(Dn=Z.call(i,Dn,!0)),Dn}let hr=Mt?_e.outerHTML:_e.innerHTML;return Mt&&ce["!doctype"]&&_e.ownerDocument&&_e.ownerDocument.doctype&&_e.ownerDocument.doctype.name&&qr(bW,_e.ownerDocument.doctype.name)&&(hr=" +`+hr),st&&Yy([Q,V,H],Zt=>{hr=n0(hr,Zt," ")}),E&&Be?E.createHTML(hr):hr},e.setConfig=function(){let Je=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pl(Je),Wt=!0},e.clearConfig=function(){ri=null,Wt=!1},e.isValidAttribute=function(Je,ne,_e){ri||Pl({});const Fe=Cn(Je),hn=Cn(ne);return w2(Fe,hn,_e)},e.addHook=function(Je,ne){typeof ne=="function"&&t0(R[Je],ne)},e.removeHook=function(Je,ne){if(ne!==void 0){const _e=f5e(R[Je],ne);return _e===-1?void 0:d5e(R[Je],_e,1)[0]}return dW(R[Je])},e.removeHooks=function(Je){R[Je]=[]},e.removeAllHooks=function(){R=yW()},e}var $5e=wW();function Gy(t="",e={}){return e={replaceJS:!0,...e},e.replaceJS&&(t=t.replace(/)<[^<]*)*<\/script>/gi,'
    Embedded JavaScript
    '),t=t.replace(/)<[^<]*)*<\/iframe>/gi,'
    Embedded iFrame
    ')),$5e.sanitize(t,{ALLOWED_URI_REGEXP:/^https?:|^\/|blob:/,ADD_ATTR:["id"],FORBID_TAGS:["style"]})}function xW({html:t,updateHtml:e,isEditing:n,darkMode:i}){return k.jsx(k.Fragment,{children:n?k.jsx(k.Fragment,{children:k.jsx(a5e,{darkMode:i,html:t,updateHtml:e})}):k.jsxs("div",{children:[k.jsx(_W,{html:t}),k.jsx("div",{className:"absolute inset-0 z-50 mt-0"})]})})}function _W({html:t}){const e=Gy(t,{replaceJS:!0});return k.jsx("div",{dangerouslySetInnerHTML:{__html:e},className:"min-h-[3.5vh] whitespace-normal"})}_W.propTypes={html:P.string},xW.propTypes={html:P.string,updateHtml:P.func,isEditing:P.bool,darkMode:P.bool};function M5e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function N5e({adjustOnResize:t,adjustOnDrag:e}={}){const n=T.useRef(null),i=3,r=T.useRef(!1),o=T.useRef(),s=T.useRef(),a=T.useRef(),l=T.useRef(),u=T.useRef(),f=T.useRef(),d=M5e(),h=(V,H)=>{const j=q=>{var Y;(Y=n.current)!=null&&Y.contains(q.target)&&H(q)};return document.body.addEventListener(V,j,!1),j},g=T.useCallback(V=>{V.preventDefault(),V.stopPropagation()},[]),m=T.useCallback((V,H)=>{n.current.style.transform=`translate(${V}px, ${H}px)`},[n]),y=T.useCallback(({x:V,y:H})=>{o.current=V,s.current=H;const j=n.current.offsetWidth,q=n.current.offsetHeight,Y={top:H,left:V,right:window.innerWidth-V-j,bottom:window.innerHeight-H-q};u.current=Y,m(V,H)},[m]),x=T.useCallback(()=>({x:o.current,y:s.current,lastSpacing:u.current}),[]),_=T.useCallback(()=>{var V;f.current=(V=n.current)==null?void 0:V.style.overflow,n.current.style.overflow="hidden"},[n]),S=T.useCallback(()=>{n.current.style.overflow=f.current},[n]),C=T.useCallback(()=>{window.getSelection().removeAllRanges();const V=document.createElement("style");V.id=`stylesheet-${d}`,document.head.appendChild(V),V.sheet.insertRule("* { user-select: none !important; }",0)},[d]),E=T.useCallback(()=>{const V=document.getElementById(`stylesheet-${d}`);V==null||V.remove()},[d]),N=T.useCallback(()=>{n.current&&(n.current.style.pointerEvents="none"),window.addEventListener("click",g,{capture:!0,passive:!1})},[n,g]),M=T.useCallback(()=>{n.current&&(n.current.style.pointerEvents=""),window.removeEventListener("click",g,{capture:!0,passive:!1})},[n,g]),I=T.useCallback(V=>{let H,j;if(V.type==="touchmove"?(H=V.touches[0].clientX,j=V.touches[0].clientY):(H=V.clientX,j=V.clientY),r.current||(Math.abs(H-a.current-o.current)>i||Math.abs(j-l.current-s.current)>i)&&(_(),C(),N(),r.current=!0),r.current){let q={x:H-a.current,y:j-l.current};e&&(q=e(n.current,{...q,lastSpacing:u.current})),y(q)}},[i,y,_,C,N,e]),W=T.useCallback(V=>{r.current=!1,window.removeEventListener("touchend",W,{capture:!0,passive:!0}),window.removeEventListener("touchmove",I,{capture:!0,passive:!0}),window.removeEventListener("mouseup",W,{capture:!0,passive:!0}),window.removeEventListener("mousemove",I,{capture:!0,passive:!0}),setTimeout(()=>{window.removeEventListener("click",g.bind(this),{capture:!0,passive:!1})},1),S(),E(),setTimeout(()=>{M()},5)},[S,E,M,I,g]),B=T.useCallback(()=>{window.addEventListener("touchend",W,{capture:!0,passive:!0}),window.addEventListener("touchmove",I,{capture:!0,passive:!0}),window.addEventListener("mouseup",W,{capture:!0,passive:!0}),window.addEventListener("mousemove",I,{capture:!0,passive:!0})},[W,I]),Z=T.useCallback(V=>{var H;if(V.stopPropagation(),r.current=!1,V.type==="touchstart"||V.button===0){V.type==="touchstart"?(a.current=V.touches[0].clientX-(o.current||0),l.current=V.touches[0].clientY-(s.current||0)):(a.current=V.clientX-(o.current||0),l.current=V.clientY-(s.current||0));for(const j of V.path||V.composedPath()){if((H=j==null?void 0:j.matches)!=null&&H.call(j,"input, .ember-basic-dropdown-trigger"))break;if(j===n.current){B();break}}}},[n,B]),R=T.useCallback(()=>{const V=h("touchstart",Z),H=h("mousedown",Z);return()=>{var j,q;(j=n.current)==null||j.removeEventListener("touchstart",V),(q=n.current)==null||q.removeEventListener("mousedown",H)}},[Z]),Q=T.useCallback(()=>{window.removeEventListener("touchend",W,{capture:!0,passive:!0}),window.removeEventListener("touchmove",I,{capture:!0,passive:!0}),window.removeEventListener("mouseup",W,{capture:!0,passive:!0}),window.removeEventListener("mousemove",I,{capture:!0,passive:!0}),setTimeout(()=>{window.removeEventListener("click",g.bind(this),{capture:!0,passive:!1})},1)},[W,I,g]);return T.useEffect(()=>{var q;const V=n.current;V.setAttribute("draggable",!0),(q=n.current)==null||q.classList.add("kg-card-movable");let H;const j=R();return t&&(H=new ResizeObserver(()=>{if(o.current===void 0||s.current===void 0)return;const Y=t(V,{x:o.current,y:s.current,lastSpacing:u.current});(Y.x!==o.current||Y.y!==s.current)&&(a.current=a.current-(Y.x-o.current),l.current=l.current-(Y.y-s.current),y(Y))}),H.observe(V)),()=>{j(),Q(),H==null||H.disconnect(),E()}},[]),{ref:n,setPosition:y,getPosition:x}}function yh(t){const n=t instanceof HTMLElement&&window.getComputedStyle(t).overflowY,i=n!=="visible"&&n!=="hidden";if(t){if(i&&t.scrollHeight>=t.clientHeight)return t}else return null;return yh(t.parentNode)||document.body}const OW=20,A5e=20,P5e=66,D5e=20,I5e=20;function L5e(){return window.innerWidth<768&&window.innerHeight>window.innerWidth}const R5e=()=>{const t=document.querySelector('[data-kg-card-editing="true"]');if(!t)return{x:0,y:0};const e=t.getBoundingClientRect(),n=window.getComputedStyle(t),i={x:0,y:0};return n.transform!=="none"&&(i.x=e.left,i.y=e.top),i};function SW(t){return t?parseInt(window.getComputedStyle(t).getPropertyValue("--kg-breakout-adjustment")||0,10):0}function CW(t){const e=SW(t);return{width:window.innerWidth-e,height:window.innerHeight}}function EW(t,{x:e,y:n,origin:i={x:0,y:0},topSpacing:r,bottomSpacing:o,rightSpacing:s,leftSpacing:a,lastSpacing:l}){if(i=R5e(),!t)return{x:e+i.x,y:n+i.y};const u=SW(t);l&&l.top{const d=f.offsetHeight,h=t||document.querySelector('[data-kg-card-editing="true"]')||document.querySelector('[data-kg-card-selected="true"]');if(!h)return;const g=h.getBoundingClientRect();if(L5e()){const E=window.innerWidth/2-f.offsetWidth/2,N=g.bottom+OW;return S6(f,{x:E,y:N})}const m=Math.min(window.innerHeight,g.bottom)-g.top;let x=g.top+m/2-d/2,_=g.right+OW;const S=window.getComputedStyle(h),C={x:0,y:0};return S.transform!=="none"&&(C.x=g.left,C.y=g.top),s0(f,{x:_,y:x,origin:C})},[t]),u=T.useCallback(f=>{let{x:d,y:h,lastSpacing:g}=i();const m=CW(f);if(m.height>o.current.height){const y=m.height-o.current.height,x=l(f);x&&x.y>h&&(h+=Math.min(x.y-h,y))}if(m.width>o.current.width){const y=m.width-o.current.width,x=l(f);x&&x.x>d&&(d+=Math.min(x.x-d,y))}r(s0(f,{x:d,y:h,lastSpacing:g})),o.current=m},[l,r,i]);return T.useLayoutEffect(()=>{if(!n.current)return;const f=yh(n.current)||document.body;let d=0;const h=kh(m=>{d=m,u(n.current)},100,{leading:!0,trailing:!0}),g=new ResizeObserver(m=>{var y;for(const x of m)if((y=x.contentBoxSize)!=null&&y[0]){const _=x.contentBoxSize[0].inlineSize;typeof _=="number"&&_!==d&&h(_)}});return g.observe(f),()=>{g.disconnect()}},[u,n]),T.useLayoutEffect(()=>{if(!(!n||!n.current))try{r(l(n.current))}catch(f){console.error(f)}},[l,r,n]),T.useLayoutEffect(()=>{if(e==="wide"&&s.current!=="wide"){const f=document.querySelector('[data-kg-card-editing="true"]');if(!f)return;const d=f.getBoundingClientRect(),h={x:d.left+2,y:d.top+1};a.current=h;const g=i().x-h.x,m=i().y-h.y;r(s0(n.current,{x:g,y:m,origin:h}))}else if(s.current==="wide"&&e!=="wide"){const f=i().x+a.current.x,d=i().y+a.current.y;r(s0(n.current,{x:f,y:d,origin:{x:0,y:0}}))}s.current=e},[e,i,l,r,n]),{ref:n}}const TW=(t,e)=>{const n=T.useRef(null);return{handleMousedown:()=>{const o=document.getSelection();n.current=o.rangeCount===0?null:o.getRangeAt(0)},handleClick:o=>{if(o.preventDefault(),t(e),n.current){const s=document.getSelection();s.removeAllRanges(),s.addRange(n.current),n.current=null}}}};function $W({buttons:t=[],selectedName:e,onClick:n,hasTooltip:i=!0}){return k.jsx("div",{className:"flex",children:k.jsx("ul",{className:"flex items-center justify-evenly rounded-lg bg-grey-100 font-sans text-md font-normal text-white dark:bg-grey-900",role:"menubar",children:t.map(({label:r,name:o,Icon:s,dataTestId:a,ariaLabel:l})=>k.jsx(F5e,{ariaLabel:l,dataTestId:a,hasTooltip:i,Icon:s,label:r,name:o,selectedName:e,onClick:n},`${o}-${r}`))})})}function F5e({dataTestId:t,onClick:e,label:n,ariaLabel:i,name:r,selectedName:o,Icon:s,hasTooltip:a}){const l=r===o,{handleMousedown:u,handleClick:f}=TW(e,r);return k.jsx("li",{className:"mb-0",children:k.jsxs("button",{"aria-checked":l,"aria-label":i||n,className:`group relative flex h-7 w-8 cursor-pointer items-center justify-center rounded-lg text-black dark:text-white ${l?"border border-grey-300 bg-white shadow-xs dark:border-grey-800 dark:bg-grey-950":""} ${s?"":"text-[1.3rem] font-bold"}`,"data-testid":t,role:"menuitemradio",type:"button",onClick:f,onMouseDown:u,children:[s?k.jsx(s,{className:"size-4 stroke-2"}):n,s&&n&&a&&k.jsx(Cu,{label:n})]})})}$W.propTypes={selectedName:P.oneOf(["regular","wide","full","split","center","left","small","medium","large","grid","list","minimal","immersive"]).isRequired,hasTooltip:P.bool,onClick:P.func.isRequired,buttons:P.arrayOf(P.shape({label:P.string,name:P.string.isRequired,Icon:P.elementType,dataTestId:P.string,ariaLabel:P.string}))};const z5e=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M17.041 12.025 6.91 22.156 1 23l.844-5.91L11.975 6.96m0-5.067 10.132 10.132M19.8 9l2.206-2.207a3.396 3.396 0 0 0 0-4.8 3.397 3.397 0 0 0-4.8 0L15 4.2"})),C6=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},J.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M22.883 19.771a.786.786 0 0 1-.668.372H1.785a.786.786 0 0 1-.666-1.202l3.93-6.286a.785.785 0 0 1 1.269-.086l3.292 3.95 6.476-8.633a.81.81 0 0 1 .7-.315.786.786 0 0 1 .628.431l5.5 11a.785.785 0 0 1-.03.769Z",clipRule:"evenodd"}),J.createElement("circle",{cx:8,cy:6,r:3,fill:"currentColor"}));function Ca({color:t="accent",dataTestId:e,href:n,size:i="small",width:r="regular",rounded:o=!0,shrink:s=!1,value:a="",placeholder:l="Add button text",type:u="button",disabled:f=!1,target:d,...h}){const g=n?"a":"button",m={type:n?null:u,href:n||null,rel:d==="_blank"?"noopener noreferrer":null,target:d||null,...h};return k.jsx(g,{className:nt("not-kg-prose inline-block cursor-pointer text-center font-sans font-medium",!s&&"shrink-0",r==="regular"||"w-full",o&&"rounded-md",a?"opacity-100":"opacity-50",t==="white"&&"bg-white text-black",t==="grey"&&"bg-grey-200 text-black",t==="black"&&"bg-black text-white",t==="accent"&&"bg-accent text-white",!["white","grey","black","accent"].includes(t)&&"bg-green text-white"),"data-testid":`${e}`,disabled:f,...m,children:k.jsx("span",{className:nt("block",i==="small"&&"px-5 py-[1rem] text-md leading-[1.4]",i==="medium"&&"px-5 py-2 text-[1.6rem]",i==="large"&&"px-6 py-3 text-lg leading-[1.35]"),"data-testid":`${e}-span`,children:a||l})})}Ca.propTypes={color:P.oneOf(["white","grey","black","accent"]),size:P.oneOf(["small","medium","large"]),width:P.oneOf(["regular","full"]),rounded:P.bool,value:P.string,placeholder:P.string,href:P.string,target:P.string,disabled:P.bool};function wh(){return(wh=Object.assign||function(t){for(var e=1;e=0||(r[n]=t[n]);return r}function a0(t){var e=T.useRef(t),n=T.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var l0=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t0:x.buttons>0)&&r.current?o(MW(r.current,x,a.current)):y(!1)},m=function(){return y(!1)};function y(x){var _=l.current,S=E6(r.current),C=x?S.addEventListener:S.removeEventListener;C(_?"touchmove":"mousemove",g),C(_?"touchend":"mouseup",m)}return[function(x){var _=x.nativeEvent,S=r.current;if(S&&(NW(_),!function(E,N){return N&&!u0(E)}(_,l.current)&&S)){if(u0(_)){l.current=!0;var C=_.changedTouches||[];C.length&&(a.current=C[0].identifier)}S.focus(),o(MW(S,_,a.current)),y(!0)}},function(x){var _=x.which||x.keyCode;_<37||_>40||(x.preventDefault(),s({left:_===39?.05:_===37?-.05:0,top:_===40?.05:_===38?-.05:0}))},y]},[s,o]),f=u[0],d=u[1],h=u[2];return T.useEffect(function(){return h},[h]),T.createElement("div",wh({},i,{onTouchStart:f,onMouseDown:f,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),T6=function(t){return t.filter(Boolean).join(" ")},PW=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,o=T6(["react-colorful__pointer",t.className]);return T.createElement("div",{className:o,style:{top:100*r+"%",left:100*n+"%"}},T.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},sr=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},B5e=function(t){return Z5e($6(t))},$6=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?sr(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?sr(parseInt(t.substring(6,8),16)/255,2):1}},W5e=function(t){return U5e(Q5e(t))},H5e=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:sr(t.h),s:sr(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:sr(r/2),a:sr(i,2)}},M6=function(t){var e=H5e(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Q5e=function(t){var e=t.h,n=t.s,i=t.v,r=t.a;e=e/360*6,n/=100,i/=100;var o=Math.floor(e),s=i*(1-n),a=i*(1-(e-o)*n),l=i*(1-(1-e+o)*n),u=o%6;return{r:sr(255*[i,a,s,s,l,i][u]),g:sr(255*[l,i,i,a,s,s][u]),b:sr(255*[s,s,l,i,i,a][u]),a:sr(r,2)}},Jy=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},U5e=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,o=r<1?Jy(sr(255*r)):"";return"#"+Jy(e)+Jy(n)+Jy(i)+o},Z5e=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,o=Math.max(e,n,i),s=o-Math.min(e,n,i),a=s?o===e?(n-i)/s:o===n?2+(i-e)/s:4+(e-n)/s:0;return{h:sr(60*(a<0?a+6:a)),s:sr(o?s/o*100:0),v:sr(o/255*100),a:r}},q5e=T.memo(function(t){var e=t.hue,n=t.onChange,i=T6(["react-colorful__hue",t.className]);return T.createElement("div",{className:i},T.createElement(AW,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:l0(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":sr(e),"aria-valuemax":"360","aria-valuemin":"0"},T.createElement(PW,{className:"react-colorful__hue-pointer",left:e/360,color:M6({h:e,s:100,v:100,a:1})})))}),Y5e=T.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:M6({h:e.h,s:100,v:100,a:1})};return T.createElement("div",{className:"react-colorful__saturation",style:i},T.createElement(AW,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:l0(e.s+100*r.left,0,100),v:l0(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+sr(e.s)+"%, Brightness "+sr(e.v)+"%"},T.createElement(PW,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:M6(e)})))}),DW=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},V5e=function(t,e){return t.toLowerCase()===e.toLowerCase()||DW($6(t),$6(e))};function X5e(t,e,n){var i=a0(n),r=T.useState(function(){return t.toHsva(e)}),o=r[0],s=r[1],a=T.useRef({color:e,hsva:o});T.useEffect(function(){if(!t.equal(e,a.current.color)){var u=t.toHsva(e);a.current={hsva:u,color:e},s(u)}},[e,t]),T.useEffect(function(){var u;DW(o,a.current.hsva)||t.equal(u=t.fromHsva(o),a.current.color)||(a.current={hsva:o,color:u},i(u))},[o,t,i]);var l=T.useCallback(function(u){s(function(f){return Object.assign({},f,u)})},[]);return[o,l]}var G5e=typeof window<"u"?T.useLayoutEffect:T.useEffect,K5e=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},IW=new Map,J5e=function(t){G5e(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!IW.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,IW.set(e,n);var i=K5e();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},eEe=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,o=t.onChange,s=Ky(t,["className","colorModel","color","onChange"]),a=T.useRef(null);J5e(a);var l=X5e(n,r,o),u=l[0],f=l[1],d=T6(["react-colorful",e]);return T.createElement("div",wh({},s,{ref:a,className:d}),T.createElement(Y5e,{hsva:u,onChange:f}),T.createElement(q5e,{hue:u.h,onChange:f,className:"react-colorful__last-control"}))},tEe={defaultColor:"000",toHsva:B5e,fromHsva:function(t){return W5e({h:t.h,s:t.s,v:t.v,a:1})},equal:V5e},nEe=function(t){return T.createElement(eEe,wh({},t,{colorModel:tEe}))},iEe=/^#?([0-9A-F]{3,8})$/i,rEe=function(t){var e=t.color,n=e===void 0?"":e,i=t.onChange,r=t.onBlur,o=t.escape,s=t.validate,a=t.format,l=t.process,u=Ky(t,["color","onChange","onBlur","escape","validate","format","process"]),f=T.useState(function(){return o(n)}),d=f[0],h=f[1],g=a0(i),m=a0(r),y=T.useCallback(function(_){var S=o(_.target.value);h(S),s(S)&&g(l?l(S):S)},[o,l,s,g]),x=T.useCallback(function(_){s(_.target.value)||h(o(n)),m(_)},[n,o,s,m]);return T.useEffect(function(){h(o(n))},[n,o]),T.createElement("input",wh({},u,{value:a?a(d):d,spellCheck:"false",onChange:y,onBlur:x}))},LW=function(t){return"#"+t},oEe=function(t){var e=t.prefixed,n=t.alpha,i=Ky(t,["prefixed","alpha"]),r=T.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),o=T.useCallback(function(s){return function(a,l){var u=iEe.exec(a),f=u?u[1].length:0;return f===3||f===6||!!l&&f===4||!!l&&f===8}(s,n)},[n]);return T.createElement(rEe,wh({},i,{escape:r,format:e?LW:void 0,process:LW,validate:o}))};function $u(){const t=document.body.querySelector(".koenig-lexical");return t&&getComputedStyle(t).getPropertyValue("--kg-accent-color")||"#ff0095"}function RW(t,e,n){T.useEffect(()=>{if(!t)return;const i=r=>{e.current&&!e.current.contains(r.target)&&n()};return window.addEventListener("mousedown",i,{capture:!0}),()=>window.removeEventListener("mousedown",i,{capture:!0})},[t,n,e])}function sEe({value:t,eyedropper:e,hasTransparentOption:n,onChange:i,children:r}){const o=T.useRef(null),s=T.useCallback(g=>{var x,_,S;g.stopPropagation();const m=(x=o.current)==null?void 0:x.querySelector("input");g.target!==m&&((S=(_=o.current)==null?void 0:_.querySelector("input"))==null||S.focus(),g.preventDefault())},[]),a=T.useRef(!1),l=T.useCallback(()=>{var g,m;a.current=!1,(m=(g=o.current)==null?void 0:g.querySelector("input"))==null||m.focus(),document.removeEventListener("mouseup",l),document.removeEventListener("touchend",l)},[]),u=T.useCallback(()=>{a.current=!0,document.addEventListener("mouseup",l),document.addEventListener("touchend",l)},[l]),f=T.useCallback(g=>{g.preventDefault(),a.current=!0,document.body.style.setProperty("pointer-events","none"),new window.EyeDropper().open().then(y=>i(y.sRGBHex)).finally(()=>{var y,x;a.current=!1,document.body.style.removeProperty("pointer-events"),(x=(y=o.current)==null?void 0:y.querySelector("input"))==null||x.focus()})},[i]);T.useEffect(()=>{var g,m;(m=(g=o.current)==null?void 0:g.querySelector("input"))==null||m.focus()},[]);let d=t;t==="accent"?d=$u():t==="transparent"&&(d="");const h=T.useCallback(g=>{var m,y;(y=(m=o.current)==null?void 0:m.querySelector("input"))==null||y.focus()},[]);return k.jsxs("div",{onMouseDown:s,onTouchStart:s,children:[k.jsx(nEe,{color:d||"#ffffff",onChange:i,onMouseDown:u,onTouchStart:u}),k.jsxs("div",{className:"mt-3 flex gap-2",children:[k.jsxs("div",{ref:o,className:"relative flex w-full items-center rounded-lg border border-grey-100 bg-grey-100 px-3 py-1.5 font-sans text-sm font-normal text-grey-900 transition-colors placeholder:text-grey-500 focus-within:border-green focus-within:bg-white focus-within:shadow-[0_0_0_2px_rgba(48,207,67,.25)] focus-within:outline-none dark:border-transparent dark:bg-grey-900 dark:text-white dark:selection:bg-grey-800 dark:placeholder:text-grey-700 dark:focus-within:border-green dark:hover:bg-grey-925 dark:focus:bg-grey-925",onClick:h,children:[k.jsx("span",{className:"ml-1 mr-2 text-grey-700",children:"#"}),k.jsx(oEe,{"aria-label":"Color value",className:"z-50 w-full bg-transparent",color:d,onChange:i}),e&&!!window.EyeDropper&&k.jsx("button",{className:"absolute inset-y-0 right-3 z-50 my-auto size-4 p-[1px]",type:"button",onClick:f,children:k.jsx(z5e,{className:"size-full stroke-2"})})]}),n&&k.jsx(Ca,{color:"grey",value:"Clear",onClick:()=>i("transparent")}),r]})]})}function aEe({hex:t,accent:e,transparent:n,title:i,isSelected:r,onSelect:o}){const s=e?$u():t,a=T.useRef(null),l=u=>{u.preventDefault(),o(e?"accent":n?"transparent":t)};return k.jsxs("button",{ref:a,className:nt("group relative flex size-5 shrink-0 items-center rounded-full border border-grey-250 dark:border-grey-800",r&&"outline outline-2 outline-green"),style:{backgroundColor:s},title:i,type:"button",onClick:l,children:[n&&k.jsx("div",{className:"absolute left-0 top-0 z-10 w-[136%] origin-left rotate-45 border-b border-b-red"}),k.jsx(Cu,{label:i})]})}function lEe({value:t,swatches:e,onSwatchChange:n,onTogglePicker:i,onChange:r,isExpanded:o,eyedropper:s,hasTransparentOption:a,children:l}){var S,C,E,N;const[u,f]=T.useState(!1),[d,h]=T.useState(!1),g=T.useRef(null);RW(u,g,()=>f(!1));const m=T.useCallback(M=>{M.stopPropagation(),M.preventDefault()},[]);let y=t,x=(S=e.find(M=>M.hex===t))==null?void 0:S.title;t==="accent"?(y=$u(),x=(C=e.find(M=>M.accent))==null?void 0:C.title):t==="image"?(y="transparent",x=(E=e.find(M=>M.image))==null?void 0:E.title):t==="transparent"&&(y="white",x=(N=e.find(M=>M.transparent))==null?void 0:N.title),o&&(x=null);const _=M=>{r(M)};return k.jsxs("div",{className:"relative","data-testid":"color-selector-button",children:[k.jsxs("button",{className:`relative size-6 cursor-pointer rounded-full ${t?"p-[2px]":"border border-grey-200 dark:border-grey-800"}`,type:"button",onClick:()=>{f(!u),h(!1)},children:[t&&k.jsx("div",{className:"absolute inset-0 rounded-full bg-clip-content p-[3px]",style:{background:"conic-gradient(hsl(360,100%,50%),hsl(315,100%,50%),hsl(270,100%,50%),hsl(225,100%,50%),hsl(180,100%,50%),hsl(135,100%,50%),hsl(90,100%,50%),hsl(45,100%,50%),hsl(0,100%,50%))",WebkitMask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMaskComposite:"xor",mask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",maskComposite:"exclude"}}),k.jsxs("span",{className:nt("block size-full rounded-full border-2 border-white dark:border-grey-950",t==="image"&&"flex items-center justify-center"),style:{backgroundColor:y},children:[t==="image"&&k.jsx(C6,{className:"size-[1.4rem]"}),t==="transparent"&&k.jsx("div",{className:"absolute left-[3px] top-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})]})]}),u&&k.jsxs("div",{ref:g,className:nt("absolute -right-3 bottom-full z-10 mb-2 flex flex-col gap-3 rounded-lg bg-white p-3 shadow transition-[width] duration-200 ease-in-out dark:bg-grey-900",(o||d)&&"min-w-[296px]"),onClick:m,onMouseDown:m,onTouchStart:m,children:[!o&&l,o&&k.jsx(sEe,{eyedropper:s,hasTransparentOption:a,value:t,onChange:_}),d&&l,k.jsxs("div",{className:"flex justify-end gap-1",children:[k.jsx("div",{className:"flex items-center gap-1",children:e.map(({customContent:M,...I})=>M?k.jsx(T.Fragment,{children:M},I.title):k.jsx(aEe,{isSelected:x===I.title,onSelect:W=>{n(W)},...I},I.title))}),k.jsxs("button",{"aria-label":"Pick color",className:`group relative size-6 rounded-full ${x?"border border-grey-200 dark:border-grey-800":"p-[2px]"}`,"data-testid":"color-picker-toggle",type:"button",onClick:()=>{h(!1),i(!o)},children:[x?k.jsx("div",{className:"absolute inset-0 rounded-full bg-[conic-gradient(hsl(360,100%,50%),hsl(315,100%,50%),hsl(270,100%,50%),hsl(225,100%,50%),hsl(180,100%,50%),hsl(135,100%,50%),hsl(90,100%,50%),hsl(45,100%,50%),hsl(0,100%,50%))]"}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"absolute inset-0 rounded-full bg-clip-content p-[3px]",style:{background:"conic-gradient(hsl(360,100%,50%),hsl(315,100%,50%),hsl(270,100%,50%),hsl(225,100%,50%),hsl(180,100%,50%),hsl(135,100%,50%),hsl(90,100%,50%),hsl(45,100%,50%),hsl(0,100%,50%))",WebkitMask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMaskComposite:"xor",mask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",maskComposite:"exclude"}}),k.jsx("span",{className:"block size-full rounded-full border-2 border-white dark:border-grey-950",style:{backgroundColor:t},children:t==="transparent"&&k.jsx("div",{className:"absolute left-[3px] top-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red"})})]}),k.jsx(Cu,{label:"Pick color"})]})]})]})]})}function uEe({buttons:t=[],selectedName:e,onClick:n}){const[i,r]=T.useState(!1),o=T.useRef(null),s=t.find(a=>a.name===e);return RW(i,o,()=>r(!1)),k.jsxs("div",{ref:o,className:"relative",children:[k.jsxs("button",{className:`relative size-6 cursor-pointer rounded-full ${e?"p-[2px]":"border border-grey-200 dark:border-grey-800"}`,"data-testid":"color-options-button",type:"button",onClick:()=>r(!i),children:[e&&k.jsx("div",{className:"absolute inset-0 rounded-full bg-clip-content p-[3px]",style:{background:"conic-gradient(hsl(360,100%,50%),hsl(315,100%,50%),hsl(270,100%,50%),hsl(225,100%,50%),hsl(180,100%,50%),hsl(135,100%,50%),hsl(90,100%,50%),hsl(45,100%,50%),hsl(0,100%,50%))",WebkitMask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMaskComposite:"xor",mask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",maskComposite:"exclude"}}),k.jsx("span",{className:`${(s==null?void 0:s.color)||""} block size-full rounded-full border-2 border-white dark:border-grey-950`})]}),i&&k.jsx("div",{className:"absolute -right-3 bottom-full z-10 mb-2 rounded-lg bg-white px-3 py-2 shadow dark:bg-grey-900","data-testid":"color-options-popover",children:k.jsx("div",{className:"flex",children:k.jsx("ul",{className:"flex w-full items-center justify-between rounded-md font-sans text-md font-normal text-white",children:t.map(({label:a,name:l,color:u})=>l!=="image"?k.jsx(cEe,{color:u,"data-testid":`color-options-${l}-button`,label:a,name:l,selectedName:e,onClick:f=>{n(f),r(!1)}},`${l}-${a}`):k.jsx("li",{className:`mb-0 flex size-[3rem] cursor-pointer items-center justify-center rounded-full border-2 ${e===l?"border-green":"border-transparent"}`,"data-testid":"background-image-color-button",type:"button",onClick:()=>n(l),children:k.jsx("span",{className:"border-1 flex size-6 items-center justify-center rounded-full border border-black/5",children:k.jsx(rv,{className:"size-3 stroke-grey-700 stroke-2 dark:stroke-grey-500 dark:group-hover:stroke-grey-100"})})},"background-image"))})})})]})}function cEe({onClick:t,label:e,name:n,color:i,selectedName:r}){const o=n===r,{handleMousedown:s,handleClick:a}=TW(t,n);return k.jsx("li",{className:"mb-0",children:k.jsxs("button",{"aria-label":e,className:`group relative flex size-6 cursor-pointer items-center justify-center rounded-full border-2 ${o?"border-green":"border-transparent"}`,"data-testid":`color-picker-${n}`,type:"button",onClick:a,onMouseDown:s,children:[k.jsx("span",{className:`${i} size-[1.8rem] rounded-full border`}),k.jsx(Cu,{label:e})]})})}const jW=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:26,height:17,viewBox:"0 0 26 17",...t},J.createElement("path",{fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"m1.469 2.5 11.5 12.143L24.469 2.5"}));function fEe({item:t,selected:e,onChange:n}){let i="";e&&(i="bg-grey-100 dark:bg-grey-950");const r=(o,s)=>{o.preventDefault(),n(s)};return k.jsx("li",{className:`${i} m-0 hover:bg-grey-100 dark:hover:bg-grey-950`,children:k.jsx("button",{className:"size-full cursor-pointer px-3 py-[7px] text-left dark:text-white","data-test-value":t.name,type:"button",onMouseDownCapture:o=>r(o,t.name),children:t.label})},t.name)}function dEe({value:t,menu:e,onChange:n,dataTestId:i}){const[r,o]=T.useState(!1),s=m=>{o(!r),r||m.target.focus()},a=m=>{m.preventDefault(),m.stopPropagation()},l=()=>{o(!1)},u=m=>{o(!1),n(m)},f=(m,y)=>k.jsx(fEe,{item:m,selected:y,onChange:u},m.name),d=e.find(m=>m.name===t),h=(d==null?void 0:d.label)??"",g=r?"z-10":"z-0";return k.jsxs("div",{className:`relative ${g} font-sans text-sm font-normal`,"data-testid":i,children:[k.jsxs("button",{className:"relative h-9 w-full cursor-pointer rounded-lg border border-grey-150 bg-grey-150 px-3 py-1 pr-5 text-left font-sans font-normal leading-[1.5] text-grey-900 hover:border-grey-100 hover:bg-grey-100 focus-visible:outline-none dark:border-grey-900 dark:bg-grey-900 dark:text-white dark:placeholder:text-grey-800 md:h-[38px] md:py-2","data-testid":`${i}-value`,type:"button",onBlur:l,onClick:s,onMouseDownCapture:a,children:[h,k.jsx(jW,{className:`absolute right-3 top-[1.5rem] size-2 text-grey-900 ${r&&"rotate-180"}`})]}),r&&k.jsx(n6,{children:k.jsx(r6,{defaultSelected:d,getItem:f,items:e,onSelect:m=>u(m.name)})})]})}function ew({onFileChange:t,fileInputRef:e,mimeTypes:n=["image/*"],multiple:i=!1,disabled:r}){const o=n.join(",");return k.jsx("form",{onChange:t,children:k.jsx("input",{ref:e,accept:o,disabled:r,hidden:!0,multiple:i,name:"image-input",type:"file",onClick:s=>s.stopPropagation()})})}function pl({className:t,onClick:e,label:n,dataTestId:i,Icon:r}){return k.jsxs("button",{"aria-label":n,className:nt("group pointer-events-auto relative flex h-8 w-9 cursor-pointer items-center justify-center rounded-md bg-white/90 text-grey-900 transition-all hover:bg-white hover:text-black",t),"data-testid":i,type:"button",onClick:e,children:[k.jsx(r,{className:"size-4 stroke-2"}),n&&k.jsx(Cu,{label:n})]})}const hEe=t=>J.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none",...t},J.createElement("path",{d:"M11.25 17.25a6 6 0 1 0 12 0 6 6 0 1 0-12 0Zm6 3v-6m0 0L15 16.5m2.25-2.25 2.25 2.25"}),J.createElement("path",{d:"M8.25 20.25h-6a1.5 1.5 0 0 1-1.5-1.5V2.25a1.5 1.5 0 0 1 1.5-1.5h10.629a1.5 1.5 0 0 1 1.06.439l2.872 2.872a1.5 1.5 0 0 1 .439 1.06V8.25"}),J.createElement("path",{d:"M3.75 12.75a2.25 1.5 0 1 0 4.5 0 2.25 1.5 0 1 0-4.5 0Z"}),J.createElement("path",{d:"m8.25 12.75-.295-5.929 1.062-.113A2.685 2.685 0 0 1 11.6 7.99"})),FW=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},J.createElement("path",{d:"M12.001 15.75v-12m4.5 4.5-4.5-4.5-4.5 4.5m15.75 7.5v1.5a3 3 0 0 1-3 3h-16.5a3 3 0 0 1-3-3v-1.5",style:{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px"}})),pEe={image:c_,gallery:G8,video:t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",...t},J.createElement("g",{strokeLinecap:"round",strokeWidth:2,fill:"none",stroke:"currentColor",strokeLinejoin:"round",className:"nc-icon-wrapper"},J.createElement("rect",{x:2,y:18,width:31,height:26,rx:4}),J.createElement("circle",{cx:8.5,cy:7.5,r:5.5}),J.createElement("circle",{cx:25.5,cy:9.5,r:3.5}),J.createElement("path",{"data-cap":"butt",d:"m33 27 13-6v20l-13-6"}))),audio:hEe,file:FW,product:t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",...t},J.createElement("g",{strokeLinecap:"round",strokeWidth:2,fill:"none",stroke:"currentColor",strokeLinejoin:"round",className:"nc-icon-wrapper"},J.createElement("path",{d:"M4 10h40"}),J.createElement("path",{d:"M44 46H4V10l8-8h24l8 8z"}),J.createElement("path",{d:"M34 20c0 5.5-4.5 10-10 10s-10-4.5-10-10"})))},N6=({text:t,type:e})=>k.jsx("span",{className:nt("text-center font-sans text-sm font-semibold text-grey-800 transition-all group-hover:text-grey-800",e==="button"&&"px-3 py-1"),"data-kg-card-drag-text":!0,children:t}),gEe=({desc:t,hasErrors:e})=>e?null:k.jsx("p",{className:"!font-sans !text-[1.3rem] !font-medium text-grey-900",children:t}),mEe=({desc:t,hasErrors:e,icon:n,size:i})=>{if(i==="xsmall"&&e)return null;const r=pEe[n],o=nt("shrink-0 opacity-80 transition-all ease-linear hover:scale-105 group-hover:opacity-100",i==="large"&&"size-20 text-grey",i==="small"&&"size-14 text-grey",i==="xsmall"&&"size-5 text-grey-700",!["large","small","xsmall"].includes(i)&&"size-16 text-grey",i==="xsmall"&&t&&"mr-3"),s=nt("flex min-w-[auto] !font-sans !text-sm !font-normal text-grey-700 opacity-80 transition-all group-hover:opacity-100",i==="xsmall"&&"!mt-0",i!=="xsmall"&&"!mt-4");return k.jsxs(k.Fragment,{children:[k.jsx(r,{className:o}),k.jsx("p",{className:s,children:t})]})};function Mu({desc:t,icon:e,filePicker:n,size:i,type:r,borderStyle:o="squared",isDraggedOver:s,errors:a=[],placeholderRef:l,dataTestId:u="media-placeholder",errorDataTestId:f="media-placeholder-errors",multiple:d=!1,...h}){const g=nt("relative flex h-full items-center justify-center",r==="button"?"rounded-lg bg-grey-100":"border bg-grey-50",i==="xsmall"&&r!=="button"&&"before:pb-[12.5%] dark:bg-grey-900",i!=="xsmall"&&r!=="button"&&"before:pb-[62.5%] dark:bg-grey-950",o==="rounded"&&r!=="button"&&"rounded-lg border-grey/20 dark:border-transparent",o!=="rounded"&&r!=="button"&&"border-grey/20 dark:border-grey/10"),m=nt("group flex cursor-pointer select-none items-center justify-center",r==="button"&&"px-3 py-1",r!=="button"&&(i==="xsmall"?"p-4":"flex-col p-20")),y=nt("font-sans text-sm font-semibold text-red",i!=="xsmall"&&"mt-3 max-w-[65%]"),x=a.map(_=>k.jsx("span",{className:y,"data-testid":f,children:_.message},_.message));return k.jsx("div",{ref:l,className:"not-kg-prose size-full",...h,"data-testid":u,children:k.jsx("div",{className:g,children:s?k.jsx(N6,{text:`Drop ${d?"'em":"it"} like it's hot 🔥`,type:r}):k.jsxs("button",{className:m,name:"placeholder-button",type:"button",onClick:n,children:[r==="button"?k.jsx(gEe,{desc:t,hasErrors:a.length>0}):k.jsx(mEe,{desc:t,hasErrors:a.length>0,icon:e,size:i}),x]})})})}Mu.propTypes={icon:P.oneOf(["image","gallery","video","audio","file","product"]),desc:P.string,size:P.oneOf(["xsmall","small","medium","large"]),type:P.oneOf(["image","button"]),borderStyle:P.oneOf(["squared","rounded"])};function js({style:t,fullWidth:e,bgStyle:n}){return k.jsx("div",{className:`rounded-full bg-grey-200 dark:bg-black ${e?"w-full":"mx-auto w-3/5"} ${n==="transparent"?"bg-white/30":"bg-grey-200"}`,"data-testid":"progress-bar",children:k.jsx("div",{className:"rounded-full bg-green py-1 text-center text-2xs leading-none text-white",style:t})})}js.propTypes={style:P.object,fullWidth:P.bool};function Wi({fileInputRef:t}){var e;(e=t.current)==null||e.click()}function tw({className:t,imgClassName:e,src:n,alt:i,desc:r,icon:o,size:s,type:a,borderStyle:l="squared",backgroundSize:u="cover",mimeTypes:f,onFileChange:d,dragHandler:h,isEditing:g=!0,isLoading:m,isPinturaEnabled:y,openImageEditor:x,progress:_,errors:S,onRemoveMedia:C=()=>{},additionalActions:E,setFileInputRef:N}){const M=T.useRef(null),I=R=>{M.current=R,N==null||N(R)},W={width:`${_==null?void 0:_.toFixed(0)}%`},B=R=>{R.stopPropagation(),C()};return!m&&!n?k.jsxs("div",{className:t,children:[k.jsx(Mu,{borderStyle:l,dataTestId:"media-upload-placeholder",desc:g?r:"",errorDataTestId:"media-upload-errors",errors:S,filePicker:()=>Wi({fileInputRef:M}),icon:o,isDraggedOver:h==null?void 0:h.isDraggedOver,placeholderRef:h==null?void 0:h.setRef,size:s,type:a}),k.jsx(ew,{fileInputRef:I,filePicker:()=>Wi({fileInputRef:M}),mimeTypes:f,onFileChange:d})]}):k.jsxs("div",{className:nt("group/image relative flex items-center justify-center",m?"min-w-[6.8rem]":"min-w-[5.2rem]",l==="rounded"&&"rounded",t),"data-testid":"media-upload-filled",children:[n&&k.jsxs(k.Fragment,{children:[k.jsx("img",{alt:i,className:nt("mx-auto h-full w-auto min-w-[5.2rem]",l==="rounded"&&"rounded-lg",u==="cover"?"object-cover":"object-contain",e),src:n}),k.jsx("div",{className:nt("absolute inset-0 bg-gradient-to-t from-black/0 via-black/5 to-black/30 opacity-0 transition-all group-hover/image:opacity-100",l==="rounded"&&"rounded-lg")})]}),!m&&k.jsxs("div",{className:"absolute right-1 top-1 flex space-x-1 opacity-0 transition-all group-hover/image:opacity-100",children:[E,y&&k.jsx(pl,{Icon:zy,label:"Edit",onClick:()=>x({image:n,handleSave:R=>{d({target:{files:[R]}})}})}),k.jsx(pl,{dataTestId:"media-upload-remove",Icon:Kc,label:"Delete",onClick:B})]}),m&&k.jsx("div",{className:nt("absolute inset-0 flex min-w-full items-center justify-center overflow-hidden bg-grey-100",l==="rounded"&&"rounded-lg"),"data-testid":"custom-thumbnail-progress",children:k.jsx(js,{style:W})})]})}tw.propTypes={additionalActions:P.node,alt:P.string,backgroundSize:P.oneOf(["cover","contain"]),borderStyle:P.oneOf(["squared","rounded"]),className:P.string,desc:P.string,dragHandler:P.shape({isDraggedOver:P.bool,setRef:P.func}),errors:P.arrayOf(P.shape({message:P.string})),icon:P.string,imgClassName:P.string,isEditing:P.bool,isLoading:P.bool,isPinturaEnabled:P.bool,mimeTypes:P.arrayOf(P.string),onFileChange:P.func,onRemoveMedia:P.func,openImageEditor:P.func,progress:P.number,setFileInputRef:P.func,size:P.string,src:P.string,type:P.oneOf(["image","button"])};function vEe({item:t,selected:e,onChange:n}){let i="";e&&(i="bg-grey-100 dark:bg-grey-900");const r=o=>{o.preventDefault(),n(t)};return k.jsx("li",{className:`${i} m-0 hover:bg-grey-100 dark:hover:bg-grey-900`,children:k.jsx("button",{className:"size-full cursor-pointer px-3 py-[7px] text-left dark:text-white","data-testid":"multiselect-dropdown-item",type:"button",onMouseDownCapture:r,children:t.label})},t.name)}function bEe({placeholder:t="",items:e=[],availableItems:n=[],onChange:i,dataTestId:r,allowAdd:o=!0}){const[s,a]=T.useState(!1),[l,u]=T.useState(""),[f,d]=T.useState(!1),h=T.useRef(null),g=B=>{a(!s),s||B.target.focus()},m=()=>{a(!1),u(""),d(!1)},y=()=>{d(!0),g()},x=B=>{!B.name||e!=null&&e.includes(B.name)||(i(e.concat(B.name)),u(""))},_=(B,Z)=>{B.preventDefault(),B.stopPropagation(),i(e.filter(R=>R!==Z.name))},S=B=>{B.key==="Backspace"&&!l&&i(e.slice(0,-1))},C=(B,Z)=>k.jsx(vEe,{item:B,selected:Z,onChange:x},B.name),E=e.map(B=>({name:B,label:B})),M=n.map(B=>({name:B,label:B})).filter(B=>!E.some(Z=>Z.name===B.name)).filter(B=>B.name.toLocaleLowerCase().includes(l.toLocaleLowerCase()));let I="";const W=M[0];return l&&o&&(e.find(Z=>Z.toLocaleLowerCase()===l.toLocaleLowerCase())||n.find(Z=>Z.toLocaleLowerCase()===l.toLocaleLowerCase())||M.unshift({name:l,label:k.jsxs(k.Fragment,{children:["Add ",k.jsxs("strong",{children:['"',l,'"...']})]})})),k.jsxs("div",{className:"relative z-0 font-sans text-sm font-normal","data-testid":r,children:[k.jsxs("div",{className:`relative flex w-full cursor-text flex-wrap gap-1 rounded-lg border ${f?"border-green bg-white shadow-[0_0_0_2px_rgba(48,207,67,.25)] dark:bg-grey-925":"border-grey-100 bg-grey-100 dark:border-transparent dark:bg-grey-900 dark:hover:bg-grey-925"} px-[10px] py-2 pr-5 font-sans text-sm font-normal leading-[1.5] text-grey-900 placeholder:text-grey-500 focus-visible:outline-none dark:text-white dark:selection:bg-grey-800 dark:placeholder:text-grey-700`,type:"button",onClick:()=>h.current.focus(),children:[E.map(B=>k.jsxs("button",{className:"flex cursor-pointer items-center gap-1.5 rounded bg-black py-px pl-2 pr-1 leading-[1.5] text-white dark:bg-grey-100 dark:text-grey-900","data-testid":"multiselect-dropdown-selected",type:"button",onMouseDownCapture:Z=>_(Z,B),children:[B.label,k.jsx(vh,{className:"mt-px size-[1rem] stroke-[3]"})]},B.name)),k.jsx("div",{className:"flex-1",children:k.jsx("input",{ref:h,className:"size-full min-w-[5rem] appearance-none bg-transparent px-0 leading-none outline-none",placeholder:E.length===0?t:"",value:l,onBlur:m,onChange:B=>u(B.target.value),onFocus:y,onKeyDown:S})}),k.jsx(jW,{className:`absolute right-3 top-4 size-2 text-grey-900 ${s&&"rotate-180"}`})]}),s&&!!M.length&&k.jsxs(n6,{children:[I,k.jsx(r6,{defaultSelected:W,getItem:C,items:M,onSelect:x})]})]})}function A6(t,e){return A6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},A6(t,e)}function kEe(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,A6(t,e)}P.number,P.number,P.number,P.func;const zW=({tabs:t,defaultTab:e,tabContent:n})=>{const[i,r]=T.useState(e||t[0].id),o=s=>{r(s)};return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:`no-scrollbar flex gap-4 border-b border-grey-300 dark:border-grey-900 ${t.length>1?"w-full px-6":"mx-6"}`,children:t.map(s=>k.jsx("button",{className:`-mb-px appearance-none whitespace-nowrap pb-3 pt-4 text-sm font-semibold transition-all ${t.length>1?"cursor-pointer border-b-2":"cursor-default"} ${i===s.id?"border-black text-black dark:border-white dark:text-white":"border-transparent text-grey-600 hover:border-grey-500 dark:text-grey-500 dark:hover:border-grey-500"}`,"data-testid":`tab-${s.id}`,type:"button",onClick:()=>o(s.id),children:s.label},s.id))}),k.jsx("div",{className:"flex flex-col gap-3 p-6 pt-4","data-testid":`tab-contents-${i}`,children:n[i]})]})};zW.propTypes={tabs:P.arrayOf(P.shape({id:P.string.isRequired,label:P.string.isRequired})).isRequired,defaultTab:P.string,tabContent:P.objectOf(P.node).isRequired};function BW({isChecked:t,onChange:e,dataTestId:n}){return k.jsxs("label",{className:"relative inline-block h-4 w-7 outline-none","data-testid":n,id:n,children:[k.jsx("input",{checked:t,className:"peer absolute hidden",type:"checkbox",onChange:e}),k.jsx("div",{className:"absolute inset-0 cursor-pointer rounded-full bg-grey-300 transition-all before:absolute before:bottom-[2px] before:left-[2px] before:size-3 before:rounded-full before:bg-white before:transition-all before:duration-100 peer-checked:bg-black peer-checked:before:translate-x-[12px] dark:bg-grey-800 dark:peer-checked:bg-green"})]})}BW.propTypes={isChecked:P.bool,onChange:P.func};function Fs({children:t,darkMode:e,cardWidth:n,tabs:i,defaultTab:r}){const{ref:o}=j5e({},n),s=T.useMemo(()=>i?typeof t=="object"&&t!==null?t:{default:t}:{default:t},[i,t]);return k.jsx("div",{className:`!mt-0 touch-none ${e?"dark":""}`,children:i?k.jsx("div",{ref:o,className:"not-kg-prose fixed left-0 top-0 z-[9999999] m-0 flex w-[320px] flex-col rounded-lg bg-white bg-clip-padding font-sans shadow-lg will-change-transform dark:bg-grey-950 dark:shadow-xl","data-testid":"settings-panel","data-kg-settings-panel":!0,children:k.jsx(zW,{defaultTab:r,tabContent:s,tabs:i})}):k.jsx("div",{ref:o,className:"not-kg-prose fixed left-0 top-0 z-[9999999] m-0 flex w-[320px] flex-col gap-3 rounded-lg bg-white bg-clip-padding p-6 font-sans shadow-lg will-change-transform dark:bg-grey-950 dark:shadow-xl","data-testid":"settings-panel","data-kg-settings-panel":!0,children:t})})}function fo({label:t,description:e,isChecked:n,onChange:i,dataTestId:r}){return k.jsxs("label",{className:"flex w-full cursor-pointer items-center justify-between",children:[k.jsxs("div",{children:[k.jsx("div",{className:"text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300",children:t}),e&&k.jsx("p",{className:"mt-1 w-11/12 text-xs font-normal leading-snug text-grey-700 dark:text-grey-600",children:e})]}),k.jsx("div",{className:"flex shrink-0 pl-2",children:k.jsx(BW,{dataTestId:r,isChecked:n,onChange:i})})]})}function ef({label:t,hideLabel:e,description:n,onChange:i,value:r,placeholder:o,dataTestId:s,onBlur:a}){return k.jsxs("div",{className:"flex w-full flex-col justify-between",children:[k.jsx("div",{className:e?"sr-only":"mb-1.5 text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300",children:t}),k.jsx(i6,{dataTestId:s,placeholder:o,value:r,onBlur:a,onChange:i}),n&&k.jsx("p",{className:"text-xs font-normal leading-snug text-grey-700 dark:text-grey-600",children:n})]})}function xh({dataTestId:t,label:e,value:n,onChange:i}){const{cardConfig:r}=T.useContext(ft),[o,s]=T.useState([]);T.useEffect(()=>{r!=null&&r.fetchAutocompleteLinks&&r.fetchAutocompleteLinks().then(l=>{s(l.map(u=>({value:u.value,label:u.label})))})},[r]);const a=o.filter(l=>l.label.toLocaleLowerCase().includes(n.toLocaleLowerCase()));return k.jsx(yEe,{dataTestId:t,label:e,listOptions:a,placeholder:"https://yoursite.com/#/portal/signup/",value:n,onChange:i})}function yEe({dataTestId:t,description:e,label:n,listOptions:i,onChange:r,placeholder:o,value:s}){function a(u){r(u.value)}const l=(u,f,d,h)=>k.jsxs(RB,{className:nt(f&&"bg-grey-100 dark:bg-grey-925","m-0 cursor-pointer px-3 py-[7px] text-left hover:bg-grey-100 dark:hover:bg-grey-925"),dataTestId:t,item:u,scrollIntoView:h,selected:f,onClick:a,onMouseOver:d,children:[k.jsx("span",{className:"block text-sm font-normal leading-tight text-black dark:text-white","data-testid":`${t}-listOption-${u.label}`,children:u.label}),k.jsx("span",{className:"block truncate text-xs leading-tight text-grey-700 dark:text-grey-600","data-testid":`${t}-listOption-${u.value}`,children:u.value})]},u.value);return k.jsxs("div",{className:"flex w-full flex-col justify-between",children:[k.jsx("div",{className:"text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300",children:n}),k.jsx(jB,{dataTestId:t,getItem:l,listOptions:i,placeholder:o,value:s,onChange:r}),e&&k.jsx("p",{className:"text-xs font-normal leading-snug text-grey-700 dark:text-grey-600",children:e})]})}function wEe({label:t,description:e,value:n,menu:i,onChange:r,dataTestId:o}){return k.jsxs("div",{className:"flex w-full flex-col justify-between gap-1",children:[k.jsx("div",{className:"text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300","data-testid":`${o}-label`,children:t}),k.jsx(dEe,{dataTestId:o,menu:i,value:n,onChange:r}),e&&k.jsx("p",{className:"text-xs font-normal leading-snug text-grey-700 dark:text-grey-600",children:e})]})}function xEe({label:t,description:e,placeholder:n="",items:i,availableItems:r,onChange:o,dataTestId:s,allowAdd:a=!0}){return k.jsxs("div",{className:"flex w-full flex-col justify-between gap-1",children:[k.jsx("div",{className:"text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300",children:t}),k.jsx(bEe,{allowAdd:a,availableItems:r,dataTestId:s,items:i,placeholder:n,onChange:o}),e&&k.jsx("p",{className:"text-xs font-normal leading-snug text-grey-700 dark:text-grey-600",children:e})]})}function Ea({label:t,onClick:e,selectedName:n,buttons:i,hasTooltip:r}){return k.jsxs("div",{className:"flex w-full items-center justify-between text-[1.3rem]",children:[k.jsx("div",{className:"text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300",children:t}),k.jsx("div",{className:"shrink-0 pl-2",children:k.jsx($W,{buttons:i,hasTooltip:r,selectedName:n,onClick:e})})]})}function nw({label:t,onClick:e,selectedName:n,buttons:i,layout:r,dataTestId:o}){return k.jsxs("div",{className:`flex w-full text-[1.3rem] ${r==="stacked"?"flex-col":"items-center justify-between"}`,"data-testid":o,children:[k.jsx("div",{className:"text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300",children:t}),k.jsx("div",{className:`shrink-0 ${r==="stacked"?"-mx-1 pt-[.6rem]":"pl-2"}`,children:k.jsx(uEe,{buttons:i,selectedName:n,onClick:e})})]})}function c0({label:t,isExpanded:e,onSwatchChange:n,onPickerChange:i,onTogglePicker:r,value:o,swatches:s,eyedropper:a,hasTransparentOption:l,dataTestId:u,children:f,showChildren:d}){const h=g=>{g.stopPropagation()};return k.jsx("div",{className:"flex-col","data-testid":u,onClick:h,children:k.jsxs("div",{className:"flex w-full items-center justify-between text-[1.3rem]",children:[k.jsx("div",{className:"text-sm font-medium tracking-normal text-grey-900 dark:text-grey-300",children:t}),k.jsx("div",{className:"shrink-0 pl-2",children:k.jsx(lEe,{eyedropper:a,hasTransparentOption:l,isExpanded:e,showChildren:d,swatches:s,value:o,onChange:i,onSwatchChange:n,onTogglePicker:r,children:f})})]})})}function iw({className:t,imgClassName:e,label:n,hideLabel:i,onFileChange:r,isDraggedOver:o,placeholderRef:s,src:a,alt:l,isLoading:u,errors:f=[],progress:d,onRemoveMedia:h,icon:g,desc:m,size:y,type:x,stacked:_,borderStyle:S,mimeTypes:C,isPinturaEnabled:E,openImageEditor:N,setFileInputRef:M}){return k.jsxs("div",{className:nt(t,!_&&"flex justify-between gap-3"),"data-testid":"media-upload-setting",children:[k.jsx("div",{className:i?"sr-only":"mb-2 shrink-0 text-sm font-medium tracking-normal text-grey-900 dark:text-grey-400",children:n}),k.jsx(tw,{alt:l,borderStyle:S,className:nt(_&&"h-32",!_&&a&&"h-[5.2rem]",!_&&x!=="button"&&!a&&"h-[5.2rem] w-[7.2rem]"),desc:m,dragHandler:{isDraggedOver:o,setRef:s},errors:f,icon:g,imgClassName:e,isLoading:u,isPinturaEnabled:E,mimeTypes:C,openImageEditor:N,progress:d,setFileInputRef:M,size:y,src:a,type:x,onFileChange:r,onRemoveMedia:h})]})}function P6({visibilityOptions:t,toggleVisibility:e}){return t.map((i,r)=>{const o=i.toggles.map(s=>k.jsx(fo,{dataTestId:`visibility-toggle-${i.key}-${s.key}`,isChecked:s.checked,label:s.label,onChange:()=>e(i.key,s.key,!s.checked)},s.key));return k.jsxs("div",{className:"flex flex-col gap-3","data-testid":"visibility-settings",children:[k.jsx("p",{className:"text-sm font-bold tracking-normal text-grey-900 dark:text-grey-300",children:i.label}),o,rr.key!=="paidMembers"),i[1].toggles=i[1].toggles.filter(r=>r.key!=="paidMembers")),i}function OEe(t){var o,s,a,l,u;const e=t.find(f=>f.key==="web").toggles,n=[];(o=e.find(f=>f.key==="freeMembers"))!=null&&o.checked&&n.push("status:free"),(s=e.find(f=>f.key==="paidMembers"))!=null&&s.checked&&n.push("status:-free");const i=t.find(f=>f.key==="email").toggles,r=[];return(a=i.find(f=>f.key==="freeMembers"))!=null&&a.checked&&r.push("status:free"),(l=i.find(f=>f.key==="paidMembers"))!=null&&l.checked&&r.push("status:-free"),{web:{nonMember:((u=e.find(f=>f.key==="nonMembers"))==null?void 0:u.checked)||!1,memberSegment:n.join(",")},email:{memberSegment:r.join(",")}}}const D6=(t,e,n)=>{const i=n==null?void 0:n.stripeEnabled;let r;t.getEditorState().read(()=>{r=A.$getNodeByKey(e).visibility});const o=WW(r),s=_Ee(r,{isStripeEnabled:i});return{visibilityData:o,visibilityOptions:s,toggleVisibility:(a,l,u)=>{t.update(()=>{const f=structuredClone(s),h=f.find(m=>m.key===a).toggles.find(m=>m.key===l);h.checked=u;const g=A.$getNodeByKey(e);g.visibility=OEe(f)})}}};function SEe({nodeKey:t,html:e}){const[n]=Oe.useLexicalComposerContext(),i=T.useContext(rn),{cardConfig:r,darkMode:o}=T.useContext(ft),[s,a]=T.useState(!1),{showVisibilitySettings:l}=zc(),{visibilityOptions:u,toggleVisibility:f}=D6(n,t,r),d=[{id:"visibility",label:"Visibility"}],h=_=>{n.update(()=>{const S=A.$getNodeByKey(t);S.html=_})},g=_=>{_.preventDefault(),_.stopPropagation(),n.dispatchCommand(Lo,{cardKey:t,focusEditor:!1})},m=_=>{var S;((S=_==null?void 0:_.relatedTarget)==null?void 0:S.className)!=="kg-prose"&&n.dispatchCommand(sw,{cardKey:t})},y=k.jsx(P6,{toggleVisibility:f,visibilityOptions:u}),x=T.useCallback(_=>{_.preventDefault(),_.stopPropagation(),n.dispatchCommand(z6,{cardKey:t})},[n,t]);return k.jsxs(k.Fragment,{children:[k.jsx(xW,{darkMode:o,html:e,isEditing:i.isEditing,updateHtml:h,onBlur:m}),k.jsx(xt,{"data-kg-card-toolbar":"html",isVisible:s,children:k.jsx(Kn,{onClose:()=>a(!1)})}),k.jsx(xt,{"data-kg-card-toolbar":"html",isVisible:i.isSelected&&!s&&!i.isEditing,children:k.jsxs(Jn,{children:[k.jsx(at,{dataTestId:"edit-html",icon:"edit",isActive:!1,label:"Edit",onClick:g}),k.jsx(Bn,{}),k.jsx(at,{dataTestId:"show-visibility",icon:"visibility",isActive:l,label:"Visibility",onClick:x}),k.jsx(Bn,{hide:!r.createSnippet}),k.jsx(at,{dataTestId:"create-snippet",hide:!r.createSnippet,icon:"snippet",isActive:!1,label:"Save as snippet",onClick:()=>a(!0)})]})}),l&&i.isSelected&&k.jsx(Fs,{darkMode:o,defaultTab:"visibility",tabs:d,onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},children:{visibility:y}})]})}const HW=A.createCommand();class f0 extends Zg{getIcon(){return l_}constructor(e={},n){super(e,n)}decorate(){return k.jsx(An,{IndicatorIcon:s5e,isVisibilityActive:this.getIsVisibilityActive(),nodeKey:this.getKey(),wrapperStyle:"wide",children:k.jsx(SEe,{html:this.__html,nodeKey:this.getKey(),visibility:this.__visibility})})}}ye(f0,"kgMenu",{label:"HTML",desc:"Insert a HTML editor card",Icon:l_,insertCommand:HW,matches:["html"],priority:18,shortcut:"/html"});function CEe(t){return new f0(t)}function EEe(t){return t instanceof f0}const QW=ib;var TEe=function(t="",{ghostVersion:e="4.0",type:n="mobiledoc"}={}){const i=QW.coerce(e);return typeof t!="string"||(t||"").trim()===""?"":QW.satisfies(i,"<4.x")?n==="markdown"?t.replace(/[^\w]/g,"").toLowerCase():t.replace(/[<>&"?]/g,"").trim().replace(/[^\w]/g,"-").replace(/-{2,}/g,"-").toLowerCase():encodeURIComponent(t.trim().toLowerCase().replace(/[\][!"#$%&'()*+,./:;<=>?@\\^_{|}~]/g,"").replace(/\s+/g,"-").replace(/^-|-{2,}|-$/g,""))},$Ee={slugify:TEe},MEe=$Ee;const UW=MM,ZW=ib,{slugify:NEe}=MEe,_h={},qW=function({ghostVersion:t}={}){const e=function(n,i={}){let r=NEe(n,{ghostVersion:t,type:"markdown"});return i[r]&&(i[r]+=1,r+=i[r]),r};return function(n){const i=n.renderer.rules.heading_open;n.renderer.rules.heading_open=function(r,o,s,a,l){const u={};r[o].attrs=r[o].attrs||[];const f=r[o+1].children.reduce(function(h,g){return h+g.content},""),d=e(f,u);return r[o].attrs.push(["id",d]),i?i.apply(this,arguments):l.renderToken.apply(l,arguments)}}},AEe=function(t){const e=ZW.coerce(t.ghostVersion||"4.0");if(ZW.satisfies(e,"<4.x")){if(_h["<4.x"])return _h["<4.x"];const n=new UW({html:!0,breaks:!0,linkify:!0}).use(rb()).use(ob()).use(sb()).use(fb()).use(qW(t)).use(db()).use(hb());return n.linkify.set({fuzzyLink:!1}),_h["<4.x"]=n,n}else{if(_h.latest)return _h.latest;const n=new UW({html:!0,breaks:!0,linkify:!0}).use(rb()).use(ob()).use(sb()).use(fb()).use(qW(t)).use(db()).use(hb());return n.linkify.set({fuzzyLink:!1}),_h.latest=n,n}};var PEe={render:function(t,e={}){return AEe(e).render(t)}},DEe=PEe;const YW=xo(DEe),I6=A.createCommand("PASTE_MARKDOWN_COMMAND"),L6="text/plain",R6="text/html",IEe=()=>{const[t]=Oe.useLexicalComposerContext(),[e,n]=T.useState(!1);return T.useEffect(()=>{const i=r=>{r.key==="Shift"&&n(!1)};return document.addEventListener("keyup",i),()=>{document.removeEventListener("keyup",i)}},[n]),T.useEffect(()=>{const i=r=>{r.key==="Shift"&&n(!0)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[n]),T.useEffect(()=>ut.mergeRegister(t.registerCommand(I6,({text:i,allowBr:r})=>{const o=A.$getSelection();if(!A.$isRangeSelection(o))return!1;const s=new DataTransfer;if(e)s.setData(L6,i);else{const a=YW.render(i),l=r?a:a.replace(//g,""),u=Gy(l,{replaceJS:!0});s.setData(R6,u)}return Ac.$insertDataTransferForRichText(s,o,t),!0},A.COMMAND_PRIORITY_LOW)),[t,e]),null};var VW={},XW={},d0={};Object.defineProperty(d0,"__esModule",{value:!0}),d0.denestTransform=KW,d0.registerDenestTransform=jEe;const tf=ei,nf=A;function LEe(t){if(!(0,tf.$isListNode)(t))return!1;const e=t.getParent();return!((0,nf.$isRootNode)(e)||(0,tf.$isListItemNode)(e))}function REe(t){if(!(0,tf.$isListItemNode)(t))return!1;const e=t.getParent();return!(0,tf.$isListNode)(e)}function GW(t){return(0,nf.$isLineBreakNode)(t)||(0,nf.$isTextNode)(t)?!1:LEe(t)||REe(t)||t.isInline&&!t.isInline()&&!(0,tf.$isListNode)(t)&&!(0,tf.$isListItemNode)(t)}function KW(t,e){const n=t.getChildren();if(!n.some(GW))return;const r=(0,nf.$createParagraphNode)();let o=e(t);n.forEach(a=>{GW(a)?(o.getChildrenSize()>0&&(r.append(o),o=e(t)),r.append(a)):o.append(a)}),o.getChildrenSize()>0&&r.append(o);let s=t;for(;s.getParent()&&s.getParent()!==(0,nf.$getRoot)();)s=s.getParentOrThrow();r.getChildren().reverse().forEach(a=>{if((0,nf.$isRootNode)(s.getParent())&&(0,tf.$isListItemNode)(a)){const l=(0,nf.$createParagraphNode)();l.append(...a.getChildren()),a.remove(),s.insertAfter(l);return}s.insertAfter(a)}),t.remove(),r.remove()}function jEe(t,e,n){return t.hasNodes([e])?t.registerNodeTransform(e,i=>{KW(i,n)}):()=>{}}var h0={};Object.defineProperty(h0,"__esModule",{value:!0}),h0.removeAlignmentTransform=JW,h0.registerRemoveAlignmentTransform=FEe;function JW(t){t.getFormatType()!==""&&t.setFormat("")}function FEe(t,e){return t.hasNodes([e])?t.registerNodeTransform(e,JW):()=>{}}const eH=tv(Cke);var p0={};Object.defineProperty(p0,"__esModule",{value:!0}),p0.mergeListNodesTransform=tH,p0.registerMergeListNodesTransform=zEe;const rw=ei;function tH(t){const e=t.getNextSibling();(0,rw.$isListNode)(e)&&(0,rw.$isListNode)(t)&&e.getListType()===t.getListType()&&(t.append(...e.getChildren()),e.remove())}function zEe(t){return t.hasNodes([rw.ListNode])?t.registerNodeTransform(rw.ListNode,tH):()=>{}}var ow={};Object.defineProperty(ow,"__esModule",{value:!0}),ow.removeAtLinkNodesTransform=rH,ow.registerRemoveAtLinkNodesTransform=BEe;const nH=A,iH=eH;function rH(t){const e=t.getPreviousSibling(),n=t.getNextSibling();e?(0,nH.$isTextNode)(e)&&e.getTextContent().endsWith(" ")&&e.setTextContent(e.getTextContent().slice(0,-1)):n&&(0,nH.$isTextNode)(n)&&n.getTextContent().startsWith(" ")&&n.setTextContent(n.getTextContent().slice(1)),t.remove()}function BEe(t){return t.hasNodes([iH.AtLinkNode])?t.registerNodeTransform(iH.AtLinkNode,rH):()=>{}}(function(t){var e=tn&&tn.__createBinding||(Object.create?function(h,g,m,y){y===void 0&&(y=m);var x=Object.getOwnPropertyDescriptor(g,m);(!x||("get"in x?!g.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return g[m]}}),Object.defineProperty(h,y,x)}:function(h,g,m,y){y===void 0&&(y=m),h[y]=g[m]}),n=tn&&tn.__exportStar||function(h,g){for(var m in h)m!=="default"&&!Object.prototype.hasOwnProperty.call(g,m)&&e(g,h,m)};Object.defineProperty(t,"__esModule",{value:!0}),t.registerDefaultTransforms=d;const i=d0,r=h0,o=ut,s=A,a=Kt,l=eH,u=ei,f=p0;n(d0,t),n(p0,t),n(h0,t),n(ow,t);function d(h){return(0,o.mergeRegister)((0,r.registerRemoveAlignmentTransform)(h,s.ParagraphNode),(0,r.registerRemoveAlignmentTransform)(h,a.HeadingNode),(0,r.registerRemoveAlignmentTransform)(h,l.ExtendedHeadingNode),(0,r.registerRemoveAlignmentTransform)(h,a.QuoteNode),(0,i.registerDenestTransform)(h,s.ParagraphNode,()=>(0,s.$createParagraphNode)()),(0,i.registerDenestTransform)(h,a.HeadingNode,g=>(0,a.$createHeadingNode)(g.getTag())),(0,i.registerDenestTransform)(h,l.ExtendedHeadingNode,g=>(0,a.$createHeadingNode)(g.getTag())),(0,i.registerDenestTransform)(h,a.QuoteNode,()=>(0,a.$createQuoteNode)()),(0,i.registerDenestTransform)(h,u.ListNode,g=>(0,u.$createListNode)(g.getListType(),g.getStart())),(0,i.registerDenestTransform)(h,u.ListItemNode,()=>(0,u.$createListItemNode)()),(0,f.registerMergeListNodesTransform)(h))}})(XW),function(t){var e=tn&&tn.__createBinding||(Object.create?function(i,r,o,s){s===void 0&&(s=o);var a=Object.getOwnPropertyDescriptor(r,o);(!a||("get"in a?!r.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return r[o]}}),Object.defineProperty(i,s,a)}:function(i,r,o,s){s===void 0&&(s=o),i[s]=r[o]}),n=tn&&tn.__exportStar||function(i,r){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&e(r,i,o)};Object.defineProperty(t,"__esModule",{value:!0}),n(XW,t)}(VW);const j6=t=>{if(!t)return!1;const{metaKey:e,key:n,target:i}=t;return n==="Escape"||e&&n==="Enter"?!1:i.matches("input, textarea")||i.cmView||i.cmIgnore||!!i.closest(".cm-editor")},kn=A.createCommand("INSERT_CARD_COMMAND"),Nu=A.createCommand("SELECT_CARD_COMMAND"),sw=A.createCommand("DESELECT_CARD_COMMAND"),Lo=A.createCommand("EDIT_CARD_COMMAND"),rf=A.createCommand("DELETE_CARD_COMMAND"),F6=A.createCommand("PASTE_LINK_COMMAND"),z6=A.createCommand("SHOW_CARD_VISIBILITY_SETTINGS_COMMAND"),WEe=A.createCommand("HIDE_CARD_VISIBILITY_SETTINGS_COMMAND"),B6=10,oH={code:"`",superscript:"^",subscript:"~",strikethrough:"~~"};function of(t,e){const n=A.$createNodeSelection();n.add(e),A.$setSelection(n),document.activeElement!==t.getRootElement()&&t.getRootElement().focus({preventScroll:!0})}function Oh(t,e){var i;const n=A.$getNodeByKey(e);(i=n==null?void 0:n.isEmpty)!=null&&i.call(n)&&HEe(t,n)}function HEe(t,e){if(A.$getRoot().getLastChild().is(e)){const n=A.$createParagraphNode();A.$getRoot().append(n),n.select()}else{const n=e.getNextSibling();A.$isDecoratorNode(n)?(or(n),t.getRootElement().focus()):n.selectStart()}e.remove()}function QEe({editor:t,containerElem:e,cursorDidExitAtTop:n,isNested:i}){const{selectedCardKey:r,setSelectedCardKey:o,isEditingCard:s,setIsEditingCard:a,setShowVisibilitySettings:l}=zc(),u=T.useRef(!1);return T.useEffect(()=>{const f=h=>{u.current=h.shiftKey},d=h=>{u.current=h.shiftKey};return document.addEventListener("keydown",f),document.addEventListener("keyup",d),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",d)}},[]),T.useEffect(()=>{const f=d=>{document.body.contains(d.target)&&e.current&&!e.current.contains(d.target)&&t.getEditorState().read(()=>{const h=A.$getSelection();if(A.$isNodeSelection(h)){const g=h.getNodes()[0];Pc(g)&&t.dispatchCommand(sw,{cardKey:g.getKey()})}})};return i||window.addEventListener("mousedown",f),()=>{window.removeEventListener("mousedown",f)}},[t,e,i]),T.useEffect(()=>ut.mergeRegister(t.registerUpdateListener(({editorState:f,tags:d})=>{if(d.has("collaboration")||d.has("card-export")||i||document.activeElement.closest("[data-lexical-decorator]"))return;const{isCardSelected:h,cardKey:g,cardNode:m}=f.read(()=>{const y=A.$getSelection();if(A.$isNodeSelection(y)&&y.getNodes().length===1&&Pc(y.getNodes()[0])){const _=y.getNodes()[0];return{isCardSelected:!0,cardKey:_.getKey(),cardNode:_}}else return{isCardSelected:!1}});h&&!r?(o(g),a(!1)):h&&r!==g&&t.update(()=>{Oh(t,r),o(g),a(!1)},{tag:"history-merge"}),!h&&r&&t.update(()=>{Oh(t,r),o(null),a(!1)},{tag:"history-merge"}),h&&m.__openInEditMode&&(t.update(()=>{m.clearOpenInEditMode()},{tag:"history-merge"}),a(!0))}),t.registerCommand(kn,({cardNode:f,openInEditMode:d})=>{let h;const g=A.$getSelection();if(A.$isRangeSelection(g))h=g.focus.getNode();else if(A.$isNodeSelection(g))h=g.getNodes()[0];else return!1;return h!==null&&(G6e({selectedNode:h,newNode:f}),o(f.getKey()),d&&a(!0)),!0},A.COMMAND_PRIORITY_LOW),t.registerCommand(Nu,({cardKey:f})=>{var d;if(r===f&&s){const h=A.$getNodeByKey(f);if((d=h.isEmpty)!=null&&d.call(h))return t.dispatchCommand(rf,{cardKey:f}),!0}r&&r!==f&&(Oh(t,r),l(!1)),of(t,f),o(f),a(!1)},A.COMMAND_PRIORITY_LOW),t.registerCommand(Lo,({cardKey:f,focusEditor:d})=>{var g;r&&r!==f&&Oh(t,r),of(t,f),o(f);const h=A.$getNodeByKey(f);(g=h.hasEditMode)!=null&&g.call(h)&&a(!0)},A.COMMAND_PRIORITY_LOW),t.registerCommand(sw,({cardKey:f})=>{Oh(t,f),o(null),a(!1),l(!1)},A.COMMAND_PRIORITY_LOW),t.registerCommand(rf,({cardKey:f,direction:d="forward"})=>{const h=A.$getNodeByKey(f),g=h.getPreviousSibling(),m=h.getNextSibling();if(d==="backward"&&g)if(A.$isDecoratorNode(g)){const y=A.$createNodeSelection();y.add(g.getKey()),A.$setSelection(y)}else g.selectEnd?g.selectEnd():h.selectPrevious();else if(m)if(A.$isDecoratorNode(m)){const y=A.$createNodeSelection();y.add(m.getKey()),A.$setSelection(y)}else m.selectStart?m.selectStart():h.selectNext();else{const y=A.$createParagraphNode();A.$getRoot().append(y),y.select()}return h.remove(),t.getRootElement().focus(),!0},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_DOWN_COMMAND,f=>!!j6(f),A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_ENTER_COMMAND,f=>{var d,h;if(r&&(f.metaKey||f.ctrlKey)){const g=A.$getNodeByKey(r);if((d=g.hasEditMode)!=null&&d.call(g)){if(f.preventDefault(),s){if(t.getRootElement().focus({preventScroll:!0}),(h=g.isEmpty)!=null&&h.call(g)){if(A.$getRoot().getLastChild().is(g)){const m=A.$createParagraphNode();A.$getRoot().append(m),m.select()}else of(t,r),t.dispatchCommand(A.KEY_ARROW_DOWN_COMMAND);g.remove()}else of(t,r);a(!1)}else a(!0);return!0}}if(!f._fromNested&&document.activeElement!==t.getRootElement())return!0;if(!i&&r){f.preventDefault();const g=A.$getNodeByKey(r),m=A.$createParagraphNode();return g.insertAfter(m),m.select(),!0}if(!i){const g=A.$getSelection(),m=g==null?void 0:g.getNodes()[0];if(A.$isTextNode(m)){const y=m.getTextContent();if(y.match(/^```(\w{1,10})?/)){f.preventDefault();const x=y.replace(/^```/,""),_=m.getTopLevelElement().insertAfter(KC({language:x,_openInEditMode:!0}));m.getTopLevelElement().remove();const S=A.$createNodeSelection();return S.add(_.getKey()),A.$setSelection(S),!0}}}},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_ARROW_UP_COMMAND,f=>{const d=A.$getSelection();if(f!=null&&f.shiftKey){if(A.$isRangeSelection(d)){let h=d.anchor.getNode();if(!A.$isRootNode(h)){h=h.getTopLevelElement();let g=d.focus.getNode().getTopLevelElement(),m=g.getTopLevelElement().getPreviousSibling();if(A.$isTextNode(g)&&A.$isTextNode(m))return!1;if(A.$isDecoratorNode(h)||A.$isDecoratorNode(m))return d.anchor.offset===0?(d.focus.set("root",g.getIndexWithinParent()-1,"element"),d.anchor.set("root",h.getIndexWithinParent(),"element")):(d.focus.set("root",g.getIndexWithinParent(),"element"),d.anchor.set("root",h.getIndexWithinParent()+1,"element")),f.preventDefault(),!0}if(A.$isRootNode(h))return d.focus.offset>0&&d.focus.set("root",d.focus.offset-1,"element"),f.preventDefault(),!0}return!1}if(f!=null&&f._fromCaptionEditor&&of(t,r),document.activeElement!==t.getRootElement())return!0;if(A.$isNodeSelection(d)){const g=d.getNodes()[0].getPreviousSibling();return!g&&n?(d.clear(),n(),!0):A.$isDecoratorNode(g)?(or(g),!0):(f.preventDefault(),g.selectEnd(),!0)}if(A.$isRangeSelection(d)&&d.isCollapsed()){const h=d.anchor.getNode().getTopLevelElement(),g=window.getSelection();if(n&&h6(d))return n(),!0;const m=(h==null?void 0:h.getTextContent().trim())===""&&d.anchor.offset===0,y=d.anchor.offset===0&&d.focus.offset===0;if(m||y){const x=h.getPreviousSibling();if(A.$isDecoratorNode(x))return or(x),!0}else if(g6(g,B6)){const _=h.getPreviousSibling();if(A.$isDecoratorNode(_))return or(_),!0}}return!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_ARROW_DOWN_COMMAND,f=>{const d=A.$getSelection();if(f!=null&&f.shiftKey){if(A.$isRangeSelection(d)){let h=d.anchor.getNode();if(!A.$isRootNode(h)){h=h.getTopLevelElement();let g=d.focus.getNode().getTopLevelElement(),m=g.getTopLevelElement().getNextSibling();if(A.$isTextNode(g)&&A.$isTextNode(m))return!1;if(A.$isDecoratorNode(h)||A.$isDecoratorNode(m))return d.anchor.offset===h.getTextContentSize()?(d.anchor.set("root",h.getIndexWithinParent()+1,"element"),d.focus.set("root",g.getIndexWithinParent()+2,"element")):(d.anchor.set("root",h.getIndexWithinParent(),"element"),d.focus.set("root",g.getIndexWithinParent()+1,"element")),f.preventDefault(),!0}if(A.$isRootNode(h))return d.focus.offset<=h.getLastChildOrThrow().getIndexWithinParent()&&d.focus.set("root",d.focus.offset+1,"element"),f.preventDefault(),!0}return!1}if(f!=null&&f._fromCaptionEditor&&of(t,r),document.activeElement!==t.getRootElement())return!0;if(A.$isNodeSelection(d)){const h=d.getNodes()[0],g=h.getNextSibling();if(!g){const m=A.$createParagraphNode();return h.insertAfter(m),m.select(),!0}return A.$isDecoratorNode(g)?(or(g),!0):(f==null||f.preventDefault(),g.selectStart(),!0)}if(A.$isRangeSelection(d)&&d.isCollapsed()){const h=d.anchor.getNode().getTopLevelElement(),g=window.getSelection(),m=p6(g.anchorNode),y=(h==null?void 0:h.getTextContent().trim())===""&&d.anchor.offset===0,x=g.rangeCount!==0&&g.anchorNode===m&&g.anchorOffset===m.children.length-1&&g.focusOffset===m.children.length-1;if(y||x){const _=h.getNextSibling();if(A.$isDecoratorNode(_))return or(_),!0}else{const S=g.getRangeAt(0).cloneRange().getClientRects();if(S.length>0){const C=S.length>1?S[1]:S[0],E=m.getBoundingClientRect();if(Math.abs(C.bottom-E.bottom){if(document.activeElement!==t.getRootElement())return!0;const d=A.$getSelection();if(n){if(A.$isNodeSelection(d)){if(!d.getNodes()[0].getPreviousSibling())return f.preventDefault(),d.clear(),n==null||n(),!0}else if(h6(d))return f.preventDefault(),n(),!0}if(!A.$isNodeSelection(d))return!1;const h=d.getNodes()[0];let g;return Pc(h)?g=h.getPreviousSibling():g=h.getTopLevelElement().getPreviousSibling(),A.$isDecoratorNode(g)?(f.preventDefault(),or(g),!0):!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_ARROW_RIGHT_COMMAND,f=>{if(document.activeElement!==t.getRootElement())return!0;const d=A.$getSelection();if(!A.$isNodeSelection(d))return!1;const h=d.getNodes(),g=h[h.length-1];let m;return Pc(g)?m=g.getNextSibling():m=g.getTopLevelElement().getNextSibling(),A.$isDecoratorNode(m)?(f.preventDefault(),or(m),!0):!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_MODIFIER_COMMAND,f=>{const{altKey:d,ctrlKey:h,metaKey:g,shiftKey:m,code:y,key:x}=f,_=x==="ArrowUp"||f.keyCode===38,S=x==="ArrowDown"||f.keyCode===40;if(g&&(_||S)){const C=A.$getSelection(),E=A.$isNodeSelection(C),N=A.$isDecoratorNode(A.$getRoot().getFirstChild()),M=A.$isDecoratorNode(A.$getRoot().getLastChild());if(E||N||M){if(S){f.preventDefault();const I=A.$getRoot().getLastChild();return A.$isDecoratorNode(I)?(or(I),!0):(I.selectEnd(),!0)}if(_){f.preventDefault();const I=A.$getRoot().getFirstChild();return A.$isDecoratorNode(I)?(or(I),!0):(I.selectStart(),!0)}}}if(h&&y==="KeyQ"){f.preventDefault();const C=A.$getSelection();if(A.$isRangeSelection(C)){const E=C.anchor.getNode().getTopLevelElement();A.$isParagraphNode(E)?Oi.$setBlocksType(C,()=>Kt.$createQuoteNode()):Kt.$isQuoteNode(E)?Oi.$setBlocksType(C,()=>sD()):aD(E)&&Oi.$setBlocksType(C,()=>A.$createParagraphNode())}}if((h||g)&&d&&y==="KeyH")return f.preventDefault(),t.dispatchCommand(A.FORMAT_TEXT_COMMAND,"highlight"),!0;if(h&&m&&y==="KeyK")return t.dispatchCommand(A.FORMAT_TEXT_COMMAND,"code"),!0;if(h&&d&&y==="KeyU")return t.dispatchCommand(A.FORMAT_TEXT_COMMAND,"strikethrough"),!0;if(h&&d&&x.match(/^[1-6]$/)){f.preventDefault();const C=A.$getSelection();A.$isRangeSelection(C)&&Oi.$setBlocksType(C,()=>Kt.$createHeadingNode(`h${x}`))}if(h&&y==="KeyL"){f.preventDefault();const C=A.$getSelection();if(A.$isRangeSelection(C)){const E=C.anchor.getNode().getTopLevelElement();ei.$isListNode(E)?t.update(()=>{const N=A.$createParagraphNode();Oi.$setBlocksType(C,()=>N),N.setIndent(0)}):d?t.dispatchCommand(ei.INSERT_ORDERED_LIST_COMMAND,void 0):t.dispatchCommand(ei.INSERT_UNORDERED_LIST_COMMAND,void 0)}}return!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_BACKSPACE_COMMAND,f=>{if(document.activeElement!==t.getRootElement())return!0;if(!i&&r)return f.preventDefault(),t.dispatchCommand(rf,{cardKey:r,direction:"backward"}),!0;const d=A.$getSelection();if(A.$isRangeSelection(d)&&d.isCollapsed()){const g=d.anchor.getNode(),m=g.getTopLevelElement(),y=m.getPreviousSibling(),x=d.anchor.offset===0&&d.focus.offset===0;if(x&&ei.$isListItemNode(g)&&g.getIndent()===0&&g.isEmpty())return f.preventDefault(),t.dispatchCommand(A.INSERT_PARAGRAPH_COMMAND),!0;if(x&&ki.$isLinkNode(g.getPreviousSibling())){const N=g.getPreviousSibling().getLastDescendant();if(A.$isTextNode(N))return N.spliceText(N.getTextContentSize(),1,"",!0),!0}if(A.$isParagraphNode(g)&&g.isEmpty()&&A.$isDecoratorNode(y))return m.remove(),or(y),!0;if(x&&ei.$isListItemNode(g.getParent())){const E=g.getParent();if(E.getIndent()===0){f.preventDefault();const N=A.$createParagraphNode();return N.append(...E.getChildren()),E.replace(N),!0}}const _=g.getParent();if(x&&(Kt.$isQuoteNode(_)||aD(_))){const E=A.$createParagraphNode();return _.getChildren().forEach(N=>{E.append(N)}),_.replace(E),E.selectStart(),f.preventDefault(),!0}if(x&&A.$isDecoratorNode(y)&&_===m&&_.getFirstChild().is(g))return f.preventDefault(),y.remove(),!0;const S=g.getTextContentSize();if(d.anchor.offset===S&&d.focus.offset===S&&A.$isTextNode(g)){const E=g.getTextContent();for(const N of Object.keys(oH))if(g.hasFormat(N)){const M=oH[N];let I=E;return N==="code"&&E.match(/{.*?}(?![A-Za-z\s])/)||(I=M+I+M),I=I.slice(0,-1),g.setFormat(0),g.setTextContent(I),d.anchor.offset=d.anchor.offset+I.length-E.length,d.focus.offset=d.focus.offset+I.length-E.length,f.preventDefault(),!0}}}return!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_DELETE_COMMAND,f=>{if(document.activeElement!==t.getRootElement())return!0;if(!i&&r)return f.preventDefault(),t.dispatchCommand(rf,{cardKey:r,direction:"forward"}),!0;const d=A.$getSelection();if(A.$isRangeSelection(d)&&d.isCollapsed()){const h=d.anchor,g=h.getNode(),m=g.getTopLevelElement(),y=m.getNextSibling();if((m==null?void 0:m.getTextContent().trim())===""&&d.anchor.offset===0&&A.$isDecoratorNode(y))return f.preventDefault(),m.remove(),or(y),!0;if((h.type==="element"&&A.$isElementNode(g)&&h.offset===g.getChildrenSize()||h.type==="text"&&h.offset===g.getTextContentSize()&&h.getNode().getParent().getLastChild().is(h.getNode()))&&A.$isDecoratorNode(y))return f.preventDefault(),y.remove(),!0}return!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.DELETE_LINE_COMMAND,f=>{if(r&&document.activeElement===t.getRootElement()&&!i)return t.dispatchCommand(rf,{cardKey:r,direction:f?"backward":"forward"}),!0;const d=A.$getSelection();if(A.$isRangeSelection(d)&&d.isCollapsed()){const g=d.anchor.getNode(),m=g.getTopLevelElement(),y=m.getPreviousSibling(),x=m.getNextSibling(),_=f?y:x,S=window.getSelection(),C=g6(S,B6);if(A.$isDecoratorNode(_)&&C)return f&&A.$isLineBreakNode(g.getNextSibling())?(g.remove(),!0):(m.remove(),or(_),!0)}return!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_TAB_COMMAND,f=>{if(document.activeElement!==t.getRootElement())return!0;if(f.shiftKey&&n){const d=A.$getSelection();if(A.$isNodeSelection(d))return f.preventDefault(),d.clear(),n(),!0;let h;if(d.isCollapsed()){const m=d.anchor.getNode();h=A.$isTextNode(m)?[m.getParent()]:[m]}else h=d.getNodes();if(!h.some(m=>m.getIndent&&m.getIndent()>0))return f.preventDefault(),n(),!0}if(!i){const h=A.$getSelection().getNodes()[0];if(A.$isTextNode(h)){const g=h.getTextContent();if(g.match(/^```(\w{1,10})?/)){f.preventDefault();const m=g.replace(/^```/,""),y=h.getTopLevelElement().insertAfter(KC({language:m,_openInEditMode:!0}));h.getTopLevelElement().remove();const x=A.$createNodeSelection();return x.add(y.getKey()),A.$setSelection(x),!0}}if(ei.$isListItemNode(h)||A.$isTextNode(h)&&ei.$isListItemNode(h.getParent())){f.preventDefault();let g=A.$isTextNode(h)?h.getParent():h;const m=g.getIndent();return f.shiftKey?m>0&&g.setIndent(m-1):g.setIndent(m+1),!0}return f.preventDefault(),!0}},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.KEY_ESCAPE_COMMAND,f=>(r&&s&&(t._parentEditor||t).dispatchCommand(Nu,{cardKey:r}),t._parentEditor&&t._parentEditor.getRootElement().focus(),f.preventDefault(),!0),A.COMMAND_PRIORITY_LOW),t.registerCommand(A.PASTE_COMMAND,f=>{var S;if(document.activeElement!==t.getRootElement()&&!i)return!!j6(f);const d=f.clipboardData;if(!d)return!1;const h=d.getData(L6),g=h==null?void 0:h.match(/^(https?:\/\/[^\s]+)$/);if(g){const C=(S=A.$getSelection())==null?void 0:S.anchor.getNode();return C&&C.getTextContent().startsWith("/")?!1:(f.preventDefault(),t.dispatchCommand(F6,{linkMatch:g}),!0)}const m=d.getData(R6);if(h&&!m)return f==null||f.preventDefault(),t.dispatchCommand(I6,{text:h,allowBr:!0}),!0;const y=d.files?Array.from(d.files):[],x=y.filter(C=>C.type.startsWith("image/")),_=m&&!!m.match(/<\s*img\b/gi);return x.length===1&&_?(f.preventDefault(),t.dispatchCommand(Kt.DRAG_DROP_PASTE,y),!0):!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(F6,({linkMatch:f})=>{const d=A.$getSelection(),h=d.getTextContent(),m=d.anchor.getNode().getTextContent();if(h.length>0){const y=f[1];return A.$isRangeSelection(d)&&t.dispatchCommand(ki.TOGGLE_LINK_COMMAND,{url:y,rel:null}),!0}if(m.length>0||u.current===!0){const y=f[1],x=ki.$createLinkNode(y),_=A.$createTextNode(y);x.append(_);const S=A.$createTextNode(" ");return A.$insertNodes([x,S]),S.remove(),!0}if(h.length===0&&m.length===0){const y=f[1],x=KB({url:y});return t.dispatchCommand(kn,{cardNode:x,createdWithUrl:!0}),!0}return!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.CLICK_COMMAND,f=>{if(f.target.matches('[data-lexical-decorator="true"]')){f.preventDefault();const d=A.$getNearestNodeFromDOMNode(f.target);return of(t,d.getKey()),!0}return!1},A.COMMAND_PRIORITY_LOW),t.registerCommand(A.CUT_COMMAND,f=>!!j6(f),A.COMMAND_PRIORITY_LOW),t.registerCommand(z6,({cardKey:f})=>(t.update(()=>{var h;const d=A.$getNodeByKey(f);EEe(d)?(l(!0),r||t.dispatchCommand(Nu,{cardKey:f,focusEditor:!0})):(h=d==null?void 0:d.hasEditMode)!=null&&h.call(d)&&!s?(l(!0),t.dispatchCommand(Lo,{cardKey:f,focusEditor:!0})):s&&Oh(t,f)}),!0),A.COMMAND_PRIORITY_LOW),t.registerCommand(WEe,({cardKey:f})=>(t.update(()=>{l(!1),t.dispatchCommand(sw,{cardKey:f})}),!0),A.COMMAND_PRIORITY_LOW))),T.useEffect(()=>VW.registerDefaultTransforms(t),[t]),null}function sH({containerElem:t=document.querySelector(".koenig-editor"),cursorDidExitAtTop:e,isNested:n}){const[i]=Oe.useLexicalComposerContext();return QEe({editor:i,containerElem:t,cursorDidExitAtTop:e,isNested:n})}const An=({nodeKey:t,width:e,wrapperStyle:n,IndicatorIcon:i,children:r})=>{const{cardConfig:o}=T.useContext(ft),[s]=Oe.useLexicalComposerContext(),[a,l]=T.useState(null),[u,f]=T.useState(null),[d,h]=T.useState(e||"regular"),g=T.useRef(null),m=T.useRef(!1),{selectedCardKey:y,isEditingCard:x,isDragging:_}=zc(),S=y===t,C=S&&x,E=T.useCallback(I=>{I.preventDefault(),I.stopPropagation(),s.dispatchCommand(z6,{cardKey:t})},[s,t]);T.useLayoutEffect(()=>{s.getEditorState().read(()=>{const I=A.$getNodeByKey(t);l(I.getType())})},[]),T.useEffect(()=>ut.mergeRegister(s.registerCommand(A.CLICK_COMMAND,I=>{var W;if(!m.current&&g.current.contains(I.target)){const B=A.$getNodeByKey(t),Z=!B,R=I.target.closest('[data-kg-allow-clickthrough="false"]'),Q=I.target.closest("[data-kg-settings-panel]");return S&&((W=B==null?void 0:B.hasEditMode)!=null&&W.call(B))&&!C&&!R&&!Q?s.dispatchCommand(Lo,{cardKey:t,focusEditor:!Z}):S||s.dispatchCommand(Nu,{cardKey:t,focusEditor:!Z}),Z?void 0:!0}return m.current===!0?(m.current=!1,!0):(m.current=!1,!1)},A.COMMAND_PRIORITY_LOW))),T.useEffect(()=>{var I;(I=g.current)!=null&&I.parentElement&&(d==="regular"?delete g.current.parentElement.dataset.kgCardWidth:(d!==e&&h(d),g.current.parentElement.dataset.kgCardWidth=e))},[d,g,e]);const N=I=>{I?s.dispatchCommand(Lo,{cardKey:t}):S||s.dispatchCommand(Nu,{cardKey:t})};T.useEffect(()=>{const I=g.current;function W(B){if(!S&&!C){s.dispatchCommand(Nu,{cardKey:t}),m.current=!0;const Z=B.target.tagName,R=["INPUT","TEXTAREA"],Q=!!B.target.closest("[data-kg-allow-clickthrough]");!R.includes(Z)&&!Q&&B.preventDefault()}}return I==null||I.addEventListener("mousedown",W),()=>{I==null||I.removeEventListener("mousedown",W)}},[s,S,C,t,g]);let M=!1;return s.getEditorState().read(()=>{var W;const I=A.$getNodeByKey(t);M=(W=I==null?void 0:I.getIsVisibilityActive)==null?void 0:W.call(I)}),k.jsx(rn.Provider,{value:{isSelected:S,captionHasFocus:u,isEditing:C,cardWidth:d,setCardWidth:h,setCaptionHasFocus:f,setEditing:N,nodeKey:t,cardContainerRef:g},children:k.jsx(g3,{ref:g,cardType:a,cardWidth:e,feature:o==null?void 0:o.feature,IndicatorIcon:i,isDragging:_,isEditing:C,isSelected:S,isVisibilityActive:M,wrapperStyle:n,onIndicatorClick:E,children:r})})};function W6(t){const e=t._nodes,n=[];for(const[i,{klass:r}]of e)r.kgMenu&&n.push([i,r]);return n}const aw=A.createCommand();function aH(t,e){const n=t.type;return Object.keys(e).find(r=>e[r].includes(n))}function UEe(t,e){const n=t[Symbol.iterator]();return new Promise((i,r)=>{const o=[],s=()=>{const{done:a,value:l}=n.next();if(a)return i({processed:o});const u=new FileReader;u.addEventListener("error",r),u.addEventListener("load",()=>{const d=u.result,h=aH(l,e);typeof d=="string"&&o.push({type:h,file:l}),s()}),aH(l,e)?u.readAsDataURL(l):(console.error("unsupported file type"),s())};s()})}async function ZEe(t,e){const n=W6(t);let i={};for(const[r,o]of n)r&&o.uploadType&&(i[r]=e[o.uploadType].mimeTypes);return{acceptableMimeTypes:i}}function lH(){const[t]=Oe.useLexicalComposerContext(),{fileUploader:e}=T.useContext(ft),n=T.useCallback(async i=>{if(!e)return;const{acceptableMimeTypes:r}=await ZEe(t,e.fileTypes),{processed:o}=await UEe(i,r);o.forEach(s=>{t.dispatchCommand(aw,s)})},[t,e]);return T.useEffect(()=>t.registerCommand(A.DROP_COMMAND,i=>{const r=Array.from(i.dataTransfer.files);return r.length>0?(i.preventDefault(),i.stopPropagation(),t.dispatchCommand(Kt.DRAG_DROP_PASTE,r),!0):!1},A.COMMAND_PRIORITY_HIGH),[t]),T.useEffect(()=>{const i=t.getRootElement(),r=a=>{!a.dataTransfer||a.target.closest("[data-kg-card]")||(a.stopPropagation(),a.preventDefault())},o=a=>{a.preventDefault()},s=a=>{a.dataTransfer.getData("text/html")&&(a.preventDefault(),t.update(()=>{t.focus();let u=A.$getSelection();u||(A.$getRoot().selectEnd(),u=A.$getSelection()),Ac.$insertDataTransferForRichText(a.dataTransfer,u,t)}))};return i.addEventListener("dragover",r),i.addEventListener("dragleave",o),i.addEventListener("drop",s),()=>{i.removeEventListener("dragover",r),i.removeEventListener("dragleave",o),i.removeEventListener("drop",s)}},[t]),T.useEffect(()=>t.registerCommand(Kt.DRAG_DROP_PASTE,async i=>{try{return t.focus(),await n(i)}catch(r){console.error(r)}},A.COMMAND_PRIORITY_LOW),[t,n]),null}function qEe({enabled:t=!0,canDrop:e,onDrop:n,onDropEnd:i,getDraggableInfo:r,getIndicatorPosition:o,draggableSelector:s,droppableSelector:a}){const l=T.useContext(ft),[u,f]=T.useState(null),[d,h]=T.useState(!1),g=T.useRef(null),m=T.useCallback(M=>{e(M)?g.current.enableDrag():g.current.disableDrag()},[e]),y=T.useCallback(()=>{h(!1)},[h]),x=T.useCallback(M=>{h(e(M))},[h,e]),_=T.useCallback(()=>{h(!1)},[h]),S=T.useCallback(M=>(n==null?void 0:n(M))||!1,[n]),C=T.useCallback((M,I)=>{i==null||i(M,I)},[i]),E=T.useCallback(M=>(o==null?void 0:o(M))||!1,[o]),N=T.useCallback(M=>(r==null?void 0:r(M))||{},[r]);return T.useEffect(()=>{var M,I;t?(M=g.current)==null||M.enableDrag():(I=g.current)==null||I.disableDrag()},[t,u]),T.useEffect(()=>{!u||!l.dragDropHandler||(g.current=l.dragDropHandler.registerContainer(u,{draggableSelector:s,droppableSelector:a,isDragEnabled:t,onDragStart:m,onDragEnd:y,onDragEnterContainer:x,onDragLeaveContainer:_,getDraggableInfo:N,getIndicatorPosition:E,onDrop:S,onDropEnd:C}))},[N,E,S,C,u,s,a,t,l.dragDropHandler,y,x,_,m]),{setRef:f,isDraggedOver:d}}function zs({handleDrop:t,disabled:e=!1}){const[n,i]=T.useState(null),[r,o]=T.useState(!1);return T.useEffect(()=>{const s=n;if(!s||e)return;s.addEventListener("dragenter",a),s.addEventListener("dragover",l),s.addEventListener("dragleave",u),s.addEventListener("drop",f);function a(h){d(h),o(!0)}function l(h){d(h),o(!0)}function u(h){d(h),o(!1)}function f(h){d(h);const{dataTransfer:g}=h;g.files&&g.files.length>0&&t(Array.from(g.files)),o(!1)}function d(h){h.preventDefault(),h.stopPropagation()}return()=>{s.removeEventListener("dragenter",a),s.removeEventListener("dragover",l),s.removeEventListener("dragleave",u),s.removeEventListener("drop",f)}},[t,n,e]),{setRef:i,isDraggedOver:r}}function lw({config:t,disabled:e=!1}){const[n,i]=T.useState(!1),[r,o]=T.useState(!1),s=T.useRef(!1),a=!e&&n&&r;T.useEffect(()=>{const u=t==null?void 0:t.jsUrl;if(u){if(window.pintura){i(!0);return}try{const f=new URL(u);import(`${f.protocol}//${f.host}${f.pathname}`).then(()=>{i(!0)}).catch(()=>{})}catch{}}},[t==null?void 0:t.jsUrl]),T.useEffect(()=>{let u=t==null?void 0:t.cssUrl;if(u)try{if(document.querySelector(`link[href="${u}"]`))o(!0);else{let d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.href=u,d.onload=()=>{o(!0)},document.head.appendChild(d)}}catch{}},[t==null?void 0:t.cssUrl]);const l=T.useCallback(({image:u,handleSave:f})=>{if(s.current=!1,ui("Image Edit Button Clicked",{location:"editor"}),u&&a){const d=new URL(u);d.searchParams.has("v")||d.searchParams.set("v",Date.now());const h=d.href,g=window.pintura.openDefaultEditor({src:h,enableTransparencyGrid:!0,util:"crop",utils:["crop","filter","finetune","redact","annotate","trim","frame","resize"],frameOptions:[[void 0,m=>m.labelNone],["solidSharp",m=>m.frameLabelMatSharp],["solidRound",m=>m.frameLabelMatRound],["lineSingle",m=>m.frameLabelLineSingle],["hook",m=>m.frameLabelCornerHooks],["polaroid",m=>m.frameLabelPolaroid]],cropSelectPresetFilter:"landscape",cropSelectPresetOptions:[[void 0,"Custom"],[1,"Square"],[2/1,"2:1"],[3/2,"3:2"],[4/3,"4:3"],[16/10,"16:10"],[16/9,"16:9"],[1/2,"1:2"],[2/3,"2:3"],[3/4,"3:4"],[10/16,"10:16"],[9/16,"9:16"]],locale:{labelButtonExport:"Save and close"},previewPad:!0,willClose:()=>s.current});g.on("loaderror",()=>{}),g.on("process",m=>{f(m.dest),ui("Image Edit Saved",{location:"editor"})})}},[a]);return T.useEffect(()=>{const u=f=>{f.target.closest('.PinturaModal button[title="Close"]')&&(s.current=!0)};return window.addEventListener("click",u,{capture:!0}),()=>{window.removeEventListener("click",u)}},[]),{isEnabled:a,openEditor:l}}var YEe=Va,VEe=Hy,XEe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,GEe=/^\w*$/;function KEe(t,e){if(YEe(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||VEe(t)?!0:GEe.test(t)||!XEe.test(t)||e!=null&&t in Object(e)}var JEe=KEe,uH=XA,eTe="Expected a function";function H6(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(eTe);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var s=t.apply(this,i);return n.cache=o.set(r,s)||o,s};return n.cache=new(H6.Cache||uH),n}H6.Cache=uH;var tTe=H6,nTe=tTe,iTe=500;function rTe(t){var e=nTe(t,function(i){return n.size===iTe&&n.clear(),i}),n=e.cache;return e}var oTe=rTe,sTe=oTe,aTe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lTe=/\\(\\)?/g,uTe=sTe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(aTe,function(n,i,r,o){e.push(r?o.replace(lTe,"$1"):i||n)}),e}),cTe=uTe,fTe=Va,dTe=JEe,hTe=cTe,pTe=Qy;function gTe(t,e){return fTe(t)?t:dTe(t,e)?[t]:hTe(pTe(t))}var uw=gTe,mTe=Hy;function vTe(t){if(typeof t=="string"||mTe(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var Q6=vTe,bTe=uw,kTe=Q6;function yTe(t,e){e=bTe(e,t);for(var n=0,i=e.length;t!=null&&n0&&n(a)?e>1?hH(a,e-1,n,i,r):t8e(r,a):i||(r[r.length]=a)}return r}var i8e=hH,r8e=i8e;function o8e(t){var e=t==null?0:t.length;return e?r8e(t,1):[]}var s8e=o8e;function a8e(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var l8e=a8e,u8e=l8e,pH=Math.max;function c8e(t,e,n){return e=pH(e===void 0?t.length-1:e,0),function(){for(var i=arguments,r=-1,o=pH(i.length-e,0),s=Array(o);++r0){if(++e>=y8e)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var O8e=_8e,S8e=k8e,C8e=O8e,E8e=C8e(S8e),T8e=E8e,$8e=s8e,M8e=f8e,N8e=T8e;function A8e(t){return N8e(M8e(t,void 0,$8e),t+"")}var P8e=A8e,D8e=XTe,I8e=P8e,L8e=I8e(function(t,e){return t==null?{}:D8e(t,e)}),R8e=L8e;const U6=xo(R8e);function Z6(t){return new URL(t).pathname.match(/\/([^/]*)$/)[1]}function j8e({images:t,updateImages:e,isSelected:n=!1,maxImages:i=9,disabled:r=!1}){const o=T.useContext(ft),[s,a]=T.useState(null),[l,u]=T.useState(!1),f=T.useRef(null),d=T.useRef(!1),h=N=>{(N.type==="image"||N.cardName==="image")&&N.dataset.src&&t.length!==i&&f.current.enableDrag()},g=()=>{u(!1)},m=()=>{u(!0)},y=()=>{u(!1)},x=N=>{if(N.type!=="image"&&N.cardName!=="image")return!1;let M=[...t],{insertIndex:I}=N;const B=Array.from(s.querySelectorAll("[data-image]")).indexOf(N.element);if(M.length||(I=0),E(B,I)){if(B===-1){const{dataset:Z}=N,R=N.element.querySelector(`img[src="${Z.src}"]`);Z.width=Z.width||R.naturalWidth,Z.height=Z.height||R.naturalHeight,Z.fileName=(Z==null?void 0:Z.fileName)||Z6(Z.src),M.splice(I,0,Z)}else{const Z=M.find(Q=>Q.src===N.dataset.src),R=BQ!==Z),M.splice(I+R,0,Z)}return e(M),f.current.refresh(),d.current=!0,!0}return!1},_=(N,M)=>{if(d.current||!M){d.current=!1;return}const I=t.find(W=>W.src===N.dataset.src);if(I){const W=t.filter(B=>B!==I);e(W),f.current.refresh()}},S=N=>{let M=N.querySelector("img").getAttribute("src"),I=t.find(B=>B.src===M)||t.find(B=>B.previewSrc===M),W=I&&U6(I,["fileName","src","row","width","height","caption"]);return I?{type:"image",dataset:W}:{}},C=(N,M,I)=>{if(N.type!=="image"&&N.cardName!=="image")return!1;const W=M.closest("[data-row]"),B=Array.from(s.querySelectorAll("[data-image]")),Z=B.indexOf(N.element),R=B.indexOf(M);if(W&&E(Z,R,I)){const Q=Array.from(W.querySelectorAll("[data-image]")),V=Q.indexOf(M);let H=R;const j=[],q=[];return Q.forEach((Y,K)=>{KV&&q.push(Y)}),I.match(/right/)&&(H+=1),{direction:"horizontal",position:I.match(/left/)?"left":"right",beforeElems:j,afterElems:q,insertIndex:H}}else return!1},E=(N,M,I="")=>N===-1?!0:N===M||typeof M>"u"?!1:(I.match(/left/)&&(M-=1),I.match(/right/)&&(M+=1),M!==N);return T.useEffect(()=>{var N,M;n?(N=f.current)==null||N.enableDrag():(M=f.current)==null||M.disableDrag()},[n,s]),T.useEffect(()=>{const N=s;if(!(!N||!(o!=null&&o.dragDropHandler)))return f.current=o.dragDropHandler.registerContainer(N,{draggableSelector:"[data-image]",droppableSelector:"[data-image]",isDragEnabled:!r&&t.length>0,onDragStart:h,onDragEnd:g,onDragEnterContainer:m,onDragLeaveContainer:y,getDraggableInfo:S,getIndicatorPosition:C,onDrop:x,onDropEnd:_}),()=>{f.current&&(f.current.destroy(),f.current=null)}},[s,t,o.dragDropHandler]),{setContainerRef:a,isDraggedOver:l}}function mH({index:t,images:e,deleteImage:n,isDragging:i}){const r=e.map((o,s)=>{const a=e.length===1?"single":s===0?"first":s===e.length-1?"last":"middle";return k.jsx(vH,{deleteImage:n,image:o,isDragging:i,position:a},o.src)});return k.jsx("div",{className:`flex flex-row justify-center ${t!==0&&"mt-4"}`,"data-row":t,children:r})}function vH({image:t,deleteImage:e,position:n,isDragging:i}){const o={flex:`${(t.width||1)/(t.height||1)} 1 0%`};let s=[],a=[];switch(n){case"first":s=["pr-2"],a=["mr-2"];break;case"middle":s=["pl-2","pr-2"],a=["ml-2","mr-2"];break;case"last":s=["pl-2"],a=["ml-2"];break}return k.jsxs("div",{className:`group/image relative ${s.join(" ")}`,"data-testid":"gallery-image",style:o,"data-image":!0,children:[k.jsx("img",{alt:t.alt,className:"pointer-events-none block size-full",height:t.height,src:t.previewSrc||t.src,width:t.width}),i?null:k.jsx("div",{className:`pointer-events-none invisible absolute inset-0 bg-gradient-to-t from-black/0 via-black/5 to-black/30 p-3 opacity-0 transition-all group-hover/image:visible group-hover/image:opacity-100 ${a.join(" ")}`,children:k.jsx("div",{className:"flex flex-row-reverse",children:k.jsx(pl,{Icon:Kc,label:"Delete",onClick:()=>e(t)})})})]})}function bH({images:t,deleteImage:e,reorderHandler:n,isDragging:i}){const r=[],o=t.length,s=function(l){return o>1&&o%3===1&&l===o-2};t.forEach((l,u)=>{let f=l.row||0;s(u)&&(f=f+1),r[f]||(r[f]=[]),r[f].push(l)});const a=r.map((l,u)=>k.jsx(mH,{deleteImage:e,images:l,index:u,isDragging:i},u));return k.jsx("div",{ref:n.setContainerRef,className:"not-kg-prose flex flex-col","data-gallery":!0,children:a})}function kH({openFilePicker:t,isDraggedOver:e,reorderHandler:n}){return k.jsx(Mu,{desc:"Click to select up to 9 images",filePicker:t,icon:"gallery",isDraggedOver:e,multiple:!0,placeholderRef:n.setContainerRef,size:"large"})}function yH({progress:t}){const e={width:`${t==null?void 0:t.toFixed(0)}%`};return k.jsx("div",{className:"absolute inset-0 flex min-w-full items-center justify-center overflow-hidden bg-white/50","data-testid":"gallery-progress",children:k.jsx(js,{bgStyle:"transparent",style:e})})}function F8e(){return k.jsx("div",{className:"bg-black-60 pointer-events-none absolute inset-0 flex items-center bg-black/60","data-kg-card-drag-text":!0,children:k.jsx("span",{className:"sans-serif fw7 f7 block w-full text-center font-bold text-white",children:"Drop to add up to 9 images"})})}function wH({captionEditor:t,captionEditorInitialState:e,clearErrorMessage:n,deleteImage:i,filesDropper:r,errorMessage:o,fileInputRef:s,imageMimeTypes:a=[],images:l=[],isSelected:u,onFileChange:f,uploader:d={},reorderHandler:h={}}){const g=()=>{s.current.click()},{isLoading:m,progress:y}=d,{isDraggedOver:x}=r,{isDraggedOver:_}=h,S=x||_;return k.jsxs("figure",{children:[k.jsxs("div",{ref:r.setRef,className:"not-kg-prose relative","data-testid":"gallery-container",children:[l.length?k.jsx(bH,{deleteImage:i,images:l,isDragging:S,reorderHandler:h}):k.jsx(kH,{isDraggedOver:S,openFilePicker:g,reorderHandler:h}),m?k.jsx(yH,{progress:y}):null,l.length&&x?k.jsx(F8e,{}):null,o&&!S?k.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60","data-testid":"gallery-error",children:k.jsxs("span",{className:"center sans-serif f7 block bg-red px-2 font-bold text-white",children:[o,".",k.jsx("button",{className:"ml-2 cursor-pointer underline","data-testid":"clear-gallery-error",type:"button",onClick:n,children:"Dismiss"})]})}):null,k.jsx("form",{onChange:f,children:k.jsx("input",{ref:s,accept:a.join(","),hidden:!0,multiple:!0,name:"image-input",type:"file"})})]}),k.jsx(dh,{captionEditor:t,captionEditorInitialState:e,captionPlaceholder:"Type caption for gallery (optional)",dataTestId:"gallery-card-caption",isSelected:u})]})}mH.propTypes={deleteImage:P.func,images:P.array,index:P.number,isDragging:P.bool},vH.propTypes={deleteImage:P.func,image:P.object,position:P.string,isDragging:P.bool},bH.propTypes={deleteImage:P.func,filesDropper:P.object,images:P.array,isDragging:P.bool,reorderHandler:P.object},kH.propTypes={openFilePicker:P.func,isDraggedOver:P.bool,reorderHandler:P.object},yH.propTypes={progress:P.number},wH.propTypes={isSelected:P.bool,onFileChange:P.func,captionEditor:P.object,captionEditorInitialState:P.object,errorMessage:P.string,clearErrorMessage:P.func,deleteImage:P.func,fileInputRef:P.object,filesDropper:P.object,imageMimeTypes:P.array,images:P.array,uploader:P.object,reorderHandler:P.object};async function sf(t){const e=new Image;return new Promise((n,i)=>{e.onload=()=>{n({width:e.naturalWidth,height:e.naturalHeight})},e.onerror=i,e.src=t})}function z8e({nodeKey:t,captionEditor:e,captionEditorInitialState:n}){const[i]=Oe.useLexicalComposerContext(),{fileUploader:r,cardConfig:o}=T.useContext(ft),{isSelected:s}=T.useContext(rn),a=T.useRef(),[l,u]=T.useState(null),[f,d]=T.useState(!1),[h,g]=T.useState(()=>i.getEditorState().read(()=>A.$getNodeByKey(t).images)),m=j8e({images:h,updateImages:_,isSelected:s}),y=r.useFileUpload("image"),x=zs({handleDrop:M});function _(Z){g0(Z),g(Z),S(Z)}function S(Z){i.update(()=>{A.$getNodeByKey(t).setImages(Z)})}const C=Z=>{const R=h.filter(Q=>Q.fileName!==Z.fileName);g0(R),g(R),S(R)},E=async Z=>{const R=h.length,Q=q6-R,V=Array.prototype.slice.call(Z,0,Q);if(V.length{const K=q.find(te=>te.fileName===Y.fileName);if(!K){console.error("Uploaded image not found in images array. Filename:",Y.fileName);return}K.src=Y.url}),g(H),S(H)},N=async Z=>{const R=Z.target.files;if(!(!R||!R.length))return await E(R)};async function M(Z){await E(Z)}function I(Z){Z.preventDefault(),a.current.click()}const W=()=>{u(null)},B=!s||x.isDraggedOver||m.isDraggedOver||h.length<=0;return k.jsxs(k.Fragment,{children:[k.jsx(wH,{captionEditor:e,captionEditorInitialState:n,clearErrorMessage:W,deleteImage:C,errorMessage:l,fileInputRef:a,filesDropper:x,imageMimeTypes:r.fileTypes.image.mimeTypes,images:h,isSelected:s,reorderHandler:m,uploader:y,onFileChange:N}),k.jsx(xt,{"data-kg-card-toolbar":"gallery",isVisible:f,children:k.jsx(Kn,{onClose:()=>d(!1)})}),k.jsx(xt,{"data-kg-card-toolbar":"gallery",isVisible:!B,children:k.jsxs(Jn,{children:[k.jsx(at,{dataTestId:"add-gallery-image",icon:"add",isActive:!1,label:"Add images",onClick:I}),k.jsx(Bn,{hide:!o.createSnippet}),k.jsx(at,{dataTestId:"create-snippet",hide:!o.createSnippet,icon:"snippet",isActive:!1,label:"Save as snippet",onClick:()=>d(!0)})]})})]})}const xH=A.createCommand(),q6=9,B8e=3,_H=["row","src","width","height","alt","caption","fileName"];function g0(t){t.forEach((e,n)=>{e.row=Math.ceil((n+1)/B8e)-1})}class cw extends nm{constructor(n={},i){super(n,i);ye(this,"__captionEditor");ye(this,"__captionEditorInitialState");const{caption:r}=n;vi(this,"__captionEditor",{editor:n.captionEditor,nodes:Qi}),!n.captionEditor&&r&&bi(this,"__captionEditor",`${r}`)}getIcon(){return a_}getDataset(){const n=super.getDataset(),i=this.getLatest();return n.captionEditor=i.__captionEditor,n.captionEditorInitialState=i.__captionEditorInitialState,n}exportJSON(){const n=super.exportJSON();return this.__captionEditor&&this.__captionEditor.getEditorState().read(()=>{const i=Mn.$generateHtmlFromNodes(this.__captionEditor,null),r=si(i);n.caption=r}),n}decorate(){return k.jsx(An,{nodeKey:this.getKey(),width:"wide",children:k.jsx(z8e,{captionEditor:this.__captionEditor,captionEditorInitialState:this.__captionEditorInitialState,nodeKey:this.getKey()})})}setImages(n){const i=n.slice(0,q6).map(r=>U6(r,_H));g0(i),this.images=i}addImages(n){const i=[...this.images,...n].slice(0,q6).map(r=>U6(r,_H));g0(i),this.images=i}}ye(cw,"kgMenu",[{label:"Gallery",desc:"Create an image gallery",Icon:a_,insertCommand:xH,insertParams:{triggerFileDialog:!0},matches:["gallery"],priority:5,shortcut:"/gallery"}]);const OH=t=>new cw(t);function m0(t){return/\.(gif)$/.test(t)}function SH({src:t,alt:e,previewSrc:n,imageUploader:i,imageCardDragHandler:r,imageFileDragHandler:o,isPinturaEnabled:s,openImageEditor:a,onFileChange:l}){var h;const u={width:`${(h=i.progress)==null?void 0:h.toFixed(0)}%`},f=i.progress.toFixed(0)<100?`upload in progress, ${i.progress}`:"";function d(g){o==null||o.setRef(g),r==null||r.setRef(g)}return k.jsxs("div",{ref:d,className:"not-kg-prose group/image relative",children:[k.jsx("img",{alt:e||f,className:`mx-auto block ${n?"opacity-40":""}`,"data-testid":i.isLoading?"image-card-loading":"image-card-populated",src:n||t}),i.isLoading?k.jsx("div",{className:"absolute inset-0 flex min-w-full items-center justify-center overflow-hidden bg-white/50","data-testid":"upload-progress",children:k.jsx(js,{style:u})}):k.jsx(k.Fragment,{}),r!=null&&r.isDraggedOver?k.jsx("div",{className:"absolute inset-0 flex items-center justify-center border border-grey/20 bg-black/80 dark:border-grey/10 dark:bg-grey-950",children:k.jsx(N6,{text:"Drop to convert to a gallery"})}):null,o!=null&&o.isDraggedOver?k.jsx("div",{className:"absolute inset-0 flex items-center justify-center border border-grey/20 bg-black/80 dark:border-grey/10 dark:bg-grey-950","data-testid":"drag-overlay",children:k.jsx(N6,{text:"Drop to replace image"})}):null,s&&!m0(t)&&k.jsx("div",{className:"pointer-events-none invisible absolute inset-0 bg-gradient-to-t from-black/0 via-black/5 to-black/30 p-3 opacity-0 transition-all group-hover/image:visible group-hover/image:opacity-100",children:k.jsx("div",{className:"flex flex-row-reverse",children:k.jsx(pl,{Icon:zy,label:"Edit",onClick:()=>a({image:t,handleSave:g=>{l({target:{files:[g]}})}})})})})]})}function CH({onFileChange:t,setFileInputRef:e,imageFileDragHandler:n,errors:i}){const r=T.useRef(null),o=s=>{r.current=s,e(r)};return k.jsxs(k.Fragment,{children:[k.jsx(Mu,{desc:"Click to select an image",errors:i,filePicker:()=>Wi({fileInputRef:r}),icon:"image",isDraggedOver:n==null?void 0:n.isDraggedOver,placeholderRef:n==null?void 0:n.setRef}),k.jsx(ew,{fileInputRef:o,filePicker:()=>Wi({fileInputRef:r}),onFileChange:t})]})}const EH=({src:t,altText:e,previewSrc:n,imageUploader:i,onFileChange:r,setFileInputRef:o,imageCardDragHandler:s,imageFileDragHandler:a,isPinturaEnabled:l,openImageEditor:u})=>n||t?k.jsx(SH,{alt:e,imageCardDragHandler:s,imageFileDragHandler:a,imageUploader:i,isPinturaEnabled:l,openImageEditor:u,previewSrc:n,src:t,onFileChange:r}):k.jsx(CH,{errors:i.errors,imageFileDragHandler:a,setFileInputRef:o,onFileChange:r});function TH({isSelected:t,src:e,onFileChange:n,captionEditor:i,captionEditorInitialState:r,altText:o,setAltText:s,setFigureRef:a,fileInputRef:l,cardWidth:u,previewSrc:f,imageUploader:d,imageCardDragHandler:h,imageFileDragHandler:g,isPinturaEnabled:m,openImageEditor:y}){const x=T.useRef(null);T.useEffect(()=>{a&&a(x)},[x,a]);const _=S=>{l&&(l.current=S.current)};return k.jsx(k.Fragment,{children:k.jsxs("figure",{ref:x,"data-kg-card-width":u,children:[k.jsx(EH,{altText:o,imageCardDragHandler:h,imageFileDragHandler:g,imageUploader:d,isPinturaEnabled:m,openImageEditor:y,previewSrc:f,setFileInputRef:_,src:e,onFileChange:n}),k.jsx(dh,{altText:o||"",altTextPlaceholder:"Type alt text for image (optional)",captionEditor:i,captionEditorInitialState:r,captionPlaceholder:"Type caption for image (optional)",dataTestId:"image-caption-editor",isSelected:t,readOnly:!t,setAltText:s})]})})}EH.propTypes={src:P.string,altText:P.string,previewSrc:P.string,imageUploader:P.object,onFileChange:P.func,setFileInputRef:P.func,imageFileDragHandler:P.object,imageCardDragHandler:P.object,isPinturaEnabled:P.bool,openImageEditor:P.func},SH.propTypes={src:P.string,alt:P.string,previewSrc:P.string,imageUploader:P.object,imageCardDragHandler:P.object,imageFileDragHandler:P.object,isPinturaEnabled:P.bool,openImageEditor:P.func,onFileChange:P.func},CH.propTypes={onFileChange:P.func,setFileInputRef:P.func,errors:P.array,imageFileDragHandler:P.object},TH.propTypes={isSelected:P.bool,src:P.string,onFileChange:P.func,captionEditor:P.object,captionEditorInitialState:P.object,altText:P.string,setAltText:P.func,setFigureRef:P.func,fileInputRef:P.object,cardWidth:P.string,previewSrc:P.string,imageUploader:P.object,imageFileDragHandler:P.object,imageCardDragHandler:P.object,isPinturaEnabled:P.bool,openImageEditor:P.func};function Y6({href:t,update:e,cancel:n}){const[i,r]=T.useState(t),o=T.useRef(null),s=T.useRef(null);T.useEffect(()=>{r(t)},[t]),T.useEffect(()=>{o.current.focus()},[]);const a=T.useCallback(u=>{s.current&&!s.current.contains(u.target)&&n()},[n]);T.useEffect(()=>(window.addEventListener("mousedown",a),()=>{window.removeEventListener("mousedown",a)}),[a]);const l=T.useCallback(u=>{u.key==="Escape"&&n()},[n]);return T.useEffect(()=>(window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}),[l]),k.jsxs("div",{ref:s,className:"relative m-0 flex items-center justify-evenly gap-1 rounded-lg bg-white p-1 font-sans text-md font-normal text-black shadow-md dark:bg-grey-950",children:[k.jsx("input",{ref:o,className:"mb-[1px] h-8 w-full pl-3 pr-9 leading-loose text-grey-900 selection:bg-grey/40 dark:bg-grey-950 dark:text-grey-300 dark:selection:bg-grey-800/40 dark:selection:text-grey-100","data-testid":"link-input",name:"link-input",placeholder:"Enter url",value:i,"data-kg-link-input":!0,onInput:u=>{r(u.target.value)},onKeyDown:u=>{if(u.key==="Enter"){u.preventDefault(),e(i);return}}}),!!i&&k.jsx("button",{"aria-label":"Close",className:"absolute right-3 cursor-pointer",type:"button",onClick:u=>{u.stopPropagation(),r(""),o.current.focus()},children:k.jsx(vh,{className:"size-4 stroke-2 text-grey"})})]})}Y6.propTypes={href:P.string};async function W8e(t,e){if(!t.startsWith("data:"))return;const n=t.split(",")[0].split(":")[1].split(";")[0];if(!e){let o;try{o=window.crypto.randomUUID()}catch{o=Math.random().toString(36).substring(2,15)}const s=n.split("/")[1];e=`data-src-image-${o}.${s}`}const i=await fetch(t).then(o=>o.blob());return new File([i],e,{type:n,lastModified:new Date})}const v0=async(t,e,n,i)=>{if(!t)return;let r=URL.createObjectURL(t[0]);r&&await n.update(()=>{const u=A.$getNodeByKey(e);u.previewSrc=r});const{width:o,height:s}=await sf(r),a=await i(t),l=a==null?void 0:a[0].url;await n.update(()=>{const u=A.$getNodeByKey(e);u.width=o,u.height=s,u.src=l,u.previewSrc=null})},V6=async(t,e)=>{if(!t)return;const n=await e(t),i=n==null?void 0:n[0].url,{width:r,height:o}=await sf(i);return{imageSrc:i,width:r,height:o}};function H8e({nodeKey:t,initialFile:e,src:n,altText:i,captionEditor:r,captionEditorInitialState:o,triggerFileDialog:s,previewSrc:a,href:l}){var te;const[u]=Oe.useLexicalComposerContext(),[f,d]=T.useState(!1),{fileUploader:h,cardConfig:g}=T.useContext(ft),{isSelected:m,cardWidth:y,setCardWidth:x}=T.useContext(rn),_=T.useRef(),S=T.useRef(),[C,E]=T.useState(!1),N=h.useFileUpload("image"),M=zs({handleDrop:K}),I=T.useCallback(oe=>oe.type==="card"&&oe.cardName==="image"&&oe.nodeKey!==t,[t]),W=T.useCallback(oe=>{const{type:ce,cardName:U,nodeKey:F,dataset:se}=oe;ce==="card"&&U==="image"&&F&&se&&u.update(()=>{const le=A.$getNodeByKey(t),pe=A.$getNodeByKey(F),je=OH();se.fileName=(se==null?void 0:se.fileName)||Z6(se.src);const He=le.getDataset();He.fileName=(He==null?void 0:He.fileName)||Z6(He.src),je.addImages([He,se]),le.replace(je),pe.remove()})},[u,t]),B=qEe({canDrop:I,onDrop:W}),{isEnabled:Z,openEditor:R}=lw({config:g.pinturaConfig});T.useEffect(()=>{if(!(n!=null&&n.startsWith("data:"))||N.isLoading)return;let oe=!0;return(async()=>{const U=await W8e(n);oe&&await v0([U],t,u,N.upload)})(),()=>oe=!1},[u,N.isLoading,N.upload,t,n]),T.useEffect(()=>{(async F=>{F&&!n&&await v0([F],t,u,N.upload)})(e);const ce=async()=>{if(n&&!e&&!s){const{width:F,height:se}=await sf(n);u.update(()=>{const le=A.$getNodeByKey(t);le.width=F,le.height=se})}};u.getEditorState().read(()=>{const F=A.$getNodeByKey(t);return!F.width||!F.height})&&ce()},[]);const Q=async oe=>{const ce=oe.target.files;return u.update(()=>{const U=A.$getNodeByKey(t);U.src=""}),await v0(ce,t,u,N.upload)},V=oe=>{u.update(()=>{const ce=A.$getNodeByKey(t);ce.href=oe})},H=oe=>{u.update(()=>{const ce=A.$getNodeByKey(t);ce.alt=oe})};T.useEffect(()=>{if(!s)return;const oe=setTimeout(()=>{Wi({fileInputRef:_}),u.update(()=>{const ce=A.$getNodeByKey(t);ce.triggerFileDialog=!1})});return()=>{clearTimeout(oe)}});const j=oe=>{u.update(()=>{const ce=A.$getNodeByKey(t);ce.cardWidth=oe,x(oe)})},q=()=>{d(!1),Y()},Y=()=>{u.update(()=>{const oe=A.$createNodeSelection();oe.add(t),A.$setSelection(oe)})};async function K(oe){await v0(oe,t,u,N.upload)}return k.jsxs(k.Fragment,{children:[k.jsx(TH,{altText:i,captionEditor:r,captionEditorInitialState:o,cardWidth:y,fileInputRef:_,imageCardDragHandler:B,imageFileDragHandler:M,imageUploader:N,isPinturaEnabled:Z,isSelected:m,openImageEditor:R,previewSrc:a,setAltText:H,src:n,onFileChange:Q}),k.jsx(xt,{"data-kg-card-toolbar":"image",isVisible:f,children:k.jsx(Y6,{cancel:q,href:l,update:oe=>{V(oe),q()}})}),k.jsx(xt,{"data-kg-card-toolbar":"image",isVisible:C,children:k.jsx(Kn,{onClose:()=>E(!1)})}),k.jsxs(xt,{"data-kg-card-toolbar":"image",isVisible:n&&m&&!f&&!C,children:[k.jsx(ew,{fileInputRef:S,mimeTypes:(te=h.fileTypes.image)==null?void 0:te.mimeTypes,onFileChange:Q}),k.jsxs(Jn,{children:[k.jsx(at,{hide:m0(n),icon:"imgRegular",isActive:y==="regular",label:"Regular width",onClick:()=>j("regular")}),k.jsx(at,{hide:m0(n),icon:"imgWide",isActive:y==="wide",label:"Wide width",onClick:()=>j("wide")}),k.jsx(at,{hide:m0(n),icon:"imgFull",isActive:y==="full",label:"Full width",onClick:()=>j("full")}),k.jsx(Bn,{hide:m0(n)}),k.jsx(at,{icon:"link",isActive:l||!1,label:"Link",onClick:()=>{d(!0)}}),k.jsx(Bn,{hide:!g.createSnippet}),k.jsx(at,{dataTestId:"create-snippet",hide:!g.createSnippet,icon:"snippet",isActive:!1,label:"Save as snippet",onClick:()=>E(!0)})]})]})]})}const Q8e=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",strokeWidth:1.5,viewBox:"0 0 24 24",...t},J.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1.472 13.357a9.063 9.063 0 1 0 16.682-7.09 9.063 9.063 0 1 0-16.682 7.09Zm14.749 2.863 7.029 7.03"})),U8e="https://tenor.googleapis.com",Z8e="v2",q8e=600,fw={COMMON:"common",INVALID_API_KEY:"invalid_key"};function Y8e({config:t}){const[e,n]=T.useState([]),[i,r]=T.useState(null),[o,s]=T.useState(!1),[a,l]=T.useState(!1),[u,f]=T.useState([]),d=T.useRef(null),h=T.useRef(""),g=T.useRef([]),m=T.useRef(null),y=T.useRef(""),x=T.useRef(4),_=T.useRef([]),S=T.useRef([]);function C(te){return y.current=te,I(),te?N(te):M()}const E=kh((te="")=>C(te),q8e);async function N(te){h.current="search",await Q(h.current,{params:{q:te,media_filter:"minimal"}})}async function M(){h.current="featured",await Q(h.current,{params:{q:"excited",media_filter:"minimal"}})}function I(){S.current=[],d.current=null,W()}function W(){let te=[],oe=[];for(let ce=0;ce{Z(te)})}function Z(te){const oe=Math.min(...g.current),ce=g.current.indexOf(oe);g.current[ce]+=300*te.ratio,_.current[ce].push(te),te.columnIndex=ce,te.columnRowIndex=_.current[ce].length-1}function R(te,oe){const[ce,U]=te.media_formats.tinygif.dims;te.ratio=U/ce,S.current.push(te),te.index=oe,Z(te)}async function Q(te,oe){const ce=`${Z8e}/${te}`.replace(/\/+/,"/"),U=new URL(ce,U8e),F=new URLSearchParams(oe.params);return F.set("key",t.googleApiKey),F.set("client_key","ghost-editor"),F.set("contentfilter",Y()),U.search=F.toString(),m.current=arguments,r(null),s(!0),fetch(U).then(se=>V(se)).then(se=>se.json()).then(se=>H(se)).then(se=>j(se)).then(()=>{n(_.current),f(S.current)}).catch(se=>{!oe.ignoreErrors&&!i&&r(fw.COMMON),i&&i.startsWith("API key not valid")&&r(fw.INVALID_API_KEY),console.error(se)}).finally(()=>{s(!1),l(!1)})}async function V(te){if(te.status>=200&&te.status<300)return te;let oe;te.headers.map["content-type"].startsWith("application/json")?oe=await te.json().then(U=>U.error.message||U.error):te.headers.map["content-type"]==="text/xml"&&(oe=await te.text()),r(oe);const ce=new Error(oe);throw ce.response=te,ce}async function H(te){return d.current=te.next,te}async function j(te){return te.results.forEach((ce,U)=>R(ce,U)),te}function q(){if(!o){if(!S.current.length)return M();if(d.current!==null){const te={pos:d.current,media_filter:"minimal"};return h.current==="search"&&(te.q=y),l(!0),Q(h.current,{params:te})}}}function Y(){return t.contentFilter||"off"}function K(te){x.current=te,W(),n(_.current)}return{updateSearch:E,isLoading:o,isLazyLoading:a,error:i,loadNextPage:q,columns:e,changeColumnCount:K,gifs:u}}function V8e({error:t}){return t===fw.COMMON?k.jsx("p",{children:"Uh-oh! Trouble reaching the Tenor API, please check your connection"}):t===fw.INVALID_API_KEY?k.jsxs("p",{children:["This version of the Tenor API is no longer supported. Please update your API key by following our",k.jsx("a",{href:"https://ghost.org/docs/config/#tenor",rel:"noopener noreferrer",target:"_blank",children:" documentation here"}),"."]}):k.jsx("p",{children:t})}function X8e({gif:t,onClick:e,highlightedGif:n={}}){const i=T.useRef(null),r=t.media_formats.tinygif;T.useEffect(()=>{var a,l;n.id===t.id?(a=i.current)==null||a.focus():(l=i.current)==null||l.blur()},[t.id,n.id]);const o=()=>{e(t)};return k.jsx("button",{ref:i,className:"cursor-pointer border-2 border-transparent focus:border-green-600","data-tenor-index":t.index,type:"button",onClick:o,children:k.jsx("img",{alt:r.content_description,height:r.dims[1],src:r.url,width:r.dims[0]})})}function G8e({isLazyLoading:t}){return t?k.jsx("div",{className:"inset-y-0 w-full p-6 text-center",children:k.jsx("div",{className:"inline-block size-[50px] animate-spin rounded-full border border-black/10 before:z-10 before:mt-[7px] before:block before:size-[7px] before:rounded-full before:bg-grey-800"})}):k.jsx("div",{className:"absolute inset-y-0 left-0 flex w-full items-center justify-center overflow-hidden",children:k.jsx("div",{className:"relative inline-block size-[50px] animate-spin rounded-full border border-black/10 before:z-10 before:mt-[7px] before:block before:size-[7px] before:rounded-full before:bg-grey-800"})})}const K8e=540,J8e=940,e9e=({onGifInsert:t,onClickOutside:e,updateSearch:n,columns:i,isLoading:r,isLazyLoading:o,error:s,changeColumnCount:a,loadNextPage:l,gifs:u})=>{const f=T.useRef(null),d=T.useRef(null),[h,g]=T.useState(void 0);T.useEffect(()=>{n()},[]),T.useEffect(()=>{if(!f.current)return;const K=new ResizeObserver(te=>{const[oe]=te,U=(Array.isArray(oe.contentBoxSize)?oe.contentBoxSize[0]:oe.contentBoxSize).inlineSize;let F=4;U<=K8e?F=2:U<=J8e&&(F=3),a(F)});return K.observe(f.current),()=>{K==null||K.disconnect()}},[]),T.useEffect(()=>(document.addEventListener("keydown",Z),()=>{document.removeEventListener("keydown",Z)}),[Z]),T.useEffect(()=>{const K=te=>{f.current&&!f.current.contains(te.target)&&e()};return window.addEventListener("mousedown",K),()=>{window.removeEventListener("mousedown",K)}},[e]);function m(K){const te=K.media_formats.gif,oe={src:te.url,width:te.dims[0],height:te.dims[1]};t(oe)}const y=K=>{n(K.target.value)},x=K=>{const te=K.target;te.scrollTop+te.clientHeight>=te.scrollHeight-1e3&&l()};function _(){var K;(K=d.current)==null||K.focus()}function S(){g(u[0])}function C(){h!==u[u.length-1]&&g(u[h.index+1])}function E(){h.index===0&&_(),g(u[h.index-1])}function N(){const K=i[h.columnIndex][h.columnRowIndex+1];K&&g(K)}function M(){const K=i[h.columnIndex][h.columnRowIndex-1];K?g(K):_()}function I(K){var le;const oe=document.querySelector(`[data-tenor-index="${h.index}"]`).getBoundingClientRect();let ce;K==="left"?ce=oe.left-oe.width/2:ce=oe.right+oe.width/2;let U=oe.top+oe.height/3,F,se=0;for(;!F;){let pe=(le=document.elementFromPoint(ce,U))==null?void 0:le.closest("[data-tenor-index]");if((pe==null?void 0:pe.dataset.tenorIndex)!==void 0){F=pe;break}if(se+=1,U-=5,se>10)break}F&&g(u[F.dataset.tenorIndex])}function W(){h.columnIndex!==i.length-1&&I("right")}function B(){if(h.index===0)return _();h.columnIndex!==0&&I("left")}function Z(K){switch(K.key){case"Tab":return R(K);case"ArrowLeft":return Q(K);case"ArrowRight":return V(K);case"ArrowUp":return H(K);case"ArrowDown":return j(K);case"Enter":return q(K);default:return null}}function R(K){if(K.shiftKey){if(h)return K.preventDefault(),E()}else{if((K==null?void 0:K.target.tagName)==="INPUT")return K.preventDefault(),K.target.blur(),S();if(h)return K==null||K.preventDefault(),C()}}function Q(K){h&&(K.preventDefault(),B())}function V(K){h&&(K.preventDefault(),W())}function H(K){h&&(K.preventDefault(),M())}function j(K){if(K.target.tagName==="INPUT")return K.preventDefault(),K.target.blur(),S();h&&(K.preventDefault(),N())}function q(K){if(K.preventDefault(),K.target.tagName==="INPUT")return K.target.blur(),S();if(h)return m(h)}const Y=r&&!o;return k.jsxs("div",{ref:f,className:"flex h-[540px] flex-col rounded border border-grey-200 bg-grey-50 dark:border-none dark:bg-grey-900","data-testid":"tenor-selector",onClick:K=>K.stopPropagation(),children:[k.jsx("header",{className:"p-6",children:k.jsxs("div",{className:"relative w-full",children:[k.jsx(Q8e,{className:"absolute left-4 top-1/2 size-4 -translate-y-2 text-grey-500 dark:text-grey-800"}),k.jsx("input",{ref:d,className:"h-10 w-full rounded-full border border-grey-300 pl-10 pr-8 font-sans text-md font-normal text-black focus:border-green focus:shadow-insetgreen dark:border-grey-800 dark:bg-grey-950 dark:text-white dark:placeholder:text-grey-800 dark:focus:border-green",placeholder:"Search Tenor for GIFs",autoFocus:!0,onChange:y})]})}),k.jsx("div",{className:"relative h-full overflow-hidden",children:k.jsxs("div",{className:"h-full overflow-auto px-6",onScroll:x,children:[!s&&!Y&&k.jsx("div",{className:"flex gap-4",children:i.map((K,te)=>k.jsx("section",{className:"flex grow basis-0 flex-col justify-start gap-4",children:K.map(oe=>k.jsx(X8e,{gif:oe,highlightedGif:h,onClick:m},oe.id))},te))}),!!r&&!s&&k.jsx(G8e,{isLazyLoading:o}),!!s&&k.jsx("div",{"data-testid":"tenor-selector-error",children:k.jsx(V8e,{error:s})})]})})]})},t9e=({nodeKey:t})=>{const{cardConfig:e}=T.useContext(ft),n=Y8e({config:e.tenor}),[i]=Oe.useLexicalComposerContext();T.useEffect(()=>{const s=a=>{a.key==="Escape"&&i.dispatchCommand(rf,{cardKey:t})};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[]);const r=()=>{i.dispatchCommand(rf,{cardKey:t})},o=async s=>{i.dispatchCommand(DH,s)};return k.jsx(e9e,{onClickOutside:r,onGifInsert:o,...n})};var n9e=Object.defineProperty,i9e=(t,e,n)=>e in t?n9e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wn=(t,e,n)=>i9e(t,typeof e!="symbol"?e+"":e,n),$H={exports:{}},b0={};/** + * @license React + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var MH;function r9e(){if(MH)return b0;MH=1;var t=T,e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(a,l,u){var f,d={},h=null,g=null;u!==void 0&&(h=""+u),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(g=l.ref);for(f in l)i.call(l,f)&&!o.hasOwnProperty(f)&&(d[f]=l[f]);if(a&&a.defaultProps)for(f in l=a.defaultProps,l)d[f]===void 0&&(d[f]=l[f]);return{$$typeof:e,type:a,key:h,ref:g,props:d,_owner:r.current}}return b0.Fragment=n,b0.jsx=s,b0.jsxs=s,b0}$H.exports=r9e();var pt=$H.exports;class o9e{constructor(e=3){Wn(this,"columnCount"),Wn(this,"columns",[]),Wn(this,"columnHeights"),this.columnCount=e,this.columns=[[]],this.columnHeights=null}reset(){let e=[],n=[];for(let i=0;iJ.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},J.createElement("path",{d:"M20 5.5l-8 8-8-8m-3.5 13h23",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,fill:"none"})),a9e=t=>J.createElement("svg",{viewBox:"0 0 32 32",...t},J.createElement("path",{d:"M17.4 29c-.8.8-2 .8-2.8 0L2.3 16.2C-.8 13.1-.8 8 2.3 4.8c3.1-3.1 8.2-3.1 11.3 0L16 7.6l2.3-2.8c3.1-3.1 8.2-3.1 11.3 0 3.1 3.1 3.1 8.2 0 11.4L17.4 29z"})),l9e={heart:a9e,download:s9e},X6=({icon:t,label:e,...n})=>{let i=null;return t&&(i=l9e[t]),pt.jsxs("a",{className:"text-grey-700 flex h-8 shrink-0 cursor-pointer items-center rounded-md bg-white px-3 py-2 font-sans text-sm font-medium leading-6 opacity-90 transition-all ease-in-out hover:opacity-100",onClick:r=>r.stopPropagation(),...n,children:[t&&i&&pt.jsx(i,{className:`size-4 ${t==="heart"?"fill-red":""} stroke-[3px] ${e&&"mr-1"}`}),e&&pt.jsx("span",{children:e})]})},NH=({payload:t,srcUrl:e,links:n,likes:i,user:r,alt:o,urls:s,height:a,width:l,zoomed:u,insertImage:f,selectImg:d})=>{const h=g=>{g.stopPropagation(),d(u?null:t)};return pt.jsxs("div",{className:`relative mb-6 block ${u?"h-full w-[max-content] cursor-zoom-out":"w-full cursor-zoom-in"}`,style:{backgroundColor:t.color||"transparent"},"data-kg-unsplash-gallery-item":!0,onClick:h,children:[pt.jsx("img",{alt:o,className:`${u?"h-full w-auto object-contain":"block h-auto"}`,height:a,loading:"lazy",src:e,width:l,"data-kg-unsplash-gallery-img":!0}),pt.jsxs("div",{className:"absolute inset-0 flex flex-col justify-between bg-gradient-to-b from-black/5 via-black/5 to-black/30 p-5 opacity-0 transition-all ease-in-out hover:opacity-100",children:[pt.jsxs("div",{className:"flex items-center justify-end gap-3",children:[pt.jsx(X6,{"data-kg-button":"unsplash-like",href:`${n.html}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit`,icon:"heart",label:i.toString(),rel:"noopener noreferrer",target:"_blank"}),pt.jsx(X6,{"data-kg-button":"unsplash-download",href:`${n.download}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit&force=true`,icon:"download"})]}),pt.jsxs("div",{className:"flex items-center justify-between",children:[pt.jsxs("div",{className:"flex items-center",children:[pt.jsx("img",{alt:"author",className:"mr-2 size-8 rounded-full",src:r.profile_image.medium}),pt.jsx("div",{className:"mr-2 truncate font-sans text-sm font-medium text-white",children:r.name})]}),pt.jsx(X6,{label:"Insert image","data-kg-unsplash-insert-button":!0,onClick:g=>{g.stopPropagation(),f({src:s.regular.replace(/&w=1080/,"&w=2000"),caption:`Photo by ${r.name} / Unsplash`,height:a,width:l,alt:o,links:n})}})]})]})]})},u9e=({payload:t,insertImage:e,selectImg:n,zoomed:i})=>pt.jsx("div",{className:"flex h-full grow basis-0 justify-center","data-kg-unsplash-zoomed":!0,onClick:()=>n(null),children:pt.jsx(NH,{alt:t.alt_description,height:t.height,insertImage:e,likes:t.likes,links:t.links,payload:t,selectImg:n,srcUrl:t.urls.regular,urls:t.urls,user:t.user,width:t.width,zoomed:i})}),c9e=()=>pt.jsx("div",{className:"absolute inset-y-0 left-0 flex w-full items-center justify-center overflow-hidden pb-[8vh]","data-kg-loader":!0,children:pt.jsx("div",{className:"animate-spin before:bg-grey-800 relative inline-block size-[50px] rounded-full border border-black/10 before:z-10 before:mt-[7px] before:block before:size-[7px] before:rounded-full"})}),f9e=t=>pt.jsx("div",{className:"mr-6 flex grow basis-0 flex-col justify-start last-of-type:mr-0",children:t.children}),d9e=t=>t!=null&&t.columns?t==null?void 0:t.columns.map((e,n)=>pt.jsx(f9e,{children:e.map(i=>pt.jsx(NH,{alt:i.alt_description,height:i.height,insertImage:t==null?void 0:t.insertImage,likes:i.likes,links:i.links,payload:i,selectImg:t==null?void 0:t.selectImg,srcUrl:i.urls.regular,urls:i.urls,user:i.user,width:i.width,zoomed:(t==null?void 0:t.zoomed)||null},i.id))},n)):null,G6=t=>pt.jsx("div",{className:"relative h-full overflow-hidden","data-kg-unsplash-gallery":!0,children:pt.jsxs("div",{ref:t.galleryRef,className:`flex size-full justify-center overflow-auto px-20 ${t!=null&&t.zoomed?"pb-10":""}`,"data-kg-unsplash-gallery-scrollref":!0,children:[t.children,(t==null?void 0:t.isLoading)&&pt.jsx(c9e,{})]})}),h9e=({zoomed:t,error:e,galleryRef:n,isLoading:i,dataset:r,selectImg:o,insertImage:s})=>t?pt.jsx(G6,{galleryRef:n,zoomed:t,children:pt.jsx(u9e,{alt:t.alt_description,height:t.height,insertImage:s,likes:t.likes,links:t.links,payload:t,selectImg:o,srcUrl:t.urls.regular,urls:t.urls,user:t.user,width:t.width,zoomed:t})}):e?pt.jsx(G6,{galleryRef:n,zoomed:t,children:pt.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[pt.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Error"}),pt.jsx("p",{className:"text-lg font-medium",children:e})]})}):pt.jsx(G6,{galleryRef:n,isLoading:i,zoomed:t,children:pt.jsx(d9e,{columns:r,insertImage:s,selectImg:o,zoomed:t})}),p9e=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",strokeWidth:1.5,viewBox:"0 0 24 24",...t},J.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M.75 23.249l22.5-22.5M23.25 23.249L.75.749"})),g9e=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",strokeWidth:1.5,viewBox:"0 0 24 24",...t},J.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M1.472 13.357a9.063 9.063 0 1 0 16.682-7.09 9.063 9.063 0 1 0-16.682 7.09Zm14.749 2.863 7.029 7.03"})),m9e=t=>J.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 122.43 122.41",...t},J.createElement("path",{d:"M83.86 54.15v34.13H38.57V54.15H0v68.26h122.43V54.15H83.86zM38.57 0h45.3v34.13h-45.3z"})),v9e=({closeModal:t,handleSearch:e,children:n})=>pt.jsxs(pt.Fragment,{children:[pt.jsx("div",{className:"fixed inset-0 z-40 h-[100vh] bg-black opacity-60"}),pt.jsxs("div",{className:"not-kg-prose fixed inset-8 z-50 overflow-hidden rounded bg-white shadow-xl","data-kg-modal":"unsplash",children:[pt.jsx("button",{className:"absolute right-6 top-6 cursor-pointer",type:"button",children:pt.jsx(p9e,{className:"text-grey-400 size-4 stroke-2","data-kg-modal-close-button":!0,onClick:()=>t()})}),pt.jsxs("div",{className:"flex h-full flex-col",children:[pt.jsxs("header",{className:"flex shrink-0 items-center justify-between px-20 py-10",children:[pt.jsxs("h1",{className:"flex items-center gap-2 font-sans text-3xl font-bold text-black",children:[pt.jsx(m9e,{className:"mb-1"}),"Unsplash"]}),pt.jsxs("div",{className:"relative w-full max-w-sm",children:[pt.jsx(g9e,{className:"text-grey-700 absolute left-4 top-1/2 size-4 -translate-y-2"}),pt.jsx("input",{className:"border-grey-300 focus:border-grey-400 h-10 w-full rounded-full border border-solid pl-10 pr-8 font-sans text-md font-normal text-black focus-visible:outline-none",placeholder:"Search free high-resolution photos",autoFocus:!0,"data-kg-unsplash-search":!0,onChange:e})]})]}),n]})]})]}),b9e=[{id:"TA5hw14Coh4",slug:"a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4",alternative_slugs:{en:"a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4"},created_at:"2024-02-07T22:39:36Z",updated_at:"2024-03-07T23:46:14Z",promoted_at:null,width:8640,height:5760,color:"#8c5940",blur_hash:"LKD]brE2IUr?Lgwci_NaDjR*ofoe",description:"NEOM will be home to one of the world’s largest nature reserves: a 25,000 sq km stretch of wilderness, encompassing two deserts divided by a mountain range. | NEOM, Saudi Arabia",alt_description:"a person standing on a sand dune in the desert",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1707345512638-997d31a10eaa?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1707345512638-997d31a10eaa"},links:{self:"https://api.unsplash.com/photos/a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4",html:"https://unsplash.com/photos/a-person-standing-on-a-sand-dune-in-the-desert-TA5hw14Coh4",download:"https://unsplash.com/photos/TA5hw14Coh4/download?ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/TA5hw14Coh4/download?ixid=M3wxMTc3M3wxfDF8YWxsfDF8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:226,liked_by_user:!1,current_user_collections:[],sponsorship:{impression_urls:[],tagline:"Made to Change",tagline_url:"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral",sponsor:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},topic_submissions:{},user:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},{id:"UArA9A02Kvk",slug:"a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk",alternative_slugs:{en:"a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk"},created_at:"2024-03-05T15:48:31Z",updated_at:"2024-03-11T06:59:25Z",promoted_at:"2024-03-11T06:59:25Z",width:2160,height:2700,color:"#262626",blur_hash:"L78;S$~p00oLD%D%IVay9F9ZIUay",description:null,alt_description:"a black and white photo of a man with his head in his hands",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709653688483-fc2b356c1f36?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709653688483-fc2b356c1f36"},links:{self:"https://api.unsplash.com/photos/a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk",html:"https://unsplash.com/photos/a-black-and-white-photo-of-a-man-with-his-head-in-his-hands-UArA9A02Kvk",download:"https://unsplash.com/photos/UArA9A02Kvk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/UArA9A02Kvk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDJ8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:20,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"gwWL9kMcm2g",updated_at:"2024-03-11T10:14:07Z",username:"nickandreka",name:"Nick Andréka",first_name:"Nick",last_name:"Andréka",twitter_username:null,portfolio_url:null,bio:null,location:null,links:{self:"https://api.unsplash.com/users/nickandreka",html:"https://unsplash.com/@nickandreka",photos:"https://api.unsplash.com/users/nickandreka/photos",likes:"https://api.unsplash.com/users/nickandreka/likes",portfolio:"https://api.unsplash.com/users/nickandreka/portfolio",following:"https://api.unsplash.com/users/nickandreka/following",followers:"https://api.unsplash.com/users/nickandreka/followers"},profile_image:{small:"https://images.unsplash.com/profile-1698854198608-989031a5ccdeimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1698854198608-989031a5ccdeimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1698854198608-989031a5ccdeimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"andreka.art",total_collections:0,total_likes:8,total_photos:35,total_promoted_photos:19,accepted_tos:!0,for_hire:!0,social:{instagram_username:"andreka.art",portfolio_url:null,twitter_username:null,paypal_email:null}}},{id:"QX_7m4Lh2qg",slug:"a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg",alternative_slugs:{en:"a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg"},created_at:"2024-03-10T16:46:33Z",updated_at:"2024-03-11T06:59:11Z",promoted_at:"2024-03-11T06:59:11Z",width:4e3,height:5751,color:"#f3f3f3",blur_hash:"LAQJiu~X-;9G-:?cIURj~qD%00xt",description:null,alt_description:"a black and white photo of a lighthouse",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710088912041-34d1767d376a?ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710088912041-34d1767d376a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710088912041-34d1767d376a"},links:{self:"https://api.unsplash.com/photos/a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg",html:"https://unsplash.com/photos/a-black-and-white-photo-of-a-lighthouse-QX_7m4Lh2qg",download:"https://unsplash.com/photos/QX_7m4Lh2qg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/QX_7m4Lh2qg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDN8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:21,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"ue6QWAAHoIQ",updated_at:"2024-03-11T08:53:54Z",username:"huzhewseh",name:"Volodymyr M",first_name:"Volodymyr",last_name:"M",twitter_username:"huzhewseh",portfolio_url:null,bio:null,location:null,links:{self:"https://api.unsplash.com/users/huzhewseh",html:"https://unsplash.com/@huzhewseh",photos:"https://api.unsplash.com/users/huzhewseh/photos",likes:"https://api.unsplash.com/users/huzhewseh/likes",portfolio:"https://api.unsplash.com/users/huzhewseh/portfolio",following:"https://api.unsplash.com/users/huzhewseh/following",followers:"https://api.unsplash.com/users/huzhewseh/followers"},profile_image:{small:"https://images.unsplash.com/profile-1663221970918-58b1620c49c9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1663221970918-58b1620c49c9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1663221970918-58b1620c49c9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"huzhewseh",total_collections:0,total_likes:0,total_photos:18,total_promoted_photos:3,accepted_tos:!0,for_hire:!0,social:{instagram_username:"huzhewseh",portfolio_url:null,twitter_username:"huzhewseh",paypal_email:null}}},{id:"fMNP7XVcct0",slug:"a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0",alternative_slugs:{en:"a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0"},created_at:"2024-03-09T08:40:07Z",updated_at:"2024-03-11T06:58:58Z",promoted_at:"2024-03-11T06:58:58Z",width:3264,height:4928,color:"#262626",blur_hash:"L35hY|xu00D%-;xuIUD%00j[?bWB",description:null,alt_description:"a woman standing in a dark room with her eyes closed",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709973540503-77d699279634?ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709973540503-77d699279634?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709973540503-77d699279634"},links:{self:"https://api.unsplash.com/photos/a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0",html:"https://unsplash.com/photos/a-woman-standing-in-a-dark-room-with-her-eyes-closed-fMNP7XVcct0",download:"https://unsplash.com/photos/fMNP7XVcct0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/fMNP7XVcct0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDR8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:7,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"lSlibqdw_c8",updated_at:"2024-03-11T08:54:13Z",username:"vitaliyshev89",name:"Vitaliy Shevchenko",first_name:"Vitaliy",last_name:"Shevchenko",twitter_username:null,portfolio_url:null,bio:null,location:"Kharkiv, Ukraine",links:{self:"https://api.unsplash.com/users/vitaliyshev89",html:"https://unsplash.com/@vitaliyshev89",photos:"https://api.unsplash.com/users/vitaliyshev89/photos",likes:"https://api.unsplash.com/users/vitaliyshev89/likes",portfolio:"https://api.unsplash.com/users/vitaliyshev89/portfolio",following:"https://api.unsplash.com/users/vitaliyshev89/following",followers:"https://api.unsplash.com/users/vitaliyshev89/followers"},profile_image:{small:"https://images.unsplash.com/profile-1652271342920-31eebbc2c3d0image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1652271342920-31eebbc2c3d0image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1652271342920-31eebbc2c3d0image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:null,total_collections:0,total_likes:1,total_photos:205,total_promoted_photos:29,accepted_tos:!0,for_hire:!1,social:{instagram_username:null,portfolio_url:null,twitter_username:null,paypal_email:null}}},{id:"b4kKyX0BQvc",slug:"a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc",alternative_slugs:{en:"a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc"},created_at:"2024-03-08T21:58:28Z",updated_at:"2024-03-11T06:57:35Z",promoted_at:"2024-03-11T06:57:27Z",width:6e3,height:4e3,color:"#0c2626",blur_hash:"LSDJS6kD9Zxu~qkDM|xaS%j]xaV@",description:'Stunning metro train station "Elbbrücken" in Hamburg, Germany during sunset',alt_description:"a train station with a train on the tracks",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709934645859-f1ed8d3a4954?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709934645859-f1ed8d3a4954"},links:{self:"https://api.unsplash.com/photos/a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc",html:"https://unsplash.com/photos/a-train-station-with-a-train-on-the-tracks-b4kKyX0BQvc",download:"https://unsplash.com/photos/b4kKyX0BQvc/download?ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/b4kKyX0BQvc/download?ixid=M3wxMTc3M3wwfDF8YWxsfDV8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:8,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{"street-photography":{status:"approved",approved_on:"2024-03-11T06:57:35Z"}},user:{id:"TffftDPlBPk",updated_at:"2024-03-11T06:59:04Z",username:"christianlue",name:"Christian Lue",first_name:"Christian",last_name:"Lue",twitter_username:"chrrischii",portfolio_url:null,bio:null,location:"Frankfurt / Berlin",links:{self:"https://api.unsplash.com/users/christianlue",html:"https://unsplash.com/@christianlue",photos:"https://api.unsplash.com/users/christianlue/photos",likes:"https://api.unsplash.com/users/christianlue/likes",portfolio:"https://api.unsplash.com/users/christianlue/portfolio",following:"https://api.unsplash.com/users/christianlue/following",followers:"https://api.unsplash.com/users/christianlue/followers"},profile_image:{small:"https://images.unsplash.com/profile-1581889127238-ea4aa40e8cb4image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1581889127238-ea4aa40e8cb4image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1581889127238-ea4aa40e8cb4image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:null,total_collections:7,total_likes:15,total_photos:571,total_promoted_photos:103,accepted_tos:!0,for_hire:!0,social:{instagram_username:null,portfolio_url:null,twitter_username:"chrrischii",paypal_email:null}}},{id:"9633dHhioC8",slug:"a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8",alternative_slugs:{en:"a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8"},created_at:"2023-04-28T15:30:26Z",updated_at:"2024-03-10T10:46:58Z",promoted_at:"2023-05-13T12:02:35Z",width:8316,height:5544,color:"#734026",blur_hash:"LVHdd89G57-o.9IBsSR-~pD*M{xt",description:"Amongst expansive red sands and spectacular sandstone rock formations, Hisma Desert – NEOM, Saudi Arabia | The NEOM Nature Reserve region is being designed to deliver protection and restoration of biodiversity across 95% of NEOM.",alt_description:"a person walking through a canyon in the desert",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1682695795255-b236b1f1267d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1682695795255-b236b1f1267d"},links:{self:"https://api.unsplash.com/photos/a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8",html:"https://unsplash.com/photos/a-person-walking-through-a-canyon-in-the-desert-9633dHhioC8",download:"https://unsplash.com/photos/9633dHhioC8/download?ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/9633dHhioC8/download?ixid=M3wxMTc3M3wxfDF8YWxsfDZ8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:631,liked_by_user:!1,current_user_collections:[],sponsorship:{impression_urls:["https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515595&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif","https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515798&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif"],tagline:"Made to Change",tagline_url:"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral",sponsor:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},topic_submissions:{},user:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},{id:"4PmYYBFhwFM",slug:"a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM",alternative_slugs:{en:"a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM"},created_at:"2024-03-09T18:40:37Z",updated_at:"2024-03-11T06:57:23Z",promoted_at:"2024-03-11T06:57:23Z",width:5248,height:7872,color:"#a6a6a6",blur_hash:"LHDA40%MbGxu%L?bt7of_N%gIBRj",description:null,alt_description:"a close up of a car door with the word budder on it",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710009439657-c0dfdc051a28?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710009439657-c0dfdc051a28"},links:{self:"https://api.unsplash.com/photos/a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM",html:"https://unsplash.com/photos/a-close-up-of-a-car-door-with-the-word-budder-on-it-4PmYYBFhwFM",download:"https://unsplash.com/photos/4PmYYBFhwFM/download?ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/4PmYYBFhwFM/download?ixid=M3wxMTc3M3wwfDF8YWxsfDd8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:5,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"Xz7_QPPM2So",updated_at:"2024-03-11T08:27:09Z",username:"tiago_f_ferreira",name:"Tiago Ferreira",first_name:"Tiago",last_name:"Ferreira",twitter_username:null,portfolio_url:"https://tiagoferreira765.wixsite.com/photographyandmusic",bio:`Photography - a hobby, a passion.\r +Planet earth 🌎, a creative space to enjoy.`,location:"Lisboa, Portugal",links:{self:"https://api.unsplash.com/users/tiago_f_ferreira",html:"https://unsplash.com/@tiago_f_ferreira",photos:"https://api.unsplash.com/users/tiago_f_ferreira/photos",likes:"https://api.unsplash.com/users/tiago_f_ferreira/likes",portfolio:"https://api.unsplash.com/users/tiago_f_ferreira/portfolio",following:"https://api.unsplash.com/users/tiago_f_ferreira/following",followers:"https://api.unsplash.com/users/tiago_f_ferreira/followers"},profile_image:{small:"https://images.unsplash.com/profile-1595844391672-cdf854039843image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1595844391672-cdf854039843image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1595844391672-cdf854039843image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"tiago_f_ferreira",total_collections:1,total_likes:144,total_photos:205,total_promoted_photos:8,accepted_tos:!0,for_hire:!1,social:{instagram_username:"tiago_f_ferreira",portfolio_url:"https://tiagoferreira765.wixsite.com/photographyandmusic",twitter_username:null,paypal_email:null}}},{id:"BUhVFtY-890",slug:"a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890",alternative_slugs:{en:"a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890"},created_at:"2024-03-09T10:03:28Z",updated_at:"2024-03-11T06:57:20Z",promoted_at:"2024-03-11T06:57:20Z",width:3511,height:2231,color:"#262626",blur_hash:"L24epEWB0eMx$*t8OEV@RPj]baay",description:null,alt_description:"a close up of a bird with a red head",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709978601970-036e92662b46?ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709978601970-036e92662b46?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709978601970-036e92662b46"},links:{self:"https://api.unsplash.com/photos/a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890",html:"https://unsplash.com/photos/a-close-up-of-a-bird-with-a-red-head-BUhVFtY-890",download:"https://unsplash.com/photos/BUhVFtY-890/download?ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/BUhVFtY-890/download?ixid=M3wxMTc3M3wwfDF8YWxsfDh8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:8,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{"textures-patterns":{status:"rejected"},spring:{status:"rejected"},"earth-hour":{status:"approved",approved_on:"2024-03-10T12:31:10Z"},health:{status:"unevaluated"},animals:{status:"unevaluated"},film:{status:"unevaluated"},travel:{status:"unevaluated"},nature:{status:"unevaluated"},wallpapers:{status:"unevaluated"}},user:{id:"3SCC0WcF-wA",updated_at:"2024-03-11T09:44:02Z",username:"refargotohp",name:"refargotohp",first_name:"refargotohp",last_name:null,twitter_username:null,portfolio_url:null,bio:"Hello 👋🏼 My name is Pavel, and I am a photographer. I enjoy the photo in any of its manifestations. Sequential shooting, street, studio, portraiture - it's all me. Waiting for you on my social networks - @refargotohp",location:null,links:{self:"https://api.unsplash.com/users/refargotohp",html:"https://unsplash.com/@refargotohp",photos:"https://api.unsplash.com/users/refargotohp/photos",likes:"https://api.unsplash.com/users/refargotohp/likes",portfolio:"https://api.unsplash.com/users/refargotohp/portfolio",following:"https://api.unsplash.com/users/refargotohp/following",followers:"https://api.unsplash.com/users/refargotohp/followers"},profile_image:{small:"https://images.unsplash.com/profile-1653036388874-dab6bdb375bcimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1653036388874-dab6bdb375bcimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1653036388874-dab6bdb375bcimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"refargotohp",total_collections:1,total_likes:86,total_photos:132,total_promoted_photos:61,accepted_tos:!0,for_hire:!0,social:{instagram_username:"refargotohp",portfolio_url:null,twitter_username:null,paypal_email:null}}},{id:"99clkpyauJI",slug:"there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI",alternative_slugs:{en:"there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI"},created_at:"2024-03-10T00:15:28Z",updated_at:"2024-03-11T06:56:32Z",promoted_at:"2024-03-11T06:56:32Z",width:4299,height:3448,color:"#f3f3f3",blur_hash:"LjJuGn?bM{xu~qoKRPM{9FM{t6M_",description:null,alt_description:"there are bottles of beer on a shelf in front of a window",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710029721414-9e2125e155c3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710029721414-9e2125e155c3"},links:{self:"https://api.unsplash.com/photos/there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI",html:"https://unsplash.com/photos/there-are-bottles-of-beer-on-a-shelf-in-front-of-a-window-99clkpyauJI",download:"https://unsplash.com/photos/99clkpyauJI/download?ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA",download_location:"https://api.unsplash.com/photos/99clkpyauJI/download?ixid=M3wxMTc3M3wwfDF8YWxsfDl8fHx8fHwyfHwxNzEwMTUzMjA1fA"},likes:2,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{film:{status:"approved",approved_on:"2024-03-10T16:39:06Z"}},user:{id:"TPCcwPbQzmY",updated_at:"2024-03-11T06:59:01Z",username:"suzm4film",name:"szm 4",first_name:"szm",last_name:"4",twitter_username:null,portfolio_url:null,bio:null,location:"Japan",links:{self:"https://api.unsplash.com/users/suzm4film",html:"https://unsplash.com/@suzm4film",photos:"https://api.unsplash.com/users/suzm4film/photos",likes:"https://api.unsplash.com/users/suzm4film/likes",portfolio:"https://api.unsplash.com/users/suzm4film/portfolio",following:"https://api.unsplash.com/users/suzm4film/following",followers:"https://api.unsplash.com/users/suzm4film/followers"},profile_image:{small:"https://images.unsplash.com/profile-1632890829763-5c518f873dee?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1632890829763-5c518f873dee?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1632890829763-5c518f873dee?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:null,total_collections:0,total_likes:0,total_photos:189,total_promoted_photos:19,accepted_tos:!0,for_hire:!1,social:{instagram_username:null,portfolio_url:null,twitter_username:null,paypal_email:null}}},{id:"Lbt-cZyOUM4",slug:"an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4",alternative_slugs:{en:"an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4"},created_at:"2024-03-09T16:58:57Z",updated_at:"2024-03-11T06:57:06Z",promoted_at:"2024-03-11T06:55:38Z",width:5783,height:3848,color:"#0c2626",blur_hash:"LkG[.y01Ri-:?bM{RjofM{xuRkWB",description:null,alt_description:"an old fashioned typewriter sitting on a table in front of a window",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710003364549-de37d4ed3413?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710003364549-de37d4ed3413"},links:{self:"https://api.unsplash.com/photos/an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4",html:"https://unsplash.com/photos/an-old-fashioned-typewriter-sitting-on-a-table-in-front-of-a-window-Lbt-cZyOUM4",download:"https://unsplash.com/photos/Lbt-cZyOUM4/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/Lbt-cZyOUM4/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEwfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:3,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"8D4VFtkiIuw",updated_at:"2024-03-11T07:28:57Z",username:"tama66",name:"Peter Herrmann",first_name:"Peter",last_name:"Herrmann",twitter_username:null,portfolio_url:null,bio:"Everything... but not boring! Instagram@Tiefstapler66",location:"Leverkusen/Germany",links:{self:"https://api.unsplash.com/users/tama66",html:"https://unsplash.com/@tama66",photos:"https://api.unsplash.com/users/tama66/photos",likes:"https://api.unsplash.com/users/tama66/likes",portfolio:"https://api.unsplash.com/users/tama66/portfolio",following:"https://api.unsplash.com/users/tama66/following",followers:"https://api.unsplash.com/users/tama66/followers"},profile_image:{small:"https://images.unsplash.com/profile-1611475141936-383e23c6cc6dimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1611475141936-383e23c6cc6dimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1611475141936-383e23c6cc6dimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"tiefstapler66",total_collections:1,total_likes:149,total_photos:363,total_promoted_photos:152,accepted_tos:!0,for_hire:!0,social:{instagram_username:"tiefstapler66",portfolio_url:null,twitter_username:null,paypal_email:null}}},{id:"D1jr0Mevs-c",slug:"an-aerial-view-of-a-body-of-water-D1jr0Mevs-c",alternative_slugs:{en:"an-aerial-view-of-a-body-of-water-D1jr0Mevs-c"},created_at:"2024-02-07T22:34:15Z",updated_at:"2024-03-10T10:54:36Z",promoted_at:null,width:5280,height:2970,color:"#0c2626",blur_hash:"LH9[JL0i+HM{^}Ezw#R.b@n$nhbb",description:"The Islands of NEOM are home to kaleidoscopic-coloured coral reefs and an abundance of diverse marine life | Islands of NEOM – NEOM, Saudi Arabia",alt_description:"an aerial view of a body of water",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1707343843982-f8275f3994c5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1707343843982-f8275f3994c5"},links:{self:"https://api.unsplash.com/photos/an-aerial-view-of-a-body-of-water-D1jr0Mevs-c",html:"https://unsplash.com/photos/an-aerial-view-of-a-body-of-water-D1jr0Mevs-c",download:"https://unsplash.com/photos/D1jr0Mevs-c/download?ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/D1jr0Mevs-c/download?ixid=M3wxMTc3M3wxfDF8YWxsfDExfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:308,liked_by_user:!1,current_user_collections:[],sponsorship:{impression_urls:[],tagline:"Made to Change",tagline_url:"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral",sponsor:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},topic_submissions:{},user:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},{id:"0RBEUjWQBBA",slug:"a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA",alternative_slugs:{en:"a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA"},created_at:"2024-03-10T10:15:48Z",updated_at:"2024-03-11T06:55:22Z",promoted_at:"2024-03-11T06:55:22Z",width:4672,height:7008,color:"#262626",blur_hash:"LOG8o{t7WBWB~DofR*j@D%NGR%WB",description:null,alt_description:"a woman standing under a cherry blossom tree",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710065574765-a685385c6d9a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710065574765-a685385c6d9a"},links:{self:"https://api.unsplash.com/photos/a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA",html:"https://unsplash.com/photos/a-woman-standing-under-a-cherry-blossom-tree-0RBEUjWQBBA",download:"https://unsplash.com/photos/0RBEUjWQBBA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/0RBEUjWQBBA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEyfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:11,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"ePlndXHeIiM",updated_at:"2024-03-11T09:04:03Z",username:"lwdzl",name:"Jack Dong",first_name:"Jack",last_name:"Dong",twitter_username:null,portfolio_url:"https://www.xiaohongshu.com/user/profile/5f11b998000000000101d8d2?xhsshare=CopyLink&appuid=5f11b998000000000101d8d2&apptime=1696562673",bio:null,location:null,links:{self:"https://api.unsplash.com/users/lwdzl",html:"https://unsplash.com/@lwdzl",photos:"https://api.unsplash.com/users/lwdzl/photos",likes:"https://api.unsplash.com/users/lwdzl/likes",portfolio:"https://api.unsplash.com/users/lwdzl/portfolio",following:"https://api.unsplash.com/users/lwdzl/following",followers:"https://api.unsplash.com/users/lwdzl/followers"},profile_image:{small:"https://images.unsplash.com/profile-1696563144074-80a8da44bcd4?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1696563144074-80a8da44bcd4?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1696563144074-80a8da44bcd4?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:null,total_collections:0,total_likes:101,total_photos:640,total_promoted_photos:112,accepted_tos:!0,for_hire:!0,social:{instagram_username:null,portfolio_url:"https://www.xiaohongshu.com/user/profile/5f11b998000000000101d8d2?xhsshare=CopyLink&appuid=5f11b998000000000101d8d2&apptime=1696562673",twitter_username:null,paypal_email:null}}},{id:"2IGDvJa2Bd0",slug:"a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0",alternative_slugs:{en:"a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0"},created_at:"2024-02-21T14:32:53Z",updated_at:"2024-03-11T06:54:06Z",promoted_at:"2024-03-11T06:54:06Z",width:4672,height:5840,color:"#f3f3f3",blur_hash:"L#Gv00ofD%ay~qoeM_ay%NafWVj[",description:null,alt_description:"a path in the middle of a foggy forest",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1708525736169-534ee3e24e99?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1708525736169-534ee3e24e99"},links:{self:"https://api.unsplash.com/photos/a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0",html:"https://unsplash.com/photos/a-path-in-the-middle-of-a-foggy-forest-2IGDvJa2Bd0",download:"https://unsplash.com/photos/2IGDvJa2Bd0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/2IGDvJa2Bd0/download?ixid=M3wxMTc3M3wwfDF8YWxsfDEzfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:11,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"zL5HAN1fnJw",updated_at:"2024-03-11T06:58:57Z",username:"viklukphotography",name:"Viktor Mischke",first_name:"Viktor",last_name:"Mischke",twitter_username:null,portfolio_url:"https://www.istockphoto.com/de/portfolio/snoviktor",bio:null,location:"Schloss Holte-Stukenbrock",links:{self:"https://api.unsplash.com/users/viklukphotography",html:"https://unsplash.com/@viklukphotography",photos:"https://api.unsplash.com/users/viklukphotography/photos",likes:"https://api.unsplash.com/users/viklukphotography/likes",portfolio:"https://api.unsplash.com/users/viklukphotography/portfolio",following:"https://api.unsplash.com/users/viklukphotography/following",followers:"https://api.unsplash.com/users/viklukphotography/followers"},profile_image:{small:"https://images.unsplash.com/profile-1646051425690-ed09fae6858fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1646051425690-ed09fae6858fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1646051425690-ed09fae6858fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"viktormischke",total_collections:0,total_likes:141,total_photos:38,total_promoted_photos:8,accepted_tos:!0,for_hire:!1,social:{instagram_username:"viktormischke",portfolio_url:"https://www.istockphoto.com/de/portfolio/snoviktor",twitter_username:null,paypal_email:null}}},{id:"PZfeP0uwBpQ",slug:"a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ",alternative_slugs:{en:"a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ"},created_at:"2024-02-24T10:57:49Z",updated_at:"2024-03-11T06:53:56Z",promoted_at:"2024-03-11T06:53:56Z",width:2720,height:4080,color:"#404026",blur_hash:"LIB:Tx%K56NGORbYxas:0KRj-poe",description:"A woman wearing a traditional coolie hat kneels in a field of green vegetables, carefully harvesting the crops.",alt_description:"a person with a hat on their head in a field",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1708771641703-0df3d179cec3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1708771641703-0df3d179cec3"},links:{self:"https://api.unsplash.com/photos/a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ",html:"https://unsplash.com/photos/a-person-with-a-hat-on-their-head-in-a-field-PZfeP0uwBpQ",download:"https://unsplash.com/photos/PZfeP0uwBpQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/PZfeP0uwBpQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE0fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:2,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{people:{status:"rejected"},experimental:{status:"rejected"}},user:{id:"mWjiXj5vQuQ",updated_at:"2024-03-11T06:58:57Z",username:"chanwei_snap",name:"Chanwei",first_name:"Chanwei",last_name:null,twitter_username:null,portfolio_url:null,bio:`👋 Just a snap-happy amateur sharing my photos with you!\r +📍Instagram: @chanwei.snap\r +`,location:"Taipei, Taiwan",links:{self:"https://api.unsplash.com/users/chanwei_snap",html:"https://unsplash.com/@chanwei_snap",photos:"https://api.unsplash.com/users/chanwei_snap/photos",likes:"https://api.unsplash.com/users/chanwei_snap/likes",portfolio:"https://api.unsplash.com/users/chanwei_snap/portfolio",following:"https://api.unsplash.com/users/chanwei_snap/following",followers:"https://api.unsplash.com/users/chanwei_snap/followers"},profile_image:{small:"https://images.unsplash.com/profile-1705518610211-a929b876f4d5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1705518610211-a929b876f4d5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1705518610211-a929b876f4d5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"chanwei.snap",total_collections:15,total_likes:63,total_photos:150,total_promoted_photos:2,accepted_tos:!0,for_hire:!1,social:{instagram_username:"chanwei.snap",portfolio_url:null,twitter_username:null,paypal_email:null}}},{id:"1JwHaWeSK9s",slug:"a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s",alternative_slugs:{en:"a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s"},created_at:"2024-03-10T11:33:51Z",updated_at:"2024-03-11T06:57:09Z",promoted_at:"2024-03-11T06:53:39Z",width:3586,height:3917,color:"#f3f3d9",blur_hash:"LIQ0T^j=_4%M%MxbM{M{_4jZITbH",description:"Title: Christmas eve Artist: Callowhill, James Publisher: L. Prang & Co. Name on Item: JC Date: [ca. 1861–1897] https://www.digitalcommonwealth.org/search/commonwealth:7w62f880r",alt_description:"a picture of some white flowers on a white background",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710069455079-2059d3cefe91?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710069455079-2059d3cefe91"},links:{self:"https://api.unsplash.com/photos/a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s",html:"https://unsplash.com/photos/a-picture-of-some-white-flowers-on-a-white-background-1JwHaWeSK9s",download:"https://unsplash.com/photos/1JwHaWeSK9s/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/1JwHaWeSK9s/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE1fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:7,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"piFVWeoWxU8",updated_at:"2024-03-11T07:28:12Z",username:"bostonpubliclibrary",name:"Boston Public Library",first_name:"Boston",last_name:"Public Library",twitter_username:null,portfolio_url:"https://www.bpl.org/",bio:"Considered a pioneer of public library service in the United States, the Boston Public Library is among the three largest collections in the country and is committed to be ‘Free for All’.",location:"Boston, USA",links:{self:"https://api.unsplash.com/users/bostonpubliclibrary",html:"https://unsplash.com/@bostonpubliclibrary",photos:"https://api.unsplash.com/users/bostonpubliclibrary/photos",likes:"https://api.unsplash.com/users/bostonpubliclibrary/likes",portfolio:"https://api.unsplash.com/users/bostonpubliclibrary/portfolio",following:"https://api.unsplash.com/users/bostonpubliclibrary/following",followers:"https://api.unsplash.com/users/bostonpubliclibrary/followers"},profile_image:{small:"https://images.unsplash.com/profile-1579171056760-0293bb679901image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1579171056760-0293bb679901image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1579171056760-0293bb679901image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:null,total_collections:6,total_likes:0,total_photos:510,total_promoted_photos:62,accepted_tos:!0,for_hire:!1,social:{instagram_username:null,portfolio_url:"https://www.bpl.org/",twitter_username:null,paypal_email:null}}},{id:"efzvMAIpfWY",slug:"a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY",alternative_slugs:{en:"a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY"},created_at:"2023-04-28T12:46:16Z",updated_at:"2024-03-11T09:48:19Z",promoted_at:null,width:9504,height:6336,color:"#c07359",blur_hash:"LELo7xNHxa~Bz:s9S4nO~VbwoLS~",description:"Amongst expansive red sands and spectacular sandstone rock formations, Hisma Desert – NEOM, Saudi Arabia | The NEOM Nature Reserve region is being designed to deliver protection and restoration of biodiversity across 95% of NEOM.",alt_description:"a couple of people that are standing in the dirt",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1682685797742-42c9987a2c34?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1682685797742-42c9987a2c34"},links:{self:"https://api.unsplash.com/photos/a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY",html:"https://unsplash.com/photos/a-couple-of-people-that-are-standing-in-the-dirt-efzvMAIpfWY",download:"https://unsplash.com/photos/efzvMAIpfWY/download?ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/efzvMAIpfWY/download?ixid=M3wxMTc3M3wxfDF8YWxsfDE2fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:211,liked_by_user:!1,current_user_collections:[],sponsorship:{impression_urls:["https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515544&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif","https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515747&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif"],tagline:"Made to Change",tagline_url:"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral",sponsor:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},topic_submissions:{},user:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},{id:"j39-6Uto9QQ",slug:"a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ",alternative_slugs:{en:"a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ"},created_at:"2024-03-09T22:12:40Z",updated_at:"2024-03-11T07:57:13Z",promoted_at:"2024-03-11T06:51:56Z",width:3759,height:5639,color:"#26260c",blur_hash:"L79tDG?H4;IURu%MM{RP~oohIoIo",description:null,alt_description:"a forest filled with lots of tall trees",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710020339360-ce951881b835?ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710020339360-ce951881b835?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710020339360-ce951881b835"},links:{self:"https://api.unsplash.com/photos/a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ",html:"https://unsplash.com/photos/a-forest-filled-with-lots-of-tall-trees-j39-6Uto9QQ",download:"https://unsplash.com/photos/j39-6Uto9QQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/j39-6Uto9QQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE3fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:1,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"MarIhx6ztc0",updated_at:"2024-03-11T06:51:56Z",username:"brice_cooper18",name:"Brice Cooper",first_name:"Brice",last_name:"Cooper",twitter_username:null,portfolio_url:null,bio:"Always down for an adventure, capturing those adventures one photo at a time. Never stop exploring!",location:"Florida",links:{self:"https://api.unsplash.com/users/brice_cooper18",html:"https://unsplash.com/@brice_cooper18",photos:"https://api.unsplash.com/users/brice_cooper18/photos",likes:"https://api.unsplash.com/users/brice_cooper18/likes",portfolio:"https://api.unsplash.com/users/brice_cooper18/portfolio",following:"https://api.unsplash.com/users/brice_cooper18/following",followers:"https://api.unsplash.com/users/brice_cooper18/followers"},profile_image:{small:"https://images.unsplash.com/profile-1673045276376-91bb892b6e94image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1673045276376-91bb892b6e94image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1673045276376-91bb892b6e94image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"brice_cooper18",total_collections:14,total_likes:0,total_photos:1467,total_promoted_photos:51,accepted_tos:!0,for_hire:!0,social:{instagram_username:"brice_cooper18",portfolio_url:null,twitter_username:null,paypal_email:null}}},{id:"oTE1p2Awp3I",slug:"a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I",alternative_slugs:{en:"a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I"},created_at:"2024-02-27T22:15:01Z",updated_at:"2024-03-11T06:51:52Z",promoted_at:"2024-03-11T06:51:52Z",width:4e3,height:5333,color:"#c0c0c0",blur_hash:"LLE:C[u5IooJ_N%gE1ax~ps8Vsoe",description:null,alt_description:"a couple of people standing on top of a cliff next to the ocean",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709071784840-cf3ecc434749?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709071784840-cf3ecc434749"},links:{self:"https://api.unsplash.com/photos/a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I",html:"https://unsplash.com/photos/a-couple-of-people-standing-on-top-of-a-cliff-next-to-the-ocean-oTE1p2Awp3I",download:"https://unsplash.com/photos/oTE1p2Awp3I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/oTE1p2Awp3I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE4fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:8,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"khtnjqjzcq0",updated_at:"2024-03-11T06:51:53Z",username:"mitchorr",name:"Mitchell Orr",first_name:"Mitchell",last_name:"Orr",twitter_username:null,portfolio_url:"https://mitchorr.darkroom.tech/",bio:`If you feel you would like to support my work, any donations no matter how small, would be extremely helpful. \r +Thanks for looking!`,location:"Wirral",links:{self:"https://api.unsplash.com/users/mitchorr",html:"https://unsplash.com/@mitchorr",photos:"https://api.unsplash.com/users/mitchorr/photos",likes:"https://api.unsplash.com/users/mitchorr/likes",portfolio:"https://api.unsplash.com/users/mitchorr/portfolio",following:"https://api.unsplash.com/users/mitchorr/following",followers:"https://api.unsplash.com/users/mitchorr/followers"},profile_image:{small:"https://images.unsplash.com/profile-1687891061126-8858e815018fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1687891061126-8858e815018fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1687891061126-8858e815018fimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"mitchorr1",total_collections:0,total_likes:41,total_photos:358,total_promoted_photos:118,accepted_tos:!0,for_hire:!0,social:{instagram_username:"mitchorr1",portfolio_url:"https://mitchorr.darkroom.tech/",twitter_username:null,paypal_email:null}}},{id:"ihmo0uRQ3jA",slug:"a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA",alternative_slugs:{en:"a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA"},created_at:"2024-02-24T20:00:04Z",updated_at:"2024-03-11T06:51:48Z",promoted_at:"2024-03-11T06:51:48Z",width:4e3,height:6e3,color:"#260c0c",blur_hash:"L78;b;?I4Xx?tcIUD+xt03oy-.M|",description:null,alt_description:"a bed sitting in a bedroom next to a window",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1708804309492-5ef3f3458c33?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1708804309492-5ef3f3458c33"},links:{self:"https://api.unsplash.com/photos/a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA",html:"https://unsplash.com/photos/a-bed-sitting-in-a-bedroom-next-to-a-window-ihmo0uRQ3jA",download:"https://unsplash.com/photos/ihmo0uRQ3jA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/ihmo0uRQ3jA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDE5fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:20,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"Og5qBrDjufI",updated_at:"2024-03-11T06:51:49Z",username:"mariailves",name:"Maria Ilves",first_name:"Maria",last_name:"Ilves",twitter_username:null,portfolio_url:"http://www.mariailves.com",bio:null,location:"Ambleside",links:{self:"https://api.unsplash.com/users/mariailves",html:"https://unsplash.com/@mariailves",photos:"https://api.unsplash.com/users/mariailves/photos",likes:"https://api.unsplash.com/users/mariailves/likes",portfolio:"https://api.unsplash.com/users/mariailves/portfolio",following:"https://api.unsplash.com/users/mariailves/following",followers:"https://api.unsplash.com/users/mariailves/followers"},profile_image:{small:"https://images.unsplash.com/profile-1708802611867-ab4ff1564c8cimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1708802611867-ab4ff1564c8cimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1708802611867-ab4ff1564c8cimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"mariailves_",total_collections:0,total_likes:0,total_photos:38,total_promoted_photos:4,accepted_tos:!0,for_hire:!0,social:{instagram_username:"mariailves_",portfolio_url:"http://www.mariailves.com",twitter_username:null,paypal_email:null}}},{id:"UvQtTVdFi9I",slug:"UvQtTVdFi9I",alternative_slugs:{en:"UvQtTVdFi9I"},created_at:"2016-08-12T16:12:25Z",updated_at:"2024-03-11T06:50:27Z",promoted_at:"2024-03-11T06:50:27Z",width:3648,height:5472,color:"#8ca673",blur_hash:"LGG9g4IAVax[.Zxus=kB9HtQ%LRj",description:null,alt_description:null,breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1471018289981-5d9f06e2bf45?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1471018289981-5d9f06e2bf45"},links:{self:"https://api.unsplash.com/photos/UvQtTVdFi9I",html:"https://unsplash.com/photos/UvQtTVdFi9I",download:"https://unsplash.com/photos/UvQtTVdFi9I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/UvQtTVdFi9I/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIwfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:60,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"dhG1THiRwtA",updated_at:"2024-03-11T06:50:28Z",username:"clarissemeyer",name:"Clarisse Meyer",first_name:"Clarisse",last_name:"Meyer",twitter_username:"claireymeyer",portfolio_url:"https://www.clarisserae.com",bio:`Photo | Video | Design - Southern California & Beyond\r +Instagram: @clarisse.rae`,location:"Orange County, CA",links:{self:"https://api.unsplash.com/users/clarissemeyer",html:"https://unsplash.com/@clarissemeyer",photos:"https://api.unsplash.com/users/clarissemeyer/photos",likes:"https://api.unsplash.com/users/clarissemeyer/likes",portfolio:"https://api.unsplash.com/users/clarissemeyer/portfolio",following:"https://api.unsplash.com/users/clarissemeyer/following",followers:"https://api.unsplash.com/users/clarissemeyer/followers"},profile_image:{small:"https://images.unsplash.com/profile-1470948329031-558b487bdf37?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1470948329031-558b487bdf37?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1470948329031-558b487bdf37?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"clarisse.rae",total_collections:2,total_likes:139,total_photos:99,total_promoted_photos:58,accepted_tos:!1,for_hire:!1,social:{instagram_username:"clarisse.rae",portfolio_url:"https://www.clarisserae.com",twitter_username:"claireymeyer",paypal_email:null}}},{id:"iswshBYbTBk",slug:"a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk",alternative_slugs:{en:"a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk"},created_at:"2024-02-27T19:26:10Z",updated_at:"2024-03-11T06:48:50Z",promoted_at:"2024-03-11T06:48:50Z",width:3940,height:2634,color:"#73a673",blur_hash:"LEDn~t%{y:WXDPVtH[jt8{o|VGk9",description:null,alt_description:"a woman riding an escalator down an escalator",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709061965707-9a89ffb23103?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709061965707-9a89ffb23103"},links:{self:"https://api.unsplash.com/photos/a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk",html:"https://unsplash.com/photos/a-woman-riding-an-escalator-down-an-escalator-iswshBYbTBk",download:"https://unsplash.com/photos/iswshBYbTBk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/iswshBYbTBk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIyfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:4,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{people:{status:"rejected"}},user:{id:"d-2o2yQwtxY",updated_at:"2024-03-11T06:48:59Z",username:"vitalymazur",name:"Vitalii Mazur",first_name:"Vitalii",last_name:"Mazur",twitter_username:"@madebyvitalii",portfolio_url:"https://www.behance.net/vitaliimazur",bio:`Life through photography 🌿 \r +Feel free to support me via PayPal (vitaly.mazur@icloud.com) if you like to use my shots. Also I'm available for a photoshoot in Toronto 📸🇨🇦`,location:"Toronto, Canada",links:{self:"https://api.unsplash.com/users/vitalymazur",html:"https://unsplash.com/@vitalymazur",photos:"https://api.unsplash.com/users/vitalymazur/photos",likes:"https://api.unsplash.com/users/vitalymazur/likes",portfolio:"https://api.unsplash.com/users/vitalymazur/portfolio",following:"https://api.unsplash.com/users/vitalymazur/following",followers:"https://api.unsplash.com/users/vitalymazur/followers"},profile_image:{small:"https://images.unsplash.com/profile-1708119387274-fad12c7d293b?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1708119387274-fad12c7d293b?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1708119387274-fad12c7d293b?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"vitalymazur ",total_collections:14,total_likes:773,total_photos:263,total_promoted_photos:15,accepted_tos:!0,for_hire:!0,social:{instagram_username:"vitalymazur ",portfolio_url:"https://www.behance.net/vitaliimazur",twitter_username:"@madebyvitalii",paypal_email:null}}},{id:"uSNuKKh7wpA",slug:"a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA",alternative_slugs:{en:"a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA"},created_at:"2024-03-01T10:58:28Z",updated_at:"2024-03-11T06:48:07Z",promoted_at:"2024-03-11T06:48:07Z",width:9600,height:5400,color:"#d9d9d9",blur_hash:"LJLq]_WI_3%eo$xa?cRi~qobITM|",description:"Made in blender 4.0",alt_description:"a picture of a green object with a white background",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709290649154-54c725bd4484?ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709290649154-54c725bd4484?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709290649154-54c725bd4484"},links:{self:"https://api.unsplash.com/photos/a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA",html:"https://unsplash.com/photos/a-picture-of-a-green-object-with-a-white-background-uSNuKKh7wpA",download:"https://unsplash.com/photos/uSNuKKh7wpA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/uSNuKKh7wpA/download?ixid=M3wxMTc3M3wwfDF8YWxsfDIzfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:42,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{"3d-renders":{status:"approved",approved_on:"2024-03-06T08:20:20Z"},experimental:{status:"approved",approved_on:"2024-03-06T07:38:30Z"}},user:{id:"5TCQxdaW0wE",updated_at:"2024-03-11T10:04:04Z",username:"theshubhamdhage",name:"Shubham Dhage",first_name:"Shubham",last_name:"Dhage",twitter_username:"theshubhamdhage",portfolio_url:"https://theshubhamdhage.com/",bio:"Creating things is my passion.",location:"Pune, India",links:{self:"https://api.unsplash.com/users/theshubhamdhage",html:"https://unsplash.com/@theshubhamdhage",photos:"https://api.unsplash.com/users/theshubhamdhage/photos",likes:"https://api.unsplash.com/users/theshubhamdhage/likes",portfolio:"https://api.unsplash.com/users/theshubhamdhage/portfolio",following:"https://api.unsplash.com/users/theshubhamdhage/following",followers:"https://api.unsplash.com/users/theshubhamdhage/followers"},profile_image:{small:"https://images.unsplash.com/profile-1702918491890-622aa47079a5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1702918491890-622aa47079a5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1702918491890-622aa47079a5image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"theshubhamdhage",total_collections:2,total_likes:296,total_photos:734,total_promoted_photos:147,accepted_tos:!0,for_hire:!0,social:{instagram_username:"theshubhamdhage",portfolio_url:"https://theshubhamdhage.com/",twitter_username:"theshubhamdhage",paypal_email:null}}},{id:"7lN8MJPnlXs",slug:"a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs",alternative_slugs:{en:"a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs"},created_at:"2024-03-06T19:31:23Z",updated_at:"2024-03-11T06:47:23Z",promoted_at:"2024-03-11T06:47:23Z",width:6720,height:4480,color:"#26260c",blur_hash:"L05OKD},~lR7TJRj%d^$_0E49Is:",description:null,alt_description:"a close up of a pine tree with lots of needles",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709753422610-39ed7ddf9e08?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709753422610-39ed7ddf9e08"},links:{self:"https://api.unsplash.com/photos/a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs",html:"https://unsplash.com/photos/a-close-up-of-a-pine-tree-with-lots-of-needles-7lN8MJPnlXs",download:"https://unsplash.com/photos/7lN8MJPnlXs/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/7lN8MJPnlXs/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI0fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:5,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{"textures-patterns":{status:"approved",approved_on:"2024-03-11T06:47:18Z"}},user:{id:"gMFqynHNocY",updated_at:"2024-03-11T06:48:57Z",username:"blakecheekk",name:"Blake Cheek",first_name:"Blake",last_name:"Cheek",twitter_username:"blakecheekk",portfolio_url:"http://blakecheek.com",bio:"Photographer and Videographer. Lover of coffee and Jesus. ",location:"Atlanta, Ga",links:{self:"https://api.unsplash.com/users/blakecheekk",html:"https://unsplash.com/@blakecheekk",photos:"https://api.unsplash.com/users/blakecheekk/photos",likes:"https://api.unsplash.com/users/blakecheekk/likes",portfolio:"https://api.unsplash.com/users/blakecheekk/portfolio",following:"https://api.unsplash.com/users/blakecheekk/following",followers:"https://api.unsplash.com/users/blakecheekk/followers"},profile_image:{small:"https://images.unsplash.com/profile-1709746841716-156061dd4fe9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1709746841716-156061dd4fe9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1709746841716-156061dd4fe9image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"blakecheekk",total_collections:4,total_likes:0,total_photos:423,total_promoted_photos:165,accepted_tos:!0,for_hire:!0,social:{instagram_username:"blakecheekk",portfolio_url:"http://blakecheek.com",twitter_username:"blakecheekk",paypal_email:null}}},{id:"Fw8vp9G6FtE",slug:"the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE",alternative_slugs:{en:"the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE"},created_at:"2024-03-10T00:43:31Z",updated_at:"2024-03-11T06:46:50Z",promoted_at:"2024-03-11T06:46:50Z",width:6240,height:4160,color:"#262626",blur_hash:"LIINNov{ae}=56I]eToaEmWC^iI;",description:null,alt_description:"the contents of a backpack laid out on a table",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710031407576-135a680d6e10?ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710031407576-135a680d6e10?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710031407576-135a680d6e10"},links:{self:"https://api.unsplash.com/photos/the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE",html:"https://unsplash.com/photos/the-contents-of-a-backpack-laid-out-on-a-table-Fw8vp9G6FtE",download:"https://unsplash.com/photos/Fw8vp9G6FtE/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/Fw8vp9G6FtE/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI1fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:4,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"UmKpkFAcSDE",updated_at:"2024-03-11T06:46:50Z",username:"taylorheeryphoto",name:"Taylor Heery",first_name:"Taylor",last_name:"Heery",twitter_username:"tahegri",portfolio_url:"http://www.taylorheery.com",bio:`VENMO: @taylorheeryphoto\r +Fujifilm fanatic.`,location:"Hendersonville, NC",links:{self:"https://api.unsplash.com/users/taylorheeryphoto",html:"https://unsplash.com/@taylorheeryphoto",photos:"https://api.unsplash.com/users/taylorheeryphoto/photos",likes:"https://api.unsplash.com/users/taylorheeryphoto/likes",portfolio:"https://api.unsplash.com/users/taylorheeryphoto/portfolio",following:"https://api.unsplash.com/users/taylorheeryphoto/following",followers:"https://api.unsplash.com/users/taylorheeryphoto/followers"},profile_image:{small:"https://images.unsplash.com/profile-1710031596049-549d947d2a3a?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1710031596049-549d947d2a3a?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1710031596049-549d947d2a3a?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"taylorheeryphoto",total_collections:0,total_likes:107,total_photos:520,total_promoted_photos:209,accepted_tos:!0,for_hire:!0,social:{instagram_username:"taylorheeryphoto",portfolio_url:"http://www.taylorheery.com",twitter_username:"tahegri",paypal_email:null}}},{id:"e75CfMG0Sgo",slug:"a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo",alternative_slugs:{en:"a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo"},created_at:"2023-04-28T12:46:16Z",updated_at:"2024-03-10T11:50:20Z",promoted_at:null,width:5429,height:3619,color:"#a6c0d9",blur_hash:"LnHLYm%0IAi_?wn$ngj[OtRjs:f6",description:"Nature Reserve – NEOM, Saudi Arabia | The NEOM Nature Reserve region is being designed to deliver protection and restoration of biodiversity across 95% of NEOM.",alt_description:"a person with a backpack looking at mountains",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1682685796002-e05458d61f07?ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1682685796002-e05458d61f07?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1682685796002-e05458d61f07"},links:{self:"https://api.unsplash.com/photos/a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo",html:"https://unsplash.com/photos/a-person-with-a-backpack-looking-at-mountains-e75CfMG0Sgo",download:"https://unsplash.com/photos/e75CfMG0Sgo/download?ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/e75CfMG0Sgo/download?ixid=M3wxMTc3M3wxfDF8YWxsfDI2fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:174,liked_by_user:!1,current_user_collections:[],sponsorship:{impression_urls:["https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515577&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif","https://secure.insightexpressai.com/adServer/adServerESI.aspx?script=false&bannerID=11515780&rnd=[timestamp]&redir=https://secure.insightexpressai.com/adserver/1pixel.gif"],tagline:"Made to Change",tagline_url:"https://www.neom.com/en-us?utm_source=unsplash&utm_medium=referral",sponsor:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},topic_submissions:{},user:{id:"mYizSrdJkkU",updated_at:"2024-03-11T08:54:08Z",username:"neom",name:"NEOM",first_name:"NEOM",last_name:null,twitter_username:"neom",portfolio_url:"http://www.neom.com",bio:"Located in the northwest of Saudi Arabia, NEOM’s diverse climate offers both sun-soaked beaches and snow-capped mountains. NEOM’s unique location will provide residents with enhanced livability while protecting 95% of the natural landscape.",location:"NEOM, Saudi Arabia",links:{self:"https://api.unsplash.com/users/neom",html:"https://unsplash.com/@neom",photos:"https://api.unsplash.com/users/neom/photos",likes:"https://api.unsplash.com/users/neom/likes",portfolio:"https://api.unsplash.com/users/neom/portfolio",following:"https://api.unsplash.com/users/neom/following",followers:"https://api.unsplash.com/users/neom/followers"},profile_image:{small:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1679489218992-ebe823c797dfimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"discoverneom",total_collections:7,total_likes:1,total_photos:222,total_promoted_photos:72,accepted_tos:!0,for_hire:!1,social:{instagram_username:"discoverneom",portfolio_url:"http://www.neom.com",twitter_username:"neom",paypal_email:null}}},{id:"jSjHcyHFOdQ",slug:"a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ",alternative_slugs:{en:"a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ"},created_at:"2024-02-08T15:36:25Z",updated_at:"2024-03-11T06:46:46Z",promoted_at:"2024-03-11T06:46:46Z",width:8400,height:5600,color:"#0c260c",blur_hash:"L44CLsVuD7pF.Po2R7R*-.oyX5My",description:null,alt_description:"a picture of a green plant in a dark room",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1707406543260-ed14bbd0d086?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1707406543260-ed14bbd0d086"},links:{self:"https://api.unsplash.com/photos/a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ",html:"https://unsplash.com/photos/a-picture-of-a-green-plant-in-a-dark-room-jSjHcyHFOdQ",download:"https://unsplash.com/photos/jSjHcyHFOdQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/jSjHcyHFOdQ/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI3fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:14,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"ogQykx6hk_c",updated_at:"2024-03-11T06:46:46Z",username:"pawel_czerwinski",name:"Pawel Czerwinski",first_name:"Pawel",last_name:"Czerwinski",twitter_username:"pm_cze",portfolio_url:"http://paypal.me/pmcze",bio:"Questions about how you can use the photos? help.unsplash.com/en/collections/1463188-unsplash-license 👍",location:"Poland",links:{self:"https://api.unsplash.com/users/pawel_czerwinski",html:"https://unsplash.com/@pawel_czerwinski",photos:"https://api.unsplash.com/users/pawel_czerwinski/photos",likes:"https://api.unsplash.com/users/pawel_czerwinski/likes",portfolio:"https://api.unsplash.com/users/pawel_czerwinski/portfolio",following:"https://api.unsplash.com/users/pawel_czerwinski/following",followers:"https://api.unsplash.com/users/pawel_czerwinski/followers"},profile_image:{small:"https://images.unsplash.com/profile-1592328433409-d9ce8a5333eaimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1592328433409-d9ce8a5333eaimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1592328433409-d9ce8a5333eaimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"pmcze",total_collections:7,total_likes:39154,total_photos:2137,total_promoted_photos:1760,accepted_tos:!0,for_hire:!1,social:{instagram_username:"pmcze",portfolio_url:"http://paypal.me/pmcze",twitter_username:"pm_cze",paypal_email:null}}},{id:"OfGHUYX0CCg",slug:"a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg",alternative_slugs:{en:"a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg"},created_at:"2024-03-06T14:06:51Z",updated_at:"2024-03-11T08:56:52Z",promoted_at:"2024-03-11T06:45:54Z",width:8192,height:5460,color:"#260c0c",blur_hash:"LUF{kg=cj@fQ}XxFS3azxFfjS2WW",description:null,alt_description:"a body of water that has some waves on it",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709733167477-25398ca709c0?ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709733167477-25398ca709c0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709733167477-25398ca709c0"},links:{self:"https://api.unsplash.com/photos/a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg",html:"https://unsplash.com/photos/a-body-of-water-that-has-some-waves-on-it-OfGHUYX0CCg",download:"https://unsplash.com/photos/OfGHUYX0CCg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/OfGHUYX0CCg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI4fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:16,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{"earth-hour":{status:"approved",approved_on:"2024-03-07T09:43:45Z"}},user:{id:"uFFemR6e1vs",updated_at:"2024-03-11T06:48:56Z",username:"marcospradobr",name:"Marcos Paulo Prado",first_name:"Marcos Paulo",last_name:"Prado",twitter_username:null,portfolio_url:"https://www.instagram.com/eusoumarcosprado",bio:"People and commercial photographer based in Rio de Janeiro, Brasil",location:"Rio de Janeiro, Brazil",links:{self:"https://api.unsplash.com/users/marcospradobr",html:"https://unsplash.com/@marcospradobr",photos:"https://api.unsplash.com/users/marcospradobr/photos",likes:"https://api.unsplash.com/users/marcospradobr/likes",portfolio:"https://api.unsplash.com/users/marcospradobr/portfolio",following:"https://api.unsplash.com/users/marcospradobr/following",followers:"https://api.unsplash.com/users/marcospradobr/followers"},profile_image:{small:"https://images.unsplash.com/profile-1572910425876-25d44d080554image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1572910425876-25d44d080554image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1572910425876-25d44d080554image?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"eusoumarcosprado",total_collections:0,total_likes:306,total_photos:413,total_promoted_photos:139,accepted_tos:!0,for_hire:!0,social:{instagram_username:"eusoumarcosprado",portfolio_url:"https://www.instagram.com/eusoumarcosprado",twitter_username:null,paypal_email:null}}},{id:"VKQpbzeWbrk",slug:"a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk",alternative_slugs:{en:"a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk"},created_at:"2024-03-09T21:24:04Z",updated_at:"2024-03-11T06:45:51Z",promoted_at:"2024-03-11T06:45:51Z",width:2592,height:3872,color:"#8c2626",blur_hash:"LFI2{Exr0gE}Dlo|=_W-5RE3O=xH",description:null,alt_description:"a bouquet of orange and white tulips on a red door",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1710018337941-58197591d55a?ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1710018337941-58197591d55a?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1710018337941-58197591d55a"},links:{self:"https://api.unsplash.com/photos/a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk",html:"https://unsplash.com/photos/a-bouquet-of-orange-and-white-tulips-on-a-red-door-VKQpbzeWbrk",download:"https://unsplash.com/photos/VKQpbzeWbrk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/VKQpbzeWbrk/download?ixid=M3wxMTc3M3wwfDF8YWxsfDI5fHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:3,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"H8-Yyg-eX4A",updated_at:"2024-03-11T06:48:56Z",username:"jaelphotos",name:"Jael Coon",first_name:"Jael",last_name:"Coon",twitter_username:null,portfolio_url:"https://linktr.ee/jaelcoon",bio:"Coffee drinker, photographer, artist and chef/baker",location:"USA",links:{self:"https://api.unsplash.com/users/jaelphotos",html:"https://unsplash.com/@jaelphotos",photos:"https://api.unsplash.com/users/jaelphotos/photos",likes:"https://api.unsplash.com/users/jaelphotos/likes",portfolio:"https://api.unsplash.com/users/jaelphotos/portfolio",following:"https://api.unsplash.com/users/jaelphotos/following",followers:"https://api.unsplash.com/users/jaelphotos/followers"},profile_image:{small:"https://images.unsplash.com/profile-1693432710439-47b22b3f6a9eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1693432710439-47b22b3f6a9eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1693432710439-47b22b3f6a9eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"jaelcoon",total_collections:51,total_likes:0,total_photos:230,total_promoted_photos:3,accepted_tos:!0,for_hire:!1,social:{instagram_username:"jaelcoon",portfolio_url:"https://linktr.ee/jaelcoon",twitter_username:null,paypal_email:null}}},{id:"W6AqsLH6HOg",slug:"a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg",alternative_slugs:{en:"a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg"},created_at:"2024-03-06T06:59:15Z",updated_at:"2024-03-11T06:45:45Z",promoted_at:"2024-03-11T06:45:45Z",width:6e3,height:4e3,color:"#595959",blur_hash:"LYE_]gO?}qOsW--Ux]$%RPoeX9oz",description:null,alt_description:"a license plate on the back of a car",breadcrumbs:[],urls:{raw:"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3",full:"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=srgb&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=85",regular:"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=1080",small:"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=400",thumb:"https://images.unsplash.com/photo-1709708210553-490ba885fcf6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw&ixlib=rb-4.0.3&q=80&w=200",small_s3:"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1709708210553-490ba885fcf6"},links:{self:"https://api.unsplash.com/photos/a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg",html:"https://unsplash.com/photos/a-license-plate-on-the-back-of-a-car-W6AqsLH6HOg",download:"https://unsplash.com/photos/W6AqsLH6HOg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw",download_location:"https://api.unsplash.com/photos/W6AqsLH6HOg/download?ixid=M3wxMTc3M3wwfDF8YWxsfDMwfHx8fHx8Mnx8MTcxMDE1MzIwNXw"},likes:3,liked_by_user:!1,current_user_collections:[],sponsorship:null,topic_submissions:{},user:{id:"VNV70zPYNto",updated_at:"2024-03-11T06:48:56Z",username:"venajeborec",name:"Václav Pechar",first_name:"Václav",last_name:"Pechar",twitter_username:null,portfolio_url:null,bio:`Photographer from South Bohemia ✌🏻\r +Be free to contact me to book a shoot 🙏🏻`,location:"Czech Republic - Písek",links:{self:"https://api.unsplash.com/users/venajeborec",html:"https://unsplash.com/@venajeborec",photos:"https://api.unsplash.com/users/venajeborec/photos",likes:"https://api.unsplash.com/users/venajeborec/likes",portfolio:"https://api.unsplash.com/users/venajeborec/portfolio",following:"https://api.unsplash.com/users/venajeborec/following",followers:"https://api.unsplash.com/users/venajeborec/followers"},profile_image:{small:"https://images.unsplash.com/profile-1687031143105-2420498da92eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=32&h=32",medium:"https://images.unsplash.com/profile-1687031143105-2420498da92eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=64&h=64",large:"https://images.unsplash.com/profile-1687031143105-2420498da92eimage?ixlib=rb-4.0.3&crop=faces&fit=crop&w=128&h=128"},instagram_username:"amazingvena",total_collections:0,total_likes:7,total_photos:324,total_promoted_photos:30,accepted_tos:!0,for_hire:!0,social:{instagram_username:"amazingvena",portfolio_url:null,twitter_username:null,paypal_email:null}}}],k9e=b9e;class y9e{constructor(){Wn(this,"photos",k9e),Wn(this,"PAGINATION",{}),Wn(this,"REQUEST_IS_RUNNING",!1),Wn(this,"SEARCH_IS_RUNNING",!1),Wn(this,"LAST_REQUEST_URL",""),Wn(this,"ERROR",null),Wn(this,"IS_LOADING",!1),Wn(this,"currentPage",1)}async fetchPhotos(){this.IS_LOADING=!0;const e=(this.currentPage-1)*30,n=this.currentPage*30;return this.currentPage+=1,this.IS_LOADING=!1,this.photos.slice(e,n)}async fetchNextPage(){if(this.REQUEST_IS_RUNNING||this.SEARCH_IS_RUNNING)return null;const e=await this.fetchPhotos();return e.length>0?e:null}async searchPhotos(e){this.SEARCH_IS_RUNNING=!0;const n=this.photos.filter(i=>i.description&&i.description.toLowerCase().includes(e.toLowerCase())||i.alt_description&&i.alt_description.toLowerCase().includes(e.toLowerCase()));return this.SEARCH_IS_RUNNING=!1,n}searchIsRunning(){return this.SEARCH_IS_RUNNING}triggerDownload(e){}}class w9e{constructor(e){Wn(this,"_provider"),this._provider=e}async fetchPhotos(){return await this._provider.fetchPhotos()}async searchPhotos(e){return await this._provider.searchPhotos(e)}async triggerDownload(e){this._provider.triggerDownload(e)}async fetchNextPage(){return await this._provider.fetchNextPage()||null}searchIsRunning(){return this._provider.searchIsRunning()}}class x9e{constructor(e){Wn(this,"API_URL","https://api.unsplash.com"),Wn(this,"HEADERS"),Wn(this,"ERROR",null),Wn(this,"PAGINATION",{}),Wn(this,"REQUEST_IS_RUNNING",!1),Wn(this,"SEARCH_IS_RUNNING",!1),Wn(this,"LAST_REQUEST_URL",""),Wn(this,"IS_LOADING",!1),this.HEADERS=e}async makeRequest(e){if(this.REQUEST_IS_RUNNING)return null;this.LAST_REQUEST_URL=e;const n={method:"GET",headers:this.HEADERS};try{this.REQUEST_IS_RUNNING=!0,this.IS_LOADING=!0;const i=await fetch(e,n),r=await this.checkStatus(i);this.extractPagination(r);const o=await r.json();return"results"in o?o.results:o}catch(i){return this.ERROR=i,null}finally{this.REQUEST_IS_RUNNING=!1,this.IS_LOADING=!1}}extractPagination(e){let n=new RegExp('<(.*)>; rel="(.*)"'),i=[],r={};for(let o of e.headers.entries())o[0]==="link"&&i.push(o[1]);return i&&i.toString().split(",").forEach(o=>{if(o){let s=n.exec(o);s&&(r[s[2]]=s[1])}}),this.PAGINATION=r,e}async fetchPhotos(){const e=`${this.API_URL}/photos?per_page=30`;return await this.makeRequest(e)}async fetchNextPage(){if(this.REQUEST_IS_RUNNING||this.SEARCH_IS_RUNNING)return null;if(this.PAGINATION.next){const e=`${this.PAGINATION.next}`,n=await this.makeRequest(e);if(n)return n}return null}async searchPhotos(e){const n=`${this.API_URL}/search/photos?query=${e}&per_page=30`;return await this.makeRequest(n)||[]}async triggerDownload(e){e.links.download_location&&await this.makeRequest(e.links.download_location)}async checkStatus(e){if(e.status>=200&&e.status<300)return e;let n="",i;const r=e.headers.get("content-type");if(r==="application/json")i=e.json().then(o=>o.errors[0]);else if(r==="text/xml")i=e.text();else throw new Error("Unsupported content type");return i.then(o=>{throw e.status===403&&e.headers.get("x-ratelimit-remaining")==="0"&&(n="Unsplash API rate limit reached, please try again later."),n=n||o||`Error ${e.status}: Uh-oh! Trouble reaching the Unsplash API`,this.ERROR=n,new Error(n)})}searchIsRunning(){return this.SEARCH_IS_RUNNING}}class _9e{constructor(e,n){Wn(this,"photoUseCases"),Wn(this,"masonryService"),Wn(this,"photos",[]),this.photoUseCases=e,this.masonryService=n}async loadNew(){let e=await this.photoUseCases.fetchPhotos();this.photos=e,await this.layoutPhotos()}async layoutPhotos(){this.masonryService.reset(),this.photos&&this.photos.forEach(e=>{e.ratio=e.height/e.width,this.masonryService.addPhotoToColumns(e)})}getColumns(){return this.masonryService.getColumns()}async updateSearch(e){let n=await this.photoUseCases.searchPhotos(e);this.photos=n,this.layoutPhotos()}async loadNextPage(){const e=await this.photoUseCases.fetchNextPage()||[];this.photos=[...this.photos,...e],this.layoutPhotos()}clearPhotos(){this.photos=[]}triggerDownload(e){this.photoUseCases.triggerDownload(e)}searchIsRunning(){return this.photoUseCases.searchIsRunning()}}const O9e=({onClose:t,onImageInsert:e,unsplashProviderConfig:n})=>{const i=T.useMemo(()=>n?new x9e(n):new y9e,[n]),r=T.useMemo(()=>new w9e(i),[i]),o=T.useMemo(()=>new o9e(3),[]),s=T.useMemo(()=>new _9e(r,o),[r,o]),a=T.useRef(null),[l,u]=T.useState(0),[f,d]=T.useState(0),[h,g]=T.useState(s.searchIsRunning()||!0),m=T.useRef(!1),[y,x]=T.useState(""),[_,S]=T.useState(null),[C,E]=T.useState([]);T.useEffect(()=>{a.current&&_===null&&f!==0&&(a.current.scrollTop=f,d(0))},[_,l,f]),T.useEffect(()=>{const R=Q=>{Q.key==="Escape"&&t()};return window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R)}},[t]),T.useEffect(()=>{const R=a.current;if(!_)return R&&R.addEventListener("scroll",()=>{u(R.scrollTop)}),()=>{R&&R.removeEventListener("scroll",()=>{u(R.scrollTop)})}},[a,_]);const N=T.useCallback(async()=>{if(m.current===!1||y.length===0){E([]),s.clearPhotos(),await s.loadNew();const R=s.getColumns();E(R||[]),a.current&&a.current.scrollTop!==0&&(a.current.scrollTop=0),g(!1)}},[s,y]),M=async R=>{const Q=R.target.value;Q.length>2&&(S(null),x(Q)),Q.length===0&&(x(""),m.current=!1,await N())},I=T.useCallback(async()=>{if(y){g(!0),E([]),s.clearPhotos(),await s.updateSearch(y);const R=s.getColumns();R&&E(R),a.current&&a.current.scrollTop!==0&&(a.current.scrollTop=0),g(!1)}},[y,s]);T.useEffect(()=>{const R=setTimeout(async()=>{y.length>2?await I():await N()},300);return()=>{m.current=!0,clearTimeout(R)}},[y,I,N]);const W=T.useCallback(async()=>{g(!0),await s.loadNextPage();const R=s.getColumns();E(R||[]),g(!1)},[s]);T.useEffect(()=>{const R=a.current;if(R){const Q=async()=>{_===null&&R.scrollTop+R.clientHeight>=R.scrollHeight-1e3&&await W()};return R.addEventListener("scroll",Q),()=>{R.removeEventListener("scroll",Q)}}},[a,W,_]);const B=R=>{R&&(S(R),d(l)),R===null&&(S(null),a.current&&(a.current.scrollTop=f))};async function Z(R){R.src&&(s.triggerDownload(R),e(R))}return pt.jsx(v9e,{closeModal:t,handleSearch:M,children:pt.jsx(h9e,{dataset:C,error:null,galleryRef:a,insertImage:Z,isLoading:h,selectImg:B,zoomed:_})})},AH=({unsplashConf:t,onImageInsert:e,onClose:n})=>k.jsx(Gc,{children:k.jsx(O9e,{unsplashProviderConfig:t,onClose:n,onImageInsert:e})}),S9e=({nodeKey:t,isModalOpen:e=!0})=>{const{cardConfig:n}=T.useContext(ft),[i]=Oe.useLexicalComposerContext(),[r,o]=T.useState(e),s=()=>{t&&i.update(()=>{A.$getNodeByKey(t).remove()})},a=async l=>{i.update(()=>{const u=A.$getNodeByKey(t);u.src=l.src,u.height=l.height,u.width=l.width,u.caption=l.caption,u.alt=l.alt;const f=TB({editor:u.__captionEditor,initialHtml:`${l.caption}`});u.__captionEditor.setEditorState(f);const d=A.$createNodeSelection();d.add(u.getKey()),A.$setSelection(d)}),o(!1)};return r?k.jsx(AH,{unsplashConf:n.unsplash,onClose:s,onImageInsert:a}):null},PH=A.createCommand("OPEN_TENOR_SELECTOR_COMMAND"),DH=A.createCommand("INSERT_FROM_TENOR_COMMAND"),IH=A.createCommand("OPEN_UNSPLASH_SELECTOR_COMMAND"),C9e=()=>{const[t]=Oe.useLexicalComposerContext();return T.useEffect(()=>{if(!t.hasNodes([Au])){console.error("ImagePlugin: ImageNode not registered");return}return ut.mergeRegister(t.registerCommand(PH,async e=>{const n=Sh({...e,selector:t9e,isImageHidden:!0});return t.dispatchCommand(kn,{cardNode:n}),!0},A.COMMAND_PRIORITY_LOW),t.registerCommand(DH,async e=>{const n=Sh(e),r=A.$getSelection().getNodes()[0];return t.dispatchCommand(kn,{cardNode:n}),r.remove(),!0},A.COMMAND_PRIORITY_LOW),t.registerCommand(IH,async e=>{const n=Sh({...e,selector:S9e});return t.dispatchCommand(kn,{cardNode:n}),!0},A.COMMAND_PRIORITY_LOW))},[t]),null},K6=A.createCommand();class Au extends Lg{constructor(n={},i){super(n,i);ye(this,"__triggerFileDialog",!1);ye(this,"__previewSrc",null);ye(this,"__captionEditor");ye(this,"__captionEditorInitialState");const{previewSrc:r,triggerFileDialog:o,initialFile:s,selector:a,isImageHidden:l}=n;this.__previewSrc=r||"",this.__triggerFileDialog=!n.src&&o||!1,this.__initialFile=s||null,this.__selector=a,this.__isImageHidden=l,vi(this,"__captionEditor",{editor:n.captionEditor,nodes:Qi}),!n.captionEditor&&n.caption&&bi(this,"__captionEditor",`${n.caption}`)}getIcon(){return u_}getDataset(){const n=super.getDataset();n.__previewSrc=this.__previewSrc,n.__triggerFileDialog=this.__triggerFileDialog;const i=this.getLatest();return n.captionEditor=i.__captionEditor,n.captionEditorInitialState=i.__captionEditorInitialState,n}get previewSrc(){return this.getLatest().__previewSrc}set previewSrc(n){const i=this.getWritable();i.__previewSrc=n}set triggerFileDialog(n){const i=this.getWritable();i.__triggerFileDialog=n}createDOM(){return document.createElement("div")}exportJSON(){const n=super.exportJSON();return this.__captionEditor&&this.__captionEditor.getEditorState().read(()=>{const i=Mn.$generateHtmlFromNodes(this.__captionEditor,null),r=si(i,{firstChildInnerContent:!0});n.caption=r}),n}decorate(){const n=this.__selector;return k.jsxs(An,{nodeKey:this.getKey(),width:this.__cardWidth,children:[this.__selector&&k.jsx(n,{nodeKey:this.getKey()}),!this.__isImageHidden&&k.jsx(H8e,{altText:this.__alt,captionEditor:this.__captionEditor,captionEditorInitialState:this.__captionEditorInitialState,href:this.href,initialFile:this.__initialFile,nodeKey:this.getKey(),previewSrc:this.previewSrc,src:this.src,triggerFileDialog:this.__triggerFileDialog})]})}}ye(Au,"kgMenu",[{label:"Image",desc:"Upload, or embed with /image [url]",Icon:u_,insertCommand:K6,insertParams:{triggerFileDialog:!0},matches:["image","img"],queryParams:["src"],priority:1,shortcut:"/image"},{section:"Embeds",label:"Unsplash",desc:"/unsplash [search term or url]",Icon:a9,insertCommand:IH,insertParams:{triggerFileDialog:!1},isHidden:({config:n})=>!(n!=null&&n.unsplash),matches:["unsplash","uns"],queryParams:["src"],priority:3,shortcut:"/unsplash"},{label:"GIF",desc:"Search and embed gifs",Icon:K8,insertCommand:PH,insertParams:{triggerFileDialog:!1},matches:["gif","giphy","tenor"],priority:17,queryParams:["src"],isHidden:({config:n})=>!(n!=null&&n.tenor),shortcut:"/gif"}]),ye(Au,"uploadType","image");const Sh=t=>new Au(t);function E9e(t){return t instanceof Au}function T9e(t,e,n,i){var r=-1,o=t==null?0:t.length;for(i&&o&&(n=t[++r]);++r"u"?!1:(n.match(/top/)&&(e-=1),n.match(/bottom/)&&(e+=1),e!==t)}function Eh(t,e){return r5(t,e,n=>n.parentNode)}function H$e(t,e){return t=t.nextElementSibling,r5(t,e,n=>n.nextElementSibling)}function Q$e(t,e){return t=t.previousElementSibling,r5(t,e,n=>n.previousElementSibling)}function U$e(t){if(!t)return i5();let e=getComputedStyle(t).getPropertyValue("position"),n=e==="absolute",i=Eh(t,r=>n&&Z$e(r)?!1:q$e(r));return e==="fixed"&&!i?i5():i}function i5(){var t;return((t=document.scrollingElement)==null?void 0:t.body)||document.scrollingElement||document.element}function nQ(t,e){t.style.webkitUserSelect=e,t.style.mozUserSelect=e,t.style.msUserSelect=e,t.style.oUserSelect=e,t.style.userSelect=e}function r5(t,e,n){if(!t)return null;let i=e,r=e,o=typeof e=="string",s=typeof e=="function";function a(u){if(u){if(o)return u.matches(i);if(s)return r(u)}else return u}let l=t;do{if(a(l))return l;l=n(l)}while(l&&l!==document.body&&l!==document)}function Z$e(t){return getComputedStyle(t).getPropertyValue("position")==="static"}function q$e(t){let e=/(auto|scroll)/,n=getComputedStyle(t,null),i=n.getPropertyValue("overflow")+n.getPropertyValue("overflow-y")+n.getPropertyValue("overflow-x");return e.test(i)}var iQ={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(n=!1));function r(l,u,f){this.fn=l,this.context=u,this.once=f||!1}function o(l,u,f,d,h){if(typeof f!="function")throw new TypeError("The listener must be a function");var g=new r(f,d||l,h),m=n?n+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],g]:l._events[m].push(g):(l._events[m]=g,l._eventsCount++),l}function s(l,u){--l._eventsCount===0?l._events=new i:delete l._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)e.call(f,d)&&u.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},a.prototype.listeners=function(u){var f=n?n+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,g=d.length,m=new Array(g);hi.height?(o=200,s=200/r):(o=200*r,s=200),n=document.createElement("img"),n.width=o,n.height=s,n.id="koenig-drag-drop-ghost",n.src=i.src,n.style.position="absolute",n.style.top="0",n.style.left=`-${o}px`,n.style.zIndex=W$e,n.style.willChange="transform"}else{console.warn("No element found in draggable");return}}if(n)return n;console.warn(`No default createGhostElement handler for type "${e.type}"`)}enableDrag(){this.isDragEnabled=!0,this.element.dataset[hw]="true",this.refresh()}disableDrag(){this.isDragEnabled=!1,delete this.element.dataset[hw],this.refresh()}refresh(){this.draggables.forEach(e=>{delete e.dataset[J6]}),this.droppables.forEach(e=>{delete e.dataset[e5]}),this.draggables=[],this.droppables=[],this.isDragEnabled&&(this.element.querySelectorAll(this.draggableSelector).forEach(e=>{e.dataset[J6]="true",this.draggables.push(e)}),this.element.querySelectorAll(this.droppableSelector).forEach(e=>{e.dataset[e5]="true",this.droppables.push(e)}))}}const G$e={speed:8,sensitivity:50};class K$e{constructor(){this.options=Object.assign({},G$e),this.currentMousePosition=null,this.findScrollableElementFrame=null,this.scrollableElement=null,this.scrollAnimationFrame=null,this._scroll=this._scroll.bind(this),this._isSafari=navigator.userAgent.indexOf("Safari")!==-1&&navigator.userAgent.indexOf("Chrome")===-1}dragStart(e){this.findScrollableElementFrame=requestAnimationFrame(()=>{this.scrollableElement=this.getScrollableElement(e.element)})}dragMove(e){this.findScrollableElementFrame=requestAnimationFrame(()=>{this.scrollableElement=this.getScrollableElement(e.target)}),this.scrollableElement&&(this.currentMousePosition={clientX:e.mousePosition.x,clientY:e.mousePosition.y},this.scrollAnimationFrame=requestAnimationFrame(this._scroll))}dragStop(){cancelAnimationFrame(this.scrollAnimationFrame),cancelAnimationFrame(this.findScrollableElementFrame),this.currentMousePosition=null,this.findScrollableElementFrame=null,this.scrollableElement=null,this.scrollAnimationFrame=null}getScrollableElement(e){let n=U$e(e);return n===i5()&&(n=document.querySelector(".gh-koenig-editor")),n}_scroll(){if(!this.scrollableElement||!this.currentMousePosition)return;cancelAnimationFrame(this.scrollAnimationFrame);let{speed:e,sensitivity:n}=this.options,i=this.scrollableElement.getBoundingClientRect(),r=this.scrollableElement,o=this.currentMousePosition.clientX,s=this.currentMousePosition.clientY,{offsetHeight:a,offsetWidth:l}=r,u=i.top+a-s,f=s-i.top;u