
    (ph?                    (   % S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	  SSK
JrJr  SSKJr  SSKJr  \R$                  " S5      r\R$                  " S	5      rSqS
\S'   SqSS jrSS jr " S S5      rSS jr " S S\R                  5      rSSS jjr\R<                  " \R>                  \\5        \R@                  " \R>                  \5        \RB                  " \R>                  SS/5        \RD                  " \R>                  S5        g)    )annotationsN)IO   )Image	ImageFile)i32le)	deprecatez^%%([^:]*):[ \t]*(.*)[ \t]*$z^%[%!\w]([^:]*)[ \t]*$zstr | bool | None	gs_binaryc                 n   [         c  [        R                  R                  S5      (       a:  [        c%  SS Kn S H  nU R                  U5      c  M  Uq  O   Sq[        q [         SL$  [        R                  " SS/[        R                  S9  Sq [         SL$ [         SL$ ! [         a    Sq  [         SL$ f = f)Nwinr   )gswin32cgswin64cgsFr   z	--version)stdout)r
   sysplatform
startswithgs_windows_binaryshutilwhich
subprocess
check_callDEVNULLOSError)r   binarys     E/var/www/html/venv/lib/python3.13/site-packages/PIL/EpsImagePlugin.pyhas_ghostscriptr   .   s    <<""5)) (<F||F+7,2) =
 ).%)I E!!"%%t[&9*BTBTU 	 E!!9E!!  "!	E!!"s   ''B B43B4c                   [        5       (       d  Sn[        U5      eU S   u  p`pxUu  p[        U5      =(       d    SnUS   U-  nUS   U-  nSU-  U
S   U
S   -
  -  nSU-  U
