"""Nevada — SilverFlume SOS portal automation. Name search implemented via the public business entity search. LLC/Corp filing selectors pending live portal verification. """ from __future__ import annotations import re from scripts.formation.base import ( StatePortal, NameSearchResult, FormationOrder, FilingResult, FilingStatus, ) from .config import CONFIG class NVPortal(StatePortal): STATE_CODE = "NV" STATE_NAME = "Nevada" PORTAL_NAME = "SilverFlume" PORTAL_URL = CONFIG["portal_url"] NWRA_ADDRESS = CONFIG["nwra_address"] NWRA_CITY = CONFIG["nwra_city"] NWRA_STATE = CONFIG["nwra_state"] NWRA_ZIP = CONFIG["nwra_zip"] async def search_name(self, name: str) -> NameSearchResult: """Search Nevada business name availability via the public portal.""" try: page = await self.start_browser() await page.goto(CONFIG["name_search_url"], wait_until="networkidle") await self.human_delay(1.0, 2.5) search_sel = ( CONFIG["selectors"].get("search_input") or 'input[type="text"], input[name*="earch"], input[name*="ame"]' ) await page.fill(search_sel, "") await self.type_slowly(page, search_sel, name) await self.human_delay(0.5, 1.0) btn_sel = ( CONFIG["selectors"].get("search_button") or 'button[type="submit"], input[type="submit"]' ) await page.click(btn_sel) await page.wait_for_load_state("networkidle") await self.human_delay(1.0, 2.0) content = await page.content() await self.screenshot(page, f"${CODE}_name_search_{name}") no_results = any( phrase in content.lower() for phrase in ["no match", "no results", "no records", "no entities", "0 results"] ) if no_results: return NameSearchResult( available=True, exact_match=False, similar_names=[], state_code="NV", searched_name=name, raw_response=content[:2000], ) similar: list[str] = [] pattern = re.compile(r'