§
    ¥”j•"  ã                   ór   — d Z ddlZddlmZ  G d„ d¦  «        Z G d„ d¦  «        Zd	„ Z G d
„ d¦  «        ZdS )zðHandle target-counter, target-counters and target-text.

The TargetCollector is a structure providing required targets' counter_values
and stuff needed to build pending targets later, when the layout of all
targeted anchors has been done.

é    Né   )ÚLOGGERc                   ó   — e Zd ZdZdd„ZdS )ÚTargetLookupItemz‡Item controlling pending targets and page based target counters.

    Collected in the TargetCollector's ``target_lookup_items``.

    Úpendingc                 óL   — || _         d | _        i | _        d | _        i | _        d S )N)ÚstateÚ
target_boxÚparse_again_functionsÚpage_maker_indexÚcached_page_counter_values)Úselfr	   s     úe/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/weasyprint/css/targets.pyÚ__init__zTargetLookupItem.__init__   s6   € ØˆŒ
ð
 ˆŒð &(ˆÔ"ð !%ˆÔð +-ˆÔ'Ð'Ð'ó    N)r   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r   r      s2   € € € € € ðð ð
-ð -ð -ð -ð -ð -r   r   c                   ó   — e Zd ZdZd„ ZdS )ÚCounterLookupItemzmItem controlling page based counters.

    Collected in the TargetCollector's ``counter_lookup_items``.

    c                 óZ   — || _         || _        || _        d | _        d| _        i | _        d S )NF)Úparse_againÚmissing_countersÚmissing_target_countersr   r   r   )r   r   r   r   s       r   r   zCounterLookupItem.__init__-   s?   € à&ˆÔð !1ˆÔØ'>ˆÔ$ð !%ˆÔð ˆŒð +-ˆÔ'Ð'Ð'r   Nr   r   r   r   r   r   '   s-   € € € € € ðð ð
