
    Miu             	       ~   S SK r S SKrS SKrS SKrS SKrS SKrSSKJrJrJ	r	J
r
JrJrJrJrJrJr  SSKJrJr  SSKJrJr  SSKJrJr  SSKJrJr  SSKJrJr  SS	K J!r!  SS
K"J#r#J$r$  SSK%J&r&  SSK'J(r(  S SK)r)S SK*J+r+J,r,J-r-J.r.J/r/J0r0J1r1  S SK2J3r3  \1\4\-\4/\54   \/\1\4\-\4/\54   4      4   r6S r7 " S S\35      r81 Skr9S-S\+S\54S jjr:S\+S\+4S jr;S\+S\54S jr< " S S5      r= " S S5      r>\7 " S S 5      5       r? " S! S"5      r@ " S# S$5      rA " S% S&5      rB\7 " S' S(5      5       rC " S) S*5      rD " S+ S,5      rEg).    N   )
DEFAULT_PROVIDERDEFAULT_PROVIDER_API_KEYMIN_WORD_THRESHOLD$IMAGE_DESCRIPTION_MIN_WORD_THRESHOLDPROVIDER_MODELSPROVIDER_MODELS_PREFIXESSCREENSHOT_HEIGHT_TRESHOLDPAGE_TIMEOUTIMAGE_SCORE_THRESHOLDSOCIAL_MEDIA_DOMAINS)UAGenValidUAGenerator)ExtractionStrategyLLMExtractionStrategy)ChunkingStrategyRegexChunking)MarkdownGenerationStrategyDefaultMarkdownGenerator)ContentScrapingStrategyLXMLWebScrapingStrategy)DeepCrawlStrategy)TableExtractionStrategyDefaultTableExtraction)	CacheMode)ProxyRotationStrategy)Any	AwaitableCallableDictListOptionalUnion)Enumc                   ^^^	 U R                   m[        R                  " T5      nUR                   Vs/ s H  o"S:w  d  M
  UPM     snm[	        T5      m	[
        R                  " T5      UU4S j5       nX0l         0 U l        [        U	4S j5       n[        S 5       n[        S 5       nX@l	        XPl
        X`l        U $ s  snf )u  Class decorator: adds set_defaults/get_defaults/reset_defaults classmethods.

After decorating, every new instance resolves parameters as:
    explicit arg  >  class-level user defaults  >  hardcoded default

Usage::

    BrowserConfig.set_defaults(headless=False, viewport_width=1920)
    cfg = BrowserConfig()          # headless=False, viewport_width=1920
    cfg = BrowserConfig(headless=True)  # explicit wins → headless=True
selfc                 x  > [        U 5      R                  nU(       a  [        UR                  5       5      n[	        [        U5      5       H(  nU[        T	5      :  d  M  UR                  T	U   5        M*     UR                  5        H$  u  pgXd;  d  M  [        R                  " U5      X&'   M&     T" U /UQ70 UD6  g N)
type_user_defaultssetkeysrangelenadditemscopydeepcopy)
r&   argskwargsuser_defaultsexplicitikeyvalueoriginal_initparam_namess
           p/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/crawl4ai/async_configs.pywrapped_init$_with_defaults.<locals>.wrapped_init9   s    T
116;;=)H3t9%s;''LLQ0 & ,113
&"&--"6FK 4 	d,T,V,    c                    > [        U5      T-
  nU(       a  [        SU R                   SU 35      eUR                  5        H(  u  p4[        R
                  " U5      U R                  U'   M*     g)zSet class-level default overrides for new instances.

Args:
    **kwargs: Parameter names and their default values.

Raises:
    ValueError: If any key is not a valid ``__init__`` parameter.
zInvalid parameter(s) for : N)r+   
ValueError__name__r0   r1   r2   r*   )klassr4   invalidkvvalid_paramss        r<   set_defaults$_with_defaults.<locals>.set_defaultsK   se     f+,+ENN+;2gYG  LLNDA&*mmA&6E  # #r?   c                 B    [         R                  " U R                  5      $ )z7Return a deep copy of the current class-level defaults.)r1   r2   r*   )rD   s    r<   get_defaults$_with_defaults.<locals>.get_defaults]   s     }}U1122r?   c                     U(       a&  U H  nU R                   R                  US5        M!     gU R                   R                  5         g)zyClear class-level defaults.

With no arguments, removes all overrides.
With arguments, removes only the named overrides.
N)r*   popclear)rD   namesns      r<   reset_defaults&_with_defaults.<locals>.reset_defaultsb   s;     $$((D1    &&(r?   )__init__inspect	signature
parameters	frozenset	functoolswrapsr*   classmethodrI   rL   rS   )
clssigpr=   rI   rL   rS   r:   r;   rH   s
          @@@r<   _with_defaultsr`   (   s     LLM


M
*C!nn<nV1n<K[)L__]#- $-  LC7 7" 3 3 
) 
) $#'Jy =s   	B=B=c                       \ rS rSrSrSrSrg)	MatchModeu   orand N)rC   
__module____qualname____firstlineno__ORAND__static_attributes__rf   r?   r<   rb   rb   u   s    	B
Cr?   rb   >.   r   	LLMConfigrb   	SEOFilter	URLFilter	URLScorerDisplayModeFilterChainProxyConfigDomainFilterBrowserConfigr   SeedingConfigCosineStrategyCompositeScorerFreshnessScorerPathDepthScorerCrawlerRunConfigLLMContentFilterURLPatternFilterBM25ContentFilterContentTypeFilterGeolocationConfigHTTPCrawlerConfigLinkPreviewConfigNoTableExtractionSemaphoreDispatcherVirtualScrollConfigBFSDeepCrawlStrategyDFSDeepCrawlStrategyPruningContentFilterDomainAuthorityScorerr   ContentRelevanceFilterr   KeywordRelevanceScorerr   RegexExtractionStrategyRoundRobinProxyStrategyr   MemoryAdaptiveDispatcherBestFirstCrawlingStrategyJsonCssExtractionStrategyJsonLxmlExtractionStrategyPDFContentScrapingStrategyJsonXPathExtractionStrategyobjignore_default_valuec           	         U c  g[        U [        [        [        [        45      (       a  U $ [        U [
        5      (       a#  U R                  R                  U R                  S.$ [        U S5      (       a  U R                  5       $ [        U [        [        [        45      (       d&  [        U S5      (       a1  [        U [        5      (       d  U  Vs/ s H  n[        U5      PM     sn$ [        U [         5      (       a%  [        U 5       Vs/ s H  n[        U5      PM     sn$ [        U [        5      (       a;  SU R#                  5        VVs0 s H  u  p4[        U5      [        U5      _M     snnS.$ U R                  R                  n[        U S5      (       a  [$        R&                  " U R                  R(                  5      nUR*                  n0 nUR#                  5        Hv  u  pU	S:X  a  M  [-        X	U
R.                  5      n[1        U5      (       a  [1        U
R.                  5      (       a  MO  XR.                  :w  d  M`  U(       a  Mi  [        U5      X'   Mx     U R                  R                  US.$ [        U 5      $ s  snf s  snf s  snnf )	zp
Recursively convert an object to a serializable dictionary using {type, params} structure
for complex objects.
N)r)   params	isoformat__iter__dict)r)   r9   	__class__r&   )
isinstancestrintfloatboolr$   r   rC   r9   hasattrr   listtupler+   r   to_serializable_dictrY   r0   rV   rW   rU   rX   getattrdefaultis_empty_value)r   r   itemrF   rG   _typer^   r   current_valuesnameparamr9   s               r<   r   r      s   
 { #S%.//
 #t..#))DD sK  }} #eS)**gc:.F.FzZ]_cOdOd7:;st$T*s;; #y!!7;CyAyt$T*yAA #tBE))+N+$!c!f2155+N
 	

 MM""E sK   6 67 !<<>KDv~Cu}}5E #5))nU]].K.KMM)2F2F+?+FN( *. MM**$
 	

 s8Oe < B Os   I>	J
!Jdatareturnc                    U c  g[        U [        [        [        [        45      (       a  U $ [        U [
        5      (       Ga!  SU ;   Ga  SU ;   d  U S   S:X  Ga
  SU ;   Ga  U S   S:X  a8  SU ;   a2  U S   R                  5        VVs0 s H  u  pU[        U5      _M     snn$ U S   nU[        ;  a  [        SU S35      eSnS/nU H7  n [        R                  " U5      n[        Xs5      (       a  [        Xs5      n  OM9     Ub_  [!        U["        5      (       a  U" U S   5      $ SU ;   a9  U S   R                  5        VVs0 s H  u  pU[        U5      _M     nnnU" S	0 UD6$ [        U [$        5      (       a  U  V	s/ s H  n	[        U	5      PM     sn	$ [        U [
        5      (       a/  U R                  5        VVs0 s H  u  pU[        U5      _M     snn$ U $ s  snnf ! [        [        4 a     GM.  f = fs  snnf s  sn	f s  snnf )
zK
Recursively convert a serializable dictionary back to an object instance.
Nr)   r   r   r9   zDeserialization of type 'zX' is not allowed. Only allowlisted configuration and strategy types can be deserialized.crawl4airf   )r   r   r   r   r   r   r0   from_serializable_dictALLOWED_DESERIALIZE_TYPESrB   	importlibimport_moduler   r   ImportErrorAttributeError
issubclassr$   r   )
r   rF   rG   	type_namer]   module_pathsmodule_pathmodconstructor_argsr   s
             r<   r   r      s&    | $c5$/00 	4dN$v,&"8W_ <6!go=A']=P=P=RS=RTQA-a00=RSS L	55+I; 7Y Z 
 "|'K--k:3**!#1C + ( ?#t$$4>**4 >B(^=Q=Q=S$=STQA-a00=S ! $ .-.. $9=>&t,>> $9=F)!,,FFKS T$  0 $ ? Gs*   G
1G  G8<G><H G54G5r9   c                     U c  g[        U [        [        [        [        [
        45      (       a  [        U 5      S:X  a  gg)z+Check if a value is effectively empty/null.Tr   F)r   r   r   r+   r   r   r.   )r9   s    r<   r   r   /  s2    }%$sD#677CJ!Or?   c                   j    \ rS rSr SS\S\S\\   4S jjr\S\SS 4S j5       r	S\4S	 jr
SS
 jrSrg)r   i7  latitude	longitudeaccuracyc                 (    Xl         X l        X0l        g)zConfiguration class for geolocation settings.

Args:
    latitude: Latitude coordinate (e.g., 37.7749)
    longitude: Longitude coordinate (e.g., -122.4194)
    accuracy: Accuracy in meters. Default: 0.0
Nr   r   r   )r&   r   r   r   s       r<   rU   GeolocationConfig.__init__8  s     !" r?   geo_dictr   c                 t    [        U R                  S5      U R                  S5      U R                  SS5      S9$ )z-Create a GeolocationConfig from a dictionary.r   r   r           r   )r   get)r   s    r<   	from_dictGeolocationConfig.from_dictI  s7     !\\*-ll;/\\*c2
 	
r?   c                 J    U R                   U R                  U R                  S.$ )%Convert to dictionary representation.r   r   r&   s    r<   to_dictGeolocationConfig.to_dictR  s#     
 	
r?   c                 n    U R                  5       nUR                  U5        [        R                  U5      $ )zCreate a copy of this configuration with updated values.

Args:
    **kwargs: Key-value pairs of configuration options to update

Returns:
    GeolocationConfig: A new instance with the specified updates
)r   updater   r   r&   r4   config_dicts      r<   cloneGeolocationConfig.cloneZ  s.     lln6" **;77r?   )r   r   r   N)r   )r   r   )rC   rg   rh   ri   r   r"   rU   staticmethodr    r   r   r   rl   rf   r?   r<   r   r   7  s`    
 %(	!! ! 5/	!" 
D 
%8 
 

 
8r?   r   c            
           \ rS rSrSr   SS\S\\   S\\   S\\   4S jjrS	\\   4S
 jr\	S\S	S 4S j5       r
\	S\S	S 4S j5       r\	SS\S	\S    4S jj5       rS	\4S jrSS jrSrg)rs   ig  directNserverusernamepasswordipc                 d    Xl         X l        X0l        U=(       d    U R                  5       U l        g)a  Configuration class for a single proxy.

Args:
    server: Proxy server URL (e.g., "http://127.0.0.1:8080")
    username: Optional username for proxy authentication
    password: Optional password for proxy authentication
    ip: Optional IP address for verification purposes
N)r   r   r   _extract_ip_from_serverr   )r&   r   r   r   r   s        r<   rU   ProxyConfig.__init__j  s*        6446r?   r   c                      SU R                   ;   a2  U R                   R                  S5      S   R                  S5      nUS   $ U R                   R                  S5      nUS   $ ! [         a     gf = f)z#Extract IP address from server URL.://r   :r   N)r   split	Exception)r&   partss     r<   r   #ProxyConfig._extract_ip_from_server  so    		#))%0399#>Qx))#.Qx 		s   AA$ A$ $
A10A1	proxy_strc                    U =(       d    SR                  5       nSU;   aX  SU;   aR  UR                  SS5      u  p#UR                  SS5      u  pESU;   a$  UR                  SS5      u  pg[        U SU 3UUS9$ SU;   a  SU;  a	  [        US9$ UR                  S5      n[        U5      S:X  a  Uu  ppg[        S	U	 SU
 3XgS9$ [        U5      S
:X  a  Uu  p[        S	U	 SU
 3S9$ [	        SU  35      e)zCreate a ProxyConfig from a string.

Supported formats:
- 'http://username:password@ip:port'
- 'http://ip:port'
- 'socks5://ip:port'
- 'ip:port:username:password'
- 'ip:port'
 @r   r   r   r   r   r   )r      zhttp://   zInvalid proxy string format: )stripr   rs   r.   rB   )r   s	auth_partserver_partprotocolcredentialsr   r   r   r   ports              r<   from_stringProxyConfig.from_string  s    _"##%!8
%&WWS!_"I$-OOE1$=!Hk!%0%6%6sA%>""&Zs;-8%%  A:#Q,a((u:?+0(Bht1TF&;hbbu:?HBt1TF&;<<8DEEr?   
proxy_dictc                     [        U R                  S5      U R                  S5      U R                  S5      U R                  S5      S9$ )z'Create a ProxyConfig from a dictionary.r   r   r   r   r   r   r   r   )rs   r   )r   s    r<   r   ProxyConfig.from_dict  sA     >>(+^^J/^^J/~~d#	
 	
r?   env_varc                    / n [         R                  " U S5      R                  S5      nU H0  nU(       d  M  UR                  [        R                  U5      5        M2     U$ ! [         a  n[        SU 35         SnAU$ SnAff = f)zLoad proxies from environment variable.

Args:
    env_var: Name of environment variable containing comma-separated proxy strings
    
Returns:
    List of ProxyConfig objects
r   ,z(Error loading proxies from environment: N)osgetenvr   appendrs   r   r   print)r   proxies
proxy_listproxyes        r<   from_envProxyConfig.from_env  s     	B7B/55c:J#{66u=> $   	B<QC@AA	Bs   AA" "
B,B  Bc                 `    U R                   U R                  U R                  U R                  S.$ )r   r   r   r   s    r<   r   ProxyConfig.to_dict  s*     kk''	
 	
r?   c                 n    U R                  5       nUR                  U5        [        R                  U5      $ )zCreate a copy of this configuration with updated values.

Args:
    **kwargs: Key-value pairs of configuration options to update

Returns:
    ProxyConfig: A new instance with the specified updates
)r   r   rs   r   r   s      r<   r   ProxyConfig.clone  s.     lln6"$$[11r?   )r   r   r   r   )NNN)PROXIES)r   rs   )rC   rg   rh   ri   DIRECTr   r"   rU   r   r   r   r    r   r!   r  r   r   rl   rf   r?   r<   rs   rs   g  s    F
 #'"& 77 3-7 3-	7
 SM7,#  !Fs !F} !F !FF 
d 
} 
 
 # d=.A  (
 
2r?   rs   c            Y          \ rS rSrSrSSSSSSSSSSSSSSSSSS	S
SSSSSSSSSSSSS0 SSSSSSSSSSS4,S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S\S \\	\
S4   S!\S"\S#\
S$\S%\S&\S'\\\
S4   S(\S)\S*\S+\S,\S-\
S.\S/\S0\
S1\S2\S3\S4\S5\S6\S7\S8\S9\\   S:\S;\4XS< jjr\S=\
S>S 4S? j5       rS@ rSA rS>\
4SB jr\SC\
S>S 4SD j5       r     SNSE\SF\SG\SH\SI\SJ\SK\4SL jjrSMrg)Oru   i  a"  
Configuration class for setting up a browser instance and its context in AsyncPlaywrightCrawlerStrategy.

This class centralizes all parameters that affect browser and context creation. Instead of passing
scattered keyword arguments, users can instantiate and modify this configuration object. The crawler
code will then reference these settings to initialize the browser in a consistent, documented manner.

Attributes:
    browser_type (str): The type of browser to launch. Supported values: "chromium", "firefox", "webkit".
                        Default: "chromium".
    headless (bool): Whether to run the browser in headless mode (no visible GUI).
                     Default: True.
    browser_mode (str): Determines how the browser should be initialized:
                       "builtin" - use the builtin CDP browser running in background
                       "dedicated" - create a new dedicated browser instance each time
                       "cdp" - use explicit CDP settings provided in cdp_url
                       "docker" - run browser in Docker container with isolation
                       Default: "dedicated"
    use_managed_browser (bool): Launch the browser using a managed approach (e.g., via CDP), allowing
                                advanced manipulation. Default: False.
    cdp_url (str): URL for the Chrome DevTools Protocol (CDP) endpoint. Default: "ws://localhost:9222/devtools/browser/".
    browser_context_id (str or None): Pre-existing CDP browser context ID to use. When provided along with
                                      cdp_url, the crawler will reuse this context instead of creating a new one.
                                      Useful for cloud browser services that pre-create isolated contexts.
                                      Default: None.
    target_id (str or None): Pre-existing CDP target ID (page) to use. When provided along with
                             browser_context_id, the crawler will reuse this target instead of creating
                             a new page. Default: None.
    cdp_cleanup_on_close (bool): When True and using cdp_url, the close() method will still clean up
                                 the local Playwright client resources. Useful for cloud/server scenarios
                                 where you don't own the remote browser but need to prevent memory leaks
                                 from accumulated Playwright instances. Default: False.
    cdp_close_delay (float): Seconds to wait after disconnecting a CDP WebSocket before stopping the
                             Playwright subprocess. Gives the connection time to fully release. Set to
                             0 to skip the delay entirely. Only applies when cdp_cleanup_on_close=True.
                             Default: 1.0.
    cache_cdp_connection (bool): When True and using cdp_url, the Playwright subprocess and CDP WebSocket
                                 are cached at the class level and shared across multiple BrowserManager
                                 instances connecting to the same cdp_url. Reference-counted; the connection
                                 is only closed when the last user releases it. Eliminates the overhead of
                                 repeated Playwright/CDP setup and teardown. Default: False.
    create_isolated_context (bool): When True and using cdp_url, forces creation of a new browser context
                                    instead of reusing the default context. Essential for concurrent crawls
                                    on the same browser to prevent navigation conflicts. Default: False.
    debugging_port (int): Port for the browser debugging protocol. Default: 9222.
    use_persistent_context (bool): Use a persistent browser context (like a persistent profile).
                                   Automatically sets use_managed_browser=True. Default: False.
    user_data_dir (str or None): Path to a user data directory for persistent sessions. If None, a
                                 temporary directory may be used. Default: None.
    chrome_channel (str): The Chrome channel to launch (e.g., "chrome", "msedge"). Only applies if browser_type
                          is "chromium". Default: "chromium".
    channel (str): The channel to launch (e.g., "chromium", "chrome", "msedge"). Only applies if browser_type
                          is "chromium". Default: "chromium".
    proxy (Optional[str]): Proxy server URL (e.g., "http://username:password@proxy:port"). If None, no proxy is used.
                         Default: None.
    proxy_config (ProxyConfig or dict or None): Detailed proxy configuration, e.g. {"server": "...", "username": "..."}.
                                 If None, no additional proxy config. Default: None.
    viewport_width (int): Default viewport width for pages. Default: 1080.
    viewport_height (int): Default viewport height for pages. Default: 600.
    viewport (dict): Default viewport dimensions for pages. If set, overrides viewport_width and viewport_height.
                     Default: None.
    device_scale_factor (float): The device pixel ratio used for rendering pages. Controls how many
                                 physical pixels map to one CSS pixel, allowing simulation of HiDPI
                                 or Retina displays. For example, a viewport of 1920x1080 with a
                                 device_scale_factor of 2.0 produces screenshots at 3840x2160 resolution.
                                 Increasing this value improves screenshot quality but may increase
                                 memory usage and rendering time.
                                 Default: 1.0.
    verbose (bool): Enable verbose logging.
                    Default: True.
    accept_downloads (bool): Whether to allow file downloads. If True, requires a downloads_path.
                             Default: False.
    downloads_path (str or None): Directory to store downloaded files. If None and accept_downloads is True,
                                  a default path will be created. Default: None.
    storage_state (str or dict or None): An in-memory storage state (cookies, localStorage).
                                         Default: None.
    ignore_https_errors (bool): Ignore HTTPS certificate errors. Default: True.
    java_script_enabled (bool): Enable JavaScript execution in pages. Default: True.
    cookies (list): List of cookies to add to the browser context. Each cookie is a dict with fields like
                    {"name": "...", "value": "...", "url": "..."}.
                    Default: [].
    headers (dict): Extra HTTP headers to apply to all requests in this context.
                    Default: {}.
    user_agent (str): Custom User-Agent string to use. Default: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
                       "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36".
    user_agent_mode (str or None): Mode for generating the user agent (e.g., "random"). If None, use the provided
                                   user_agent as-is. Default: None.
    user_agent_generator_config (dict or None): Configuration for user agent generation if user_agent_mode is set.
                                                Default: None.
    text_mode (bool): If True, disables images and other rich content for potentially faster load times.
                      Default: False.
    light_mode (bool): Disables certain background features for performance gains. Default: False.
    extra_args (list): Additional command-line arguments passed to the browser.
                       Default: [].
    enable_stealth (bool): If True, applies playwright-stealth to bypass basic bot detection.
                          Cannot be used with use_undetected browser mode. Default: False.
    memory_saving_mode (bool): If True, adds aggressive cache discard and V8 heap cap flags
                               to reduce Chromium memory growth. Recommended for high-volume
                               crawling (1000+ pages). May slightly reduce performance due to
                               cache eviction. Default: False.
    max_pages_before_recycle (int): Number of pages to crawl before recycling the browser
                                    process to reclaim leaked memory. 0 = disabled.
                                    Recommended: 500-1000 for long-running crawlers.
                                    Default: 0.
    avoid_ads (bool): If True, blocks ad-related and tracker network requests at the
                      browser context level using a curated blocklist of top ad/tracker
                      domains. Default: False.
    avoid_css (bool): If True, blocks loading of CSS files (css, less, scss, sass) to
                      reduce resource usage and speed up crawling. Default: False.
chromiumT	dedicatedFN      ?8  X  zQMozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/116.0.0.0 Safari/537.36r   i$  	localhostr   browser_typeheadlessbrowser_modeuse_managed_browsercdp_urlbrowser_context_id	target_idcdp_cleanup_on_closecdp_close_delaycache_cdp_connectioncreate_isolated_contextuse_persistent_contextuser_data_dirchrome_channelchannelr  proxy_configviewport_widthviewport_heightviewportdevice_scale_factoraccept_downloadsdownloads_pathstorage_stateignore_https_errorsjava_script_enabledsleep_on_closeverbosecookiesheaders
user_agentuser_agent_modeuser_agent_generator_config	text_mode
light_mode
extra_argsdebugging_porthostenable_stealth	avoid_ads	avoid_cssinit_scriptsmemory_saving_modemax_pages_before_recyclec-                    Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        Xl        U=(       d    U R                   =(       d    SU l        U=(       d    U R                   =(       d    SU l        U R                   S;   a  SU l        SU l        U(       a  [        R                   " S["        5        UU l        UU l        [)        U R&                  [*        5      (       a$  [,        R/                  U R&                  5      U l        [)        U R&                  [0        5      (       a$  [,        R3                  U R&                  5      U l        U R$                  (       a4  U R&                  (       a#  [        R                   " S["        5        S U l        O<U R$                  (       a+  [,        R3                  U R$                  5      U l        S U l        UU l        UU l        UU l        U R8                  bB  U R8                  R;                  SS5      U l        U R8                  R;                  SS	5      U l        UU l        UU l        UU l         UU l!        UU l"        UU l#        Ub  UO/ U l$        Ub  UO0 U l%        UU l&        U U l'        U!U l(        U"U l)        U#U l*        U$b  U$O/ U l+        UU l,        UU l-        U%U l.        U&U l/        U'U l0        U(U l1        U)U l2        U*b  U*O/ U l3        U+U l4        U,U l5        [m        5       n-U RN                  S
:X  a+  U-Rn                  " S0 U RP                  =(       d    0 D6U l&        O [p        Rr                  " U RL                  5      U l:        U RJ                  Rw                  SU Rt                  5        U R                  S:X  a  SU l        ORU R                  S:X  a  SU l        O:U R                  S:X  a  U R                  (       a  SU l        OU R                  S:X  a   U R                  (       a  SU l        U R`                  (       a.  U R                  (       a  U R                  S:X  a  [y        S5      eg g g )Nr  )firefoxwebkitr   zhThe 'proxy' parameter is deprecated and will be removed in a future release. Use 'proxy_config' instead.zRBoth 'proxy' and 'proxy_config' are provided. 'proxy_config' will take precedence.widthr  heightr  randomz	sec-ch-uabuiltinTdockercustomr  znenable_stealth cannot be used with browser_mode='builtin'. Stealth mode requires a dedicated browser instance.rf   )=r  r  r  r  r  r  r  r  r  r  r  r   r!  r"  r#  warningswarnUserWarningr  r$  r   r   rs   r   r   r   r%  r&  r'  r   r(  r)  r*  r+  r,  r-  r0  r1  r2  r3  r4  r5  r6  r7  r.  r/  r8  r9  r:  r;  r<  r=  r>  r?  r   generater   generate_client_hintsbrowser_hint
setdefaultrB   ).r&   r  r  r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  r?  fa_user_agenr_generators.                                                 r<   rU   BrowserConfig.__init__W  s   j ) (#6 "4"$8!.$8!'>$&<#*,O0A0AOZA$"3"3Az 55DL"$DMM  E  GR  S
(d''.. + 5 5d6G6G HDd''-- + 7 78I8I JD::$++MMnp{|DJZZ + 7 7

 CDDJ,. ==$"&--"3"3GT"BD#'==#4#4Xs#CD #6  0,*#6 #6 ")"5w2")"5w2$.+F("$(2(>*B,,	,"",8,DL""4(@%"2"48+5>> 339rDO !77HT->->? 	)'+D$(*'+D$(*t||'+D$+- &&'+D$ 4#;#;@Q@QU^@^F  A_#;r?   r4   r   c           
         U R                  5        VVs0 s H.  u  pU[        U[        5      (       a  SU;   a  [        U5      OU_M0     n nn[        R
                  " [        R                  5      R                  R                  5       S1-
  n[        S0 U R                  5        VVs0 s H  u  pX;   d  M  X_M     snnD6$ s  snnf s  snnf Nr)   r&   rf   )
r0   r   r   r   rV   rW   ru   rU   rX   r,   r4   rF   rG   valids       r<   from_kwargsBrowserConfig.from_kwargs  s     
& Jq$,?,?FaK%a(UVV& 	 
 !!-"8"89DDIIKvhVON1:NOO
  O   5C&C5Cc           	         0 SU R                   _SU R                  _SU R                  _SU R                  _SU R                  _SU R
                  _SU R                  _SU R                  _S	U R                  _S
U R                  _SU R                  _SU R                  _SU R                  _SU R                  _S[        U R                  S5      (       a  U R                  R!                  5       OU R                  _SU R"                  _SU R$                  _0 SU R&                  _SU R(                  _SU R*                  _SU R,                  _SU R.                  _SU R0                  _SU R2                  _SU R4                  _SU R6                  _SU R8                  _SU R:                  _SU R<                  _SU R>                  _S U R@                  _S!U RB                  _S"U RD                  _S#U RF                  _EU RH                  U RJ                  U RL                  U RN                  U RP                  U RR                  U RT                  S$.EnU$ )%Nr  r  r  r  r  r  r  r  r  r   r!  r"  r#  r  r$  r   r%  r&  r(  r)  r*  r+  r,  r-  r0  r1  r2  r3  r4  r5  r6  r7  r.  r/  r8  )r9  r:  r;  r<  r=  r>  r?  )+r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r  r   r$  r   r%  r&  r(  r)  r*  r+  r,  r-  r0  r1  r2  r3  r4  r5  r6  r7  r.  r/  r8  r9  r:  r;  r<  r=  r>  r?  )r&   results     r<   r   BrowserConfig.to_dict  s   *
D--*
*
 D--*
 "4#;#;	*

 t||*
 !$"9"9*
 *
 #D$=$=*
 &t'C'C*
 %d&A&A*
 T//*
 d11*
 t||*
 TZZ*
 74CTCTV_;`;`D--557fjfwfw*
  d11!*
" t33#*
$ "4#;#;%*
&  5 5'*
( d11)*
* T//+*
, "4#;#;-*
. "4#;#;/*
0 t||1*
2 t||3*
4 $//5*
6 t337*
8 *4+K+K9*
: ;*
< $//=*
> $//?*
@ d11A*
B t||C*
D d11E*
F II"11 --"&"9"9(,(E(ES*
Z r?   c                 n    U R                  5       nUR                  U5        [        R                  U5      $ )zCreate a copy of this configuration with updated values.

Args:
    **kwargs: Key-value pairs of configuration options to update

Returns:
    BrowserConfig: A new instance with the specified updates
)r   r   ru   rV  r   s      r<   r   BrowserConfig.clone1  s.     lln6"((55r?   c                     [        U 5      $ r(   r   r   s    r<   dumpBrowserConfig.dump?      #D))r?   r   c                 p    [        U 5      n[        U[        5      (       a  U$ [        R                  U5      $ r(   )r   r   ru   rV  r   configs     r<   loadBrowserConfig.loadC  s1     (-fm,,M((00r?   token
channel_idcountrystatecityr   session_durationc                    U(       a  U(       d  [        S5      eUS;  a  [        SU 35      eSSUUUUUS.nU(       a  XHS'   U(       a  XXS'   S	n	 [        R                  " XS
S9n
U
R                  5         U
R	                  5       n[        U[        5      (       a4  UR                  S5      (       a  [        SUR                  SS5       35      e[        U[        5      (       a  U(       d  [        S5      eUS   n[        U SUS    SUS    3US   US   S9U l
        g! [         a  n[        SU 35        e SnAff = f)a  
Fetch a proxy from NSTProxy API and automatically assign it to proxy_config.

Get your NSTProxy token from: https://app.nstproxy.com/profile

Args:
    token (str): NSTProxy API token.
    channel_id (str): NSTProxy channel ID.
    country (str, optional): Country code (default: "ANY").
    state (str, optional): State code (default: "").
    city (str, optional): City name (default: "").
    protocol (str, optional): Proxy protocol ("http" or "socks5"). Defaults to "http".
    session_duration (int, optional): Session duration in minutes (0 = rotate each request). Defaults to 10.

Raises:
    ValueError: If the API response format is invalid.
    PermissionError: If the API returns an error message.
z,[NSTProxy] token and channel_id are required)httpsocks5z[NSTProxy] Invalid protocol: r   r   )fTypecount	channelIdrj  r   sessionDurationrh  rk  rl  z3https://api.nstproxy.com/api/v1/generate/apiproxies
   )r   timeouterrz[NSTProxy] API Error: msgzUnknown erroru=   [NSTProxy] Invalid API response — expected a non-empty listr   r   r   r   r   r   r   r   u$   [NSTProxy] ❌ Failed to set proxy: N)rB   requestsr   raise_for_statusjsonr   r   PermissionErrorr   rs   r$  r   r  )r&   rh  ri  rj  rk  rl  r   rm  r   urlresponser   
proxy_infor  s                 r<   set_nstproxyBrowserConfig.set_nstproxyK  sX   < JKLL--<XJGHH # /
 #7O!6NC	||CCH%%'==?D $%%$((5//%(>txx?_>`&abbdD)) !`aaaJ !,"3z$'7&8*V:L9MN#J/#J/!D  	8<=	s   CD   
D>*D99D>)-r)  r;  r<  r  rN  r  r  r  r  r  r  r#  r"  r0  r  r8  r(  r*  r:  r7  r1  r  r9  r,  r=  r-  r6  r?  r>  r  r$  r.  r+  r  r5  r  r   r2  r4  r3  r!  r/  r'  r&  r%  )ANYr   r   ro  ru  )rC   rg   rh   ri   __doc__r   r   r   r#   rs   r   r   r   r!   rU   r   rV  r   r   r`  rf  r  rl   rf   r?   r<   ru   ru     sz   mb ''$)"&%*!$%*(-',!(!7;""%(!&"04$($($
 `!,. "$"&#(()e[[ [ 	[
 "[ [  [ [ #[ [ #[ "&[ !%[ [ [  ![" #[$ Kt34%[& '[( )[* +[, #-[. /[0 1[2 S$_-3[4 "5[6 "7[8 9[: ;[< =[> ?[@ A[L M[N &*O[P Q[R S[T U[V W[X Y[Z [[\ ][^ _[` 3ia[b !c[d #&e[z 
PD 
P_ 
P 
P.`6*d * 14 1O 1 1  "MM M 	M
 M M M M Mr?   ru   c            	       p    \ rS rSrSr   SS\S\S\\\4   S\4S jjr	S\
4S	 jr\S
\
SS 4S j5       rSrg)r   i  zConfiguration for virtual scroll handling.

This config enables capturing content from pages with virtualized scrolling
(like Twitter, Instagram feeds) where DOM elements are recycled as user scrolls.
container_selectorscroll_count	scroll_bywait_after_scrollc                 4    Xl         X l        X0l        X@l        g)a  
Initialize virtual scroll configuration.

Args:
    container_selector: CSS selector for the scrollable container
    scroll_count: Maximum number of scrolls to perform
    scroll_by: Amount to scroll - can be:
        - "container_height": scroll by container's height
        - "page_height": scroll by viewport height  
        - int: fixed pixel amount
    wait_after_scroll: Seconds to wait after each scroll for content to load
Nr  r  r  r  )r&   r  r  r  r  s        r<   rU   VirtualScrollConfig.__init__  s    & #5("!2r?   r   c                 `    U R                   U R                  U R                  U R                  S.$ )z(Convert to dictionary for serialization.r  r  r   s    r<   r   VirtualScrollConfig.to_dict  s0     #'"9"9 --!%!7!7	
 	
r?   r   c                     U " S0 UD6$ )z Create instance from dictionary.rf   rf   )r]   r   s     r<   r   VirtualScrollConfig.from_dict  s     {T{r?   )r  r  r  r  N)ru  container_heightg      ?)rC   rg   rh   ri   r  r   r   r#   r   rU   r   r   r\   r   rl   rf   r?   r<   r   r     st     %7#&33 3 c?	3
 !30
 
 T &;  r?   r   c                       \ rS rSrSr          SS\S\S\\\      S\\\      S\	S	\	S
\	S\\   S\\
   S\4S jjr\S\\\4   SS 4S j5       rS\\\4   4S jrSS jrSrg)r   i  z3Configuration for link head extraction and scoring.Ninclude_internalinclude_externalinclude_patternsexclude_patternsconcurrencyrv  	max_linksqueryscore_thresholdr/  c                 P   Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        US::  a  [        S5      eUS::  a  [        S5      eUS::  a  [        S5      eU	b  SU	s=::  a  S::  d  O  [        S5      eU(       d  U(       d  [        S	5      egg)
a  
Initialize link extraction configuration.

Args:
    include_internal: Whether to include same-domain links
    include_external: Whether to include different-domain links  
    include_patterns: List of glob patterns to include (e.g., ["*/docs/*", "*/api/*"])
    exclude_patterns: List of glob patterns to exclude (e.g., ["*/login*", "*/admin*"])
    concurrency: Number of links to process simultaneously
    timeout: Timeout in seconds for each link's head extraction
    max_links: Maximum number of links to process (prevents overload)
    query: Query string for BM25 contextual scoring (optional)
    score_threshold: Minimum relevance score to include links (0.0-1.0, optional)
    verbose: Show detailed progress during extraction
r   zconcurrency must be positiveztimeout must be positivezmax_links must be positiveNr   r  z+score_threshold must be between 0.0 and 1.0zAAt least one of include_internal or include_external must be True)r  r  r  r  r  rv  r  r  r  r/  rB   )r&   r  r  r  r  r  rv  r  r  r  r/  s              r<   rU   LinkPreviewConfig.__init__  s    8 !1 0 0 0&"
. !;<<a<788>9::&0M#0MJKK(8`aa )9r?   r   r   c                 n   U (       d  g[        U R                  SS5      U R                  SS5      U R                  S5      U R                  S5      U R                  SS	5      U R                  S
S5      U R                  SS5      U R                  S5      U R                  S5      U R                  SS5      S9
$ )zFCreate LinkPreviewConfig from dictionary (for backward compatibility).Nr  Tr  Fr  r  r  ru  rv     r  d   r  r  r/  
r  r  r  r  r  rv  r  r  r  r/  )r   r   )r   s    r<   r   LinkPreviewConfig.from_dict  s      (__-?F(__-?G(__-?@(__-?@#r:OOIq1!ook37//'*'OO,=>OOIu5
 	
r?   c                     U R                   U R                  U R                  U R                  U R                  U R
                  U R                  U R                  U R                  U R                  S.
$ )zConvert to dictionary format.r  r  r   s    r<   r   LinkPreviewConfig.to_dict  s`     !% 5 5 $ 5 5 $ 5 5 $ 5 5++||ZZ#33||
 	
r?   c                 n    U R                  5       nUR                  U5        [        R                  U5      $ )z"Create a copy with updated values.)r   r   r   r   r   s      r<   r   LinkPreviewConfig.clone  s,    lln6" **;77r?   )
r  r  r  r  r  r  r  r  rv  r/  )
TFNNru  r  r  NNF)r   r   )rC   rg   rh   ri   r  r   r"   r!   r   r   r   rU   r   r    r   r   r   r   rl   rf   r?   r<   r   r     s    = "&!&0404#+/1b1b 1b #49-	1b
 #49-1b 1b 1b 1b }1b "%1b 1bf 
tCH~ 
2E 
 
$
c3h 
8r?   r   c                   R   \ rS rSr% SrSr\\S'   Sr\	\
\\4      \S'   Sr\	\
\\4      \S'   Sr\	\
\\4      \S'   S	r\\S
'   S	r\\S'         SS\S\	\
\\4      S\	\
\\4      S\	\
\\4      S
\S\4S jjr\S\SS 4S j5       rS rS rS\4S jr\S\SS 4S j5       rSrg)r   i&  z#HTTP-specific crawler configurationGETmethodNr1  r   r{  Tfollow_redirects
verify_sslc                 L    Xl         X l        X0l        X@l        XPl        X`l        g r(   r  r1  r   r{  r  r  )r&   r  r1  r   r{  r  r  s          r<   rU   HTTPCrawlerConfig.__init__0  s#     		 0$r?   r4   r   c                     [        U R                  SS5      U R                  S5      U R                  S5      U R                  S5      U R                  SS5      U R                  SS5      S	9$ )
Nr  r  r1  r   r{  r  Tr  r  )r   r   r4   s    r<   rV  HTTPCrawlerConfig.from_kwargs@  s^     ::h.JJy)F#F##ZZ(:DAzz,5
 	
r?   c                     U R                   U R                  U R                  U R                  U R                  U R
                  S.$ )Nr  r  r   s    r<   r   HTTPCrawlerConfig.to_dictK  s8    kk||IIII $ 5 5//
 	
r?   c                 n    U R                  5       nUR                  U5        [        R                  U5      $ )zCreate a copy of this configuration with updated values.

Args:
    **kwargs: Key-value pairs of configuration options to update

Returns:
    HTTPCrawlerConfig: A new instance with the specified updates
)r   r   r   rV  r   s      r<   r   HTTPCrawlerConfig.cloneU  s.     lln6" ,,[99r?   c                     [        U 5      $ r(   r_  r   s    r<   r`  HTTPCrawlerConfig.dumpb  s    #D))r?   c                 p    [        U 5      n[        U[        5      (       a  U$ [        R                  U5      $ r(   )r   r   r   rV  rd  s     r<   rf  HTTPCrawlerConfig.loade  s0    '-f/00M ,,V44r?   )r   r  r1  r{  r  r  )r  NNNTT)rC   rg   rh   ri   r  r  r   __annotations__r1  r"   r    r   r   r{  r  r   r  rU   r   r   rV  r   r   r`  rf  rl   rf   r?   r<   r   r   &  s?   -FC(,GXd38n%,%)D(4S>
")%)D(4S>
")!d!J ,0)-)-!%%% $sCx.)% tCH~&	%
 tCH~&% % %  
D 
%8 
 

:*d * 54 5/ 5 5r?   r   c                   d  ^  \ rS rSrSrSSSSS.r\S\" 5       \" 5       S	SSSSS	SS	S	S
SSSSSS	SSSS	\	R                  SS	S	S	S	SS	SS\SSS	SSSSSSSS	SS	SSS	S	S	S	S	S	S	S	S	S\S	S	S	\\SSS	S	SS	S	SS	S	S	SS	S	S	SS	S	S	SSS	SS0 SSSS\R                   SSS4cS\S\S\S\S\S\S\\   S\S\S\S\S \S!\S"\S#\S$\S%\S%   \\S4   S&\\   S'\\   S(\\   S)\S*\\   S+\\   S,\\   S-\S.\	S/\S0\S1\S2\S3\S4\S5\S6\S7\S8\S9\S:\S;\S<\S=\S>\S?\S@\\\\   4   SA\\\\   4   SB\\\\   4   SC\SD\SE\SF\SG\\   SH\SI\SJ\SK\SL\SM\SN\SO\SP\SQ\SR\SS\ST\SU\SV\SW\SX\SY\ SZ\S[\S\\S]\S^\S_\S`\Sa\Sb\Sc\Sd\Se\Sf\Sg\Sh\Si\Sj\Sk\Sl\Sm\Sn\So\Sp\Sq\\!   Sr\\"\#\\$4   4   Ss\\%\#\\$4   4   St\\&   Su\Sv\#\\$4   Sw\Sx\\'\/\(\   4      4Sy jjr)\*Sz 5       r+\,S{ 5       r-\-R\                  S| 5       r-S}\4S~ jr/S r0Sk\S}\4S jr1S r2U 4S jr3\*S\S}S 4S j5       r4S}\4S jr5\*S\S}S 4S j5       r6S r7S r8Sr9U =r:$ )r{   il  ax@  
Configuration class for controlling how the crawler runs each crawl operation.
This includes parameters for content extraction, page manipulation, waiting conditions,
caching, and other runtime behaviors.

This centralizes parameters that were previously scattered as kwargs to `arun()` and related methods.
By using this class, you have a single place to understand and adjust the crawling options.

Attributes:
    # Deep Crawl Parameters
    deep_crawl_strategy (DeepCrawlStrategy or None): Strategy to use for deep crawling.

    # Content Processing Parameters
    word_count_threshold (int): Minimum word count threshold before processing content.
                                Default: MIN_WORD_THRESHOLD (typically 200).
    extraction_strategy (ExtractionStrategy or None): Strategy to extract structured data from crawled pages.
                                                      Default: None (NoExtractionStrategy is used if None).
    chunking_strategy (ChunkingStrategy): Strategy to chunk content before extraction.
                                          Default: RegexChunking().
    markdown_generator (MarkdownGenerationStrategy): Strategy for generating markdown.
                                                     Default: None.
    only_text (bool): If True, attempt to extract text-only content where applicable.
                      Default: False.
    css_selector (str or None): CSS selector to extract a specific portion of the page.
                                Default: None.
    
    target_elements (list of str or None): List of CSS selectors for specific elements for Markdown generation 
                                            and structured data extraction. When you set this, only the contents 
                                            of these elements are processed for extraction and Markdown generation. 
                                            If you do not set any value, the entire page is processed. 
                                            The difference between this and css_selector is that this will shrink 
                                            the initial raw HTML to the selected element, while this will only affect 
                                            the extraction and Markdown generation.
                                Default: None
    excluded_tags (list of str or None): List of HTML tags to exclude from processing.
                                         Default: None.
    excluded_selector (str or None): CSS selector to exclude from processing.
                                     Default: None.
    keep_data_attributes (bool): If True, retain `data-*` attributes while removing unwanted attributes.
                                 Default: False.
    keep_attrs (list of str): List of HTML attributes to keep during processing.
                                  Default: [].
    remove_forms (bool): If True, remove all `<form>` elements from the HTML.
                         Default: False.
    prettiify (bool): If True, apply `fast_format_html` to produce prettified HTML output.
                      Default: False.
    parser_type (str): Type of parser to use for HTML parsing.
                       Default: "lxml".
    scraping_strategy (ContentScrapingStrategy): Scraping strategy to use.
                       Default: LXMLWebScrapingStrategy.
    proxy_config (ProxyConfig or dict or None): Detailed proxy configuration, e.g. {"server": "...", "username": "..."}.
                                 If None, no additional proxy config. Default: None.

    # Sticky Proxy Session Parameters
    proxy_session_id (str or None): When set, maintains the same proxy for all requests sharing this session ID.
                                    The proxy is acquired on first request and reused for subsequent requests.
                                    Session expires when explicitly released or crawler context is closed.
                                    Default: None.
    proxy_session_ttl (int or None): Time-to-live for sticky session in seconds.
                                     After TTL expires, a new proxy is acquired on next request.
                                     Default: None (session lasts until explicitly released or crawler closes).
    proxy_session_auto_release (bool): If True, automatically release the proxy session after a batch operation.
                                       Useful for arun_many() to clean up sessions automatically.
                                       Default: False.

    # Browser Location and Identity Parameters
    locale (str or None): Locale to use for the browser context (e.g., "en-US").
                         Default: None.
    timezone_id (str or None): Timezone identifier to use for the browser context (e.g., "America/New_York").
                              Default: None.
    geolocation (GeolocationConfig or None): Geolocation configuration for the browser.
                                            Default: None.

    # SSL Parameters
    fetch_ssl_certificate: bool = False,
    # Caching Parameters
    cache_mode (CacheMode or None): Defines how caching is handled.
                                    If None, defaults to CacheMode.ENABLED internally.
                                    Default: CacheMode.BYPASS.
    session_id (str or None): Optional session ID to persist the browser context and the created
                              page instance. If the ID already exists, the crawler does not
                              create a new page and uses the current page to preserve the state.
    bypass_cache (bool): Legacy parameter, if True acts like CacheMode.BYPASS.
                         Default: False.
    disable_cache (bool): Legacy parameter, if True acts like CacheMode.DISABLED.
                          Default: False.
    no_cache_read (bool): Legacy parameter, if True acts like CacheMode.WRITE_ONLY.
                          Default: False.
    no_cache_write (bool): Legacy parameter, if True acts like CacheMode.READ_ONLY.
                           Default: False.
    shared_data (dict or None): Shared data to be passed between hooks.
                                 Default: None.

    # Cache Validation Parameters (Smart Cache)
    check_cache_freshness (bool): If True, validates cached content freshness using HTTP
                                  conditional requests (ETag/Last-Modified) and head fingerprinting
                                  before returning cached results. Avoids full browser crawls when
                                  content hasn't changed. Only applies when cache_mode allows reads.
                                  Default: False.
    cache_validation_timeout (float): Timeout in seconds for cache validation HTTP requests.
                                      Default: 10.0.

    # Page Navigation and Timing Parameters
    wait_until (str): The condition to wait for when navigating, e.g. "domcontentloaded".
                      Default: "domcontentloaded".
    page_timeout (int): Timeout in ms for page operations like navigation.
                        Default: 60000 (60 seconds).
    wait_for (str or None): A CSS selector or JS condition to wait for before extracting content.
                            Default: None.
    wait_for_timeout (int or None): Specific timeout in ms for the wait_for condition.
                                   If None, uses page_timeout instead.
                                   Default: None.
    wait_for_images (bool): If True, wait for images to load before extracting content.
                            Default: False.
    delay_before_return_html (float): Delay in seconds before retrieving final HTML.
                                      Default: 0.1.
    mean_delay (float): Mean base delay between requests when calling arun_many.
                        Default: 0.1.
    max_range (float): Max random additional delay range for requests in arun_many.
                       Default: 0.3.
    semaphore_count (int): Number of concurrent operations allowed.
                           Default: 5.

    # Page Interaction Parameters
    js_code (str or list of str or None): JavaScript code/snippets to run on the page
                                          after wait_for and delay_before_return_html.
                                          Default: None.
    js_code_before_wait (str or list of str or None): JavaScript to run BEFORE wait_for.
                                          Use for triggering loading that wait_for then checks.
                                          Default: None.
    js_only (bool): If True, indicates subsequent calls are JS-driven updates, not full page loads.
                    Default: False.
    ignore_body_visibility (bool): If True, ignore whether the body is visible before proceeding.
                                   Default: True.
    scan_full_page (bool): If True, scroll through the entire page to load all content.
                           Default: False.
    scroll_delay (float): Delay in seconds between scroll steps if scan_full_page is True.
                          Default: 0.2.
    max_scroll_steps (Optional[int]): Maximum number of scroll steps to perform during full page scan.
                                     If None, scrolls until the entire page is loaded. Default: None.
    process_iframes (bool): If True, attempts to process and inline iframe content.
                            Default: False.
    flatten_shadow_dom (bool): If True, flatten shadow DOM content into the light DOM
                                before HTML capture so page.content() includes it.
                                Also injects an init script to force-open closed shadow roots.
                                Default: False.
    remove_overlay_elements (bool): If True, remove overlays/popups before extracting HTML.
                                    Default: False.
    remove_consent_popups (bool): If True, remove GDPR/cookie consent popups (IAB TCF/CMP)
                                  before extracting HTML. Targets known CMP providers like
                                  OneTrust, Cookiebot, TrustArc, Quantcast, Didomi, etc.
                                  Default: False.
    simulate_user (bool): If True, simulate user interactions (mouse moves, clicks) for anti-bot measures.
                          Default: False.
    override_navigator (bool): If True, overrides navigator properties for more human-like behavior.
                               Default: False.
    magic (bool): If True, attempts automatic handling of overlays/popups.
                  Default: False.
    adjust_viewport_to_content (bool): If True, adjust viewport according to the page content dimensions.
                                       Default: False.

    # Media Handling Parameters
    screenshot (bool): Whether to take a screenshot after crawling.
                       Default: False.
    screenshot_wait_for (float or None): Additional wait time before taking a screenshot.
                                         Default: None.
    screenshot_height_threshold (int): Threshold for page height to decide screenshot strategy.
                                       Default: SCREENSHOT_HEIGHT_TRESHOLD (from config, e.g. 20000).
    force_viewport_screenshot (bool): If True, always take viewport-only screenshots regardless of page height.
                                      When False, uses automatic decision (viewport for short pages, full-page for long pages).
                                      Default: False.
    pdf (bool): Whether to generate a PDF of the page.
                Default: False.
    image_description_min_word_threshold (int): Minimum words for image description extraction.
                                                Default: IMAGE_DESCRIPTION_MIN_WORD_THRESHOLD (e.g., 50).
    image_score_threshold (int): Minimum score threshold for processing an image.
                                 Default: IMAGE_SCORE_THRESHOLD (e.g., 3).
    exclude_external_images (bool): If True, exclude all external images from processing.
                                     Default: False.
    table_score_threshold (int): Minimum score threshold for processing a table.
                                 Default: 7.
    table_extraction (TableExtractionStrategy): Strategy to use for table extraction.
                                 Default: DefaultTableExtraction with table_score_threshold.

    # Virtual Scroll Parameters
    virtual_scroll_config (VirtualScrollConfig or dict or None): Configuration for handling virtual scroll containers.
                                                                 Used for capturing content from pages with virtualized 
                                                                 scrolling (e.g., Twitter, Instagram feeds).
                                                                 Default: None.

    # Link and Domain Handling Parameters
    exclude_social_media_domains (list of str): List of domains to exclude for social media links.
                                                Default: SOCIAL_MEDIA_DOMAINS (from config).
    exclude_external_links (bool): If True, exclude all external links from the results.
                                   Default: False.
    exclude_internal_links (bool): If True, exclude internal links from the results.
                                   Default: False.
    exclude_social_media_links (bool): If True, exclude links pointing to social media domains.
                                       Default: False.
    exclude_domains (list of str): List of specific domains to exclude from results.
                                   Default: [].
    exclude_internal_links (bool): If True, exclude internal links from the results.
                                   Default: False.
    score_links (bool): If True, calculate intrinsic quality scores for all links using URL structure,
                       text quality, and contextual relevance metrics. Separate from link_preview_config.
                       Default: False.

    # Debugging and Logging Parameters
    verbose (bool): Enable verbose logging.
                    Default: True.
    log_console (bool): If True, log console messages from the page.
                        Default: False.

    # HTTP Crwler Strategy Parameters
    method (str): HTTP method to use for the request, when using AsyncHTTPCrwalerStrategy.
                    Default: "GET".
    data (dict): Data to send in the request body, when using AsyncHTTPCrwalerStrategy.
                    Default: None.
    json (dict): JSON data to send in the request body, when using AsyncHTTPCrwalerStrategy.

    # Connection Parameters
    stream (bool): If True, enables streaming of crawled URLs as they are processed when used with arun_many.
                  Default: False.
    process_in_browser (bool): If True, forces raw:/file:// URLs to be processed through the browser
                               pipeline (enabling js_code, wait_for, scrolling, etc.). When False (default),
                               raw:/file:// URLs use a fast path that returns HTML directly without browser
                               interaction. This is automatically enabled when browser-requiring parameters
                               are detected (js_code, wait_for, screenshot, pdf, etc.).
                               Default: False.

    check_robots_txt (bool): Whether to check robots.txt rules before crawling. Default: False
                             Default: False.
    user_agent (str): Custom User-Agent string to use.
                      Default: None.
    user_agent_mode (str or None): Mode for generating the user agent (e.g., "random"). If None, use the provided user_agent as-is.
                                   Default: None.
    user_agent_generator_config (dict or None): Configuration for user agent generation if user_agent_mode is set.
                                                Default: None.

    # Experimental Parameters
    experimental (dict): Dictionary containing experimental parameters that are in beta phase.
                        This allows passing temporary features that are not yet fully integrated 
                        into the main parameter set.
                        Default: None.

    url: str = None  # This is not a compulsory parameter
z*Instead, use cache_mode=CacheMode.DISABLEDz(Instead, use cache_mode=CacheMode.BYPASSz,Instead, use cache_mode=CacheMode.WRITE_ONLYz+Instead, use cache_mode=CacheMode.READ_ONLY)disable_cachebypass_cacheno_cache_readno_cache_writeNFlxmlg      $@domcontentloadedg?g333333?r  Tg?   r  r   word_count_thresholdextraction_strategychunking_strategymarkdown_generator	only_textcss_selectortarget_elementsexcluded_tagsexcluded_selectorkeep_data_attributes
keep_attrsremove_forms	prettiifyparser_typescraping_strategyr$  rs   proxy_rotation_strategyproxy_session_idproxy_session_ttlproxy_session_auto_releaselocaletimezone_idgeolocationfetch_ssl_certificate
cache_mode
session_idr  r  r  r  shared_datacheck_cache_freshnesscache_validation_timeout
wait_untilpage_timeoutwait_forwait_for_timeoutwait_for_imagesdelay_before_return_html
mean_delay	max_rangesemaphore_countjs_codejs_code_before_wait
c4a_scriptjs_onlyignore_body_visibilityscan_full_pagescroll_delaymax_scroll_stepsprocess_iframesflatten_shadow_domremove_overlay_elementsremove_consent_popupssimulate_useroverride_navigatormagicadjust_viewport_to_content
screenshotscreenshot_wait_forscreenshot_height_thresholdforce_viewport_screenshotpdfcapture_mhtml$image_description_min_word_thresholdimage_score_thresholdtable_score_thresholdtable_extractionexclude_external_imagesexclude_all_imagesexclude_social_media_domainsexclude_external_linksexclude_social_media_linksexclude_domainsexclude_internal_linksscore_links!preserve_https_for_internal_linksr/  log_consolecapture_network_requestscapture_console_messagesr  streamprefetchprocess_in_browserr}  base_urlcheck_robots_txtr2  r3  r4  deep_crawl_strategylink_preview_configvirtual_scroll_configurl_matcher
match_modeexperimentalmax_retriesfallback_fetch_functioncd                 	   WVU l         WWU l        Xl        X l        X0l        X@l        XPl        X`l        U=(       d    / U l        U=(       d    / U l	        U	=(       d    SU l
        Xl        U=(       d    / U l        Xl        Xl        Xl        U=(       d
    [!        5       U l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l        UU l         UU l!        U U l"        U!U l#        U"U l$        U#U l%        U$U l&        U%U l'        U&U l(        U'U l)        U(U l*        U)U l+        U*U l,        U+U l-        U,U l.        U-U l/        U.U l0        U/U l1        U0U l2        U1U l3        U2U l4        U3U l5        U4U l6        U5U l7        U6U l8        U7U l9        U8U l:        U9U l;        U:U l<        U;U l=        U<U l>        U=U l?        U>U l@        U?U lA        W@U lB        WAU lC        WBU lD        WEU lE        WFU lF        WCU lG        WDc  [        WCS9U lI        OWDU lI        WG=(       d    [        U lK        WHU lL        WIU lM        WJ=(       d    / U lN        WKU lO        WLU lP        WMU lQ        WNU lR        WOU lS        WPU lT        WQU lU        WSU lV        WTU lW        WUU lX        WRU lY        WXU lZ        WYU l[        WZU l\        W[U l]        U R                  b*  [        U R                  [        5      (       d  [        S5      eU R                  b*  [        U R                  [        5      (       d  [        S5      eU R                  c  [        5       U l        W\U lc        W]c  S U ld        OX[        W][        5      (       a  W]U ld        O;[        W][        5      (       a  [        R                  W]5      U ld        O[        S5      eW^c  S U lh        OX[        W^[        5      (       a  W^U lh        O;[        W^[        5      (       a  [        R                  W^5      U lh        O[        S5      eW_U lj        W`U lk        Wa=(       d    0 U ll        WbU lm        WcU ln        U R^                  (       a#  U RZ                  (       d  U R                  5         g g g )Nr   )r  z=extraction_strategy must be an instance of ExtractionStrategyz9chunking_strategy must be an instance of ChunkingStrategyz<link_preview_config must be LinkPreviewConfig object or dictz@virtual_scroll_config must be VirtualScrollConfig object or dict)pr}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r$  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r   r  r   r  r  r  r  r  r  r  r/  r	  r
  r  r  r  r  r  r  r2  r3  r4  r   r   rB   r   r   r  r  r   r   r   r  r   r  r  r  r  r  _compile_c4a_script)dr&   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r/  r	  r
  r  r  r  r  r  r}  r  r  r2  r3  r4  r  r  r  r  r  r  r  r  sd                                                                                                       r<   rU   CrawlerRunConfig.__init__m  s   t   %9!#6 !2"4"(.4"*0b!2!8b$8!$*("&!2!O6M6O('>$ !1!2*D' && &;" %$(**,&%:"(@% %(  0.(@%$". #6 $&<#,( 0."4'>$%:"*"4
*D' %#6 +F()B&*4X1%:"'>$"4%:" #$:Qf$gD!$4D! )@,@ 	) '=#*D'.4"&<#&1R. & )A%(@%  "4 !1 %.+F( ##/
$$&89
 9
 O  !!-j""$47
 7
 K 
 !!)%2_D" $7  &'+D$+->??':D$+T22'8'B'BCV'WD$[\\ !()-D&-/BCC)>D&-t44)<)F)FG\)]D&_`` '$ ).B ''>$ ??4<<$$& $0?r?   c                 F   [        U [        5      (       a  / nU  H  nUb  US:X  a  UR                  S5        M  [        U[        5      (       a&  UR                  [        R                  U5      5        MZ  [        U[        5      (       a&  UR                  [        R                  U5      5        M  UR                  U5        M     U$ [        U [        5      (       a  [        R                  U 5      $ [        U [        5      (       a  U S:X  a  g[        R                  U 5      $ U $ )zINormalize proxy_config to ProxyConfig, list of ProxyConfig/None, or None.Nr   )r   r   r   r   rs   r   r   r   )r9   
normalizedr_   s      r<   _normalize_proxy_config(CrawlerRunConfig._normalize_proxy_config  s     eT""J9X%%d+4((%%k&;&;A&>?3''%%k&=&=a&@A%%a(  t$$((//s## **511r?   c                     U R                   $ r(   )_proxy_configr   s    r<   r$  CrawlerRunConfig.proxy_config  s    !!!r?   c                 8    [         R                  U5      U l        g r(   )r{   r  r!  )r&   r9   s     r<   r$  r"    s    -EEeLr?   r   c                     U R                   c  S/$ [        U R                   [        5      (       a   U R                   (       a  U R                   $ S/$ U R                   /$ )z4Normalize proxy_config to a list for the retry loop.N)r$  r   r   r   s    r<   _get_proxy_list CrawlerRunConfig._get_proxy_list  sR    $6Md''..(,(9(94$$EvE!!""r?   c                      SSK Jn  [	        U R
                  [        5      (       a  U R
                  /nOU R
                  n/ n[        U5       H  u  pEU" U5      nUR                  (       a  UR                  UR                  5        M;  UR                  nSUS-    SUR                   SUR                   SUR                   SUR                   3
nUR                   (       a  US	UR                   S   R                   3-  n[#        U5      e   X0l
        g! [         a
    SSKJn   GN f = f! [         a    [#        S
5      e[$         a:  n	S[        U	5      R'                  5       ;  a  [#        S[        U	5       35      ee Sn	A	ff = f)z Compile C4A script to JavaScriptr   )compiler   z%C4A Script compilation error (script z
):
  Line z	, Column rA   z	
  Code: z
  Suggestion: z^C4A script compiler not available. Please ensure crawl4ai.script module is properly installed.zcompilation errorzFailed to compile C4A script: N)scriptr(  r   crawl4ai.scriptr   r  r   	enumeratesuccessextendr  first_errorlinecolumnmessagesource_linesuggestionsrB   r   lower)
r&   r(  scriptscompiled_jsr7   r)  rZ  error	error_msgr  s
             r<   r  $CrawlerRunConfig._compile_c4a_script  sz   ,	4+
 $//3//??+// K&w/	 >>&&v~~6 #..E?!u E""'**Yu||nBu}}o V##(#4#4"57 
 ((!'78I8I!8L8T8T7U%VV	$Y//! 0$ 'L;  4334>  	N   	"#a&,,.8 #A#a&!JKK		s5   D DD- D*&D- )D**D- -F5F  Fc                    U R                   c  g[        U R                   5      (       a  U R                  U5      $ [        U R                   [        5      (       a  SSKJn  U" XR                   5      $ [        U R                   [
        5      (       a  U R                   (       d  g/ nU R                    H`  n[        U5      (       a  UR                  U" U5      5        M,  [        U[        5      (       a  SSKJn  UR                  U" X5      5        M`  Mb     U R                  [        R                  :X  a  U(       a  [        U5      $ S$ U(       a  [        U5      $ S$ g)zCheck if this config matches the given URL.

Args:
    url: The URL to check against this config's matcher
    
Returns:
    bool: True if this config should be used for the URL or if no matcher is set.
Tr   )fnmatchF)r  callabler   r   r;  r   r   r  rb   rj   anyall)r&   r}  r;  resultsmatchers        r<   is_matchCrawlerRunConfig.is_match  s    #D$$%%##C((((#..'3 0 011(($//##G++G$$NN73<0--/NN73#89  , ),,.'.s7|9E9'.s7|9E9r?   c                     XR                   ;   a  [        SU SU R                   U    35      e[        SU R                  R                   SU S35      e)zHandle attribute access.z	Getting '' is deprecated. 'z' has no attribute ')_UNWANTED_PROPSr   r   rC   )r&   r   s     r<   __getattr__CrawlerRunConfig.__getattr__(  s[    ''' 9TF2CDDXDXY]D^C_!`aaq!8!8 99MdVSTUVVr?   c                    > [         R                  " U R                  5      nUR                  nXR                  ;   a/  X$U   R
                  La  [        SU SU R                  U    35      e[        TU ]!  X5        g)zHandle attribute setting.z	Setting 'rD  N)	rV   rW   rU   rX   rF  r   r   super__setattr__)r&   r   r9   r^   
all_paramsr   s        r<   rK  CrawlerRunConfig.__setattr__.  sq     .^^
'''ED9I9Q9Q,Q 9TF2CDDXDXY]D^C_!`aaD(r?   r4   c           
         U R                  5        VVs0 s H.  u  pU[        U[        5      (       a  SU;   a  [        U5      OU_M0     n nn[        R
                  " [        R                  5      R                  R                  5       S1-
  n[        S0 U R                  5        VVs0 s H  u  pX;   d  M  X_M     snnD6$ s  snnf s  snnf rS  )
r0   r   r   r   rV   rW   r{   rU   rX   r,   rT  s       r<   rV  CrawlerRunConfig.from_kwargs9  s     
& Jq$,?,?FaK%a(UVV& 	 
 !!"2";";<GGLLNRXQYYRFLLN"QNDAaj414N"QRR
 #RrX  c                     [        U 5      $ r(   r_  r   s    r<   r`  CrawlerRunConfig.dumpH  rb  r?   r   c                 p    [        U 5      n[        U[        5      (       a  U$ [        R                  U5      $ r(   )r   r   r{   rV  rd  s     r<   rf  CrawlerRunConfig.loadL  s2     (-f.//M++F33r?   c           	      
   0 SU R                   _SU R                  _SU R                  _SU R                  _SU R                  _SU R
                  _SU R                  _SU R                  _S	U R                  _S
U R                  _SU R                  _SU R                  _SU R                  _SU R                  _SU R                  _S[        U R                   ["        5      (       a>  U R                    Vs/ s H&  n[%        US5      (       a  UR'                  5       OUPM(     snO@[%        U R                   S5      (       a  U R                   R'                  5       OU R                   _SU R(                  _0 SU R*                  _SU R,                  _SU R.                  _SU R0                  _SU R2                  _SU R4                  _SU R6                  _SU R8                  _SU R:                  _SU R<                  _SU R>                  _SU R@                  _SU RB                  _S U RD                  _S!U RF                  _S"U RH                  _S#U RJ                  _E0 S$U RL                  _S%U RN                  _S&U RP                  _S'U RR                  _S(U RT                  _S)U RV                  _S*U RX                  _S+U RZ                  _S,U R\                  _S-U R^                  _S.U R`                  _S/U Rb                  _S0U Rd                  _S1U Rf                  _S2U Rh                  _S3U Rj                  _S4U Rl                  _E0 S5U Rn                  _S6U Rp                  _S7U Rr                  _S8U Rt                  _S9U Rv                  _S:U Rx                  _S;U Rz                  _S<U R|                  _S=U R~                  _S>U R                  _S?U R                  _S@U R                  _SAU R                  _SBU R                  _SCU R                  _SDU R                  _SEU R                  _E0 SFU R                  _SGU R                  _SHU R                  _SIU R                  _SJU R                  _SKU R                  _SLU R                  _SMU R                  _SNU R                  _SOU R                  _SPU R                  _SQU R                  _SRU R                  _SSU R                  _STU R                  _SUU R                  _SVU R                  _EU R                  U R                  (       a  U R                  R'                  5       OS U R                  U R                  U R                  U R                  U R                  SW.E$ s  snf )XNr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r/  r	  r
  r  r  r  r  r  r  r2  r3  r4  )r  r  r}  r  r  r  r  )`r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r$  r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r/  r	  r
  r  r  r  r  r  r  r2  r3  r4  r  r  r}  r  r  r  r  )r&   r_   s     r<   r   CrawlerRunConfig.to_dictT  sr   a
"D$=$=a
!4#;#;a
  !7!7a
 !$"9"9	a

 a
 D--a
 t33a
 T//a
  !7!7a
 #D$=$=a
 $//a
 D--a
 a
 4++a
  !7!7a
  d//66 GKFWFWXFW9 5 51<FWX5<T=N=NPY5Z5Zd''//1`d`q`q'a
* &t'C'C+a
,  5 5-a
.  !7!7/a
0 )$*I*I1a
2 dkk3a
4 4++5a
6 4++7a
8 $T%?%?9a
: $//;a
< $//=a
> D--?a
@ T//Aa
B T//Ca
D d11Ea
F 4++Ga
H $//Ia
J D--Ka
L Ma
N  5 5Oa
P t33Qa
R '(E(ESa
T $//Ua
V Wa
X t33Ya
Z t||[a
\ "4#;#;]a
^ t||_a
` %d&A&Aaa
b d11ca
d D--ea
f  5 5ga
h t33ia
j !$"9"9ka
l &t'C'Cma
n $T%?%?oa
p T//qa
r !$"9"9sa
t TZZua
v )$*I*Iwa
x $//ya
z "4#;#;{a
| *4+K+K}a
~ 488a
@ T//Aa
B 3D4]4]Ca
D $T%?%?Ea
F $T%?%?Ga
H  5 5Ia
J !$"9"9Ka
L &t'C'CMa
N +D,M,MOa
P %d&A&AQa
R )$*I*ISa
T t33Ua
V %d&A&AWa
X 4++Ya
Z 01W1W[a
\ t||]a
^ 4++_a
` '(E(Eaa
b '(E(Eca
d dkkea
f dkkga
h ia
j !$"9"9ka
l  5 5ma
n $//oa
p t33qa
r *4+K+Ksa
t $(#;#;IMIaIa4#;#;#C#C#Egk88++// --++Aa
 a	
" Ys   3-Uc                 n    U R                  5       nUR                  U5        [        R                  U5      $ )a  Create a copy of this configuration with updated values.

Args:
    **kwargs: Key-value pairs of configuration options to update

Returns:
    CrawlerRunConfig: A new instance with the specified updates

Example:
    ```python
    # Create a new config with streaming enabled
    stream_config = config.clone(stream=True)

    # Create a new config with multiple updates
    new_config = config.clone(
        stream=True,
        cache_mode=CacheMode.BYPASS,
        verbose=True
    )
    ```
)r   r   r{   rV  r   s      r<   r   CrawlerRunConfig.clone  s.    , lln6"++K88r?   )dr!  r  r  r  r  r  r  r  r  r
  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r}  r  r2  r4  r3  r/  r  r  r  r  r  r  );rC   rg   rh   ri   r  rF  r   r   r   r   BYPASSr   r
   r   r   rb   rj   r   r   r   r   r   r   r!   r   r   r#   r   r"   r   r   r   r   r   r   r    r   r   
UrlMatcherr   r   rU   r   r  propertyr$  setterr%  r  rA  rG  rK  rV  r`  rf  r   r   rl   __classcell__)r   s   @r<   r{   r{   l  s   vp GCHH	O %726.;o9Q9S %)"!%%*"!59SWCG*.+/+0 $%)37&+ ) 0 0"##$ &+*.,( $ %*- )-59,0'+$!*. %#((-&+##(+0 %)+E*/#4X%:%&48(-#(-1',+0 $',!27!).).#(!&#,.;?HLLP,0 )'+MQos' "s' 0	s'
 ,s' 7s' s' s' cs' s' s' #s' s' s' s'  !s'" 3#s'$ M4+>c4OP%s'& "**?!@'s'* #3-+s', $C=-s'. %)/s'2 3s'4 c]5s'6 /07s':  $;s'> ?s'@ As'B Cs'D Es'F Gs'H Is'J Ks'N  $Os'P #(Qs'T Us'V Ws'X Ys'Z [s'\ ]s'^ #(_s'` as'b cs'd es'h sDI~&is'j #3S	>2ks'l #tCy.)ms'n os'p !%qs'r ss't us'v #3-ws'x ys'z !{s'| "&}s'~  $s'@ As'B !Cs'D Es'F %)Gs'J Ks'L #Ms'N &)Os'P $(Qs'R Ss'T Us'V /2Ws'X  #Ys'Z  #[s'\ 2]s'^ "&_s'` !as'd '+es'f !%gs'h %)is'j ks'l !%ms'n os'p ,0qs't us'v ws'z #'{s'| #'}s'@ As'B Cs'D Es'F !Gs'H Is'J Ks'L Ms'N Os'P Qs'R &*Ss'V &&78Ws'Z ##4d38n#DE[s'^  %%8$sCx.%HI_s'b j)cs'd es'h 38nis'l ms'n "*(C5)C.3H*I!Jos'l	  , " " M M# #.`+C +D +\W	) SD S%7 S S*d * 44 4. 4 4b
H9 9r?   r{   c                       \ rS rSr\SSSSSSSSSSSS4S\S\\   S\\   S\\   S\\   S\\   S	\\   S
\\   S\\	\      S\\   S\\   S\\   S\\   4S jjr
\S\SS 4S j5       rS rS rSrg)rm   i  Nprovider	api_tokenr  temperature
max_tokenstop_pfrequency_penaltypresence_penaltystoprR   backoff_base_delaybackoff_max_attemptsbackoff_exponential_factorc                   ^ TU l         U(       a  UR                  S5      (       d  X l        OU(       a5  UR                  S5      (       a  [        R                  " USS 5      U l        O[
        R                  " 5       n[        U4S jU 5       5      (       a2  [        U4S jU 5       S5      n[
        R                  " U5      U l        O*[        U l         [        R                  " [        5      U l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl        Ub  UOSU l        Ub  UOSU l        Ub  Xl        gSU l        g)z4Configuaration class for LLM provider and API token.zenv:r   Nc              3   F   >#    U  H  nTR                  U5      v   M     g 7fr(   
startswith.0prefixr^  s     r<   	<genexpr>%LLMConfig.__init__.<locals>.<genexpr>  s     FX68&&v..Xs   !c              3   X   >#    U  H  nTR                  U5      (       d  M  Uv   M!     g 7fr(   rk  rm  s     r<   rp  rq    s      R(h6I6I&6QVV(s   *	*r      )r^  rl  r_  r   r   r	   r,   r=  nextr   r   r   r  r`  ra  rb  rc  rd  re  rR   rf  rg  rh  )r&   r^  r_  r  r`  ra  rb  rc  rd  re  rR   rf  rg  rh  prefixesselected_prefixs    `              r<   rU   LLMConfig.__init__  s   " !Y11&99&N9//77YYy}5DN 0446HFXFFF"&R(R# ":!=!=o!N 0!#+C!D &$
!2 0	8J8V"4\]<P<\$8bc!HbHn*D'tu'r?   r4   r   c                    [        U R                  S[        5      U R                  S5      U R                  S5      U R                  S5      U R                  S5      U R                  S5      U R                  S5      U R                  S5      U R                  S	5      U R                  S
5      U R                  S5      U R                  S5      U R                  S5      S9$ )Nr^  r_  r  r`  ra  rb  rc  rd  re  rR   rf  rg  rh  r^  r_  r  r`  ra  rb  rc  rd  re  rR   rf  rg  rh  )rm   r   r   r  s    r<   rV  LLMConfig.from_kwargs  s    ZZ
,<=jj-ZZ
+

=1zz,/**W%$jj)<=#ZZ(:;F#jjo%zz*>?!',B!C'-zz2N'O
 	
r?   c                 &   U R                   U R                  U R                  U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  S.$ )Nry  ry  r   s    r<   r   LLMConfig.to_dict  ss    ++//ZZ!%!7!7 $ 5 5II"&"9"9$($=$=*.*I*I
 	
r?   c                 n    U R                  5       nUR                  U5        [        R                  U5      $ )zCreate a copy of this configuration with updated values.

Args:
    **kwargs: Key-value pairs of configuration options to update

Returns:
    llm_config: A new instance with the specified updates
)r   r   rm   rV  r   s      r<   r   LLMConfig.clone%  s.     lln6"$$[11r?   )r_  rf  rh  rg  r  rc  ra  rR   rd  r^  re  r`  rb  )rC   rg   rh   ri   r   r   r"   r   r   r!   rU   r   r   rV  r   r   rl   rf   r?   r<   rm   rm     s     )#'"&'+$(!%-1,0$(,0.248-v-v C=-v 3-	-v
 e_-v SM-v -v $E?-v #5/-v tCy!-v C=-v %SM-v 'sm-v %-SM-v^ 
D 
[ 
 
"
"2r?   rm   c            #           \ rS rSrSr                 SS\S\\   S\S\S\S	\S
\S\S\\   S\\	   S\\   S\\   S\\
   S\S\S\S\4"S jjrS\\\4   4S jr\S\\\4   SS 4S j5       rS\SS 4S jrSrg)rv   i2  zN
Configuration class for URL discovery and pre-validation via AsyncUrlSeeder.
Nsourcepattern
live_checkextract_headmax_urlsr  hits_per_secforcebase_directory
llm_configr/  r  r  scoring_methodfilter_nonsense_urlscache_ttl_hoursvalidate_sitemap_lastmodc                     Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        Xl        Xl        Xl        Xl        UU l        UU l        g)a  
Initialize URL seeding configuration.

Args:
    source: Discovery source(s) to use. Options: "sitemap", "cc" (Common Crawl), 
           or "sitemap+cc" (both). Default: "sitemap+cc"
    pattern: URL pattern to filter discovered URLs (e.g., "*example.com/blog/*"). 
            Supports glob-style wildcards. Default: "*" (all URLs)
    live_check: Whether to perform HEAD requests to verify URL liveness. 
               Default: False
    extract_head: Whether to fetch and parse <head> section for metadata extraction.
                 Required for BM25 relevance scoring. Default: False
    max_urls: Maximum number of URLs to discover. Use -1 for no limit. 
             Default: -1
    concurrency: Maximum concurrent requests for live checks/head extraction. 
                Default: 1000
    hits_per_sec: Rate limit in requests per second to avoid overwhelming servers. 
                 Default: 5
    force: If True, bypasses the AsyncUrlSeeder's internal .jsonl cache and 
          re-fetches URLs. Default: False
    base_directory: Base directory for UrlSeeder's cache files (.jsonl). 
                   If None, uses default ~/.crawl4ai/. Default: None
    llm_config: LLM configuration for future features (e.g., semantic scoring). 
               Currently unused. Default: None
    verbose: Override crawler's general verbose setting for seeding operations. 
            Default: None (inherits from crawler)
    query: Search query for BM25 relevance scoring (e.g., "python tutorials"). 
          Requires extract_head=True. Default: None
    score_threshold: Minimum relevance score (0.0-1.0) to include URL. 
                   Only applies when query is provided. Default: None
    scoring_method: Scoring algorithm to use. Currently only "bm25" is supported.
                  Future: "semantic". Default: "bm25"
    filter_nonsense_urls: Filter out utility URLs like robots.txt, sitemap.xml,
                         ads.txt, favicon.ico, etc. Default: True
    cache_ttl_hours: Hours before sitemap cache expires. Set to 0 to disable TTL
                    (only lastmod validation). Default: 24
    validate_sitemap_lastmod: If True, compares sitemap's <lastmod> with cache
                             timestamp and refetches if sitemap is newer. Default: True
N)r  r  r  r  r  r  r  r  r  r  r/  r  r  r  r  r  r  )r&   r  r  r  r  r  r  r  r  r  r  r/  r  r  r  r  r  r  s                     r<   rU   SeedingConfig.__init__6  sg    v $( &(
,$
.,$8!.(@%r?   r   c                     U R                   R                  5        VVs0 s H  u  pUS:w  d  Uc  M  X_M     snn$ s  snnf )Nr  )__dict__r0   )r&   rF   rG   s      r<   r   SeedingConfig.to_dict  s8    !%!4!4!6]!6!|:Kq!6]]]s   ;;r4   c                     [        S0 U D6$ )Nrf   )rv   r  s    r<   rV  SeedingConfig.from_kwargs  s    &v&&r?   c                 n    U R                  5       nUR                  U5        [        R                  U5      $ r(   )r   r   rv   rV  r   s      r<   r   SeedingConfig.clone  s,    lln6"((55r?   )r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r/  )z
sitemap+cc*FFi  r  FNNNNNbm25T   T)rC   rg   rh   ri   r  r   r"   r   r   rm   r   rU   r    r   r   r   rV  r   rl   rf   r?   r<   rv   rv   2  sz   
 #!$ "(,*."&#+/$%)!)-%KAKA #KA 	KA
 KA KA KA KA KA !KA Y'KA $KA }KA "%KA KA  #!KA" #KA$ #'%KA\^c3h ^ 'DcN ' ' '6c 6o 6r?   rv   )F)Fr1   rZ   r   r   rI  ry  re  r   r   r   r   r   r	   r
   r   r   r   user_agent_generatorr   r   r  r   r   r  r   r   markdown_generation_strategyr   r   content_scraping_strategyr   r   deep_crawlingr   r  r   r   cache_contextr   proxy_strategyr   rV   typingr   r   r   r    r!   r"   r#   enumr$   r   r   rY  r`   rb   r   r   r   r   r   rs   ru   r   r   r   r{   rm   rv   rf   r?   r<   <module>r     sw      	     : J > ^ W , M $ 1  H H H  3#-tE#xt?T:T4U/VVW
JZ  DHc H$ HVB B BJ# $ .8 .8`}2 }2~ q q qf+ +Z\8 \8~D5 D5L c9 c9 c9J^2 ^2@\6 \6r?   