o
    q>e                     @  s6   d dl mZ ddlmZ dd ZG dd deeZdS )	    )annotations   )UpdateDictMixinc                   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key \/var/www/bmteknikk.ddns.net/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dZedZedZedZedZedZ	edZ
edZed	Zed
ZedZedZedZedZedZedZedZedZedZedZedZedZedZedZedZedZd+ddZdd  Zd!d" Z d#d$ Z!d%d& Z"d'd( Z#d)d* Z$d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-uriz	child-srczconnect-srczdefault-srczfont-srczform-actionzframe-ancestorsz	frame-srczimg-srczmanifest-srcz	media-srcznavigate-toz
object-srczprefetch-srczplugin-typesz	report-toz
report-urisandboxz
script-srczscript-src-attrzscript-src-elemz	style-srczstyle-src-attrzstyle-src-elemz
worker-srcr   Nc                 C  s$   t | |pd || _|d u| _d S )Nr   )dict__init__	on_updateprovided)selfvaluesr   r   r   r   r   >   s   zContentSecurityPolicy.__init__c                 C  s
   |  |S )+Used internally by the accessor properties.)getr   r   r   r   r   r   C   s   
z ContentSecurityPolicy._get_valuec                 C  s$   |du r|  |d dS || |< dS r   N)pop)r   r   valuer   r   r   r   G   s   z ContentSecurityPolicy._set_valuec                 C  s   || v r	| |= dS dS r    r   r   r   r   r   r   N   s   
z ContentSecurityPolicy._del_valuec                 C  s   ddl m} || S )z6Convert the stored values into a cache control header.   )dump_csp_header)httpr$   )r   r$   r   r   r   	to_headerS   s   zContentSecurityPolicy.to_headerc                 C  s   |   S r   )r&   )r   r   r   r   __str__Y   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>]   s     z1ContentSecurityPolicy.__repr__.<locals>.<genexpr><>)joinsorteditemstype__name__)r   kv_strr   r   r   __repr__\   s   zContentSecurityPolicy.__repr__)r   N)%r3   
__module____qualname____doc__r   base_uri	child_srcconnect_srcdefault_srcfont_srcform_actionframe_ancestors	frame_srcimg_srcmanifest_src	media_srcnavigate_to
object_srcprefetch_srcplugin_types	report_to
report_urir   
script_srcscript_src_attrscript_src_elem	style_srcstyle_src_attrstyle_src_elem
worker_srcr   r   r   r   r&   r'   r5   r   r   r   r   r      sD    
r   N)
__future__r   mixinsr   r   r   r   r   r   r   r   <module>   s    