Ë
    ul�jP  ã                   ób  — d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlZ	d dl
mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZmZmZ d dlmZ  ed«      duZ  ed«      duZ! ejD                  e#«      Z$d	„ Z% e&ejN                  jP                  ejN                  jR                   ejT                  ejN                  jR                  d
¬«      e%¬«      Z+dZ, e&dde-¬«      Z. e&dddd¬«      Z/d„ Z0 G d„ d«      Z1 G d„ de1«      Z2 G d„ de2«      Z3 G d„ de1«      Z4d„ Z5d„ Z6d „ Z7d!„ Z8d"„ Z9y)#é    N)ÚPath)Ú	find_spec)Úsetup_logging)Ú	add_inputÚ	get_inputÚiterator_hasvalue)ÚBooleanOptionalActionÚPILÚcv2c                 óä   — |t         j                  k(  rd}n6|t         j                  k(  rd}n t        dt        j
                  |   › d�«      ‚t        j                  j                  | ||g|¢­i |¤ŽS )NFTz5Cannot create foreign_simple bitmap with bitmap type ú.)	Úpdfium_cÚFPDFBitmap_BGRxÚFPDFBitmap_BGRAÚRuntimeErrorÚpdfium_iÚBitmapTypeToStrÚpdfiumÚ	PdfBitmapÚnew_foreign_simple)ÚwidthÚheightÚformatÚargsÚkwargsÚ	use_alphas         úJ/var/www/html/pp/venv/lib/python3.12/site-packages/pypdfium2_cli/render.pyÚ_bitmap_wrapper_foreign_simpler      sr   € Ø”×)Ñ)Ò)Ø‰	Ø	”8×+Ñ+Ò	+Ø‰	äÐRÔS[×SkÑSkÐlrÑSsÐRtÐtuÐvÓwÐwÜ×Ñ×.Ñ.¨u°f¸iÐYÈ$ÒYÐRXÑYÐYó    T)Úforce_packed)ÚnativeÚforeignÚforeign_packedÚforeign_simple)Ú	path_fillÚpath_strokeÚ	text_fillÚtext_strokeÚCé   )ÚmetavarÚnargsÚtype)éª   éd   r   éÿ   )r   é–   r0   r0   ©r0   r0   r0   r0   )r1   r0   r   r0   c           
      ó’  ‡— t        | d¬«       | j                  ddd„ dd¬«       | j                  dd	¬
«       | j                  ddt        j                  d¬«       t        t
        t        dœŠ| j                  ddˆfd„dt        ‰j                  «       «      › �¬«       | j                  ddt        d¬«       | j                  ddt        dd¬«        | j                  	 djddit        ¤Ž | j                  d d!d"¬#«       | j                  d$d%d&t        d'd(¬)«       | j                  d*t        dd+¬,«       | j                  d-t        dd.¬,«       | j                  d/d0g d1t        j                  d2¬3«       | j                  d4d5d6¬7«       | j                  d8d9¬:«      }|j                  d;t        j                  «       d<d=t        j                  ¬>«       |j                  d?d5d@¬7«       |j                  dAdBdC„ dD¬«       |j                  dEdFt        dG¬H«       |j                  dIt        dJ¬7«       | j                  dKdL¬:«      }|j                  dMdNt        t        j                   dO¬P«       |j                  dQt#        j$                  «       t        dR¬«       |j                  dSdTdUt        j                  dV¬W«       |j                  dXdYdZt        j                  d[¬W«       |j                  d\t        j                  d]¬«       | j                  d^d_¬:«      }|j                  d`d5da¬7«        |j                  dki t        ¤Ž  |j                  dli t        ¤Ž  |j                  dmi t        ¤Ž  |j                  dni t        ¤Ž |j                  dbd5dc¬7«       | j                  ddde¬:«      }|j                  dfd5dg¬7«       |j                  dhd5di¬7«       y )oNT)Úpagesz--outputz-oc                 óP   — t        | «      j                  «       j                  «       S ©N)r   Ú
