
    i                    H   d Z ddlmZ ddlZddlmZ ddlmZmZmZm	Z	m
Z
 ddlmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlmZ dd	lmZ dd
l m!Z!m"Z" ddl#m$Z$m%Z%m&Z&m'Z'm(Z( ddl)m*Z* ddl+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1 ddl2m3Z3 erddl4m5Z5 g Z6 G d de          Z7dgZ8dS )z$The base for :rfc:`5545` components.    )annotationsN)deepcopy)datedatetimetime	timedeltatimezone)TYPE_CHECKINGAnyClassVarLiteraloverload)
CONCEPTS_TYPE_SETTERLINKS_TYPE_SETTERRELATED_TO_TYPE_SETTERcomments_propertyconcepts_propertylinks_propertyrefids_propertyrelated_to_propertysingle_utc_propertyuid_property)ComponentFactory)CaselessDict)InvalidCalendarJCalParsingError)ContentlineContentlines
Parametersq_joinq_split)DEFAULT_ENCODING)	VPROPERTYTypesFactory	vDDDListsvText)tzpis_date)Selfc                      e Zd ZU dZdZded<   	 dZded<   	 dZded<   	 dZded	<   	 dZ	ded
<   	 dZ
ded<   	 dZded<   	  ej                    Zded<   dZded<   ded<   	 edud            Zedvd            Zedwd             Z fd!Zd" Z fd#Zdxd$Zd% Zedyd'            Z	 	 dzd{d-Zd|d/Zefd}d2Zd~d3Zd~d4Z dd6Z!d7 Z"dd8 fdd9Z#dd;Z$	 	 ddd>Z%e&e	 dddB                        Z'e&eddD                        Z'e	 dddF            Z'eddH            Z(dddIZ)dddJZ*dddKZ+dL Z, fdMZ- e.dNdO          xZ/Z0 e.dPdQ          Z1e2ddS            Z3e3j4        dT             Z3e3j5        dU             Z3e2ddV            Z6e6j4        dW             Z6e6j5        dX             Z6ddYZ7edZ             Z8e9Z:e;Z<e=Z>e?Z@eAZBeCZD e.d[d\          ZEd(ZFed]             ZGe	 	 	 	 	 	 	 	 dddk            ZHddmZIddnZJeddq            ZKdd fdtZL xZMS )	ComponentzBase class for calendar components.

    Component is the base object for calendar, Event and the other
    components defined in :rfc:`5545`. Normally you will not use this class
    directly, but rather one of the subclasses.
    NzClassVar[str | None]name zClassVar[tuple[()]]required
singletonsmultiple	exclusivez-ClassVar[tuple[str] | tuple[tuple[str, str]]]	inclusiveFzClassVar[bool]ignore_exceptionszClassVar[TypesFactory]types_factoryz!ClassVar[ComponentFactory | None]_components_factorylist[Component]subcomponentsstrreturntype[Component]c                j    | j         t                      | _         | j                             |          S )z|Return a component with this name.

        Parameters:
            name: Name of the component, i.e. ``VCALENDAR``
        )r6   r   get_component_class)clsr-   s     R/root/projects/butler/venv/lib/python3.11/site-packages/icalendar/cal/component.pyr=   zComponent.get_component_classa   s2     "*&6&8&8C#&::4@@@    component_classNonec                >   t          |d          r|j        t          | d          | j        t	                      | _        | j                            |j                  }|||urt          d|j         d|           | j                            |           dS )a  Register a custom component class.

        Parameters:
            component_class: Component subclass to register.
                Must have a ``name`` attribute.

        Raises:
            ValueError: If ``component_class`` has no ``name`` attribute.
            ValueError: If a component with this name is already registered.

        Examples:
            Create a custom icalendar component with the name ``X-EXAMPLE``:

            .. code-block:: pycon

                >>> from icalendar import Component
                >>> class XExample(Component):
                ...     name = "X-EXAMPLE"
                ...     def custom_method(self):
                ...         return "custom"
                >>> Component.register(XExample)
        r-   Nz must have a 'name' attributezComponent 'z' is already registered as )hasattrr-   
ValueErrorr6   r   getadd_component_class)r>   rA   existings      r?   registerzComponent.registerl   s    0 // 	P?3G3ONNNOOO"*&6&8&8C# *../CDDHO$C$C"o2 " "" "  
 	33ODDDDDr@   value1date | datetime | timedelta | time | tuple | list