-ð -ð -ð -ð -r   r   c                 óÐ   — | d         dk    r+| d                               d¦  «        r| d         dd…         S | d         dk    r | d         d         dk    r| d         d         S dS dS )z)Get anchor name from string or uri token.r   Ústringé   ú#NÚurlÚinternal)Ú
startswith)Úanchor_tokens    r   Úanchor_name_from_tokenr&   ?   sz   € à�A„˜(Ò"Ð" |°A¤×'AÒ'AÀ#Ñ'FÔ'FÐ"Ø˜AŒ˜q˜r˜rÔ"Ð"Ø	�aŒ˜EÒ	!Ð	! l°1¤o°aÔ&8¸JÒ&FÐ&FØ˜AŒ˜qÔ!Ð!ð 
"Ð	!Ð&FÐ&Fr   c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚTargetCollectorz@Collector of HTML targets used by CSS content with ``target-*``.c                 ó>   — i | _         i | _        d| _        d| _        d S )NTF)Útarget_lookup_itemsÚcounter_lookup_itemsÚ
collectingÚhad_pending_targets)r   s    r   r   zTargetCollector.__init__J   s+   € à#%ˆÔ Ø$&ˆÔ!ð ˆŒð
 $)ˆÔ Ð Ð r   c                 óä   — t          |t          ¦  «        rZ| j                             |¦  «        �t	          j        d|¦  «         dS | j                             |t          ¦   «         ¦  «         dS dS )z7Create a TargetLookupItem for the given `anchor_name``.NzAnchor defined twice: %r)Ú
isinstanceÚstrr*   Úgetr   ÚwarningÚ
setdefaultr   )r   Úanchor_names     r   Úcollect_anchorzTargetCollector.collect_anchorZ   s   € å�k¥3Ñ'Ô'ð 	5ØÔ'×+Ò+¨KÑ8Ô8ÐDÝ”Ð9¸;ÑGÔGÐGÐGÐGàÔ(×3Ò3ØÕ!1Ñ!3Ô!3ñ5ô 5ð 5ð 5ð 5ð		5ð 	5r   c                 ó  — t          |¦  «        }| j                             |t          d¦  «        ¦  «        }|j        dk    r$d| _        |j                             ||f|¦  «         |j        dk    rt          j	        d|¦  «         |S )zîGet a TargetLookupItem corresponding to ``anchor_token``.

        If it is already filled by a previous anchor-element, the status is
        'up-to-date'. Otherwise, it is 'pending', we must parse the whole
        tree again.

        Ú	undefinedr   Tz7Content discarded: target points to undefined anchor %r)
r&   r*   r1   r   r	   r-   r   r3   r   Úerror)r   r%   Ú
source_boxÚ	css_tokenr   r4   Úitems          r   Úlookup_targetzTargetCollector.lookup_targetc   s£   € õ -¨\Ñ:Ô:ˆØÔ'×+Ò+ØÕ)¨+Ñ6Ô6ñ8ô 8ˆð Œ:˜Ò"Ð"Ø'+ˆDÔ$ØÔ&×1Ò1Ø˜YÐ'¨ñ6ô 6ð 6ð Œ:˜Ò$Ð$ÝŒLØIØñô ð ð ˆr   c                 óÐ   — | j                              |¦  «        }|rE|j        dk    r<d|_        ||_        |j        €)d„ |                     ¦   «         D ¦   «         |_        dS dS dS dS )z¦Store a target called ``anchor_name``.

        If there is a pending TargetLookupItem, it is updated. Only previously
        collected anchors are stored.

        r   ú
up-to-dateNc                 ó>   — i | ]\  }}||                      ¦   «         “ŒS r   )Úcopy)Ú.0ÚkeyÚvalues      r   ú
<dictcomp>z0TargetCollector.store_target.<locals>.<dictcomp>‰   s3   € ð 46ð 46ð 46Ù*4¨#¨u�C˜Ÿš™œð46ð 46ð 46r   )r*   r1   r	   r
   Úcached_counter_valuesÚitems)r   r4   Útarget_counter_valuesr
   r;   s        r   Ústore_targetzTargetCollector.store_target{   s’   € ð Ô'×+Ò+¨KÑ8Ô8ˆØð 	6�D”J )Ò+Ð+Ø%ˆDŒJØ(ˆDŒOð Ô/Ð7ð46ð 46à,×2Ò2Ñ4Ô4ð46ñ 46ô 46�
Ô0Ð0Ð0ð	6ð 	6Ð+Ð+ð
 8Ð7r   c                 óœ   — | j         sdS |s|r>|j        €||_        t          |||¦  «        }| j                             ||f|¦  «         dS dS )a$  Collect missing (probably page-based) counters during formatting.

        The ``missing_counters`` are re-used during pagination.

        The ``missing_link`` attribute added to the parent_box is required to
        connect the paginated boxes to their originating ``parent_box``.

        N)r,   Úmissing_linkr   r+   r3   )r   Ú
parent_boxr:   Úparse_again_functionr   r   Úcounter_lookup_items          r   Úcollect_missing_countersz(TargetCollector.collect_missing_counters�   s‹   € ð Œð 	ØˆFð ð 	>Ð6ð 	>ØÔ&Ð.Ø*4�
Ô'Ý"3Ø$Ð&6Ø'ñ#)ô #)Ðð Ô%×0Ò0Ø˜YÐ'Ð)<ñ>ô >ð >ð >ð >ð	>ð 	>r   c                 ó´   — | j         rI| j                             ¦   «         D ](}|j                             ¦   «         D ]} |¦   «          ŒŒ)d| _         d| _        dS )z Check pending targets if needed.FN)r-   r*   Úvaluesr   r,   )r   r;   Úfunctions      r   Úcheck_pending_targetsz%TargetCollector.check_pending_targets¦   sn   € àÔ#ð 	-ØÔ0×7Ò7Ñ9Ô9ð ð �Ø $Ô :× AÒ AÑ CÔ Cð ð �HØ�H‘J”J�J�Jðà',ˆDÔ$àˆŒˆˆr   c                 óB  — | j         rdS | j                             |¦  «        }|ró|j        dk    rê||_        |j        |k    rÚt          j        |¦  «        |_        | j         	                    ¦   «         D ]©\  \  }}}|dk    rŒ|j
                             |¦  «        }|€Œ,|j        �|j        t          |¦  «        k    rd|_        ŒS|D ]M}	|                     |	¦  «        }
|
�4||j                 d         }d|d<   |                     |j        ¦  «          nŒNŒ¤dS dS dS dS )z…Store target's current ``page_maker_index`` and page counter values.

        Eventually update associated targeting boxes.

        Nr>   ÚcontentTéÿÿÿÿÚcontent_changed)r,   r*   r1   r	   r   r   r@   Údeepcopyr+   rF   r   Úlenr   r   )r   r4   Úpage_counter_valuesr   Ú
page_makerr;   Ú_r:   r   Úcounter_nameÚcounter_valueÚremake_states               r   Úcache_target_page_countersz*TargetCollector.cache_target_page_counters°   s~  € ð Œ?ð 	ØˆFàÔ'×+Ò+¨KÑ8Ô8ˆØð #	"�D”J ,Ò.Ð.Ø$4ˆDÔ!ØÔ.Ð2EÒEÐEÝ26´-Ø'ñ3)ô 3)�Ô/ð
 -1Ô,E×,KÒ,KÑ,MÔ,Mð "ð "Ñ(‘N�Q˜	 Dà  IÒ-Ð-Ø ð (,Ô'C×'GÒ'GØ#ñ(%ô (%Ð$à'Ð/Ø ð Ô-Ð5Ø Ô1µS¸±_´_ÒDÐDØ'+˜œØ ð
 )9ð "ð "˜Ø(;×(?Ò(?ÀÑ(MÔ(M˜Ø(Ð4à *¨4Ô+@Ô AÀ"Ô Eð )à>B˜LÐ):Ñ;Ø ×,Ò,¨TÔ-LÑMÔMÐMØ!˜Eð 5øð=#	"ð #	"Ð.Ð.àEÐEð"ð "r   N)r   r   r   r   r   r5   r<   rH   rN   rR   r_   r   r   r   r(   r(   G   sƒ   € € € € € ØJÐJð)ð )ð )ð 5ð 5ð 5ðð ð ð06ð 6ð 6ð$>ð >ð >ð2 ð  ð  ð/"ð /"ð /"ð /"ð /"r   r(   )r   r@   Úloggerr   r   r   r&   r(   r   r   r   ú<module>ra      sÇ   ððð ð €€€à Ð Ð Ð Ð Ð ð-ð -ð -ð -ð -ñ -ô -ð -ð2-ð -ð -ð -ð -ñ -ô -ð -ð0"ð "ð "ðX"ð X"ð X"ð X"ð X"ñ X"ô X"ð X"ð X"ð X"r   