+
    	ie:                     v   R t ^ RIHt ^ RIHtHt ^ RIHt ^ RIHt ^ RI	t	^ RI
t
^ RItR;tt/ RRbRRbR	RbR
RbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRRR/Ct. R'Ot^RIHtHtHt ^RIHtHt R  t ! R! R4      t ! R" R4      t ! R# R4      t^R$IHt ^R%IHtHtH t H!t! ^R&I"H#t#H$t$ R# )(z~The Awesome Document Factory.

The public API is what is accessible from this "root" packages without
importing sub-modules.

)datetime)getctimegetmtime)Path)urljoinNz68.1stylesheetsattachmentsattachment_relationshipspdf_identifierpdf_variantpdf_version	pdf_formspdf_tagsFuncompressed_pdfxmp_metadatacustom_metadatapresentational_hintssrgboptimize_imagesjpeg_qualitydpi
full_fontshintingcacheCSSHTML
Attachment)
URLFetcherdefault_url_fetcherselect_source)LOGGERPROGRESS_LOGGERc                    \        \        V P                  R4      4      R4      pVe4   VP                  RR4      P                  4       pV'       d   \	        W4      # V# )zdReturn the base URL for the document.

See https://www.w3.org/TR/html5/urls.html#document-base-url

baseNhref )nextitergetstripr   )html_documentfallback_base_urlfirst_base_elementr$   s   &&  Y/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/weasyprint/__init__.py_find_base_urlr.   e   sW     d=#5#5f#=>E%!%%fb1779,33    c                   X   a  ] tR t^st o RtR
R ltRR ltR tR tRR lt	RR lt
R	tV tR# )r   a  HTML document parsed by tinyhtml5.

You can just create an instance with a positional argument:
``doc = HTML(something)``
The class will try to guess if the input is a filename, an absolute URL,
or a :term:`file object`.

Alternatively, use **one** named argument so that no guessing is involved:

:type filename: str or pathlib.Path
:param filename:
    A filename, relative to the current directory, or absolute.
:param str url:
    An absolute, fully qualified URL.
:type file_obj: :term:`file object`
:param file_obj:
    Any object with a ``read`` method.
:param str string:
    A string of HTML source.

Specifying multiple inputs is an error:
``HTML(filename="foo.html", url="localhost://bar.html")``
will raise a :obj:`TypeError`.

You can also pass optional named arguments:

:param str encoding:
    Force the source character encoding.
:type base_url: str or pathlib.Path
:param base_url:
    The base used to resolve relative URLs (e.g. in
    ``<img src="../foo.png">``). If not provided, try to use the input
    filename, URL, or ``name`` attribute of
    :term:`file objects <file object>`.
:type url_fetcher: :term:`callable`
:param url_fetcher:
    An instance of :class:`urls.URLFetcher`. (See :ref:`URL Fetchers`.)
:param str media_type:
    The media type to use for ``@media``. Defaults to ``'print'``.
    **Note:** In some cases like ``HTML(string=foo)`` relative URLs will be
    invalid if ``base_url`` is not provided.

Nc
           	     b   \         P                  ! R T;'       g"    T;'       g    T;'       g    \        VRR4      4       \        V\        4      '       d   \        V4      pVf   \        4       p\        WW4WWV4      p
