o
    'h                     @  sR   d dl mZ d dlmZ d dlZddlmZ dd	d
Z	G dd dee
e
f ZdS )    )annotationsN   )CallbackDictkeystrreturnt.Anyc                   s,   t  fdd fdd fddd S )zReturn a new property object for a content security policy header.
    Useful if you want to add support for a csp extension in a
    subclass.
    c                   
   |   S N)
_get_valuexr    W/var/www/html/olx_land/venv/lib/python3.10/site-packages/werkzeug/datastructures/csp.py<lambda>      
 zcsp_property.<locals>.<lambda>c                   s   |   |S r
   )
_set_value)r   vr   r   r   r      s    c                   r	   r
   )
_del_valuer   r   r   r   r      r   zaccessor for )propertyr   r   r   r   csp_property	   s   


r   c                      s  e Zd ZU dZedZded< edZded< edZded< ed	Z	ded
< edZ
ded< edZded< edZded< edZded< edZded< edZded< edZded< edZded< edZded< edZded< edZded < ed!Zded"< ed#Zded$< ed%Zded%< ed&Zded'< ed(Zded)< ed*Zded+< ed,Zded-< ed.Zded/< ed0Zded1< ed2Zded3< 	4	5dMdN fd<d=ZdOd@dAZ dPdCdDZ!dQdEdFZ"dRdGdHZ#dRdIdJZ$dRdKdLZ%  Z&S )SContentSecurityPolicyaV  Subclass of a dict that stores values for a Content Security Policy
    header. It has accessors for all the level 3 policies.

    Because the csp directives in the HTTP header use dashes the
    python descriptors use underscores for that.

    To get a header of the :class:`ContentSecuirtyPolicy` object again
    you can convert the object into a string or call the
    :meth:`to_header` method.  If you plan to subclass it and add your
    own items have a look at the sourcecode for that class.

    .. versionadded:: 1.0.0
       Support for Content Security Policy headers was added.

    zbase-uri
str | Nonebase_uriz	child-src	child_srczconnect-srcconnect_srczdefault-srcdefault_srczfont-srcfont_srczform-actionform_actionzframe-ancestorsframe_ancestorsz	frame-src	frame_srczimg-srcimg_srczmanifest-srcmanifest_srcz	media-src	media_srcznavigate-tonavigate_toz
object-src
object_srczprefetch-srcprefetch_srczplugin-typesplugin_typesz	report-to	report_toz
report-uri
report_urisandboxz
script-src
script_srczscript-src-attrscript_src_attrzscript-src-elemscript_src_elemz	style-src	style_srczstyle-src-attrstyle_src_attrzstyle-src-elemstyle_src_elemz
worker-src
worker_srcr   Nvalues>cabc.Mapping[str, str] | cabc.Iterable[tuple[str, str]] | None	on_update3cabc.Callable[[ContentSecurityPolicy], None] | Noner   Nonec                   s   t  || |d u| _d S r
   )super__init__provided)selfr3   r5   	__class__r   r   r9   A   s   zContentSecurityPolicy.__init__r   r   c                 C  s
   |  |S )+Used internally by the accessor properties.)getr;   r   r   r   r   r   I   s   
z ContentSecurityPolicy._get_valuevaluec                 C  s$   |du r|  |d dS || |< dS r>   N)pop)r;   r   rA   r   r   r   r   M   s   z ContentSecurityPolicy._set_valuec                 C  s   || v r	| |= dS dS rB   r   r@   r   r   r   r   T   s   
z ContentSecurityPolicy._del_valuec                 C  s   ddl m} || S )z6Convert the stored values into a cache control header.   )dump_csp_header)httprE   )r;   rE   r   r   r   	to_headerY   s   zContentSecurityPolicy.to_headerc                 C  s   |   S r
   )rG   )r;   r   r   r   __str___   s   zContentSecurityPolicy.__str__c                 C  s4   d dd t|  D }dt| j d| dS )N c                 s  s"    | ]\}}| d |V  qdS )=Nr   ).0kr   r   r   r   	<genexpr>c   s     z1ContentSecurityPolicy.__repr__.<locals>.<genexpr><>)joinsorteditemstype__name__)r;   kv_strr   r   r   __repr__b   s   zContentSecurityPolicy.__repr__)r   N)r3   r4   r5   r6   r   r7   )r   r   r   r   )r   r   rA   r   r   r7   )r   r   r   r7   )r   r   )'rT   
__module____qualname____doc__r   r   __annotations__r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r9   r   r   r   rG   rH   rV   __classcell__r   r   r<   r   r      sH   
 




r   )r   r   r   r   )
__future__r   collections.abcabccabctypingt
structuresr   r   r   r   r   r   r   r   <module>   s    
