
    Nji<                       d dl mZ d dlZd dlZd dlZd dlZd dlZej        dk     rPd dlZej	        Z	ej        dk     rej
        Z
ej        Zej        Zej        Zn@ej
        Z
ej        Zej        Zej        Zn#ej
        Z
ej        Zej        Zej        Zej	        Z	ej        dk     r ed          Znej        Zd dlmZ  ej        dd	          Z ej        d
          Z ej        de	          Z ej        d           G d dej        eef                               Zej        Zej        Zd1dZd2dZd3dZd4d Z d5d$Z!d6d(Z"d6d)Z#ej        dk     r7 ej$        d*          d7d+            Z% ej$        d*          d7d,            Z&n6 ej$        d*          d7d-            Z% ej$        d*          d7d.            Z& ej        d           G d/ d0ej        e                               Z'ej(        Z(ej)        j*        Z*ej)        j+        Z+ej,        Z,ej-        Z-ej.        Z.ej/        Z/ej0        Z0ej1        Z1ej2        Z3ej4        Z4dS )8    )annotationsN)      )r   	   r   
   )declarative_asn1TT)	covariantUTag)bound)frozenc                  (    e Zd ZU dZded<   ded<   dS )Varianta  
    A tagged variant for CHOICE fields with the same underlying type.

    Use this when you have multiple CHOICE alternatives with the same type
    and need to distinguish between them:

        foo: (
            Annotated[Variant[int, typing.Literal["IntA"]], Implicit(0)]
            | Annotated[Variant[int, typing.Literal["IntB"]], Implicit(1)]
        )

    Usage:
        example = Example(foo=Variant(5, "IntA"))
        decoded.foo.value  # The int value
        decoded.foo.tag    # "IntA" or "IntB"
    r   valuestrtagN)__name__
__module____qualname____doc____annotations__     q/lsinfo/ai/hellotax_ai/training_center/backend/venv/lib/python3.11/site-packages/cryptography/hazmat/asn1/asn1.pyr   r   2   s.          " HHHHHHHHr   r   
field_typetypereturnboolc                    t          t          d          rt          j        t          j        fnt          j        f}t          |           |v S )N	UnionType)hasattrtypesr"   typingUnionget_type_origin)r   union_typess     r   	_is_unionr)   M   sE     5+&&	&,''l_ 
 :&&+55r   metadatatuple
field_namer   declarative_asn1.Annotationc                   d }d }d }| D ]}t          |t                    r|t          d| d          |j        }4t          |t          j                  r|t          d| d          |}ft          |t          j                  r|t          d| d          |}t          d|           t	          j        |||          S )Nz-multiple DEFAULT annotations found in field ''z7multiple IMPLICIT/EXPLICIT annotations found in field 'z*multiple SIZE annotations found in field 'zunsupported annotation: )defaultencodingsize)
isinstanceDefault	TypeErrorr   r	   EncodingSize
Annotation)r*   r,   r0   r1   r2   raw_annotations         r   _extract_annotationr:   Y   s?    GHD" I Ing.. 	I"&"& & &   %*GG(8(ABB 	I#&"& & &   &HH(8(=>> 	INNNN   "DDG~GGHHH&(   r   
typing.Anydeclarative_asn1.AnnotatedTypec                   t          |           t          u r't          | j                  }t	          |           ^} }nt          j                    }|j        at          |           t          j	        t          fvr?| t          j        t          j        t          t          t          fvrt!          d d          | t"          u rGt%          |j        t(                    rt!          d d          |j        t!          d d          t-          | d          r{| j        }t%          |t
          j        j        t
          j        j        f          st!          d|           t          j        t9          j        t
          j        |          |          S t=          |           rt	          |           }t?          |          dk    rt@          |v r|d         tC          d           u r|d	         n|d         }|t"          u rt!          d
          tE          |          }|j#        $                                st!          d          |j        t!          d          t
          j        %                    |          }nt%          |j        t(                    rt!          d          fd|D             }	|	d	         j&        d utO          fd|	D                       rt!          d          r;d |	D             }
