
    iH                         d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
mZmZmZ erddlmZ 	 ddee   ddd	ed
edededdfdZdZ	 	 	 	 	 	 	 	 	 dddded	edededededz  dee   dz  dededefdZy)z0HTML documentation generation for cyclopts apps.    )TYPE_CHECKING)escape_htmlextract_text)build_command_chainextract_descriptionextract_usagefilter_help_entriesformat_usage_linegenerate_anchoriterate_commands)Applinesappr   include_hiddenapp_nameprefixdepthreturnNc           
         |j                   syt        ||      D ]  \  }}|r| | n|}| d|j                  dd       j                         }	d|dz   z  }
| j	                  |
 d|	 d| d       |j                   r>| j	                  |
 d	       t        | |||| d|dz          | j	                  |
 d
       | j	                  |
 d        y)z,Recursively generate HTML table of contents.N- z     z<li><a href="#z"><code>z</code></a>z  <ul>z  </ul>z</li>)	_commandsr   replacelowerappend_generate_html_toc)r   r   r   r   r   r   namesubappdisplay_name	full_pathindents              x/home/jay/workspace/.worktrees/task-2116-dev1/scripts/.codegraph-venv/lib/python3.12/site-packages/cyclopts/docs/html.pyr   r      s     ==(n= 'f,2&$(j,"6"6sC"@!ABHHJ	#x~i[kRSLLF86*+ufnh<.XYHZ\ade\efLLF87+,xu%&'    a=  
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --code-bg: #f5f5f5;
    --link-color: #0066cc;
    --header-bg: #f8f9fa;
    --required-color: #d73027;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

h1 { font-size: 2em; border-bottom: 2px solid var(--border-color); padding-bottom: 0.3em; }
h2 { font-size: 1.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
h3 { font-size: 1.25em; }
h4 { font-size: 1em; }

code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9em;
}

pre {
    background: var(--code-bg);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9em;
}

pre code {
    background: none;
    padding: 0;
}

.usage-block {
    margin: 16px 0;
}

.usage {
    background: #f8f9fa;
    border-left: 4px solid #0066cc;
}

.description, .app-description, .command-description {
    margin: 16px 0;
    color: var(--text-color);
}

.panel-description {
    margin: 12px 0;
    color: #666;
}

.help-panel {
    margin: 24px 0;
}

/* List styles for commands and parameters */
.commands-list, .parameters-list {
    list-style: none;
    padding-left: 0;
    margin: 16px 0;
}

.commands-list li, .parameters-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.commands-list li:last-child, .parameters-list li:last-child {
    border-bottom: none;
}

.commands-list code, .parameters-list code {
    font-weight: 600;
}

/* Metadata styling */
.parameter-metadata {
    display: inline-flex;
    gap: 8px;
    margin-left: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.metadata-item {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.85em;
    border-radius: 4px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
}

.metadata-required {
    background: #fee;
    border-color: #fcc;
    color: #c00;
    font-weight: 600;
}

.metadata-default {
    background: #f0f8ff;
    border-color: #d0e8ff;
    color: #0066cc;
}

.metadata-env {
    background: #f0fff0;
    border-color: #d0ffd0;
    color: #080;
}

.metadata-choices {
    background: #fffaf0;
    border-color: #ffd0a0;
    color: #840;
}

.metadata-label {
    font-weight: 600;
    opacity: 0.8;
    text-transform: uppercase;
    font-size: 0.9em;
}

/* Table of Contents */
.table-of-contents {
    background: var(--header-bg);
    border-radius: 6px;
    padding: 16px;
    margin: 24px 0;
}

.table-of-contents h2 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.table-of-contents ul {
    margin: 8px 0;
    padding-left: 24px;
}

.table-of-contents li {
    margin: 4px 0;
}

.table-of-contents a {
    color: var(--link-color);
    text-decoration: none;
}

.table-of-contents a:hover {
    text-decoration: underline;
}

/* General link styles */
a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.commands-list a code {
    color: var(--link-color);
}

/* Back to top link */
.back-to-top {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.9em;
    opacity: 0.7;
}

.back-to-top:hover {
    opacity: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .commands-list, .parameters-list {
        font-size: 0.9em;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1e1e1e;
        --text-color: #e0e0e0;
        --border-color: #444;
        --code-bg: #2d2d2d;
        --link-color: #66b3ff;
        --header-bg: #2d2d2d;
    }

    .usage {
        background: #2d2d2d;
        border-left-color: #66b3ff;
    }

    .table-of-contents {
        background: #2d2d2d;
    }

    .metadata-required {
        background: #4a2020;
        border-color: #6a3030;
        color: #ff9999;
    }

    .metadata-default {
        background: #20304a;
        border-color: #304060;
        color: #99ccff;
    }

    .metadata-env {
        background: #204a20;
        border-color: #306030;
        color: #99ff99;
    }

    .metadata-choices {
        background: #4a3020;
        border-color: #604030;
        color: #ffcc99;
    }
}

/* Command sections */
.command-section {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
}

.command-section:first-child {
    border-top: none;
}
	recursiveheading_levelmax_heading_level
standalone
custom_csscommand_chaingenerate_tocflatten_commandsc
                    ddl m}
 |g }g }|s|s|j                  d       |s;| j                  d   }|}|}t	        ||      }|j                  d| d| d| d       nv|r|d   n| j                  d   }d	j                  |      }t        |      }t	        ||      }|j                  d
       |j                  d| d| dt        |       d| d	       | j                  j                  dd      }t        | |      }|r,t        |d      }|r|j                  dt        |       d       |rs|sq| j                  re|j                  d       |j                  d       |j                  d       t        || ||dd       |j                  d       |j                  d       t        |       }|rt	        |dz   |      }|j                  d| d| d       |j                  d       t        |t               r|}nt        |d      }t#        ||d      }|j                  dt        |       d       |j                  d       | j                  | g      5  | j%                  g |      }ddd        |