expanduserÚresolve)Úps    r   ú<lambda>zattach.<locals>.<lambda><   s   € œ˜a›×+Ñ+Ó-×5Ñ5Ó7€ r   zDOutput directory where the serially numbered images shall be placed.)r-   ÚrequiredÚhelpz--prefixzDCustom prefix for the images. Defaults to the input filename's stem.)r<   z--formatz-fz/The image format to use (default: conditional).)r-   r<   )Úpilz	numpy+pilz	numpy+cv2z--engineÚ
engine_clsc                 ó*   •— ‰| j                  «          S r6   ©Úlower)ÚkÚengines_maps    €r   r:   zattach.<locals>.<lambda>M   s   ø€ ˜ Q§W¡W£YÑ/€ r   zThe saver engine to use )Údestr-   r<   z--scaleé   zªDefine the resolution of the output images. By default, one PDF point (1/72in) is rendered to 1x1 pixel. This factor scales the number of pixels that represent one point.)Údefaultr-   r<   z
--rotationr   )r   éZ   é´   i  z'Rotate pages by 90, 180 or 270 degrees.)rF   r-   Úchoicesr<   r<   z˜Color the bitmap will be filled with before rendering. Shall be given in RGBA format as a sequence of integers ranging from 0 to 255. Defaults to white.z--optimize-mode)ÚlcdÚprintz3The rendering optimisation mode. None if not given.)rI   r<   z--cropr)   r*   )r   r   r   r   z/Amount to crop from (left, bottom, right, top).)r+   r,   r-   rF   r<   z--draw-annotsz1Whether annotations may be shown (default: true).)ÚactionrF   r<   z--draw-formsz+Whether forms may be shown (default: true).z--no-antialiasú+)ÚtextÚimageÚpathz&Item types that shall not be smoothed.)r,   rF   rI   r-   r<   z--force-halftoneÚ
store_truez)Always use halftone for image stretching.)rL   r<   zBitmap optionsz&Bitmap config, including pixel format.)ÚtitleÚdescriptionz--bitmap-makerr!   zThe bitmap maker to use.)rI   rF   r<   r-   z--grayscalez0Whether to render in grayscale mode (no colors).z--byteorderÚrev_byteorderc                 ó.   — dddœ| j                  «          S )NFT)ÚbgrÚrgbr@   )Úvs    r   r:   zattach.<locals>.<lambda>š   s   €  ¨tÑ4°Q·W±W³YÑ?€ r   z;Whether to use BGR or RGB byteorder (default: conditional).z--x-channelÚprefer_bgrxz@Whether to prefer BGRx/RGBx over BGR/RGB (default: conditional).)rD   rL   r<   z--maybe-alphazÛWhether to use BGRA if page content has transparency. Note, this makes format selection page-dependent. As this behavior can be confusing, it is not currently the default, but recommended for performance in these cases.ÚParallelizationz.Options for rendering with multiple processes.z--linearú?z°Render non-parallel if page count is less or equal to the specified value (default: 4). If this flag is given without a value, then render linear regardless of document length.)r,   r-   Úconstr<   z--processeszXThe maximum number of parallel rendering processes. Defaults to the number of CPU cores.z--parallel-strategy)ÚspawnÚ
forkserverÚforkr]   zQThe process start method to use. ('fork' is discouraged due to stability issues.))rI   rF   r-   r<   z--parallel-lib©ÚmpÚftra   zRThe parallelization module to use (mp = multiprocessing, ft = concurrent.futures).z--parallel-mapzLThe map function to use (backend specific, the default is an iterative map).zFlat color schemezÚOptions for using pdfium's color scheme renderer. Note that this may flatten different colors into one, so the usability of this is limited. Alternatively, consider post-processing with lightness inversion (see below).z--sample-themezWUse a dark background sample theme as base. Explicit color params override selectively.z--fill-to-strokea  When rendering with custom color scheme, only draw borders around fill areas using the `path_stroke` color, instead of filling with the `path_fill` color. This is actually recommended, since with a single fill color for paths the boundaries of adjacent fill paths are less visible.zPost processingzgOptions to post-process rendered images. Note, this may have a strongly negative impact on performance.z--invert-lightnessa]  Invert lightness using the HLS color space (e.g. white<->black, dark_blue<->light_blue). The intent is to achieve a dark theme for documents with light background, while providing better visual results than classical color inversion or a flat pdfium color scheme. However, note that --optimize-mode lcd is not recommendable when inverting lightness.z--exclude-imagesz7Whether to exclude PDF images from lightness inversion.)z--fill-color)z--path-fill)z--path-stroke)z--text-fill)z--text-stroke)r   Úadd_argumentÚstrrA   Ú	PILEngineÚNumpyPILEngineÚNumpyCV2EngineÚtupleÚkeysÚfloatÚintÚ	ColorOptsr	   Úadd_argument_groupÚBitmapMakersÚmathÚinfÚosÚ	cpu_count)ÚparserÚbitmapÚparallelÚcolor_schemeÚpostprocrC   s        @r   Úattachrx   8   s§  ø€ Üˆf˜DÕ!Ø
×ÑØ�DÙ7ØØUð	 ô ð ×ÑØØUð ô ð ×ÑØ�DÜ�y‰yØ@ð ô ô
 $´.Ì~Ñ^€KØ
