+
    i\$                         R t ^ RIt^ RIHt ^ RIHtHt ^ RIt^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ RIHt ^ RIt ! R R	]	P$                  ]	P&                  4      t ! R
 R]4      tR tR tR tR tR tR tR tR tR# )a   
Add a ``figure-mpl`` directive that is a responsive version of ``figure``.

This implementation is very similar to ``.. figure::``, except it also allows a
``srcset=`` argument to be passed to the image tag, hence allowing responsive
resolution images.

There is no particular reason this could not be used standalone, but is meant
to be used with :doc:`/api/sphinxext_plot_directive_api`.

Note that the directory organization is a bit different than ``.. figure::``.
See the *FigureMpl* documentation below.

N)relpath)PurePathPath)nodes)
directives)FigureImage)ExtensionErrorc                       ] tR t^tRtR# )
figmplnode N)__name__
__module____qualname____firstlineno____static_attributes__r       څ/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/matplotlib/sphinxext/figmpl_directive.pyr   r      s    r   r   c                      a  ] tR t^ t o RtRt^t^tRtR]	P                  R]	P                  R]	P                  R]	P                  R]P                  R]	P                   R	]	P                  R
]	P                  /tR tRtV tR# )	FigureMpla&  
Implements a directive to allow an optional hidpi image.

Meant to be used with the *plot_srcset* configuration option in conf.py,
and gets set in the TEMPLATE of plot_directive.py

e.g.::

    .. figure-mpl:: plot_directive/some_plots-1.png
        :alt: bar
        :srcset: plot_directive/some_plots-1.png,
                 plot_directive/some_plots-1.2x.png 2.00x
        :class: plot-directive

The resulting html (at ``some_plots.html``) is::

    <img src="sphx_glr_bar_001_hidpi.png"
        srcset="_images/some_plot-1.png,
                _images/some_plots-1.2x.png 2.00x",
        alt="bar"
        class="plot_directive" />

Note that the handling of subdirectories is different than that used by the sphinx
figure directive::

    .. figure-mpl:: plot_directive/nestedpage/index-1.png
        :alt: bar
        :srcset: plot_directive/nestedpage/index-1.png
                 plot_directive/nestedpage/index-1.2x.png 2.00x
        :class: plot_directive

The resulting html (at ``nestedpage/index.html``)::

    <img src="../_images/nestedpage-index-1.png"
        srcset="../_images/nestedpage-index-1.png,
                ../_images/_images/nestedpage-index-1.2x.png 2.00x",
        alt="bar"
        class="sphx-glr-single-img" />

where the subdirectory is included in the image name for uniqueness.
Faltheightwidthscalealignclasscaptionsrcsetc                :   \        4       pV P                  ^ ,          pV P                  P                  RR4      VR&   V P                  P                  RR4      VR&   V P                  P                  RR4      VR&   V P                  P                  RR4      VR&   V P                  P                  RR4      VR&   V P                  P                  RR4      VR&   V P                  P                  R	R4      VR	&   W!R
&   V P                  P                  RR4      VR&   V.# )    r    r   Nr   r   r   r   r   urir   )r   	argumentsoptionsget)self
image_nodeimagenms   &  r   runFigureMpl.runZ   s   \
..# LL,,UB7
5"ll..w=
7"ll..w=
7"ll..w=
7#||//$?
8"ll..w=
7 $ 0 0D A
9 $5#||//$?
8|r   r   N)r   r   r   r   __doc__has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacer   	unchangedlength_or_unitless length_or_percentage_or_unitlessnonnegative_intr   r   class_optionoption_specr(   r   __classdictcell__)__classdict__s   @r   r   r       s     (T K %z##*//<<++((:''*&&	K r   r   c                8   V P                  R4      p/ pV F  pVP                  4       P                  R4      p\        V4      ^8X  d   V^ ,          V^ &   K@  \        V4      ^8X  d$   V^,          RR pV^ ,          V\        V4      &   Ks  \	        RV R24      h	  V# )z
parse srcset...
, Nzsrcset argument "z" is invalid.)splitstriplenfloatr	   )stentriesr   entrysplmults   &     r   _parse_srcsetNodesrD   q   s     hhsmGFkkm!!#&s8q=AF1IX]q6#2;D"%a&F5; #4UG=!IJJ  Mr   c                 F   VR ,          '       d   \        VR ,          4      pMRp\        V P                  R,          4      P                  pV P                  P
                  p\        W44      P                  RR4      P                  \        P                  R4      p\        V4      '       d
   VR,          p\        V P                  P                  V P                  P                  4      p\        V4      P                  RRR7       V'       dS   VP                  4        F=  p\        W74      pWXP                   ,           p	\"        P$                  ! WV	,          4       K?  	  MA\        W1R,          4      pWXP                   ,           p	\"        P$                  ! WV	,          4       WbV3# )	r   Nsource.r    -T)parentsexist_okr!   )rD   r   documentparentbuildersrcdirr   replaceossepr=   outdirimagedirr   mkdirvaluesnameshutilcopyfile)