t?          |	          t?          |
          k    rt!          d          t
          j        (                    |	          }t@          |v rCt
          j        %                    t          j        |t          j                                        n|}nt          |           t          j	        u rCtE          t	          |           d	                   }t
          j        )                    |          }nmt          |           t          u rCtE          t	          |           d	                   }t
          j        
                    |          }nt          j*        |           }t          j        ||          S )Nzfield 'z' has a SIZE annotation, but SIZE annotations are only supported for fields of types: [SEQUENCE OF, SET OF, BIT STRING, OCTET STRING, UTF8String, PrintableString, IA5String]zW' has an IMPLICIT annotation, but IMPLICIT annotations are not supported for TLV types.zT' has a DEFAULT annotation, but DEFAULT annotations are not supported for TLV types.__asn1_root__zunsupported root type:       r   z=optional TLV types (`TLV | None`) are not currently supportedzoptional (`X | None`) types cannot have `X` annotated: annotations must apply to the union (i.e: `Annotated[X | None, annotation]`)z@optional (`X | None`) types should not have a DEFAULT annotationzCCHOICE (`X | Y | ...`) types should not have an IMPLICIT annotationc                R    g | ]#}|t          d           ut          |          $S N)r   _type_to_variant).0argr,   s     r   
<listcomp>z)_normalize_field_type.<locals>.<listcomp>   s>       d4jj(( !j11(((r   c              3  2   K   | ]}|j         d uk    V  d S rB   tag_name)rD   vare_union_types_taggeds     r   	<genexpr>z(_normalize_field_type.<locals>.<genexpr>   sD         4',BB     r   zbWhen using `asn1.Variant` in a union, all the other types in the union must also be `asn1.Variant`c                    h | ]	}|j         
S r   rH   )rD   rJ   s     r   	<setcomp>z(_normalize_field_type.<locals>.<setcomp>   s    555q
555r   zBWhen using `asn1.Variant` in a union, the tags used must be unique)+r'   	Annotatedr:   __metadata__get_type_argsr	   r8   r2   builtinslistSetOfbytesr   	BitString	IA5StringPrintableStringr5   TLVr3   r1   Implicitr0   r#   r>   TypeSequenceSetAnnotatedTyper%   castr)   lenNoneTyper   _normalize_field_type
annotationis_emptyOptionrI   anyChoice
SequenceOfnon_root_python_to_rust)r   r,   rc   _	root_type
union_argsoptional_typeannotated_typerust_field_typevariantstagsrust_choice_type
inner_typerK   s    `           @r   rb   rb   |   s   
 z""i//()@*MM
&z22
QQ%022
"
##HM5+AAANL

 
 *j * * *
 
 	
 Sj)844 		H* H H H   +G* G G G  
 z?++ `O,	"+-=-B-FG
 
 	C AiAABBB-K(-y99:
 
 	
 
:		 VO":..
z??aH
$:$: ",A$t**!<!<
1*Q-  ##*   3=*MMN!,5577 ?   !-!  
 /3::>JJOO *-x88 !     %  H &.a[%9%E"    !       E  
 & 55H555x==CII--#)  
  04;;HEE z)) !%,,$2(*:*E*G*G    & O 
	$	$	5	5**%%a(*
 

 +/:::FF		$	$	-	-**%%a(*
 

 +/55jAA*B:NN)/:FFFr   tdeclarative_asn1.Variantc                   t          |           t          u }|rt          |           d         n| }t          |          t          u rt          |          \  }}t          |          t          j        urt          d          t          |          d         }t          |d          r|j        }nt          j
        |          }|r)t          j        |t          | j        |                    }n&t          j        |t          j                              }t          j        t          ||          S t          j        |t          | |          d           S )Nr   zWhen using `asn1.Variant` in a type annotation, the second type parameter must be a `typing.Literal` type. E.g: `Variant[int, typing.Literal["MyInt"]]`.r>   )r'   rO   rQ   r   r%   Literalr5   r#   r>   r	   ri   r^   r:   rP   r8   rb   )	rt   r,   is_annotatedrs   