|dz   |||      }|j'                          D ]A  \  }}|s|r|j(                  s|st+        | ||      |_        |j,                  s8 |dd|       C |j/                         j1                         }|r|j                  |       | j                  r7t3        | |      D ]'  \  }}t5        |||      }|	r|}n|dz   }|j                  d
       t7        |      dkD  r'| d d j                  |dd        j9                         n| d | j9                         }t	        ||      } |j                  d|  d| dt        d	j                  |             d|  d	       |j                  | |g      5  |j                  j                  d|      }!t        ||!      }"|"r,t        |"d      }#|#r|j                  d!t        |#       d       t        |      }$|$r|	r|dz   }%n|d"z   }%t	        |%|      }%|j                  d|% d|% d       |j                  d       t        |$t               r|$}&nt        |$d      }&t#        |&|d      }&|j                  dt        |&       d       |j                  d       |r|j%                  g |!      }'|	r|dz   }(n|d"z   }(t	        |(|      }( |
|(|||      })|'D ]A  \  }*}+|s|*r|*j(                  s|st+        ||+|      |+_        |+j,                  s8 |)dd|+       C |)j/                         j1                         },|,r|j                  |,       |ry|j                  rmt3        ||      D ]^  \  }-}.t5        ||-|      }/|	r|}0n|d"z   }0|.j                  ||.g      5  t;        |.|||0|d#d|/d#|	$
      }1ddd       |j                  1       ` ddd       |r|j                  d%       |j                  d&       * |r|j                  d&       |s|s|j                  d       d'j                  |      }2|r!|r|nt<        }3d(t        |       d)|3 d*|2 d+}4|4S |2S # 1 sw Y   BxY w# 1 sw Y   xY w# 1 sw Y   xY w),aQ  Generate HTML documentation for a CLI application.

    Parameters
    ----------
    app : App
        The cyclopts App instance to document.
    recursive : bool
        If True, generate documentation for all subcommands recursively.
        Default is True.
    include_hidden : bool
        If True, include hidden commands/parameters in documentation.
        Default is False.
    heading_level : int
        Starting heading level for the main application title.
        Default is 1.
    max_heading_level : int
        Maximum heading level to use. Headings deeper than this will be capped
        at this level. HTML supports levels 1-6.
        Default is 6.
    standalone : bool
        If True, generate a complete HTML document with <html>, <head>, etc.
        If False, generate only the body content. Default is True.
    custom_css : str
        Custom CSS to use instead of the default styles.
    command_chain : list[str]
        Internal parameter to track command hierarchy.
        Default is None.
    generate_toc : bool
        If True, generate a table of contents for multi-command apps.
        Default is True.
    flatten_commands : bool
        If True, generate all commands at the same heading level instead of nested.
        Default is False.

    Returns
    -------
    str
        The generated HTML documentation.
    r   )HtmlFormatterNz<div class="cli-documentation">z<hz class="app-title">z</h>r   z!<section class="command-section">z id="z" class="command-title"><code>z
</code></hhelp_formatrestructuredtext)fallbackz<div class="app-description">z</div>z<div class="table-of-contents">z<h2>Table of Contents</h2>z<ul> z</ul>r   z	>Usage</hz<div class="usage-block">$)r   z<pre class="usage">z</pre>)r&   r   r   r*   r   z!<div class="command-description">   F)	r%   r   r&   r'   r(   r)   r*   r+   r,   u6   <a href="#top" class="back-to-top">↑ Back to top</a>z
</section>
z<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>z) - CLI Documentation</title>
    <style>
z&
    </style>
</head>
<body id="top">
z
</body>
</html>)cyclopts.help.formatters.htmlr.   r   r   minjoinr   r   	app_stackresolver   r   r   r   r   
isinstancestrr
   _assemble_help_panelsresetshowr	   entries
get_outputstripr   r   lenr   generate_html_docsDEFAULT_CSS)5r   r%   r   r&   r'   r(   r)   r*   r+   r,   r.   r   r   full_commandtitleeffective_level	anchor_idr0   description	desc_textusageusage_level
usage_texthelp_panels_with_groups	formattergrouppanel
panel_docsr   r   sub_command_chainsub_heading_leveleffective_sub_levelsub_help_formatsub_descriptionsub_desc_text	sub_usageusage_heading_levelsub_usage_text
sub_panelspanel_heading_levelsub_formatter	sub_group	sub_panelsub_panel_docsnested_name
nested_appnested_chainnested_heading_levelnested_docsbody_contentcssdocs5                                                        r#   rE   rE   G  s   f <  E 67 88A;m->?r/**=eWCGXXYZ[ (5=##((1+xx.#L1	m->?89!yk1OP[\hPiOjjt  vE  uF  FG  H	

 --''@R'SK%c;7K d3	LL8Y9O8PPVWX Mcmm6712V5#~xQGWX #E-!+->?r+i}A>?01eS!J%eT2J&z=M
*;z+B*C6JKX 
u	 M"%";";B"LM #a'%#	I OO/ )u%

/UNKEM==dD%() %%'--/JZ  }},S.A n	'LD& 3M4 R  $1!$1A$5! LL<= ()A- *Achh'8'<=>?EEG z4&)//1 
 #&&79J"KLL()yk9WXcdgdldlm~d  YA  XB  BL  M`  La  ab  c !!3-0 P2"("2"2":":=S^":"_"5fo"N"$0$$GM$'HUbIcHddj%kl *&1	'.;a.?+.;a.?+*-.ACT*U'LL2&9%:)DWCXXY!Z[LL!<=!)S1)2)5i)F%6~GXad%eNLL#6{>7R6SSY!Z[LL* !'!=!=b/!RJ (.;a.?+.;a.?+*-.ACT*U'$1&9'5!)&7	%M 1; A,	9-)INN$-0CFIWe0fI-$,,)$i@A &3%=%=%?%E%E%GN%^4 !1!13CFN3[ 2/Z':;Lk[c'd+3@03@13D0 (116:2FG *< **3/=.B2C+0+/.:-21A+K [1/2sP2f UVLL&]n	'b \" X 99U#L &jK
 !" #    
SM Mn GP2 P2s8   Z',E5[ "B[ )Z4	?[ 'Z14Z=9[  [		)r   )	TFr      TNNTF)__doc__typingr   cyclopts._markupr   r   cyclopts.docs.baser   r   r   r	   r
   r   r   cyclopts.corer   listr=   boolintr   rF   rE    r$   r#   <module>rv      s#   6   6   ! '9'	' ' 	'
 ' ' 
'8Tr  !&*"_	__ _ 	_
 _ _ d
_ 9t#_ _ _ 	_r$   