Ë
    7^(h1  ã                   ó‚   — d dl mZ d dlmZ d dlmZ d dlmc mc m	Z	 d dl
mZ d„ Zd„ Z G d„ d	e	j                  «      Zy)
é    )ÚCallable)ÚBasic)Úimport_moduleN)Úlatexc                 óR   — t        | t        «      rt        | d¬«      S t        | «      S )NÚinline)Úmode)Ú
isinstancer   r   Ústr)Úlabels    úr/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/plotting/backends/matplotlibbackend/matplotlib.pyÚ_str_or_latexr      s#   € Ü�%œÔÜ�U Ô*Ð*Üˆu‹:Ðó    c                 óŽ  — g }g }t        | «      r‘| D ]ˆ  }|d   }|d   }|j                  |j                  |j                  |j                  |j                  dg«       |j                  |j                  |j                  |j                  |j                  dg«       ŒŠ ||fS |j                  d«       |j                  d«       ||fS )zi
    Returns lists for matplotlib ``fill`` command from a list of bounding
    rectangular intervals
    r   é   N)NNNN)ÚlenÚextendÚstartÚend)Úinterval_listÚxlistÚylistÚ	intervalsÚ	intervalxÚ	intervalys         r   Ú_matplotlib_listr      sÅ   € ð
 €EØ€EÜ
ˆ=ÔØ&ò 	AˆIØ! !™ˆIØ! !™ˆIØ�L‰L˜)Ÿ/™/¨9¯?©?Ø#Ÿ-™-¨¯©¸ð>ô ?à�L‰L˜)Ÿ/™/¨9¯=©=Ø#Ÿ-™-¨¯©¸$ð@õ Að	Að �%ˆ<Ðð 	�‰Ð-Ô.Ø�‰Ð-Ô.Ø�%ˆ<Ðr   c                   óX   ‡ — e Zd ZdZˆ fd„Zd„ Zed
d„«       Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zˆ xZS )ÚMatplotlibBackendzd This class implements the functionalities to use Matplotlib with SymPy
    plotting functions.
    c                 ó  •— t        ‰| �  |i |¤Ž t        ddg d¢idt        f¬«      | _        | j                  j
                  | _        | j                  j                  | _        | j                  j                  j                  | _	        |j                  dd«      | _        | j                  dk7  r-t        | j                  d   «      | j                  d	   z  | _        |j                  d