S   U
S   -
  -  n[        R                  " 5       u  nn[
        R                  " U5        Sn[        US5      (       a;  [
        R                  R                  UR                  5      (       a  UR                  nO[        R                  " 5       u  nn[
        R                  " U5        Un[        US	5       nUR                  S[        R                  5        UR                  5       nUR                  S5        UnUS:  aJ  UR!                  [#        US
5      5      nU(       d  O'U[%        U5      -  nUR'                  U5        US:  a  MJ  SSS5        U(       a  SOSn[(        SSUS SUS 3SUS SUS 3SSSSU 3SU 3SU
S   *  SU
S   *  S3SUSS/n Sn[*        R,                  R/                  S5      (       a8  [0        R2                  " 5       nU=R4                  [0        R6                  -  sl        [0        R8                  " UUS9  [:        R                  " U5      nUR=                  5          [
        R>                  " U5        U(       a  [
        R>                  " U5        UR@                  RC                  5       nUR                  5         U$ ! , (       d  f       GNM= f! [         a     NJf = f!  [
        R>                  " U5        U(       a  [
        R>                  " U5        f f ! [         a     f f = f= f)z!Render an image using Ghostscriptz%Unable to locate Ghostscript on pathsr   r   g      R@      Nnamewbi  pngalphappmrawz-qz-gdxz-rfz-dBATCHz	-dNOPAUSEz-dSAFERz	-sDEVICE=z-sOutputFile=z-c z
 translatez-fshowpager   )startupinfo)"r   r   inttempfilemkstemposclosehasattrpathexistsr!   openseekioSEEK_ENDtellreadminlenwriter
   r   r   r   r   STARTUPINFOdwFlagsSTARTF_USESHOWWINDOWr   r   loadunlinkimcopy)tilesizefpscaletransparencymsgdecoderoffsetdatalengthbboxwidthheightres_xres_yout_fdoutfileinfile_tempinfilein_fdr'   fsize
lengthfilesdevicecommandr*   out_imrA   s                                r   Ghostscriptr]   E   s    5cl #'q'G6LF JO!EGeOE!Wu_F5LDGd1g-.E6MT!WtAw./E&&(OFGHHVKr6rww~~bgg66%--/{

 +t$GGAr{{#GGIE GGAJJq.GGC
J78c!f$

 q. % (ZXF 	
U1IQvaj!
U1IQuQi 
F8
y!G8*AtAwhZz*#G*<<""5))$002K:#B#BBg;?G$	IIg		+& 
	B
LLNIs %$h  				IIg		+&  		sP   'BLBL# "3L 
L
L L #M*%3MM*
M'$M*&M''M*c                  H    \ rS rSrSrS r\R                  4S jrSS jr	Sr
g)	PSFile   z
Wrapper for bytesio object that treats either CR or LF as end of line.
This class is no longer used internally, but kept for backwards compatibility.
c                4    [        SSSS9  Xl        S U l        g )Nr_      zSIf you need the functionality of this class you will need to implement it yourself.)action)r	   rE   char)selfrE   s     r   __init__PSFile.__init__   s#    6	
 	    c                H    S U l         U R                  R                  X5        g N)rd   rE   r4   )re   rJ   whences      r   r4   PSFile.seek   s    	V$rh   c                   U R                   =(       d    S/nS U l         U R                  R                  S5      nUS;  aT  [        U5      (       aD  UR	                  U5        U R                  R                  S5      nUS;  a  [        U5      (       a  MD  U R                  R                  S5      U l         U R                   S;   a  S U l         SR                  U5      R                  S5      $ )Nrh   r      
latin-1)rd   rE   r8   r:   appendjoindecode)re   rY   cs      r   readlinePSFile.readline   s    YY#	GGLLOSVVHHQKQA SVV GGLLO	99DIxx{!!),,rh   )rd   rE   N)returnstr)__name__
__module____qualname____firstlineno____doc__rf   r5   SEEK_SETr4   rt   __static_attributes__ rh   r   r_   r_      s    
 #%++ %-rh   r_   c                f    U S S S:H  =(       d#    [        U 5      S:  =(       a    [        U 5      S:H  $ )N      %!PS   P )r:   i32)prefixs    r   _acceptr      s/    "1: TS[A%5%S#f+:STrh   c                  R    \ rS rSrSrSrSrSSSSS	.rSS
 jrS r	SS jr
SS jrSrg)EpsImageFile   z.EPS File Parser for the Python Imaging LibraryEPSzEncapsulated PostscriptLLABRGBCMYK)r   r   r    r   c                0  ^ ^^^^ T R                  T R                  5      u  mmT R                  R                  T5        ST l        S T l        [        S5      n[        U5      nSnSnSmSmSU 4S jjnS UUUU U4S jjn T R                  R                  S5      nUS	:X  a  US:X  a  U(       a  U" 5         GOOTUS
;   a	  US:X  a  MG  OEUS:  a1  US   [        S5      :X  a  Sn[        U5      eU(       a	  U" 5         SnSnUS   X'   US-  nM  U(       a  US   [        S5      :w  d	  US S S:X  a  U" 5         SnM  [        US U S5      n	U" U	5      (       dp  [        R                  U	5      n
U
(       a=  U
R                  S5      nUS S S:X  a  USS  T R                  S'   OST R                  U'   OU	S   S:X  a  OSn[        U5      eOUS S S:X  aY  USU R!                  S S5      nS US S  5       u  pnnUS:X  a  ST l        OUS:X  a   T R"                  U   T l        OOIX4T l        g US S S:X  a  O6T(       a  T(       a  [        US U S5      n	U" U	5        OUS S S:X  a  SmSnGM  T R                  (       d  Sn[        U5      eg ! [$         a     M,  f = f)!Nr      r   TFc                 z   > STR                   ;  a  Sn [        U 5      eSTR                   ;  a  Sn [        U 5      eg)z
The EPS specification requires that some headers exist.
This should be checked when the header comments formally end,
when image data starts, or when the file ends, whichever comes first.
PS-Adobez'EPS header missing "%!PS-Adobe" commentBoundingBoxz*EPS header missing "%%BoundingBox" commentN)infoSyntaxError)rH   re   s    r   check_required_header_comments:EpsImageFile._open.<locals>.check_required_header_comments   sB     *?!#&&DII-B!#&& .rh   c                6  >  [         R                  U 5      nU(       d  gUR                  SS5      u  pEUTR                  U'   US:X  a  US:X  a  Sm
gTR                  (       a  T(       aq  T
(       aj   UR                  5        Vs/ s H  n[        [        U5      5      PM     nnUS   US   -
  US	   US   -
  4Tl        S
STR                  -   T	TU44/Tl        gg! [        R                   a  nSn[	        U5      UeS nAff = fs  snf ! [         a     gf = f)Nnot an EPS fileFr   r   r   z(atend)Tr   r    epsr   r   )splitmatchreerrorr   groupr   _sizer+   floatrD   rC   	Exception)rY   merH   kviboxrL   rJ   reading_trailer_commentsre   trailer_reacheds           r   _read_comment)EpsImageFile._open.<locals>._read_comment   s   .KKN
 771a=DADIIaLM!	>/3,  <T 78ggi@is58}i@%(Vc!f_c!fs1vo%E
&+Vdii-?&RU%W$X	 - 88 .'!#&A-." A % s;   C 2D D"8D D0C>>DD 
DDr   rh   rn   %r      s   %%EndCommentsro      r   	    zbad EPS headerrb   s   %ImageData:   c              3  8   #    U  H  n[        U5      v   M     g 7frj   )r+   ).0values     r   	<genexpr>%EpsImageFile._open.<locals>.<genexpr>]  s      5,A5CJJ,As   r   1   s   %%EOFs	   %%Trailerz!cannot determine EPS bounding boxrv   None)rY   rw   rv   bool)_find_offsetrE   r4   _moder   	bytearray
memoryviewr8   ordr   rw   fieldr   r   r   r   r   mode_map
ValueError)re   byte_arrbytes_mv
bytes_readreading_header_commentsr   r   byterH   rY   r   r   image_data_valuescolumnsrows	bit_depthmode_idrL   rJ   r   r   s   `                @@@@r   _openEpsImageFile._open   s   ,,TWW5 	V

S>h'
"&#( 	'	 	8 77<<?Ds{?.68 #  ? #
 $  {c#h./)#..2:<6;3 &'
'+Aw$a
& A;#c(*hsm?O.O24.3+*-y9$Q''AAGGAJRa5J.45abEDIIj1+-DIIaL1 .%cl* ( #2.0 %-R
$;$A$A$$J!5,=bq,A51y' >!$DJ!^%)]]7%;
 $]
"1) %=*-y9a "1-"&JI L zz5C#, # & s   	J 
JJc                (   UR                  S5      nUS:X  a5  UR                  S[        R                  5        UR	                  5       nSnX44$ [        U5      S:X  a+  UR                  S5      n[        U5      n[        US5      nX44$ Sn[        U5      e)Nr   r   r   r   r   r   )r8   r4   r5   r6   r7   r   r   )re   rE   rY   rL   rJ   rH   s         r   r   EpsImageFile._find_offset{  s    GGAJ<GGAr{{#WWYFF ~ Vz! 
AVFAYF
 ~ $Cc""rh   c                >   U R                   (       an  [        U R                   U R                  U R                  X5      U l        U R                  R
                  U l        U R                  R                  U l        / U l         [        R                  R                  U 5      $ rj   )
rC   r]   rD   rE   rA   moder   r   r   r?   )re   rF   rG   s      r   r?   EpsImageFile.load  sa    99!$))TYYUDGDJDJDI{{%%rh   c                    g rj   r   )re   poss     r   	load_seekEpsImageFile.load_seek  s     	rh   )r   r   rA   rC   Nr   r   F)r   r+   rv   r   )rx   ry   rz   r{   r|   formatformat_descriptionr   r   r   r?   r   r~   r   rh   r   r   r      s4    8F25Uv6HaF.&rh   r   c                   U R                  5         U R                  S:X  a  SnO3U R                  S:X  a  SnO U R                  S:X  a  SnOSn[        U5      eU(       a  UR                  S5        UR                  S	5        UR                  S
U R                  -  5        UR                  S5        UR                  S5        UR                  S5        UR                  SU R                  -  5        UR                  SU-  5        UR                  S5        UR                  S5        UR                  SU R                  S   US   -  -  5        UR                  SU R                  -  5        UR                  SU R                  -  5        UR                  SU R                  S   U R                  S   U R                  S   4-  5        UR                  S5        UR                  US   S-   5        [        US5      (       a  UR                  5         [        R                  " XSSU R                  -   SS4/5        UR                  S5        UR                  S 5        [        US5      (       a  UR                  5         gg)!z*EPS Writer for the Python Imaging Library.r   )r   r   s   imager   )r   r    s   false 3 colorimager   )r   r   s   false 4 colorimagezimage mode is not supporteds   %!PS-Adobe-3.0 EPSF-3.0
s   %%Creator: PIL 0.1 EpsEncode
s   %%%%BoundingBox: 0 0 %d %d
s   %%Pages: 1
s   %%EndComments
s   %%Page: 1 1
s   %%ImageData: %d %d s   %d %d 0 1 1 "%s"
s   gsave
s   10 dict begin
s   /buf %d string def
r   r   s   %d %d scale
s   %d %d 8
s   [%d 0 0 -%d 0 %d]
s+   { currentfile buf readhexstring pop } bind
r      
flushr   r   Ns   
%%%%EndBinary
s   grestore end
)	r?   r   r   r;   rD   r0   r   r   _save)rA   rE   filenamer   operatorrH   s         r   r   r     s    GGI 
ww#~#	E	0	F	0+o

-.
23
0277:;
!
#$
!"
'"''12
&12 HHZHH HH$
Xa[(@ABHH'(HH\BGG#$HH#rwwqz2771:rwwqz&JJKHH<=HHXa[5 !r7

OOBeVbgg%5q$?@AHH!"HHr7

 rh   z.psz.epszapplication/postscript)rv   r   r   )r   bytesrv   r   )r   )
rA   zImage.ImagerE   z	IO[bytes]r   zstr | bytesr   r+   rv   r   )#
__future__r   r5   r.   r   r   r   r,   typingr   r   r   r   _binaryr   r   
_deprecater	   compiler   r   r
   __annotations__r   r   r]   r_   r   r   r   register_openr   register_saveregister_extensionsregister_mimer   rh   r   <module>r      s   , # 	 	 	  
    ! !
 	

23


,-#	 # ".Zz"- "-JUN9&& Nh.h   L''w ?   L'' /   ,--v ?   L'')A Brh   