str | Nonec                    t          | t                    r<| sdS t          d | D                       rdS t          d | D                       rdS dS t          |           rdS t          | t                    rdS dS )a  Infer the ``VALUE`` parameter from a Python type.

        Parameters:
            value: Python native type, one of :py:class:`date`, :py:mod:`datetime`,
                :py:class:`timedelta`, :py:mod:`time`, :py:class:`tuple`,
                or :py:class:`list`.

        Returns:
            str or None: The ``VALUE`` parameter string, for example, "DATE",
                "TIME", or other string, or ``None``
                if no specific ``VALUE`` is needed.
        Nc              3  4   K   | ]}t          |          V  d S Nr(   .0items     r?   	<genexpr>z.Component._infer_value_type.<locals>.<genexpr>   s(      33T74==333333r@   DATEc              3  @   K   | ]}t          |t                    V  d S rO   )
isinstancer   rP   s     r?   rS   z.Component._infer_value_type.<locals>.<genexpr>   s,      <<d:dD))<<<<<<r@   TIME)rV   listallr)   r   rJ   s    r?   _infer_value_typezComponent._infer_value_type   s      eT"" 
	 t33U33333 v<<e<<<<< v45>> 	6eT"" 	6tr@   c                V     t                      j        |i | g | _        g | _        dS )z#Set keys to upper for initial dict.N)super__init__r8   errors)selfargskwargs	__class__s      r?   r^   zComponent.__init__   s2    $)&))).0r@   c                    dS )zAReturns True, CaselessDict would return False if it had no items.Tr.   r`   s    r?   __bool__zComponent.__bool__   s    tr@   c                F    t                                          |          S )z1Get property value from the component dictionary.)r]   __getitem__)r`   keyrc   s     r?   rh   zComponent.__getitem__   s    ww""3'''r@   c                8    	 | |         S # t           $ r |cY S w xY w)z Get property value with default.)KeyError)r`   ri   defaults      r?   rF   zComponent.get   s5    	9 	 	 	NNN	s   
 c                p    t          t          |                                           | j        z              S )zDReturns True if Component has no items or subcomponents, else False.)boolrX   valuesr8   re   s    r?   is_emptyzComponent.is_empty   s+    T[[]]++d.@@@AAAr@      c                   |s|S t          || j        j                  r|}nwd}|rd|v r	|d         }n@t          || j        j                  s&|                     |          }|r|}|i }d|vr||d<   | j                            ||          } ||          }|r[t          |d          st                      |_        |                                D ]#\  }	}
|
|	|j        v r|j        |	= |
|j        |	<   $|S )a  Encode values to icalendar property values.

        :param name: Name of the property.
        :type name: string

        :param value: Value of the property. Either of a basic Python type of
                      any of the icalendar's own property types.
        :type value: Python native type or icalendar property type.

        :param parameters: Property parameter dictionary for the value. Only
                           available, if encode is set to True.
        :type parameters: Dictionary

        :param encode: True, if the value should be encoded to one of
                       icalendar's own property types (Fallback is "vText")
                       or False, if not.
        :type encode: Boolean

        :returns: icalendar property value
        NVALUEparams)	rV   r5   	all_typesr[   for_propertyrD   r   rt   items)r>   r-   rJ   
parametersencodeobjvalue_paraminferredklassri   rR   s              r?   _encodezComponent._encode   sD   ,  	LeS.899 	CC K 
7g33(1s'8'BCC 70077 7"*K!)%'
j00.6
7+%224EEE%,,C 	+3)) *'\\
'--// + +	T<cj((JsO&*CJsOO
r@   Trx   dict[str, str] | Parametersry   rn   c                    t          |t                    r*                                dv rt          j        |          }r=t          |t
                    r(                                dvr fd|D             }n                     |          } v rT          }t          |t
                    r3t          |t
                    r||z   }n|                    |           |}n||g}| <   dS )a  Add a property.

        :param name: Name of the property.
        :type name: string

        :param value: Value of the property. Either of a basic Python type of
                      any of the icalendar's own property types.
        :type value: Python native type or icalendar property type.

        :param parameters: Property parameter dictionary for the value. Only
                           available, if encode is set to True.
        :type parameters: Dictionary

        :param encode: True, if the value should be encoded to one of
                       icalendar's own property types (Fallback is "vText")
                       or False, if not.
        :type encode: Boolean

        :returns: None
        )dtstampcreatedzlast-modified)rdateexdate