d «      | _        |j                  dd «      | _        y )NÚ
matplotlibÚfromlist)ÚpyplotÚcmÚcollectionsz1.1.0)Úimport_kwargsÚmin_module_versionÚcatchÚaspect_ratioÚautor   r   ÚfigÚax)ÚsuperÚ__init__r   ÚRuntimeErrorr    r"   Úpltr#   r$   ÚLineCollectionÚgetÚaspectÚfloatÚpopÚ_plotgrid_figÚ_plotgrid_ax)ÚselfÚseriesÚkwargsÚ	__class__s      €r   r-   zMatplotlibBackend.__init__0   sÖ   ø€ Ü‰Ñ˜&Ð+ FÒ+Ü'¨Ø%Ò'FÐGØ&¬|¨oô?ˆŒð —?‘?×)Ñ)ˆŒØ—/‘/×$Ñ$ˆŒØ"Ÿo™o×9Ñ9×HÑHˆÔØ—j‘j °Ó8ˆŒØ�;‰;˜&Ò Ü §¡¨A¡Ó/°$·+±+¸a±.Ñ@ˆDŒKð $ŸZ™Z¨¨tÓ4ˆÔØ"ŸJ™J t¨TÓ2ˆÕr   c                 ó  — d„ }| j                   �R| j                   | _        | j                  | _        t	        d„ | j
                  D «       «      s || j                  «       y y | j                  j                  | j                  ¬«      | _        t	        d„ | j
                  D «       «      r%| j                  j                  dddd¬«      | _        y | j                  j                  ddd«      | _         || j                  «       y )Nc                 ó`  — | j                   d   j                  d«       | j                   d   j                  d«       | j                   d   j                  d«       | j                   d   j                  d«       | j                  j	                  d«       | j
                  j	                  d«       y )NÚleftÚzeroÚrightÚnoneÚbottomÚtop)ÚspinesÚset_positionÚ	set_colorÚxaxisÚset_ticks_positionÚyaxis)r+   s    r   Ú
set_spinesz4MatplotlibBackend._create_figure.<locals>.set_spinesA   s‚   € Ø�I‰I�fÑ×*Ñ*¨6Ô2Ø�I‰I�gÑ×(Ñ(¨Ô0Ø�I‰I�hÑ×,Ñ,¨VÔ4Ø�I‰I�eÑ×&Ñ& vÔ.Ø�H‰H×'Ñ'¨Ô1Ø�H‰H×'Ñ'¨Õ/r   c              3   ó4   K  — | ]  }|j                   –— Œ y ­w©N©Úis_3D©Ú.0Úss     r   ú	<genexpr>z3MatplotlibBackend._create_figure.<locals>.<genexpr>L   s   è ø€ Ò5 1�q—w•wÑ5ùó   ‚)Úfigsizec              3   ó4   K  — | ]  }|j                   –— Œ y ­wrK   rL   rN   s     r   rQ   z3MatplotlibBackend._create_figure.<locals>.<genexpr>P   s   è ø€ Ò1˜q�1—7•7Ñ1ùrR   r   Ú3d)Ú
projection)
r5   r*   r6   r+   ÚanyÚ_seriesr/   ÚfigureÚsizeÚadd_subplot)r7   rI   s     r   Ú_create_figurez MatplotlibBackend._create_figure@   sÅ   € ò	0ð ×ÑÐ)Ø×)Ñ)ˆDŒHØ×'Ñ'ˆDŒGÜÑ5¨¯©Ô5Ô5Ù˜4Ÿ7™7Õ#ð 6ð —x‘x—‘¨t¯y©y�Ó9ˆDŒHÜÑ1 D§L¡LÔ1Ô1ØŸ(™(×.Ñ.¨q°!°QÀ4Ð.ÓH�•àŸ(™(×.Ñ.¨q°!°QÓ7�”Ù˜4Ÿ7™7Õ#r   c                 óî   — t        d«      }|�d}| ||f}nd}| |f}|j                  j                  |«      j                  j	                  dd|«      }|j                  j                  |dd |dd gd¬«      S )a‡   Convert two list of coordinates to a list of segments to be used
        with Matplotlib's :external:class:`~matplotlib.collections.LineCollection`.

        Parameters
        ==========
            x : list
                List of x-coordinates

            y : list
                List of y-coordinates

            z : list
                List of z-coordinates for a 3D line.
        ÚnumpyNé   é   éÿÿÿÿr   )Úaxis)r   ÚmaÚarrayÚTÚreshapeÚconcatenate)ÚxÚyÚzÚnpÚdimÚpointss         r   Úget_segmentszMatplotlibBackend.get_segmentsV   sƒ   € ô  ˜7Ó#ˆØˆ=ØˆCØ˜˜A�Y‰FàˆCØ˜�VˆFØ—‘—‘˜VÓ$×&Ñ&×.Ñ.¨r°1°cÓ:ˆØ�u‰u× Ñ  &¨¨" +¨v°a°b¨zÐ!:ÀÐ ÓCÐCr   c                 óP  — t        d«      }t        dddgi¬«      }g g g }}}|D �]¾  }|j                  rõ|j                  r|j                  «       \  }	}
}n|j                  «       \  }	}
t	        |j
                  t        t        f«      st        |j
                  «      rT| j                  |	|
«      }| j                  |«      }|j                  |j                  «       «       |j                  |«       ŒÍt        |j                  «      }|j!                  |	|
||j
                  ¬«      \  }�Œ|j"                  r |j$                  |j                  «       Ž  �Œ0|j&                  �r=|j                  «       \  }	}
}}t	        |j
                  t        t        f«      st        |j
                  «      rk|j(                  j*                  }| j                  |	|
|«      }|j-                  |«      }|j                  |j                  «       «       |j                  |«       n5t        |j                  «      }|j!                  |	|
|||j
                  ¬«       |j/                  |j0                  «       |j/                  |j2                  «       |j/                  |j4                  «       �Œz|j6                  �rH|j                  r|j                  «       \  }	}
}}}n|j                  «       \  }	}
}|j9                  |	|
|t;        | j<                  d| j<                  j>                  «      ddd	¬
«      }t	        |j@                  t        t        tB        f«      r=|j                  «       }|jE                  |jF                  «      }|j                  |«       n|jI                  |j@                  «       |j/                  |j0                  «       |j/                  |j2                  «       |j/                  |j4                  «       �ŒÏ|jJ                  r¾|j                  «       }tM        |«      dk(  r2tO        |d   «      \  }	}
|jQ                  |	|
|j
                  d¬«       �Œ+| jR                  jT                  jV                  } |d|j
                  g«      }|\  }}}}|dk(  r|j%                  ||||¬«       �Œ‚|jY                  ||||¬«       �Œ™|jZ                  �r|j\                  dk(  r( |j                   |j^                  i |j`                  ¤Ž �ŒÝ|j\                  dk(  r( |jb                  |j^                  i |j`                  ¤Ž �Œ|j\                  dk(  r( |jd                  |j^                  i |j`                  ¤Ž �ŒK|j\                  dk(  s�Œ\|jg                   | jR                  jh                  jj                  |j^                  i |j`                  ¤Ž«       �Œ§tm        djo                  |«      «      ‚ |j(                  jp                  }t	        ||«      s1|js                  |ju                  «       |jw                  «       ¬«       �n8|rS|jy                  |«      }|j{                  |d d …df   «      |j}                  |d d …df   «      f}|j                  |«       n|j                  ddg«       |rS|jy                  |«      }|j{                  |d d …df   «      |j}                  |d d …df   «      f}|j�                  |«       n|j�                  ddg«       |rS|jy                  |«      }|j{                  |d d …df   «      |j}                  |d d …df   «      f}|jƒ                  |«       n|jƒ                  ddg«       | j„                  r't	        ||«      s|j‡                  | j„                  «       | jˆ                  r't	        ||«      s|j‹                  | jˆ                  «       t	        ||«      r| jR                  jŒ                  dk\  r|j�                  | j�                  «       | j’                  �r"| j’                  } t	        ||«      r�n| dk(  r=|j”                  d   j—                  d«       |j”                  d   j—                  d«       nÆ| dk(  r{|j™                  «       \  }!}"|j›                  «       \  }#}$|!|"z  dk  rdnd}%|#|$z  dk  rdnd}&|j”                  d   j—                  |%«       |j”                  d   j—                  |&«       nF|j”                  d   j—                  d| d   f«       |j”                  d   j—                  d| d   f«       | jœ                  s|jŸ                  «        | j                   r5|j¡                  «       r%|j¢                  j¥                  | j                   «       | j¦                  r6|j©                  | j¦                  «       |j«                  | j¦                  «       | j¬                  r|j¯                  | j¬                  «       | j°                  r(t        | j°                  «      }'|j³                  |'d¬ «       | j´                  r(t        | j´                  «      }(|j·                  |(d!¬ «       t	        ||«      r4| j¸                  r(t        | j¸                  «      })|j»                  |)d!¬ «       | j¼                  r|j                  | j¼                  «       | j¾                  r|j�                  | j¾                  «       | jÀ                  jÃ                  | jÄ                  «       y )"Nr^   Úmpl_toolkitsr!   Úmplot3d)r%   )r   ÚcolorÚviridisr   gš™™™™™¹?)ÚcmapÚrstrideÚcstrideÚ	linewidthr`   r   ÚNone)Ú	facecolorÚ	edgecolorÚwhiteÚcontour)rt   ÚmarkersÚannotationsÚfillÚ
rectangleszc{} is not supported in the SymPy plotting module with matplotlib backend. Please report this issue.)ÚscalexÚscaleyz1.2.0Úcenterr=   rA   r)   )Údatar   r„   )r   r   )Úposition)r   r   )cr   Ú	is_2DlineÚis_parametricÚget_datar
   Ú