value_typetag_literalrI   	rust_typeann_types	            r   rC   rC     sX    #1%%2L(4;q!!!$$!J z""g--"/
";";
K;''v~==;  
 !--a0:// 	M"0II(@LLI 		'5#ANJ?? HH
 (5 +-- H
  '8DDD  '!!Z00
 
 	
r   
raw_fieldsdict[str, type])dict[str, declarative_asn1.AnnotatedType]c                h    i }|                                  D ]\  }}t          ||          }|||<   |S rB   )itemsrb   )r}   fieldsr,   r   annotated_field_types        r   _annotate_fieldsr   7  sM     F","2"2"4"4 2 2
J  5ZLL1zMr   clstype[U]Nonec                    t          | d          }t          j                            | t	          |                    }t          | d|           d S NT)include_extrasr>   )get_type_hintsr	   r[   r\   r   setattrr   r}   roots      r   _register_asn1_sequencer   D  sM    D999J ))#/?
/K/KLLDC$'''''r   c                    t          | d          }t          j                            | t	          |                    }t          | d|           d S r   )r   r	   r[   r]   r   r   r   s      r   _register_asn1_setr   K  sM    D999J $$S*::*F*FGGDC$'''''r   )kw_only_defaultc                    t           j        dk    r" t          j        dddd          |           }n t          j        dd          |           }t	          |           |S Nr   FTrepreq
match_argskw_only)r   r   )sysversion_infodataclasses	dataclassr   r   dataclass_clss     r   sequencer   Z  s     w&&	K1 ! 	 	 	 	 	MMK1    M 	 ...r   c                    t           j        dk    r" t          j        dddd          |           }n t          j        dd          |           }t	          |           |S r   )r   r   r   r   r   r   s     r   setr   q  s     w&&	K1 ! 	 	 	 	 	MMK1    M 	=)))r   c                f     t          j        dddd          |           }t          |           |S NFTr   )r   r   r   r   s     r   r   r     sN    
-	
 
 

   	 ...r   c                f     t          j        dddd          |           }t          |           |S r   )r   r   r   r   s     r   r   r     sN    
-	
 
 

   	=)))r   c                      e Zd ZU ded<   dS )r4   r   r   N)r   r   r   r   r   r   r   r4   r4     s         HHHHHr   r4   )r   r   r   r    )r*   r+   r,   r   r   r-   )r   r;   r,   r   r   r<   )rt   r;   r,   r   r   ru   )r}   r~   r   r   )r   r   r   r   )r   r   r   r   )5
__future__r   rR   r   r   r$   r%   r   typing_extensionsLiteralStringr   get_argsrQ   
get_originr'   rO   r   ra   "cryptography.hazmat.bindings._rustr	   TypeVarr
   r   r   r   Genericr   
decode_der
encode_derr)   r:   rb   rC   r   r   r   dataclass_transformr   r   r4   rT   r6   ExplicitrZ   r7   rX   rW   UTCTimeGeneralizedTimerV   TlvrY   Nullr   r   r   <module>r      s  
 # " " " " "      



  g%3M
 &  *9)2+6%/		. +$		*NOM'O I(MgtDzzHH~H ? ? ? ? ? ?FN3$'''FN3fnU-000 d###    fnQV$   $#, (
(
	6 	6 	6 	6       FKG KG KG KG`(
 (
 (
 (
V
 
 
 
( ( ( (( ( ( ( g**4@@@   A@, +*4@@@   A@ 0  V555
 
 
 65
  V555
 
 
 65
 d###    fnQ   $# 	$-$-"2&	

""2&	r   