T
;_uu_ 4       w  rGrRR/pVe   WR&   Ve   WmR&   \        P                  ! V3/ VB p
RRR4       \        W4      V n        Wn        Wn        \        P                  P!                  V
RR7      V n        V P"                  P$                  V n        R#   + '       g   i     Lo; i)	z'Step 1 - Fetching and parsing HTML - %snamezHTML stringNnamespace_html_elementsFtransport_encodingoverride_encoding)content_language)r!   infogetattr
isinstancer   strr   r   	tinyhtml5parser.   base_urlurl_fetcher
media_type
cssselect2ElementWrapperfrom_html_rootwrapper_elementetree_element)selfguessfilenameurlfile_objstringencodingr=   r>   r?   resultprotocol_encoding_kwargss   &&&&&&&&&&    r-   __init__HTML.__init__   s%    	5 5 5X 5 5 5 5Hfm4	6 h%%8}H$,KSFkKVA,=/7F ,/@+,#.6*+__X88F  'v8&$)88GGT  H  +!11?? Vs   /DD.	c                8    V'       d   \         \        .# \         .# N)HTML5_UA_STYLESHEETHTML5_UA_FORM_STYLESHEET)rE   formss   &&r-   _ua_stylesheetsHTML._ua_stylesheets   s    ')ABB#$$r/   c                .    \         P                  ! 4       .# rS   )HTML5_UA_COUNTER_STYLEcopyrE   s   &r-   _ua_counter_styleHTML._ua_counter_style   s    &++-..r/   c                    \         .# rS   )HTML5_PH_STYLESHEETr\   s   &r-   _ph_stylesheetsHTML._ph_stylesheets   s    #$$r/   c                    \        V4      \        \        4      ,
           F  p\        P                  ! RV4       K  	  \        P	                  4       pVP                  V4       Tp\        P                  ! WW#V4      # )a  Lay out and paginate the document, but do not (yet) export it.

This returns a :class:`document.Document` object which provides
access to individual pages and various meta-data.
See :meth:`write_pdf` to get a PDF directly.

:type font_config: :class:`text.fonts.FontConfiguration`
:param font_config:
    A font configuration handling ``@font-face`` rules.
:type counter_style: :class:`css.counters.CounterStyle`
:param counter_style:
    A dictionary storing ``@counter-style`` rules.
:param options:
    The ``options`` parameter includes by default the
    :data:`DEFAULT_OPTIONS` values.
:returns: A :class:`document.Document` object.

zUnknown rendering option: %s.)setDEFAULT_OPTIONSr    warningr[   updateDocument_render)rE   font_configcounter_stylecolor_profilesoptionsunknownnew_optionss   &&&&,  r-   renderHTML.render   sk    ( 7|c/&:::GNN:GD ;%**,7#}gG 	Gr/   c                    \         P                  4       pVP                  V4       TpV P                  ! WEV3/ VB P                  ! WV3/ VB # )aM  Render the document to a PDF file.

This is a shortcut for calling :meth:`render`, then
:meth:`Document.write_pdf() <document.Document.write_pdf>`.

:type target:
    :class:`str`, :class:`pathlib.Path` or :term:`file object`
:param target:
    A filename where the PDF file is generated, a file object, or
    :obj:`None`.
:param float zoom:
    The zoom factor in PDF units per CSS units.  **Warning**:
    All CSS units are affected, including physical units like
    ``cm`` and named sizes like ``A4``.  For values other than
    1, the physical CSS units will thus be "wrong".
:type finisher: :term:`callable`
:param finisher:
    A finisher function or callable that accepts the document and a
    :class:`pydyf.PDF` object as parameters. Can be passed to perform
    post-processing on the PDF right before the trailer is written.
:type font_config: :class:`text.fonts.FontConfiguration`
:param font_config:
    A font configuration handling ``@font-face`` rules.
:type counter_style: :class:`css.counters.CounterStyle`
:param counter_style:
    A dictionary storing ``@counter-style`` rules.
:param options:
    The ``options`` parameter includes by default the
    :data:`DEFAULT_OPTIONS` values.
:returns:
    The PDF as :obj:`bytes` if ``target`` is not provided or
    :obj:`None`, otherwise :obj:`None` (the PDF is written to
    ``target``).

)re   r[   rg   rp   	write_pdf)	rE   targetzoomfinisherrj   rk   rl   rm   ro   s	   &&&&&&&, r-   rs   HTML.write_pdf   sZ    J &**,7#KKNNgNYX:18:	;r/   )r=   rD   r?   r>   rC   )	NNNNNNNNprint)F)NNN)N   NNNN)__name__
__module____qualname____firstlineno____doc__rP   rW   r]   ra   rp   rs   __static_attributes____classdictcell____classdict__s   @r-   r   r   s   s0     *V@6%
/%G8*; *;r/   c                   .   a  ] tR tRt o RtRR ltRtV tR# )r   i  a  CSS stylesheet parsed by tinycss2.

An instance is created in the same way as :class:`HTML`, with the same
arguments.