categoriesc                @    g | ]}                     |          S r.   r~   )rQ   vry   r-   rx   r`   s     r?   
<listcomp>z!Component.add.<locals>.<listcomp>6  s+    NNN1T\\$:v>>NNNr@   N)rV   r   lowerr'   localize_utcrX   r~   append)r`   r-   rJ   rx   ry   oldvals   `` `` r?   addzComponent.add  s)   6 eX&& 	,4::<< <
 ,
 ,
 $U++E 		B5$''		B 

$EEE ONNNNNNNNNEELLuj&AAE 4<<$ZF&$'' (eT** #"UNEEMM%((("EET


r@   r#   c                    t          |d          r|j        S t          |t                    r|S | j                            ||          }t          |t                    r|                    t                    }|S )z&Internal for decoding property values.
ical_value)	rD   r   rV   r%   r5   	from_icalr&   ry   r"   )r`   r-   rJ   decodeds       r?   _decodezComponent._decodeH  sy     5,'' 	$##eY'' 	L$..tU;; gu%% 	7nn%566Gr@   rl   r   c                      v rB          }t          |t                    r fd|D             S                      |          S |t          u rt	                    |S )zReturns decoded value of property.

        A component maps keys to icalendar property value types.
        This function returns values compatible to native Python types.
        c                <    g | ]}                     |          S r.   r   )rQ   r   r-   r`   s     r?   r   z%Component.decoded.<locals>.<listcomp>d  s'    ===!T1--===r@   )rV   rX   r   _markerrk   )r`   r-   rl   rJ   s   ``  r?   r   zComponent.decoded[  sw     4<<JE%&& >=====u====<<e,,,g4.. r@   c                j     d t                              D             }|r fd|D             S |S )z*Returns a list of values (split on comma).c                8    g | ]}|                     d           S )z" )strip)rQ   r   s     r?   r   z(Component.get_inline.<locals>.<listcomp>p  s"    ;;;!;;;r@   c                <    g | ]}                     |          S r.   r   )rQ   valr-   r`   s     r?   r   z(Component.get_inline.<locals>.<listcomp>r  s'    <<<DLLs++<<<r@   )r!   )r`   r-   decodevalss   ``  r?   
get_inlinezComponent.get_inlinen  sM    ;;wtDz':':;;; 	=<<<<<t<<<<r@   c                x     |r fd|D             }  j         d         t          |                     <   dS )z^Converts a list of values into comma separated string and sets value
        to that.
        c                @    g | ]}                     |d           S )rq   ry   r   )rQ   rJ   r-   r`   s     r?   r   z(Component.set_inline.<locals>.<listcomp>z  s+    NNNedll4ql99NNNr@   inlineN)r5   r    )r`   r-   ro   ry   s   ``  r?   
set_inlinezComponent.set_inlineu  sP      	ONNNNNvNNNF1T'1&..AAT


r@   	componentc                :    | j                             |           dS )z%Add a subcomponent to this component.N)r8   r   )r`   r   s     r?   add_componentzComponent.add_component  s    !!),,,,,r@   c                    g }|| j         |k    r  ||           r|                    |            | j        D ]}||                    ||          z  }|S )zWalk to given component.)r-   r   r8   _walk)r`   r-   selectresultsubcomponents        r?   r   zComponent._walk  sj    LDI--66$<<-MM$ . 	7 	7Ll((v666FFr@   c                    dS NTr.   )_s    r?   <lambda>zComponent.<lambda>  s    t r@   c                Z    ||                                 }|                     ||          S )a  Recursively traverses component and subcomponents. Returns sequence
        of same. If name is passed, only components with name will be returned.

        :param name: The name of the component or None such as ``VEVENT``.
        :param select: A function that takes the component as first argument
          and returns True/False.
        :returns: A list of components that match.
        :rtype: list[Component]
        )upperr   )r`   r-   r   s      r?   walkzComponent.walk  s+     ::<<Dzz$'''r@   uidc                D    fd|                                  D             S )zReturn a list of components with the given UID.

        Parameters:
            uid: The UID of the component.

        Returns:
            list[Component]: List of components with the given UID.
        c                F    g | ]}|                     d           k    |S )r   )rF   )rQ   cr   s     r?   r   z&Component.with_uid.<locals>.<listcomp>  s-    >>>a!%%,,#*=*=*=*=*=r@   )r   )r`   r   s    `r?   with_uidzComponent.with_uid  s'     ?>>>499;;>>>>r@   sortedlist[tuple[str, object]]c                "   | j         d         }d || j                                                  fg}|r|                                 n|                                 }|D ]S}| |         }t          |t                    r|D ]}|                    ||f           <|                    ||f           T|r#| j        D ]}	||		                    |          z  }|                    d || j                                                  f           |S )z`Returns properties in this component and subcomponents as:
        [(name, value), ...]
        textBEGINr   END)