×ÑØØÛ/Ø)¬%°×0@Ñ0@Ó0BÓ*CÐ)DÐEð	 ô ð ×ÑØØÜð |ð	 ô ð ×ÑØØÜØ#Ø8ð ô ð €F×ÑØñð jðô òð
 ×ÑØØ"ØDð ô ð
 ×ÑØØ˜1¤5ØØ@ð	 ô ð ×ÑØÜ&ØØBð	 ô ð ×ÑØÜ&ØØ<ð	 ô ð ×ÑØØØØ+Ü�y‰yØ7ð ô ð ×ÑØØØ:ð ô ð ×&Ñ&Ø Ø>ð 'ó €Fð ×ÑØÜ×#Ñ#Ó%ØØ)Ü�y‰yð ô ð ×ÑØØØAð ô ð
 ×ÑØØÙ?ØLð	 ô ð ×ÑØØÜ&ØQð	 ô ð ×ÑØÜ&ð mð ô ð ×(Ñ(Ø!ØFð )ó €Hð ×ÑØØÜÜ—‘ð Bð ô ð ×ÑØÜ—,‘,“.ÜØið	 ô ð ×ÑØØ1ØÜ�y‰yØbð ô ð ×ÑØØØÜ�y‰yØcð ô ð ×ÑØÜ�y‰yØ]ð ô ð ×,Ñ,Ø#ð sð -ó €Lð ×ÑØØØhð ô ð
 €L×ÑÑ;´Ò;Ø€L×ÑÑ;´Ò;Ø€L×ÑÑ;´Ò;Ø€L×ÑÑ;´Ò;Ø×ÑØØð kð ô ð ×(Ñ(Ø!Øð )ó €Hð ×ÑØØð oð ô ð
 ×ÑØØØHð õ r   c                   ó   — e Zd Zd„ Zd„ Zd„ Zy)ÚSavingEnginec                 ó    — || _         || _        y r6   )r   Úpostproc_kwargs)ÚselfÚ
saver_argsr|   s      r   Ú__init__zSavingEngine.__init__ô   s   € ØˆŒ	Ø.ˆÕr   c                 ó~   — | j                   }|j                  |j                  › |dz   d|j                  › d�›d|› �z  S )NrE   Ú0Údr   )r   Ú
output_dirÚprefixÚn_digits)r}   ÚiÚextr   s       r   Ú	_get_pathzSavingEngine._get_pathø   sA   € Ø�y‰yˆØ�‰ D§K¡K =°°1±°Q°t·}±}°oÀQÐ4FÐ0GÀqÈÈÐ!NÑNÐNr   c                 ó–  — | j                   j                  rE| j                   j                  dv r-t        j                  |«      rt
        j                  d«       d}n| j                   j                  }| j                  ||«      }| j                  |||| j                  «       t
        j                  d|dz   › d|j                  › �«       y )N)ÚjpgÚjpegz8Page has transparency - overriding output format to PNG.ÚpngzWrote page rE   z as )r   Úmaybe_alphar   r   ÚFPDFPage_HasTransparencyÚloggerÚinforˆ   Ú_saving_hookr|   Úname)r}   r†   rt   Úpager‡   Úout_paths         r   Ú__call__zSavingEngine.__call__ü   sš   € Ø�9‰9× Ò  T§Y¡Y×%5Ñ%5¸Ñ%HÌX×MnÑMnÐosÔMtä�K‰KÐRÔSØ‰Cà—)‘)×"Ñ"ˆCØ—>‘> ! SÓ)ˆØ×Ñ˜( F¨D°$×2FÑ2FÔGÜ�‰�k ! A¡#  d¨8¯=©=¨/Ð:Õ;r   N)Ú__name__Ú
__module__Ú__qualname__r   rˆ   r•   © r   r   rz   rz   ò   s   „ ò/òOó	<r   rz   c                   ó°   — e Zd Zd„ Z eej                  j                  «      Zd„ Z	ed„ «       Z
dZe ej                  d¬«      d„ «       «       Zed„ «       Zy	)
re   c                 ón   — | j                   d   sy t        j                  d«       dd ladd ladd ladd lay )NÚinvert_lightnessz&PIL engine imports for post-processingr   )r|   r�   ÚdebugÚ	PIL.Imager
   ÚPIL.ImageOpsÚPIL.ImageFilterÚPIL.ImageDraw©r}   s    r   Ú
