Ë
    íì�i‰  ã                   óš   — d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d„ Zd„ Zed	„ «       Zd
„ Z G d„ dee«      Zy)é    N)ÚUserDict)Ú	lru_cache)Úquote)Ú	docscrape)ÚReprHTMLMixinc                 ó¼   — | j                   }t        j                  |› d�|xs d«      }|€y|j                  d«      }t	        |«      › dt	        |«      › �}|› d|› �S )zŸURL to the relevant section of the docstring using a Text Fragment

    https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments
    z	 : (.+)\nÚ Né   z,-z	#:~:text=)Ú__doc__ÚreÚsearchÚgroupr   )Úestimator_classÚ
param_nameÚdoc_linkÚ	docstringÚmÚ
param_typeÚtext_fragments          ú„/var/www/ITT-ServiceAPI-Services/ITT-Document-Scan/mrzscanner/mrzenv/lib/python3.12/site-packages/sklearn/utils/_repr_html/params.pyÚ_generate_link_to_param_docr      sp   € ð
  ×'Ñ'€Iä
�	‰	�Z�L 
Ð+¨Yª_¸"Ó=€Aà€yð ð —‘˜“€JÜ˜ZÓ(Ð)¨¬E°*Ó,=Ð+>Ð?€MàˆZ�y  Ð0Ð0ó    c                 óâ   — t        j                  | «      } t        j                  «       }d|_        d|_        d|_        t        j                  |j                  |«      «      }| |v rdnd}|| |dœS )zžCategorizes parameters as 'default' or 'user-set' and formats their values.
    Escapes or truncates parameter values for display safety and readability.
    é   r
   é2   zuser-setÚdefault)r   r   Úparam_value)ÚhtmlÚescapeÚreprlibÚReprÚmaxlistÚmaxtupleÚ	maxstringÚrepr)ÚnameÚvalueÚnon_default_paramsÚrÚcleaned_valuer   s         r   Ú_read_paramsr+   &   sd   € ô �;‰;�tÓ€DÜ�‰‹€AØ€A„IØ€A„JØ€A„KÜ—K‘K §¡ u£Ó.€Mà#Ð'9Ñ9‘¸y€Jà$°DÈÑWÐWr   c                 ó,   — t        j                  | «      S ©N)r   ÚNumpyDocString)r   s    r   Ú_scrape_estimator_docstringr/   6   s   € ä×#Ñ# IÓ.Ð.r   c           	      ó¾  — d}d}d}t        j                  | j                  «      }|r+t        |«      x}r|d   D �ci c]  }|j                  |“Œ }}ni }g }| D ]Ý  }	t        |	| |	   | j                  «      }
t        | j                  |	| j                  «      }|j                  |	d«      x}r8|j                  › d|j                  › ddj                  |j                  «      › �}nd}| j                  r|r|r|j                  ||
d	   |¬
«      }n|
d	   }|j                   |j                  di |
¤d|i¤Ž«       Œß |j                  dj                  |«      ¬«      S c c}w )a   Generate HTML representation of estimator parameters.

    Creates an HTML table with parameter names and values, wrapped in a
    collapsible details element. Parameters are styled differently based
    on whether they are default or user-set values.
    a/  
        <div class="estimator-table">
            <details>
                <summary>Parameters</summary>
                <table class="parameters-table">
                  <tbody>
                    {rows}
                  </tbody>
                </table>
            </details>
        </div>
    aW  
        <tr class="{param_type}">
            <td><i class="copy-paste-icon"
                 onclick="copyToClipboard('{param_name}',
                          this.parentElement.nextElementSibling)"
            ></i></td>
            <td class="param">{param_display}</td>
            <td class="value">{param_value}</td>
        </tr>
    zÔ
        <a class="param-doc-link"
            rel="noreferrer" target="_blank" href="{link}">
            {param_name}
            <span class="param-doc-description">{param_description}</span>
        </a>
    Ú
ParametersNz: z<br><br>z<br>r   )Úlinkr   Úparam_descriptionÚparam_displayú
)Úrows© )ÚinspectÚgetdocr   r/   r&   r+   Únon_defaultr   r   ÚgetÚtypeÚjoinÚdescÚformatÚappend)ÚparamsÚPARAMS_TABLE_TEMPLATEÚPARAM_ROW_TEMPLATEÚ!PARAM_AVAILABLE_DOC_LINK_TEMPLATEÚestimator_class_docsÚstructured_docstringÚparam_docstringÚ	param_mapr6   ÚrowÚparamr2   Úparam_numpydocr3   r4   s                  r   Ú_params_html_reprrL   ;   sœ  € ðÐð	Ðð)Ð%ô #Ÿ>™>¨&×*@Ñ*@ÓAÐÙÜ ;Ð<PÓ QÐQÐÐQð $8¸Ñ#Eö
àð × Ñ  /Ñ1ð
ˆ	ñ 
ð
 ˆ	Ø€DØò UˆÜ˜S &¨¡+¨v×/AÑ/AÓBˆÜ*¨6×+AÑ+AÀ3ÈÏÉÓXˆØ&Ÿ]™]¨3°Ó5Ð5ˆ>Ð5à!×&Ñ&Ð' r¨.×*=Ñ*=Ð)>¸hØ—;‘;˜~×2Ñ2Ó3Ð4ð6ñ ð
 !%Ðà�?Š?™tÑ(9à=×DÑDØØ  Ñ.Ø"3ð Eó ‰Mð " ,Ñ/ˆMà�‰Ð-Ð&×-Ñ-ÑS°ÑSÀ]ÒSÕTð-Uð0 !×'Ñ'¨T¯Y©Y°t«_Ð'Ó=Ð=ùò?
s   ¼Ec                   ó<   ‡ — e Zd ZdZeZd e«       dddœˆ fd„
Zˆ xZS )Ú
ParamsDictaQ  Dictionary-like class to store and provide an HTML representation.

    It builds an HTML structure to be used with Jupyter notebooks or similar
    environments. It allows storing metadata to track non-default parameters.

    Parameters
    ----------
    params : dict, default=None
        The original dictionary of parameters and their values.

    non_default : tuple, default=(,)
        The list of non-default parameters.

    estimator_class : type, default=None
        The class of the estimator. It allows to find the online documentation
        link for each parameter.

    doc_link : str, default=""
        The base URL to the online documentation for the estimator class.
        Used to generate parameter-specific documentation links in the HTML
        representation. If empty, documentation links will not be generated.
    Nr	   )rA   r:   r   r   c                óV   •— t         ‰| �  |xs i «       || _        || _        || _        y r-   )ÚsuperÚ__init__r:   r   r   )ÚselfrA   r:   r   r   Ú	__class__s        €r   rQ   zParamsDict.__init__¡   s-   ø€ ô 	‰Ñ˜š 2Ô&Ø&ˆÔØ.ˆÔØ ˆ�r   )	Ú__name__Ú
__module__Ú__qualname__r   rL   Ú
_html_reprÚtuplerQ   Ú__classcell__)rS   s   @r   rN   rN   ‡   s'   ø„ ñð. #€Jð ©%«'À4ÐRT÷!ò !r   rN   )r   r8   r   r    Úcollectionsr   Ú	functoolsr   Úurllib.parser   Úsklearn.externals._numpydocr   Úsklearn.utils._repr_html.baser   r   r+   r/   rL   rN   r7   r   r   ú<module>r_      sV   ðó Û Û 	Û Ý  Ý Ý å 1Ý 7ò1ò,Xð  ñ/ó ð/òI>ôX !� õ  !r   