r5   r-   to_icalsorted_keyskeysrV   rX   r   r8   property_items)
r`   	recursiver   v_text
propertiesproperty_namesr-   ro   rJ   r   s
             r?   r   zComponent.property_items  s@    #F+ty 1 1 9 9 ; ;<=
/5F))+++499;;" 	2 	2D$ZF&$'' 2# 5 5E%%tUm44445 !!4.1111 	I $ 2 I Il999HHH

5&&"3"3";";"="=>???r@   ststr | bytesLiteral[False]c                    d S rO   r.   r>   r   r1   s      r?   r   zComponent.from_ical  s	     Cr@   Literal[True]c                    d S rO   r.   r   s      r?   r   zComponent.from_ical  s    UXUXr@   Component | list[Component]c           
        ddl m} g }g }t          j        |          D ]}|s	 |                                \  }}}	nV# t
          $ rI}
|r|d         nd}|r|j        s |j                            dt          |
          f           Y d}
~
nd}
~
ww xY w|
                                }|dk    ra|	
                                }|                     |          } |            }t          |dd          s||_        |                    |           |dk    rx|st          d	          |                                }|s|                    |           n|d                             |           |	d
k    rd|v rt!          j        |           o|r|                    d          nd}| j                            ||          }|r|d         nd}|s|dk    r n%t          d| d          d}|r||v r|                    d          nd}|
                                dk    rddlm} t          |          }|                    d          }|dk    r||dz   d         }	  ||          } ||          }||_        |                    ||d           nH# t
          $ r;}
|j        s |j                            |t          |
          f           Y d}
~
nd}
~
ww xY w|	g}n.|dk    r|	                    d          }n|dk    r	|	dk    rg }n|	g}|D ]}	 |r|                    ||          }n|                    |          } ||          }||_        |                    ||d           \# t6          $ r~}
|j        s t          |dd          }|                    |||||
          }|j                            |t          |
          f           |                    ||d           Y d}
~
d}
~
ww xY w|r|S t;          |          dk    r#t          |                     d|                    t;          |          dk     r#t          |                     d|                    |d         S )a  Parse iCalendar data into component instances.

        Handles standard and custom components (``X-*``, IANA-registered).

        Parameters:
            st: iCalendar data as bytes or string
            multiple: If ``True``, returns list. If ``False``, returns single component.

        Returns:
            Component or list of components

        See Also:
            :doc:`/how-to/custom-components` for examples of parsing custom components
        r   )vBrokenNr   r-    r   z.END encountered without an accompanying BEGIN!	VTIMEZONETZIDrs   z	X-COMMENTz
Property "z#" does not have a parent component.)DTSTARTDTENDzRECURRENCE-IDDUERDATEEXDATE
CATEGORIES)split_on_unescaped_comma:rq   r   FREEBUSY,r   __name__unknown)	raw_valuert   property_nameexpected_typeerrorz3Found multiple components where only one is allowedz1Found no components where exactly one is required)icalendar.propr   r   r   partsrE   r4   r_   r   r9   r   r=   getattrr-   popr   r'   cache_timezone_componentrF   r5   rv   icalendar.parserr   rfindrt   r   split	Exceptionfrom_parse_errorlen_format_error)r>   r   r1   r   stackcompsliner-   rt   r   er   unamec_namec_classr{   factorydatetime_namestzidr   line_str	colon_idxr   category_list	vals_inst	vals_listr   
parsed_valr   broken_props                                 r?   r   zComponent.from_ical  s   $ 	+***** *2.. F	C F	CD 
%)ZZ\\"fdd    */8E"IID	  	(C  ''s1vv777 JJLLE 11&99
 $GII	y&"55 ,%+INY''''%  W$%UVVV!IIKK	 7LL++++"I++I666;&&6Y+>+>0;;; 6<Efjj111+88{KK).8E"IID	   ++$NTNNN  " .4X8N8Nvzz&)))TX ::<<<//       #4yyH !)s 3 3I 1}}$,Y]__$=	E,D,DY,O,OM(/(>(>I/5I,%MM$	!MDDDD) E E E#,#> & %%,33UCFFODDDDDDDDE !!%IIZ'' $

3II W__ "II!%I % C CCC @)0):):3)E)EJJ)0):):3)?)?J$+GJ$7$7	+1	(!dIa@@@@$ C C C(: "!(/Y(O(O&-&>&>&)#)*.*7"# '? ' ' "(//s1vv???!dKBBBBBBBBCC0  	Lu::>>!!I2   
 u::>>!!G   
 QxsG   ?
B	?BB!5J
K!1KKAM11
O9;A4O44O9[...]c                    d}t          |           t          |          z   t          |          z   |k    r4|t          |           z
  t          |          z
  }|  d|d |          d| S |  d| S )Na   z:  )r   )error_description	bad_inputelipsismax_error_lengthtruncate_tos        r?   r   zComponent._format_error|  s     # !!C	NN2S\\ADTTT*S1B-C-CCc'llRK'NN9\k\+BNNWNNN#22y222r@   c                l    t          |dt                                }t          j        ||||          S )z!Returns property as content line.rt   r   )r   r   r   
from_parts)r`   r-   rJ   r   rt   s        r?   content_linezComponent.content_line  s1    *,,77%dFE&IIIIr@   c                    t                      }|                     |          D ]2\  }}|                     |||          }|                    |           3|                    d           |S )z<Converts the Component and subcomponents into content lines.r   r   )r   r   r  r   )r`   r   contentlinesr-   rJ   cls         r?   content_lineszComponent.content_lines  sz    #~~..f.== 	$ 	$KD%""4v">>B####Br@   c                V    |                      |          }|                                S )z}
        :param sorted: Whether parameters and properties should be
                       lexicographically sorted.
        r   )r  r   )r`   r   r  s      r?   r   zComponent.to_ical  s,     **&*99$$&&&r@   c                    d                     d | j        D                       }| j        pt          |           j         dt          |            |rd|z   nd dS )z>String representation of class with all of it's subcomponents.z, c              3  4   K   | ]}t          |          V  d S rO   )r9   )rQ   its     r?   rS   z%Component.__repr__.<locals>.<genexpr>  s(      >>RR>>>>>>r@   (r   ))joinr8   r-   typer   dict)r`   subss     r?   __repr__zComponent.__repr__  st    yy>>4+=>>>>>y/DJJ/ ; ;T