do_importszPILEngine.do_imports
  s-   € Ø×#Ñ#Ð$6Ò7ØÜ�‰Ð=Ô>ãÛÛÜr   c                 ó”   — |j                  |«      }| j                  |«      } | j                  |||fi |¤Ž}|j                  |«       y r6   )Úget_posconvÚ_to_pil_hookÚpostprocessÚsave)r}   r”   rt   r“   r|   ÚposconvÚ	pil_images          r   r‘   zPILEngine._saving_hook  sI   € Ø×$Ñ$ TÓ*ˆØ×%Ñ% fÓ-ˆ	Ø$�D×$Ñ$ Y°°gÑQÀÑQˆ	Ø�‰�xÕ r   c                 óp   — t        j                  | ||«      \  }}}d|z
  }t        j                  |||«      S )NrE   )ÚcolorsysÚ
rgb_to_hlsÚ
hls_to_rgb)ÚrÚgÚbÚhÚlÚss         r   Ú_invert_px_lightnesszPILEngine._invert_px_lightness  s:   € ä×%Ñ% a¨¨AÓ.‰ˆˆ1ˆaØ�‰EˆÜ×"Ñ" 1 a¨Ó+Ð+r   é   rE   )Úmaxsizec                 ó~   — t         j                  j                  j                  | j                  | j
                  «      S r6   )r
   ÚImageFilterÚ
Color3DLUTÚgenerateÚLINV_LUT_SIZErµ   )Úclss    r   Ú_get_linv_lutzPILEngine._get_linv_lut$  s-   € ô �‰×)Ñ)×2Ñ2°3×3DÑ3DÀc×F^ÑF^Ó_Ð_r   c           	      ól  — |}|�r(|j                   dk(  r t        j                  j                  |«      }n|j	                  | j                  «       «      }|rØt        |j                  t        j                  gd¬«      «      \  }}|r¨t        j                  j                  d|j                  «      }	t        j                  j                  |	«      }
|D ]G  }|j                  «       D ��cg c]  \  }}|j!                  ||«      ‘Œ }}}|
j#                  |d¬«       ŒI |j%                  ||	¬«       |S c c}}w )NÚLrE   ©Ú	max_depthÚ1)Úfill)Úmask)Úmoder
   ÚImageOpsÚinvertÚfilterr¾   r   Úget_objectsr   ÚFPDF_PAGEOBJ_IMAGEÚImageÚnewÚsizeÚ	ImageDrawÚDrawÚget_quad_pointsÚ	to_bitmapÚpolygonÚpaste)r½   Ú	src_imager“   r©   rœ   Úexclude_imagesÚ	dst_imageÚhave_imagesÚ