line_colorÚintr3   Úcallablern   r0   Ú	set_arrayÚget_color_arrayÚadd_collectionr   r   ÚplotÚ
is_contourr|   Ú	is_3Dlinerq   Úart3dÚLine3DCollectionÚappendÚ_xlimÚ_ylimÚ_zlimÚis_3DsurfaceÚplot_surfaceÚgetattrr#   ÚjetÚsurface_colorr   rf   rZ   rE   Úis_implicitr   r   r   r    ÚcolorsÚListedColormapÚcontourfÚ
is_genericÚtypeÚargsÚrendering_kwÚannotateÚfill_betweenÚ	add_patchÚpatchesÚ	RectangleÚNotImplementedErrorÚformatÚAxes3DÚautoscale_viewÚget_autoscalex_onÚget_autoscaley_onrd   ÚaminÚamaxÚset_xlimÚset_ylimÚset_zlimÚxscaleÚ
set_xscaleÚyscaleÚ
set_yscaleÚ__version__Úset_autoscale_onÚ	autoscaleÚaxis_centerrC   rD   Úget_xlimÚget_ylimrb   Úset_axis_offÚlegendÚlegend_Úset_visibleÚmarginÚset_xmarginÚset_ymarginÚtitleÚ	set_titleÚxlabelÚ
set_xlabelÚylabelÚ
set_ylabelÚzlabelÚ
set_zlabelÚxlimÚylimr+   Ú
set_aspectr2   )*r7   r8   r+   rk   rp   ÚxlimsÚylimsÚzlimsrP   rh   ri   ÚparamÚsegmentsÚ
collectionÚlblÚlinerj   r’   ÚuÚvÚcolor_arrayrm   rŸ   ÚcolormapÚxarrayÚyarrayÚzarrayÚ	plot_typer¬   rÎ   rÏ   ÚzlimÚvalÚxlÚxhÚylÚyhÚpos_leftÚ
pos_bottomÚxlblÚylblÚzlbls*                                             r   Ú_process_seriesz!MatplotlibBackend._process_seriesp   sŒ  € Ü˜7Ó#ˆÜ$Ø¨:¸	°{Ð*CôEˆð
 ! " b�eˆuˆàó W	!ˆAà�{Š{Ø—?’?Ø"#§*¡*£,‘K�A�q™%àŸ:™:›<‘D�A�qÜ˜qŸ|™|¬c´5¨\Ô:Ü  §¡Ô.Ø#×0Ñ0°°AÓ6�HØ!%×!4Ñ!4°XÓ!>�JØ×(Ñ(¨×):Ñ):Ó)<Ô=Ø×%Ñ% jÕ1ä'¨¯©Ó0�CØŸG™G A q°¸1¿<¹<˜GÓH‘E’DØ—’Ø�—