;+/7D4KKR; ; ;	
r@   c                    t          | j                  t          |j                  k    rdS t                                          |          }|sdS | j        D ]}||j        vr dS dS )NFT)r   r8   r]   __eq__)r`   otherproperties_equalr   rc   s       r?   r  zComponent.__eq__  s    t!""c%*=&>&>>>5 77>>%00 	5 !. 	 	L5#666uu 7 tr@   DTSTAMPa@  RFC 5545:

        Conformance:  This property MUST be included in the "VEVENT",
        "VTODO", "VJOURNAL", or "VFREEBUSY" calendar components.

        Description: In the case of an iCalendar object that specifies a
        "METHOD" property, this property specifies the date and time that
        the instance of the iCalendar object was created.  In the case of
        an iCalendar object that doesn't specify a "METHOD" property, this
        property specifies the date and time that the information
        associated with the calendar component was last revised in the
        calendar store.

        The value MUST be specified in the UTC time format.

        In the case of an iCalendar object that doesn't specify a "METHOD"
        property, this property is equivalent to the "LAST-MODIFIED"
        property.
    zLAST-MODIFIEDa  RFC 5545:

        Purpose:  This property specifies the date and time that the
        information associated with the calendar component was last
        revised in the calendar store.

        Note: This is analogous to the modification date and time for a
        file in the file system.

        Conformance:  This property can be specified in the "VEVENT",
        "VTODO", "VJOURNAL", or "VTIMEZONE" calendar components.
    r   c                    | j         p| j        S )zDatetime when the information associated with the component was last revised.

        Since :attr:`LAST_MODIFIED` is an optional property,
        this returns :attr:`DTSTAMP` if :attr:`LAST_MODIFIED` is not set.
        )LAST_MODIFIEDr"  re   s    r?   last_modifiedzComponent.last_modified  s     !1T\1r@   c                    || _         d S rO   r$  r`   rJ   s     r?   r%  zComponent.last_modified  s    "r@   c                
    | ` d S rO   r'  re   s    r?   r%  zComponent.last_modified  s    r@   c                    | j         p| j        S )zDatetime when the information associated with the component was created.

        Since :attr:`CREATED` is an optional property,
        this returns :attr:`DTSTAMP` if :attr:`CREATED` is not set.
        )CREATEDr"  re   s    r?   r   zComponent.created  s     |+t|+r@   c                    || _         d S rO   r+  r(  s     r?   r   zComponent.created  s    r@   c                
    | ` d S rO   r-  re   s    r?   r   zComponent.created  s    LLLr@   c                X    t          d |                                 D                       S )zXWhether this component has attributes that indicate that Mozilla Thunderbird created it.c              3  @   K   | ]}|                     d           V  dS )zX-MOZ-N)
