+
    	iC                         R t ^ RIt^ RIt^ RIH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Ht ^RIHt ^R	IHt R
 tRR ltR tR tR tR tR# )z4Insert anchors, links, bookmarks and inputs in PDFs.N)md5)basename)unquoteurlsplit)
Attachment)LOGGER)ffigobjectpango)get_font_description)URLFetchingErrorc                   V w  rgV EF  w  rrVP                   ! V
R,          !  w  rVP                   ! V
R,          !  w  rVR9   g   KB  \        P                  ! RRRRR\        P                  ! WW.4      R	\        P                  ! R
^ /4      /4      Vn        Ve$   \        P
                  ! V	4      VP                  R&   VR8X  d%   \        P
                  ! V	4      VP                  R&   M=\        P                  ! RRRRR\        P
                  ! V	4      /4      VP                  R&   VP                  VP                  4       RV9  d   \        P                  ! 4       VR&   VR,          P                  VP                  P                  4       EK  	  V FT  pVw  pppVP                  VV4      w  ppVP                  V\        P                  ! VP                  RVV^ .4      .4       KV  	  R# )z%Include hyperlinks in given PDF page.N   Nr   NNinternalType/AnnotSubtypez/LinkRectBSWNContentsDest/ActionSz/URIURIAAnnots/XYZ)r   external)	transform_pointpydyf
DictionaryArraylink_annotationString
add_objectappend	reference)links_and_anchorsmatrixpdfpagenamestagslinksanchors	link_typelink_target	rectangleboxx1y1x2y2anchoranchor_namexys   &&&&&&              \/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/weasyprint/pdf/anchors.py	add_linksr?      s   &NE27.		''27''2700"'"2"27RR$45e&&Qx0	4 #C 27,,{2K##J/J&.3ll;.G##F++0+;+;I5<<4= ,##C(
 NN3../t#!&XN!!#"5"5"?"?@/ 382 "Q%%a+1dnnfaA%FGI 	J     c           	        \        V4      p. pV EF9  w  pw  rgrp
\        P                  ! V P                  V,          RWx^ 34      p\        P                  ! R\        P
                  ! V4      RV/4      pV P                  V4       \        W	VR7      w  rWR&   V
R8X  d   VR;;,          R,          uu&   MW>,          pV'       d-   VR,          P                  VR&   VP                  VR,          R&   V'       d-   V^ ,          P                  VR	&   VR,          P                  VR
&   Ve   VP                  VR&   VP                  V4       EK<  	  Vf   V'       d   \        P                  ! RVR	V^ ,          P                  R
VR,          P                  /4      pV P                  V4       V F  pVP                  VR&   K  	  VP                  V P                  R&   WC3# )z!Include bookmark outlines in PDF.r   Titler   )parentCountclosedPrevNextFirstLastParentOutlines)lenr"   r$   page_referencesr#   r&   r'   add_outlinesr)   r(   catalog)r,   	bookmarksrC   countoutlinestitler-   r<   r=   childrenstatedestinationoutlinechildren_outlineschildren_countoutlines_dictionarys   &&&             r>   rO   rO   6   s   	NEH09,|ukk3#6#6t#<faA"NO""U\\%(&+$? @w,8'-+))HG"#E&rl44GFO#*#4#4HRL 03==GG/3==GFO & 0 0GH ) 1:, ~(#..UXa[**HRL**0
 
 	*+G 3 = =GH  "5"?"?J?r@   c                   V '       d    \        V P                  4       4      '       g   R# RV9  d   \        P                  ! 4       VR&   RVP                  9  dG   \        P
                  ! R\        P                  ! 4       RVP                  RR/4      VP                  R&   VR,          P                  4       ^ ,          p\        P                  ! \        P                  ! V4      \        P                  4      pV P                  4        U	U
UUUu. uF  w  rV
 F
  w  rpWW3NK  	  K  	  pppp