obj_walkerrÅ   ÚdrawÚobjÚxÚyÚqpointss                  r   r§   zPILEngine.postprocess)  s
  € àˆ	ÚØ�~‰~ Ò$ÜŸL™L×/Ñ/°	Ó:‘	à%×,Ñ,¨S×->Ñ->Ó-@ÓA�	Ùô +<¸T×=MÑ=MÌx×OjÑOjÐNkÐwxÐ=MÓ=yÓ*{Ñ'�˜ZÙÜŸ9™9Ÿ=™=¨¨i¯n©nÓ=�DÜŸ=™=×-Ñ-¨dÓ3�DØ)ò 6˜ØGJ×GZÑGZÓG\×"]¹t¸qÀ! 7×#4Ñ#4°Q¸Õ#:Ð"]˜Ñ"]ØŸ™ W°1˜Õ5ð6ð —O‘O I°D�OÔ9ØÐùó #^s   Ã'D0N)r–   r—   r˜   r£   Ústaticmethodr   r   Úto_pilr¦   r‘   rµ   r¼   ÚclassmethodÚ	functoolsÚ	lru_cacher¾   r§   r™   r   r   re   re     s|   „ òñ   × 0Ñ 0× 7Ñ 7Ó8€Lò!ð ñ,ó ð,ð
 €MàØ€Y×Ñ Ô#ñ`ó $ó ð`ð ñó ñr   re   c                   ó.   ‡ — e Zd Zˆ fd„Zed„ «       Zˆ xZS )rf   c                 óT   •— t         j                  d«       dd lat        ‰| �  «        y )NzNumPy+PIL engine importsr   )r�   r�   rž   r
   Úsuperr£   )r}   Ú	__class__s    €r   r£   zNumpyPILEngine.do_importsA  s   ø€ Ü�‰Ð/Ô0ãÜ‰ÑÕr   c                 ór   — t         j                  j                  | j                  «       | j                  «      S r6   )r
   rÌ   Ú	fromarrayÚto_numpyrÆ   )rt   s    r   r¦   zNumpyPILEngine._to_pil_hookG  s$   € ä�y‰y×"Ñ" 6§?¡?Ó#4°f·k±kÓBÐBr   )r–   r—   r˜   r£   rß   r¦   Ú__classcell__)rç   s   @r   rf   rf   ?  s   ø„ ôð ñCó ôCr   rf   c                   ó(   — e Zd Zd„ Zd„ Zed„ «       Zy)rg   c                 ó^   — t         j                  d«       dd la| j                  d   rdd lay y )NzNumPy+cv2 engine importsr   rÖ   )r�   r�   r   r|   ÚnumpyÚnpr¢   s    r   r£   zNumpyCV2Engine.do_importsN  s)   € Ü�‰Ð/Ô0ãØ×ÑÐ 0Ò1Üð 2r   c                 óŒ   — |j                  «       } | j                  |||fi |¤Ž}t        j                  t	        |«      |«       y r6   )rê   r§   r   Úimwriterd   )r}   r”   rt   r“   r|   Únp_arrays         r   r‘   zNumpyCV2Engine._saving_hookU  s;   € Ø—?‘?Ó$ˆØ#�4×#Ñ# H¨f°dÑN¸oÑNˆÜ�‰”C˜“M 8Õ,r   c                 ó  — |}|�rÿ|j                   t        j                  k(  r| }n¯|j                  r t        j
                  t        j                  fnt        j                  t        j                  f\  }}t        j                  ||«      }t        j                  |«      \  }	}
}|
 }