startswith)rQ   attrs     r?   rS   z+Component.is_thunderbird.<locals>.<genexpr>  s.      EE4??8,,EEEEEEr@   )anyr   re   s    r?   is_thunderbirdzComponent.is_thunderbird  s'    EEEEEEEEr@   c                 >    t          j        t          j                  S )zReturn now as UTC value.)r   nowr	   utcr.   r@   r?   _utc_nowzComponent._utc_now  s     |HL)))r@   r+  an  
        CREATED specifies the date and time that the calendar
        information was created by the calendar user agent in the calendar
        store.

        Conformance:
            The property can be specified once in "VEVENT",
            "VTODO", or "VJOURNAL" calendar components.  The value MUST be
            specified as a date with UTC time.

        c                <    | |dS | |k    rt          d          dS )z{This validates start and end.

        Raises:
            ~error.InvalidCalendar: If the information is not valid
        Nzend must be after start)r   )startends     r?   _validate_start_and_endz!Component._validate_start_and_end   s1     =CKF3;;!";<<< ;r@   r   date | Nonecommentslist[str] | str | Noneconceptsr   r%  linksr   refids
related_tor   stampc	                     |             }	||	_         ||	_        ||	_        ||	_        ||	_        ||	_        ||	_        ||	_        |	S )a  Create a new component.

        Parameters:
            comments: The :attr:`comments` of the component.
            concepts: The :attr:`concepts` of the component.
            created: The :attr:`created` of the component.
            last_modified: The :attr:`last_modified` of the component.
            links: The :attr:`links` of the component.
            related_to: The :attr:`related_to` of the component.
            stamp: The :attr:`DTSTAMP` of the component.

        Raises:
            ~error.InvalidCalendar: If the content is not valid
                according to :rfc:`5545`.

        .. warning:: As time progresses, we will be stricter with the
            validation.
        )r"  r   r%  r>  rA  rC  r@  rB  )
r>   r   r>  r@  r%  rA  rB  rC  rD  r   s
             r?   newzComponent.new,  sT    < CEE	!	#	"/	%		)	%	!	r@   rX   c                >   g }|                                  D ]\\  }}t          |t                    r|n|gD ]<}|                    |                    |                                                     =]| j                                        |d | j        D             gS )a  Convert this component to a jCal object.

        Returns:
            jCal object

        See also :attr:`to_json`.

        In this example, we create a simple VEVENT component and convert it to jCal:

        .. code-block:: pycon

            >>> from icalendar import Event
            >>> from datetime import date
            >>> from pprint import pprint
            >>> event = Event.new(summary="My Event", start=date(2025, 11, 22))
            >>> pprint(event.to_jcal())
            ['vevent',
             [['dtstamp', {}, 'date-time', '2025-05-17T08:06:12Z'],
              ['summary', {}, 'text', 'My Event'],
              ['uid', {}, 'text', 'd755cef5-2311-46ed-a0e1-6733c9e15c63'],
              ['dtstart', {}, 'date', '2025-11-22']],
             []]
        c                6    g | ]}|                                 S r.   )to_jcal)rQ   r   s     r?   r   z%Component.to_jcal.<locals>.<listcomp>t  s$    KKK\!!##KKKr@   )rw   rV   rX   r   rI  r   r-   r8   )r`   r   ri   rJ   rR   s        r?   rI  zComponent.to_jcalU  s    0 