r%   noder   	docsourcesrctoprelrS   srcabspathrV   s
   &&        r   _copy_images_figmplr_      s3    H~~#DN3 x0188I \\  F
)
$
,
,S"
5
=
=bffc
JC
3xxs
 ++T\\-B-BCH 	N5 ==?Cy.G%DOOG_5	 # 95k2\\!D1S  r   c           	         \        W4      w  r#p\        V P                  R ,          4      p\        V P                  P                  R4      p\        WV4      p\        V P                  P                  R4      pW,          p	\        \        W)P                  4      4      P                  4       p
V P                  P                  R8X  d   RV
 2p
\        VR,          R,          4      P                  pV
 RV V 2pRVRVR,          /pTpV'       d   R$pRpVP                  4        F`  w  pp\        VR,          4      P                  pV
 RV V 2pVV,          pV^ 8X  d   VR	,          pMVR
VR R2,          pVV8  g   K\  TpTpKb  	  VRR% VR&   VR,          e   R
P                  VR,          4      VR&   R& FQ  pVV,          '       g   K  RV9  d   V RVV,           R2VR&   K/  VR;;,          V RVV,           R2,          uu&   KS  	  V P                  P                  T P                  TRVR,          '       d   RVR,           2MRR7      4       V P                  P                  V P                  VRRVR7      V P                  ! VR3/ VB ,           R,           4       VR,          '       d   V P                  P                  V P                  VR4      4       V P                  P                  V P                  VR4      4       V P                  P                  V P                  VR R!R7      4       V P                  P                  VR,          4       V P                  P                  R"4       V P                  P                  R#4       R# )'rF   r    dirhtmlz..r!   :   NN/r]   r   z, r9   z1.2fzx, Nr   r   stylez: ;figurer   zalign-zalign-center)CLASSaz"reference internal image-reference)rg   hrefimgz</a>
r   
figcaptionpspanzcaption-textz</span></p></figcaption>
z
</figure>
r:   )r   r   r   )r_   r   rK   rM   rN   r   rR   rL   as_posixrV   itemsjoinbodyappendstarttagemptytag)r%   rY   rS   r   r\   rZ   r[   	relsourcedesttopdestimagerelnmr!   	img_attrsmaxsrcmaxmultsrcsetstrC   r]   pathrd   s   &&                   r   visit_figmpl_htmlr      s2   /;Hc x01I dll))2.F	*It||**B/GD ++67@@BH||I%z? 
$u+b/	"	'	'BJauRD
!CUDK0I FID##b'"''BZqbT*DHqyD aT{#..g~ ( 'sm	(G}  XXd7m4	'-;;i'(-wbeQ%?	'"'"r$u+a&@@" ." 	II(.27mmF4=/* 	 	QR 	IIdC'K! 	 	#dE/Y/	0 		
 I		t\:;		tS12		tV>JK		i)		56II]#r   c                     VR ,          e;   \        W4      w  r#Rp\        VRR7      p\        W4,          4      P                  VR&   V P	                  V4       R# )r   N)defaultr!   r:   )r_   maxr   rV   visit_figure)r%   rY   rS   r   r}   s   &&   r   visit_figmpl_latexr      sN    H~!.t:fb)v/44Udr   c                     R # Nr   r%   rY   s   &&r   depart_figmpl_htmlr     s    r   c                 (    V P                  V4       R # r   )depart_figurer   s   &&r   depart_figmpl_latexr     s    tr   c                 ^    V P                  \        \        \        3\        \
        3R 7       R# ))htmllatexN)add_noder   r   r   r   r   )apps   &r   figurempl_addnoder     s(    LL(*<=*,?@  Br   c                 t    V P                  R \        4       \        V 4       RRRRR\        P                  /pV# )z
figure-mplparallel_read_safeTparallel_write_safeversion)add_directiver   r   
matplotlib__version__)r   metadatas   & r   setupr     s;    lI.c$d,A4:113HOr   )r*   rP   os.pathr   pathlibr   r   rW   docutilsr   docutils.parsers.rstr   &docutils.parsers.rst.directives.imagesr   r   sphinx.errorsr	   r   GeneralElementr   r   rD   r_   r   r   r   r   r   r   r   r   r   <module>r      sx    
  "   + @ ( 	 	N Nb$$!NR$j		Br   