t        j                  |	|
|g«      }t        j                  ||«      }|�r,|j                   t        j                  k7  sJ d«       ‚|j                  |«      }t        |j                  t        j                   gd¬«      «      \  }}|rÇt"        j%                  |j&                  |j(                  dft"        j*                  «      }|D ]o  }t"        j-                  |j/                  «       D ��cg c]  \  }}|j1                  ||«      ‘Œ c}}t"        j2                  «      }t        j5                  ||gd«       Œq t        j7                  |||¬«      }|S c c}}w )Nz=Not sure how to paste with mask on {RGB,BGR}X image using cv2rE   rÁ   )rÅ   Údst)r   r   ÚFPDFBitmap_GrayrT   r   ÚCOLOR_RGB2HLSÚCOLOR_HLS2RGBÚCOLOR_BGR2HLSÚCOLOR_HLS2BGRÚcvtColorÚsplitÚmerger   r¥   r   rÊ   rË   rï   Úzerosr   r   Úuint8ÚarrayrÑ   rÒ   Úint32ÚfillPolyÚcopyTo)r½   rÕ   rt   r“   rœ   rÖ   r×   Ú
convert_toÚconvert_fromr²   r³   r´   r©   rØ   rÙ   rÅ   rÛ   rÜ   rÝ   rÞ   s                       r   r§   zNumpyCV2Engine.postprocessZ  sÌ  € àˆ	ÚØ�}‰}¤× 8Ñ 8Ò8Ø&˜J‘	àU[×UiÒUi¬C×,=Ñ,=¼s×?PÑ?PÑ+QÔps÷  qBñ  qBô  DG÷  DUñ  DUð  pVÑ(�
˜LÜŸL™L¨°JÓ?�	ÜŸ)™) IÓ.‘��1�aØ�B�ÜŸI™I q¨!¨Q iÓ0�	ÜŸL™L¨°LÓA�	ÚØ—}‘}¬×(@Ñ(@Ò@ð  Bð  CBó  BÐ@Ø ×,Ñ,¨TÓ2�Ü*;¸T×=MÑ=MÌx×OjÑOjÐNkÐwxÐ=MÓ=yÓ*{Ñ'�˜ZÙÜŸ8™8 V§]¡]°F·L±LÀ!Ð$DÄbÇhÁhÓO�DØ)ò 9˜Ü"$§(¡(ÐPS×PcÑPcÓPe×+fÉÈÈ1¨G×,=Ñ,=¸aÀÕ,CÓ+fÔhj×hpÑhpÓ"q˜ÜŸ™ T¨G¨9°aÕ8ð9ô !$§
¡
¨9¸4ÀY 
Ó O�IØÐùó ,gs   Æ HN)r–   r—   r˜   r£   r‘   rá   r§   r™   r   r   rg   rg   L  s    „ òò-ð
 ñó ñr   rg   c                 óÒ   —  | «        t         j                  dt        j                  «       › �«        |«        t	        j
                  ||d¬«      }|r|j                  «        |||fay )NzInitializing data for process T)ÚpasswordÚ	autoclose)r�   r�   rq   Úgetpidr   ÚPdfDocumentÚ