**,, 	= 	=JC!+E4!8!8Eug = =!!$,,syy{{";";<<<<= IOOKK8JKKK
 	
r@   c                N    t          j        |                                           S )zReturn this component as a jCal JSON string.

        Returns:
            JSON string

        See also :attr:`to_jcal`.
        )jsondumpsrI  re   s    r?   to_jsonzComponent.to_jsonw  s     z$,,..)))r@   jcal
str | listc                   t          |t                    rt          j        |          }t          |t                    rt          |          dk    rt          d| |          |\  }}}t          |t                    st          d| dg|          |                                | j        k    r<| 	                    |                                          }|
                    |          S  |             }t          |t                    st          d| d|          t          |          D ]\  }}t          j        || d|g	           |d         }	|d
         }
| j                            |	|
          }t          j        d|          5  |
                    |          }ddd           n# 1 swxY w Y   || j                            |	          k    r|`|                    |	|           t          |t                    st          d| d
|          t          |          D ]_\  }}t          j        d
|          5  |j                            | 
                    |                     ddd           n# 1 swxY w Y   `|S )a  Create a component from a jCal list.

        Parameters:
            jcal: jCal list or JSON string according to :rfc:`7265`.

        Raises:
            ~error.JCalParsingError: If the jCal provided is invalid.
            ~json.JSONDecodeError: If the provided string is not valid JSON.

        This reverses :func:`to_json` and :func:`to_jcal`.

        The following code parses an example from :rfc:`7265`:

        .. code-block:: pycon

            >>> from icalendar import Component
            >>> jcal = ["vcalendar",
            ...   [
            ...     ["calscale", {}, "text", "GREGORIAN"],
            ...     ["prodid", {}, "text", "-//Example Inc.//Example Calendar//EN"],
            ...     ["version", {}, "text", "2.0"]
            ...   ],
            ...   [
            ...     ["vevent",
            ...       [
            ...         ["dtstamp", {}, "date-time", "2008-02-05T19:12:24Z"],
            ...         ["dtstart", {}, "date", "2008-10-06"],
            ...         ["summary", {}, "text", "Planning meeting"],
            ...         ["uid", {}, "text", "4088E990AD89CB3DBB484909"]
            ...       ],
            ...       []
            ...     ]
            ...   ]
            ... ]
            >>> calendar = Component.from_jcal(jcal)
            >>> print(calendar.name)
            VCALENDAR
            >>> print(calendar.prodid)
            -//Example Inc.//Example Calendar//EN
            >>> event = calendar.events[0]
            >>> print(event.summary)
            Planning meeting

           z(A component must be a list with 3 items.rZ   zThe name must be a string.r   )pathrJ   zThe properties must be a list.rq   )rR     Nz!The subcomponents must be a list.)rV   r9   rK  loadsrX   r   r   r   r-   r=   	from_jcal	enumeratevalidate_propertyr5   rv   reraise_with_path_addedrs   r   r8   r   )r>   rN  r-   r   r8   component_clsr   iprop	prop_name