p	p\        P                   ! \"        4      p\        P                   ! \"        4      p \%        V4       E	F  w  pw  rr. VP&                  ! VR	,          !  OVP&                  ! VR
,          !  O5pVP(                  P+                  R4      pVP(                  P+                  RR4      pRVP-                  4        RV 2pVP(                  P+                  RV4      pVR,          R,          pVP/                  4       pVP1                  VR,          4       \        P
                  ! RRRRR\        P                  ! V4      RVP                  R^R\        P2                  ! V4      /4      pVRO9   Ed   VR8X  d   VW,          9  d   \        P
                  ! RRRRPR\        P2                  ! V4      R R!R"\        P                  ! 4       R#\        P                  ! 4       /4      ;W,          V&   pVP5                  V4       VP                  R,          R,          P7                  VP                  4       W,          V,          pVR,          R$,          pR%pMR&pV^,          V^ ,          ,
          pV^,          V^,          ,
          pVP/                  R'VP                  RR(RR)R*\        P                  ! ^ ^ VV34      /R+7      pVP9                  4        VP;                  4        VP1                  VR,          4       VP=                  R,V4       VVR,          ,
          ^,          pVVR,          ,
          ^,          pVP?                  VV4       VPA                  V4       VPC                  4        VPE                  4        VP5                  V4       VP=                  R,V4       R-VP(                  9   pVR8X  d   \G        XR",          4      MR.p \        P
                  ! V VP                  /4      p!RVR&   \        P2                  ! R/PI                  VPJ                  4      4      VR0&   V'       d   R1V  2MR!VR2&   \        P
                  ! R3V!/4      VR4&   \        P
                  ! R5\        P2                  ! V4      /4      VR6&   VP5                  V4       VR8X  dp   XP                  VR7&   V'       d	   R1V  2VR &   VR",          P7                  VP                  4       VR#,          P7                  \        P2                  ! V4      4       EM\        P2                  ! V4      VR&   VR2,          VR &   EMVPL                  R88X  Ed   \O        V4      p"\        PP                  ! WhV"4      p#VPS                  V#4      w  p#p$R9V#n*        VP=                  V#PV                  V4       . p%. p&V F  p'\        P2                  ! V'P(                  P+                  RR:4      4      p(\        P2                  ! V'PX                  ;'       g    R:4      p)V%P7                  \        P                  ! V(V).4      4       R;V'P(                  9   g   K  V&P7                  V(4       K  	  R<VR&   \        P2                  ! R/PI                  VPJ                  4      4      VR0&   \        P                  ! V%4      VR#&   R=VP(                  9   d    RQVR&   \        P                  ! V&4      VR &   M/RRVR&   V&'       d
   V&RS,          M\        P2                  ! R:4      VR &   VP5                  V4       EMVR>8X  g   VPL                  R?8X  Ed>   ^p*V	P(                  P+                  R@R:4      P[                  4       RA8w  d
   V*^,          p*\        P                  ! RB W	,          P                  4        4       4      p+RVR&   \        P2                  ! R/PI                  VPJ                  4      4      VR0&   \        P2                  ! V	P(                  P+                  RR:4      4      VR &   RTVR&   \        P
                  ! RRCRDRER\        P2                  ! V	P(                  P+                  RF4      4      RV+RGV*/4      VRH&   VP5                  V4       EM^\O        V4      p"\        PP                  ! WhV"4      p#VPS                  V#4      w  p#p$R9V#n*        VP=                  V#PV                  V4       RIVR&   \        P2                  ! R/PI                  VPJ                  4      4      VR0&   \        P2                  ! VP(                  P+                  RR:4      4      VR &   VPL                  RJ8X  d4   RUVR&   \        P2                  ! VPX                  ;'       g    R:4      VR &   MVRK8X  d   RVVR&   MVRL8X  d   RWVR&   VP+                  RMR:4      ;p,P]                  4       '       d   V,VRN&   VP5                  V4       VR,          P7                  VP                  4       VP                  R,          R,          P7                  VP                  4       VV 9  g   E	K  VW	,          V&   E	K  	  R# u upppp
p	i )XzInclude form inputs in PDF.Nr   AcroFormFieldsDRNeedAppearancestruer   r   r   typevalueYeszunknown--name	font_sizeg      ?colorr   r   r   z/Widgetr   PFTradioFTz/BtnFfVz/OffKidsOptg      ?l4	Resources/XObject/FormBBox)extraZaDbcheckedon    DA/ASNAPCAMKrJ   selectT selectedz/Chmultiplesubmitbuttonmethodpostc              3   8   "   T F  qP                   x  K  	  R # 5iN)r)   ).0fields   & r>   	<genexpr>add_forms.<locals>.<genexpr>   s      S>RU>Rs   r   r   z/SubmitFormactionFlagsr   z/Txtextareapasswordfile	maxlengthMaxLen)rl   checkboxi   i    i   rL   i   i   i    i   )/anyvaluesr"   r$   rP   r#   r)   splitr   gcr
   pango_font_map_create_contextr	   g_object_unrefitemscollectionsdefaultdictdict	enumerater!   attribgetdecodeclone	set_colorr&   r'   r(   
push_state
begin_textset_font_sizemove_text_toshow_text_stringend_text	pop_staterM   joinstreamtagr   pango_font_map_load_fontadd_fontused_in_formshashtextlowerisdigit)-formsr+   r,   r-   	resourcesr   font_mappage_referencecontextforminputselementstyler4   inputs_with_formsradio_groupsi
input_typeinput_valuedefault_name
input_namerg   field_streamr   group	characterwidthheightchecked_streamr<   r=   rz   key
appearancefont_descriptionfont_optionsselected_valuesoptionrc   r   flagsfields
max_lengths-   &&&&&&&                                      r>   	add_formsr   ^   sT	   ELLN++tX$"'"2"2ekkm)%%v4
 #J
 *%++-a0Nff++H5 G
 "KKM)LD)/%GI 
))/ 	*)  
 **40L##D)E09:K0L,,D55##Yr]35##Yr]35	 ^^''/
nn((%8!."7"7"9!:!A3?^^''=
+&-	||~uW~.  HyEKK	*j)"
  ..W$\%77=B=M=Mf?U\\*5Vu{{}O > L&z2U NN5)KK
+H5<<U__M$*:6!+.4			 aL9Q</Eq\IaL0F#\\Y00
7Q5&$9:	1\ N %%'%%'$$U7^4((;T))Q.A)d**a/A''1-++I6##%$$&NN>*&&vy97>>1G(2g(=#eFm$4C))30H0H*IJJ E$K,,tyy1D1D'EFE$K'.AcU)FE$K**C+<=E$K**D%,,y2I+JKE$KNN5!W$"'//h#$SEE#Jf$$U__5e##ELL$=>"\\*5c
"4[c
[[H$3E:11#35Dood+GD!!%D&&tyy)<G O!V]]%6%6w%CD||FKK$5$526u{{E4=9:.#**51 "  E$K,,tyy1D1D'EFE$K ;;w/E%LW^^++d"[[9c
+d+:OB'b) c
 NN5!8#w{{h'> E{{x,224>%[[ Sek>P>P>R SSF E$K,,tyy1D1D'EFE$Kdkkoogr&BCE#J'E$K))	]U\\$++//(";<&+ E#J NN5!  4E:11#35Dood+GD!!%D&&tyy)<E$K,,tyy1D1D'EFE$Kgnn&8&8"&EFE#J{{j(+d"\\',,*<*<"=c
z)+dv%+d%kk+r::
CCEE",hNN5!Xeoo.J)00AU"&+EK
#{ 1Ms   m!c                   V  EF  w  rxrVR8w  d   K  W9  d%   \        WP                  R7      p\        W;V4      WX&   WX,          pVf   KH  . VP                  ! V	R,          !  OVP                  ! V	R,          !  O5p	\        P
                  ! . RRRR	R
\        P                  ! V	4      /V4      pVP                  V4       \        P                  ! RRR\        P                  ! V	4      RRR\        P                  ! 4       RVP                  R\        P                  ! RVP                  /4      RR/4      pVP                  V4       RV9  d   \        P                  ! 4       VR&   VR,          P                  VP                  4       EK  	  R# )zInclude annotations in PDF.
attachment)urlurl_fetcherNr   r   r   ru   r   rv   rw   r   r   z/FileAttachmentrk   FSr   r   r   z/Nr   )r   r   write_pdf_attachmentr!   r"   Streamr$   r'   r#   r&   r)   r(   )r0   r+   documentr,   r-   annot_filescompressr2   annot_targetr4   r   r   
annot_filer   annots   &&&&&&&        r>   add_annotationsr     st    27-	$* $ .B.BDJ(<)+K% .
5##Yr]35##Yr]35	 bJwEKK	*#
 	
 	v  HEKK	*(*&&%""C)9)9#:;$"
  	u4"[[]DNXeoo.M 27r@   c                &   R;r4 VP                   ;_uu_ 4       w  rSrdVP                  4       p\        V\        4      '       d   VP	                  4       pRRR4       \        XRR7      P                  4       Tn	        TP                  '       d   TP                  p	MMT'       dD   \        T4      P                  '       d)   \        \        \        T4      P                  4      4      p	MRp	T;'       g*    \         P"                  ! T	RR7      ^ ,          ;'       g    R	p\$        P&                  ! TP(                  P+                  R
4      4      p
\$        P&                  ! TP,                  P+                  R
4      4      p\$        P.                  ! RRRRTP1                  RR4       2R\$        P.                  ! RRTP                   R2R\3        T4      RT
RT/4      /4      p\$        P4                  ! T.YR7      pT P7                  T4       \$        P.                  ! RRR\$        P&                  ! T	P	                  RR7      4      R\$        P&                  ! T	4      R\$        P.                  ! RTP8                  /4      R\$        P&                  ! TP:                  ;'       g    R4      /4      pT P7                  T4       T#   + '       g   i     ELm; i  \
         d;   p\        P                  ! RT4       \        P                  ! RTR7        Rp?R# Rp?ii ; i) z&Write an attachment to the PDF stream.NzFailed to load attachment: %szError while loading attachment:)exc_infoF)usedforsecurityzattachment.bin)strictzapplication/octet-streamzD:%Y%m%d%H%M%SZr   z/EmbeddedFiler   r~   z#2fParamsCheckSum<>SizeCreationDateModDate)r   z	/Filespecrj   ignore)errorsUFEFDescr   )sourceread
isinstancestrencoder   r   errordebugr   	hexdigestrf   r   pathr   r   	mimetypes
guess_typer"   r&   createdstrftimemodifiedr#   replacerM   r   r'   r)   description)r,   r   r   r   	mime_typefile_objr   r   	exceptionfilenamecreationmod
file_extrafile_streampdf_attachments   &&&            r>   r   r   H  sy    C"?8!]]_F&#&&  7AACJN ??	####GHSM$6$678# 	# 	#Xe4Q7	# 	#" 
 ||J..778IJKH
,,z**334EF
GC!!Qy((e456%""!JNN+1-CKHs	$
 	# 	J ,,xGKNN;%%U\\(///:;ell8$e[%:%:;<Z3399r:' N NN>"]   4i@6Ks4   K :J7K 7K	K K L/LLc              #  *  "   \        4       p. p\        V 4       Fq  w  r4VP                  . 4       VP                  P	                  4        F=  w  pw  rg pWQ9  g   K  VR,          P                  WVV34       VP                  V4       K?  	  Ks  	  V  F|  p. p	VP                   FS  p
V
w  r pVR8X  d3   WQ9  d   \        P                  ! RV4       K/  V	P                  V
4       KB  V	P                  V
4       KU  	  WP                  ^ 4      3x  K~  	  R# 5i)a  Resolve internal hyperlinks.

Links to a missing anchor are removed with a warning.

If multiple anchors have the same name, the first one is used.

:returns:
    A generator yielding lists (one per page) like :attr:`Page.links`,
    except that ``target`` for internal hyperlinks is
    ``(page_number, x, y)`` instead of an anchor name.
    The page number is a 0-based index into the :attr:`pages` list,
    and ``x, y`` are in CSS pixels from the top-left of the page.

r   z(No anchor #%s for internal URI referenceNrL   )
setr   r(   r1   r   addr0   r   r   pop)pagesr1   paged_anchorsr   r-   r;   point_xpoint_yr   
page_linkslinkr2   s   &           r>   resolve_linksr    s     eGMU#R 59\\5G5G5I1K1'Aq)b!((+)HIK( 6J $ 
JJD+/(IAqJ&-LLB#% %%d+ !!$'  ++A... s   ADB7Dr   )__doc__r   r  hashlibr   os.pathr   urllib.parser   r   r"   r   r   loggerr   text.ffir   r	   r
   
text.fontsr   urlsr   r?   rO   r   r   r   r   r@   r>   <module>r(     sQ    :     *    * * - #!JH%Pu,p//d4n%/r@   