init_formsÚProcObjs)Úlogging_initÚengine_initÚinputr  Úmay_init_formsr   ÚengineÚpdfs           r   Ú_render_parallel_initr  t  sU   € á„NÜ
‡K�KÐ0´·±³°Ð>Ô?Ù„Mä
×
Ñ
˜U¨XÀÔ
F€CÙØ�‰Ôð �V˜VÐ$�Hr   c                 óf   — ||    } |j                   di |¤Ž} || ||«       |j                  «        y )Nr™   )ÚrenderÚclose)r†   r  r   r  r“   rt   s         r   Ú_render_jobr  ‚  s3   € àˆq‰6€DØˆT�[‰[Ñ"˜6Ñ"€FÙ
ˆ1ˆf�dÔØ‡J�J…Lr   c                 ó$   — t        | gt        ¢­Ž  y r6   )r  r  )r†   s    r   Ú_render_parallel_jobr  ‰  s   € ä�Ð”HÔr   c                   ó   — y r6   r™   r™   r   r   Ú_do_nothingr  �  s   � r   c                 óz  ‡— | j                   j                  «       st        d| j                   ›�«      ‚t        | | j                  ¬«      }t        |«      Št        ˆfd„| j                  D «       «      st        d«      ‚t        | j                  «      t        t        | j                  «      «      k7  rt        d«      ‚| j                  €| j                  j                  › d�| _	        | j                  €| j                  rdnd| _        | j                  €| j                  d	   d
k(  rdnd| _        | j                  €d| _        | j                   €Et"        st$        sJ d«       ‚t"        rt$        r| j                  dk(  rt&        | _        nt(        | _        | j*                  €t-        | j                   t(        «      | _        | j.                  €0t-        | j                   t(        «      xr | j                  dk7  | _        t1        «       }| j                  r |j2                  d"i t4        ¤Ž  |j2                  d"i t6        D �ci c]  }t9        | |«      sŒ|t9        | |«      “Œ c}¤Ž |rt;        j<                  d"i |¤Žnd }t1        | j>                  | j@                  | jB                  | jD                  | j                  | jF                  | jH                  | j                  | jJ                  | j*                  | j.                  | jL                  tN        | jP                     || jR                  ¬«      }| jT                  D ]
  }d|d|› �<   Œ tW        jX                  | j                   | j                  t        t[        ‰«      «      | j                  | jL                  ¬«      }t1        | j\                  | j^                  ¬«      }| j\                  r$| jF                  dk(  rt`        jc                  d«       te        | «      jg                  «       }	|	d= |	d= |	d   rd|	d<   t`        ji                  |	› «       |rt`        ji                  |› «       | j!                  ||«      }
t        | j                  «      | j                  k  rEt`        jk                  d«       |
jm                  «        | j                  D ]  }to        ||||
«       Œ y t`        jk                  d«       tq        jr                  | jt                  «      }t1        |jv                  dfty        jz                  t|        j~                  |¬«      df¬«      }|| j€                     \  }}| j‚                  r| j‚                  }| jt                  d k(  rt„        t„        }}|
jm                  «        nt†        |
jl                  }}t1        tˆ        |||jŠ                  | jŒ                  | j                  ||
f¬!«      }t�        | j�                  t        | j                  «      «      } ||fi |¤Ž5 }t9        ||«      } |t’        | j                  «      D ]  }Œ 	 d d d «       y c c}w # 1 sw Y   y xY w)#Nz*Output path is not an existing directory: )r
  c              3   ó>   •K  — | ]  }d |cxk  xr ‰k  nc –— Œ y­w)r   Nr™   )Ú.0r†   Úpdf_lens     €r   ú	<genexpr>zmain.<locals>.<genexpr>™  s   øè ø€ Ò4 Aˆq�AÖ˜×ÐÑ4ùs   ƒz*Out-of-bounds page indices are prohibited.z&Duplicate page indices are prohibited.Ú_)r   r   r   r0   r2   é   r0   rŠ   rŒ   r*   z?Either pillow or numpy+cv2 must be installed for rendering CLI.)ÚscaleÚrotationÚcropÚ	grayscaleÚ
fill_colorÚoptimize_modeÚdraw_annotsÚmay_draw_formsÚforce_halftonerT   rY   r�   Úbitmap_makerrv   Úfill_to_strokeTÚ	no_smooth)rƒ   r„   r…   r   r�   )rœ   rÖ   rJ   ztLCD optimization clashes with lightness inversion, as post-processing colors defeats the idea of subpixel rendering.Ú
subcommandr4   r  z<obfuscated>zLinear rendering ...zParallel rendering ...Úimap)Ú
mp_contextÚmapr`   r_   )ÚinitializerÚinitargsr™   )JÚoutputÚis_dirÚ
ValueErrorr   Ú
draw_formsÚlenÚallr4   Úsetr„   r  Ústemr&  Úsample_themer   Úlinearr>   Úhave_pilÚhave_cv2rg   re   rT   Ú
issubclassrY   ÚdictÚupdateÚSampleThemeÚColorSchemeFieldsÚgetattrr   ÚPdfColorSchemer"  r#  r$  r%  r'  r(  r*  r�   rn   r+  r,  Úno_antialiasÚtypesÚSimpleNamespacerd   rœ   rÖ   r�   ÚwarningÚvarsÚcopyr�   r�   r£   r  ra   Úget_contextÚparallel_strategyÚPoolrâ   Úpartialrb   ÚProcessPoolExecutorÚparallel_libÚparallel_mapr  r   r  Ú_inputr  ÚminÚ	processesr  )r   r  Ú	cs_kwargsÚfrv   r   r-   r~   r|   Ú
print_argsr  r†   ÚctxÚpool_backendsÚ	pool_ctorÚmap_attrr  r  Úpool_kwargsÚn_procsÚpoolÚmap_funcr   r  s                          @r   Úmainrb  ‘  s'  ø€ à�;‰;×ÑÔäÐEÀdÇkÁkÀ_ÐUÓVÐVä
�D T§_¡_Ô
5€CÜ�#‹h€GÜÓ4¨¯©Ô4Ô4ÜÐEÓFÐFÜ
ˆ4�:‰:ƒœ#œc $§*¡*›oÓ.Ò.ÜÐAÓBÐBà‡{�{ÐØŸ™Ÿ™Ð)¨Ð+ˆŒØ‡�ÐØ,0×,=Ò,=™.ÐCWˆŒØ‡{�{Ðà#Ÿ™¨qÑ1°SÒ8‘e¸eˆŒØ‡{�{ÐØˆŒð ‡�ÐÝ�8ÐfÐ%fÓfÐ#Ý�h¨4¯;©;¸%Ò+?Ü,ˆD�Oä'ˆDŒOð ×ÑÐ!Ü'¨¯©¼ÓCˆÔØ×ÑÐä% d§o¡o´yÓAÒZÀdÇkÁkÐUZÑFZˆÔä“€IØ×ÒØˆ	×ÑÑ'œ;Ò'Ø€I×ÑÑ\Ô5FÖ[°Ì'ÐRVÐXYÕJZ˜œ7 4¨Ó+Ñ+Ò[Ò\Ù9B”6×(Ñ(Ñ5¨9Ò5È€LäØ—
‘
Ø—=‘=Ø�y‰yØ—N‘NØ—_‘_Ø×*Ñ*Ø×&Ñ&ØŸ™Ø×,Ñ,Ø×*Ñ*Ø×&Ñ&Ø×&Ñ&Ü# D×$5Ñ$5Ñ6Ø#Ø×,Ñ,ô€Fð" ×!Ñ!ò *ˆØ%)ˆ�˜4˜&Ð!Ò"ð*ô ×&Ñ&Ø—[‘[Ø—‘Ü”s˜7“|Ó$Ø—‘Ø×&Ñ&ô€Jô Ø×0Ñ0Ø×,Ñ,ô€Oð ×Ò ×!3Ñ!3°uÒ!<Ü�‰ð  Nô  	Oä�d“—‘Ó"€JØ�<Ð  *¨WÐ"5Ø�*ÒØ!/ˆ
�:ÑÜ
‡L�L�J�<Ô!ÙÜ�‰˜�~Ô'à�_‰_˜Z¨Ó9€Fä
ˆ4�:‰:ƒ˜$Ÿ+™+Ò%ä�‰Ð*Ô+Ø×ÑÔØ—‘ò 	0ˆAÜ˜˜3 ¨Õ/ñ	0ô
 	�‰Ð,Ô-ä�n‰n˜T×3Ñ3Ó4ˆÜØ—(‘(˜FÐ#Ü×#Ñ#¤B×$:Ñ$:ÀsÔKÈUÐSô
ˆð ,¨D×,=Ñ,=Ñ>Ñˆ	�8Ø×ÒØ×(Ñ(ˆHà×!Ñ! VÒ+Ü(3´[˜+ˆLØ×ÑÕä(5°v×7HÑ7H˜+ˆLäÜ/Ø$ k°3·:±:¸t¿}¹}ÈdÏoÉoÐ_eÐgmÐnô
ˆô
 �d—n‘n¤c¨$¯*©*£oÓ6ˆÙ�wÑ. +Ñ.ð 	°$Ü˜t XÓ.ˆHÙÔ2°D·J±JÓ?ò �Øñ÷	ð 	ùò_ \÷^	ð 	ús   È=X,ÉX,×9)X1Ø1X:):rq   ro   rH  Úloggingr¬   râ   Úpathlibr   Úmultiprocessingra   Úconcurrent.futuresÚfuturesrb   Úimportlib.utilr   Úpypdfium2._helpersÚ_helpersr   Úpypdfium2.internalÚinternalr   Úpypdfium2.rawÚrawr   Úpypdfium2_cli._setupr   Úpypdfium2_cli._parsersr   r   r   Úpypdfium2_cfg.stlr	   r>  r?  Ú	getLoggerr–   r�   r   rA  r   Ú
new_nativeÚnew_foreignrP  rn   rD  rk   rl   rC  rx   rz   re   rf   rg   r  r  r  r  rb  r™   r   r   ú<module>ru     sB  ðó 
Û Û Û Û Û Ý Û Ý Ý $å #Ý %Ý  Ý .÷ñ õ 4á�UÓ 4Ð'€Ù�UÓ 4Ð'€Ø	ˆ×	Ñ	˜8Ó	$€òZñ Ø×Ñ×(Ñ(Ø×Ñ×*Ñ*Ø&�Y×&Ñ& v×'7Ñ'7×'CÑ'CÐRVÔWØ3ô	€ð MÐ Ù˜ A¨CÔ0€	Ùà&Ø&Ø&Ø&ô€òw÷t<ñ <ô,4�ô 4ôn
C�iô 
Cô%�lô %òP%òòò ó{r   