
    h@                    &   % 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  \R                   " S5      r\R                   " S5      rSqS	\S
'   SqSS jr  S           SS jjrSS jr " S S\R                  5      rSSS jjr\R6                  " \R8                  \\5        \R:                  " \R8                  \5        \R<                  " \R8                  SS/5        \R>                  " \R8                  S5        g)    )annotationsN)IO   )Image	ImageFile)i32lez^%%([^:]*):[ \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     D/var/www/html/env/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[        [        [        5      (       d   eU S   R
                  n[        U[        5      (       d   eUu  px[        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  p[        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R1                  U5        US:  a  MJ  SSS5        U(       a  Sn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[2        R4                  R7                  S5      (       a8  [8        R:                  " 5       nU=R<                  [8        R>                  -  sl        [8        R@                  " UUS9  [B        R                   " U5       nURE                  5         URF                  RI                  5       sSSS5         [        RJ                  " U5        U(       a  [        RJ                  " U5        $ $ ! , (       d  f       GNG= f! [         a     $ f = f! , (       d  f       O= f  [        RJ                  " U5        U(       a  [        RJ                  " U5        gg! [         a     gf = f!  [        RJ                  " U5        U(       a  [        RJ                  " 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pnmrawz-qz-gdxz-rfz-dBATCHz	-dNOPAUSEz-dSAFERz	-sDEVICE=z-sOutputFile=z-c z
 translatez-fshowpager   )startupinfo)&r   r   
isinstancer	   strargstupleinttempfilemkstemposclosehasattrpathexistsr    openseekioSEEK_ENDtellreadminlenwriter   r   r   r   STARTUPINFOdwFlagsSTARTF_USESHOWWINDOWr   r   loadimcopyunlink)tilesizefpscaletransparencymsgr,   lengthbboxwidthheightres_xres_yout_fdoutfileinfile_tempinfilein_fdr&   fsize
lengthfilesdevicecommandr)   out_ims                             r   Ghostscriptr]   D   s{    5cli%%%% 7<<DdE""""LF JO!EGeOE!Wu_F5LDGd1g-.E6MT!WtAw./E&&(OFHHVKr6rww~~bgg66%--/{

 +t$GGAr{{#GGIE GGAJJq.GGC
J78c!f$

 q. %   	
U1IQvaj!
U1IQuQi 
F8
y!G8*AtAwhZz*#G*<<""5))$002K:#B#BBg;?ZZ FKKM99>># ! 	IIg		+& s %$v  		 !  	IIg		+&  				IIg		+&  		sz   BL3B	N- 
*M4	N- >3M3
M
MM
M#N- (3N 
N*)N*-O4/3O$"O4$
O1.O40O11O4c                x    U R                  S5      =(       d#    [        U 5      S:  =(       a    [        U 5      S:H  $ )N   %!PS      P )r   r=   i32)prefixs    r   _acceptrd      s4    W% Fq6S[J6    c                  f    \ rS rSrSrSrSrSSSSS	.rSS
 jrSS jr	 S     SS j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                  ^ ^^^ T R                  T R                  5      u  pT R                  R                  U5        ST l        S mS n[	        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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   XF'   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      (       d}  [        R                  U5      nU(       aJ  UR                  S5      nUR                  S5      (       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  ab  U(       a  SnGMi  USU R!                  S S5      nS US S  5       u  nnnnUS:X  a  ST l        OUS:X  a   T R"                  U   T l        OOEUU4nO;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(       d  Sn[        U5      eU=(       d    TS   TS   -
  TS    TS   -
  4T l        [(        R*                  " S!S"T R,                  -   X!T45      /T l        g ! [$         a     Ms  f = f)%Nrl      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)rK   selfs    r   check_required_header_comments:EpsImageFile._open.<locals>.check_required_header_comments   sB     *?!#&&DII-B!#&& .re   c                  >  [         R                  U 5      nU(       d  gUR                  SS5      u  pEUT	R                  U'   US:X  aS  US:X  a  SmgT(       a  T
(       a<  T(       a5   UR                  5        Vs/ s H  n[        [        U5      5      PM     snm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   rr   z(atend)T)
splitmatchreerrorrt   grouprs   r.   float	Exception)rY   merK   kvibounding_boxreading_trailer_commentsru   trailer_reacheds          r   read_comment(EpsImageFile._open.<locals>.read_comment   s    .KKN
 771a=DADIIaLM!	>/3,  &/>V @Awwy'Iy!E!Hy'I ) 88 .'!#&A-." (J$ s;   B (C :CC C1B??CC 
CCr   re   s   
%ry      s   %%EndCommentszlatin-1rq   	    zbad EPS header   s   %ImageData:   c              3  8   #    U  H  n[        U5      v   M     g 7fN)r.   ).0values     r   	<genexpr>%EpsImageFile._open.<locals>.<genexpr>L  s      5,A5CJJ,As   r`   1      s   %%EOFs	   %%Trailerz!cannot determine EPS bounding boxr   r   epsr   r   returnNone)rY   r+   r   bool)_find_offsetrH   r7   _mode	bytearray
memoryviewr;   ordrt   r+   fieldr{   r~   r   rs   r   rz   mode_map
ValueError_sizer   _TilerG   rF   )ru   rL   offsetimagedata_sizebyte_arrbytes_mv
bytes_readreading_header_commentsrv   r   byterK   rY   r   r   image_data_valuescolumnsrows	bit_depthmode_idr   r   r   s   `                   @@@r   _openEpsImageFile._open   sG   ,,TWW5 	V
 *.15S>h'
"&#( 	'	 	4 77<<?Ds{?.68 #  ? #
 $  {c#h./)#..2:<6;3 &'
'+Aw$a
& A;#c(*hsm?O.O24.3+*-y9#AAAGGAJ<<
3345abEDIIj1+-DIIaL1 .%cl* ' #2.0 "!"J %-R
$;$A$A$$J!5,=bq,A51y' >!$DJ!^%)]]7%;
  ")$"1) %=*-y9Q"1-"&JW ^ 5C#, $ 
Ol1o-Ol1o-(

 OOE6DII#5v?UV
	= & s   K 
K,+K,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   ra   r   ry   )r;   r7   r8   r9   r:   rb   rt   )ru   rH   rY   rL   r   rK   s         r   r   EpsImageFile._find_offsetw  s    GGAJ<GGAr{{#WWYFF ~ Vz! 
AVFAYF
 ~ $Cc""re   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      $ r   )
rF   r]   rG   rH   rC   moder   r   r   rB   )ru   rI   rJ   s      r   rB   EpsImageFile.load  sc     99!$))TYYUDGDJDJDI{{%%re   c                    g r    )ru   poss     r   	load_seekEpsImageFile.load_seek  s     	re   )r   r   rC   rF   Nr   )rH   	IO[bytes]r   tuple[int, int]r   F)rI   r.   rJ   r   r   zImage.core.PixelAccess | None)r   r.   r   r   )__name__
__module____qualname____firstlineno____doc__formatformat_descriptionr   r   r   rB   r   __static_attributes__r   re   r   rg   rg      sQ    8F25Uv6Hv
p0 49	&	&,0	&	&	&re   rg   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[        R                  " SSU R                  -   5      /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.rj   )r   r   s   imagerl   )r   r   s   false 3 colorimagerm   )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   s   
%%%%EndBinary
s   grestore end
N)
rB   r   r   r>   rG   r3   r   r   _saver   )rC   rH   filenamer   operatorrK   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

OOBY__UFRWW4DEFGHH!"HHr7

 re   z.psz.epszapplication/postscript)r   r   r   )rF   zlist[ImageFile._Tile]rG   r   rH   r   rI   r.   rJ   r   r   zImage.core.ImagingCore)rc   bytesr   r   )r   )
rC   zImage.ImagerH   r   r   zstr | bytesr   r.   r   r   ) 
__future__r   r8   r1   r|   r   r   r/   typingr   r   r   r   _binaryr   rb   compilerz   r   r	   __annotations__r   r   r]   rd   rg   r   register_openr   register_saveregister_extensionsregister_mimer   re   r   <module>r      s)  , # 	 	 	  
    !
 	

23


,-#	 # "6 e
e
e 	e 	e
 e ePe9&& eV.h   L''w ?   L'' /   ,--v ?   L'')A Bre   