prop_valueprop_clsv_propr   s                 r?   rU  zComponent.from_jcal  s<   \ dC   	$:d##D$%% 	Ta":Ct    +/'j-$$$ 	",c4    ::<<38##33DJJLLAAM **4000CEE	*d++ 	"0#AZ    !,, 	- 	-GAt.tS1vFFFFQIaJ(+(9(F(F:) )H "9!Q?? 2 2!++D112 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3,99)DDDDLMM)V,,,,-.. 	"3S!=     )77 	L 	LOA|!9!Q?? L L'..s}}\/J/JKKKL L L L L L L L L L L L L L Ls$   F--F1	4F1	 .I::I>	I>	r   r*   c                f    |rt          |           S t                                                      S )a  Copy the component.

        Parameters:
            recursive:
                If ``True``, this creates copies of the component, its subcomponents,
                and all its properties.
                If ``False``, this only creates a shallow copy of the component.

        Returns:
            A copy of the component.

        Examples:

            Create a shallow copy of a component:

            .. code-block:: pycon

                >>> from icalendar import Event
                >>> event = Event.new(description="Event to be copied")
                >>> event_copy = event.copy()
                >>> str(event_copy.description)
                'Event to be copied'

            Shallow copies lose their subcomponents:

            .. code-block:: pycon

                >>> from icalendar import Calendar
                >>> calendar = Calendar.example()
                >>> len(calendar.subcomponents)
                3
                >>> calendar_copy = calendar.copy()
                >>> len(calendar_copy.subcomponents)
                0

            A recursive copy also copies all the subcomponents:

            .. code-block:: pycon

                >>> full_calendar_copy = calendar.copy(recursive=True)
                >>> len(full_calendar_copy.subcomponents)
                3
                >>> full_calendar_copy.events[0] == calendar.events[0]
                True
                >>> full_calendar_copy.events[0] is calendar.events[0]
                False

        )r   r]   copy)r`   r   rc   s     r?   ra  zComponent.copy  s,    b  	"D>>!ww||~~r@   )r-   r9   r:   r;   )rA   r;   r:   rB   )rJ   rK   r:   rL   rO   )Nrq   r   )r-   r9   rx   r   ry   rn   )r-   r9   rJ   r#   )r-   r9   rl   r   r:   r   )rq   )r   r,   )r:   r7   )r   r9   r:   r7   )TT)r   rn   r:   r   )F)r   r   r1   r   r:   r,   )r   r   r1   r   r:   r7   )r   r   r1   rn   r:   r   )r  )T)r   rn   )r:   r   )r:   rn   )NNNNNNNN)r   r=  r>  r?  r@  r   r%  r=  rA  r   rB  r?  rC  r   rD  r=  r:   r,   )r:   rX   )r:   r9   )rN  rO  r:   r,   )r   rn   r:   r*   )Nr   
__module____qualname____doc__r-   __annotations__r/   r0   r1   r2   r3   r4   r$   instancer5   r6   classmethodr=   rI   staticmethodr[   r^   rf   rh   rF   rp   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r   r  r  r   r"  rD  r$  propertyr%  setterdeleterr   r4  r8  r   r   r   r>  r   rA  r   rC  r   r@  r   rB  r+  _validate_newr<  rF  rI  rM  rU  ra  __classcell__)rc   s   @r?   r,   r,   +   s;          "&D%%%% %'H&&&&(&(J((((1$&H&&&&4%'I''''2ACICCCC
 ).---- -BL,A,C,CMCCCC=AAAAA"""".A A A [A %E %E %E [%EN    \B      ( ( ( ( (   B B B 4 4 4 [4t 37; ; ; ; ;z   & 18     &   B B B B- - - -   ^^ ( ( ( ( (	? 	? 	? 	?      6 9>    [ X XXX [ XX/4k k k k [kZ 3 3 3 \3J J J J J
    ' ' ' ' '
 
 
    & *)	  Ge, ('	 M  2 2 2 X2 # # #    , , , X, ^  ^ _  _F F F F * * \* C HE$J HF!!
	 G M	= 	= \	=   $+/)-%)#')--1!& & & & [&P 
  
  
  
D* * * * V V V [Vp3 3 3 3 3 3 3 3 3 3 3r@   r,   )9rd  
__future__r   rK  ra  r   r   r   r   r   r	   typingr
   r   r   r   r   icalendar.attrr   r   r   r   r   r   r   r   r   r   icalendar.cal.component_factoryr   icalendar.caselessdictr   icalendar.errorr   r   r   r   r   r   r    r!   icalendar.parser_toolsr"   r   r#   r$   r%   r&   icalendar.timezoner'   icalendar.toolsr)   icalendar.compatibilityr*   r   r,   __all__r.   r@   r?   <module>ry     sC   * * " " " " " "        > > > > > > > > > > > > > > B B B B B B B B B B B B B B                        = < < < < < / / / / / / = = = = = = = =              4 3 3 3 3 3 D D D D D D D D D D D D " " " " " " # # # # # # -,,,,,,
b b b b b b b bJ -r@   