‘
˜AŸJ™J›LÓ)Ø—“Ø!"§¡£‘��1�a˜Ü˜qŸ|™|¬c´5¨\Ô:Ü  §¡Ô.Ø(×0Ñ0×6Ñ6�EØ#×0Ñ0°°A°qÓ9�HØ!&×!7Ñ!7¸Ó!A�JØ×(Ñ(¨×):Ñ):Ó)<Ô=Ø×%Ñ% jÕ1ä'¨¯©Ó0�CØ—G‘G˜A˜q !¨3°a·l±l�GÔCà—‘˜QŸW™WÔ%Ø—‘˜QŸW™WÔ%Ø—‘˜QŸW™WÖ%Ø—“Ø—?’?Ø$%§J¡J£L‘M�A�q˜!˜Q¡àŸj™j›l‘G�A�q˜!ØŸ_™_¨Q°°1Ü  §¡¨)°T·W±W·[±[ÓAØ q°Cð -ó 9�
ô ˜aŸo™o´´s¼HÐ/EÔFØ"#×"3Ñ"3Ó"5�KØ"-×"5Ñ"5°k×6FÑ6FÓ"G�KØ×(Ñ(¨Õ5à×(Ñ(¨¯©Ô9à—‘˜QŸW™WÔ%Ø—‘˜QŸW™WÔ%Ø—‘˜QŸW™WÖ%Ø—’ØŸ™›�Ü�v“; !Ò#ä+¨F°1©IÓ6‘D�A�qØ—G‘G˜A˜q¨A¯L©LÀF�GÖKð
 &*§_¡_×%;Ñ%;×%JÑ%J�NÙ-¨w¸¿¹Ð.EÓF�HØ8>Ñ5�F˜F F¨IØ  IÒ-ØŸ
™
 6¨6°6À˜
ÖIàŸ™ F¨F°FÀ˜ÖJØ—“Ø—6‘6˜YÒ&à�B—G‘G˜QŸV™VÐ6 q§~¡~Ô6Ø—V‘V˜}Ò,Ø�B—K‘K §¡Ð:¨1¯>©>Ô:Ø—V‘V˜vÒ%à#�B—O‘O Q§V¡VÐ>¨q¯~©~Ô>Ø—V‘V˜|Ô+à—L‘LØ9˜Ÿ™×/Ñ/×9Ñ9ØŸV™Vð7Ø'(§~¡~ñ7ö8ô *ðIç‘V˜B“Zó!ð !ðiW	!ðr ×%Ñ%×,Ñ,ˆÜ˜"˜fÔ%Ø×ÑØ×+Ñ+Ó-Ø×+Ñ+Ó-ð ö /ñ ØŸ™ ›�ØŸ™ ¢a¨ d¡Ó,¨b¯g©g°eºA¸q¸D±kÓ.BÐC�Ø—‘˜DÕ!à—‘˜Q ˜FÔ#áØŸ™ ›�ØŸ™ ¢a¨ d¡Ó,¨b¯g©g°eºA¸q¸D±kÓ.BÐC�Ø—‘˜DÕ!à—‘˜Q ˜FÔ#áØŸ™ ›�ØŸ™ ¢a¨ d¡Ó,¨b¯g©g°eºA¸q¸D±kÓ.BÐC�Ø—‘˜DÕ!à—‘˜Q ˜FÔ#ð
 �;Š;œz¨"¨fÔ5Ø�M‰M˜$Ÿ+™+Ô&Ø�;Š;œz¨"¨fÔ5Ø�M‰M˜$Ÿ+™+Ô&Ü˜"˜fÔ%¨¯©×)DÑ)DÈÒ)OØ×Ñ §¡Ô/Ø×ÓØ×"Ñ"ˆCÜ˜"˜fÔ%ÙØ˜’Ø—	‘	˜&Ñ!×.Ñ.¨xÔ8Ø—	‘	˜(Ñ#×0Ñ0°Õ:Ø˜’ØŸ™›‘��BØŸ™›‘��BØ*,¨R©%°1ª*™;¸(�Ø,.¨r©E°QªJ™[¸H�
Ø—	‘	˜&Ñ!×.Ñ.¨xÔ8Ø—	‘	˜(Ñ#×0Ñ0°Õ<à—	‘	˜&Ñ!×.Ñ.°¸¸A¹Ð/?Ô@Ø—	‘	˜(Ñ#×0Ñ0°&¸#¸a¹&Ð1AÔBØ�yŠyØ�O‰OÔØ�;Š;Ø�y‰yŒ{Ø—
‘
×&Ñ& t§{¡{Ô3Ø�;Š;Ø�N‰N˜4Ÿ;™;Ô'Ø�N‰N˜4Ÿ;™;Ô'Ø�:Š:Ø�L‰L˜Ÿ™Ô$Ø�;Š;Ü  §¡Ó-ˆDØ�M‰M˜$¨ˆMÔ0Ø�;Š;Ü  §¡Ó-ˆDØ�M‰M˜$¨ˆMÔ0Ü�b˜&Ô! d§k¢kÜ  §¡Ó-ˆDØ�M‰M˜$¨ˆMÔ0ð �9Š9Ø�K‰K˜Ÿ	™	Ô"Ø�9Š9Ø�K‰K˜Ÿ	™	Ô"Ø�‰×Ñ˜4Ÿ;™;Õ'r   c                 óp   — | j                  «        | j                  | j                  | j                  «       y)za
        Iterates over every ``Plot`` object and further calls
        _process_series()
        N)r\   rì   rX   r+   ©r7   s    r   Úprocess_seriesz MatplotlibBackend.process_series&  s(   € ð
 	×ÑÔØ×Ñ˜TŸ\™\¨4¯7©7Õ3r   c                 óÎ   — | j                  «        t        j                  r5| j                  j	                  «        | j
                  j                  «        y | j                  «        y rK   )rï   Úbase_backendÚ_showr*   Útight_layoutr/   ÚshowÚcloserî   s    r   rô   zMatplotlibBackend.show.  s?   € Ø×ÑÔô ×ÒØ�H‰H×!Ñ!Ô#Ø�H‰H�M‰M�Oà�J‰J�Lr   c                 óZ   — | j                  «        | j                  j                  |«       y rK   )rï   r*   Úsavefig)r7   Úpaths     r   ÚsavezMatplotlibBackend.save9  s    € Ø×ÑÔØ�‰×Ñ˜Õr   c                 óN   — | j                   j                  | j                  «       y rK   )r/   rõ   r*   rî   s    r   rõ   zMatplotlibBackend.close=  s   € Ø�‰�‰�t—x‘xÕ r   rK   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r-   r\   Ústaticmethodrn   rì   rï   rô   rù   rõ   Ú__classcell__)r:   s   @r   r   r   +   sC   ø„ ñô3ò $ð, òDó ðDò2s(òl4ò	òö!r   r   )Úcollections.abcr   Úsympy.core.basicr   Úsympy.externalr   Ú$sympy.plotting.backends.base_backendÚplottingÚbackendsrñ   Úsympy.printing.latexr   r   r   ÚPlotr   © r   r   ú<module>r
     s5   ðÝ $Ý "Ý (ß ;Ó ;Ý &òòô0S!˜×)Ñ)õ S!r   