An additional argument called ``font_config`` must be provided to handle
``@font-face`` rules. The same ``text.fonts.FontConfiguration`` object
must be used for different ``CSS`` objects applied to the same document.

``CSS`` objects have no public attributes or methods. They are only meant
to be used in the :meth:`HTML.write_pdf` and :meth:`HTML.render` methods
of :class:`HTML` objects.

Nc                   \         P                  ! R T;'       g    T;'       g    \        VRR4      4       Vf   \        4       p\	        WW4WWWR7      pT;_uu_ 4       w  rGppVP                  4       p\        V\        4      '       d   \        P                  ! V4      pM\        P                  ! VVVR7      w  ppRRR4       Wpn        T;'       g    \        P                  ! 4       V n        Vf   . MTV n        Vf   . MTV n        Vf   / MTpVf   / MTp\#        WXWP                  V P                  V P                   WVVR7       R#   + '       g   i     L; i)z&Step 2 - Fetching and parsing CSS - %sr2   z
CSS stringN)r=   r>   check_css_mime_type)environment_encodingrM   )layer)r!   r7   r8   r   r   readr9   r:   tinycss2parse_stylesheetparse_stylesheet_bytesr=   r@   Matchermatcher
page_ruleslayerspreprocess_stylesheet)rE   rF   rG   rH   rI   rJ   rK   r=   r>   _check_mime_typer?   rj   rk   rl   r   r   r   r   rL   rM   	mime_typecss
stylesheetrN   s   &&&&&&&&&&&&&&&&&&      r-   rP   CSS.__init__  s1   
 	4FFFFwxF	H $,KSF#K VI,=y--/C#s##%66s;
 ( ? ?h&7!9
A  !66*"4"4"6 * 2"
"Nb+3-5>*k<<OOT[[+n	 Vs   AEE	)r=   r   r   r   )NNNNNNNNFrx   NNNNNNNrz   r{   r|   r}   r~   rP   r   r   r   s   @r-   r   r     s      r/   c                   .   a  ] tR tRt o RtRR ltRtV tR# )r   i>  ao  File attachment for a PDF document.

An instance is created in the same way as :class:`HTML`, except that the
HTML specific arguments (``encoding`` and ``media_type``) are not
supported.

:param str name:
    The name of the attachment to be included in the PDF document.
    May be :obj:`None`.
:param str description:
    A description of the attachment to be included in the PDF document.
    May be :obj:`None`.
:type created: :obj:`datetime.datetime`
:param created:
    Creation date and time. Default is current date and time.
:type modified: :obj:`datetime.datetime`
:param modified:
    Modification date and time. Default is current date and time.
:param str relationship:
    A string that represents the relationship between the attachment and
    the PDF it is embedded in. Default is 'Unspecified', other common
    values are defined in ISO-32000-2:2020, 7.11.3.

Nc           
        Vf   \        4       p\        WW4WVVR7      V n        Wn        Wn        Wn        R V n        V
f>   V'       d!   \        P                  ! \        V4      4      p
M\        P                  ! 4       p
Vf>   V'       d!   \        P                  ! \        V4      4      pM\        P                  ! 4       pWn        Wn        R # )N)r=   r>   )r   r   sourcer2   descriptionrelationshipmd5r   fromtimestampr   nowr   createdmodified)rE   rF   rG   rH   rI   rJ   r=   r>   r2   r   r   r   r   s   &&&&&&&&&&&&&r-   rP   Attachment.__init__W  s     $,K#SF#% 	&(?"00(1CD",,.#11(82DE#<<> r/   )r   r   r   r   r2   r   r   )NNNNNNNNNNNUnspecifiedr   r   s   @r-   r   r   >  s     0! !r/   )r   )rZ   rT   rU   r`   )rh   Page)	r   re   r   VERSIONr   rh   r   __version__r   )%r~   r   os.pathr   r   pathlibr   urllib.parser   r@   r   r;   r   r   re   __all__urlsr   r   r   loggerr    r!   r.   r   r   r   r   r   htmlrZ   rT   rU   r`   documentrh   r    r/   r-   <module>r      s^    &       +d44  d	
 4 4    D u E E u D  
4!" %#$ uT',* A @ +
X; X;v- -`2! 2!l '  % $r/   