o
    PÉfe  ã                   @   sF   d dl mZ d dlmZ d dlmZ d dlmZ G dd„ deeƒZdS )é    )ÚMacroElement)ÚTemplate)Ú
JSCSSMixin)Úparse_optionsc                       s6   e Zd ZdZdgZdgZedƒZd‡ fdd„	Z‡  Z	S )	ÚGroupedLayerControla|  
    Create a Layer Control with groups of overlays.

    Parameters
    ----------
    groups : dict
          A dictionary where the keys are group names and the values are lists
          of layer objects.
          e.g. {
              "Group 1": [layer1, layer2],
              "Group 2": [layer3, layer4]
            }
    exclusive_groups: bool, default True
         Whether to use radio buttons (default) or checkboxes.
         If you want to use both, use two separate instances of this class.
    **kwargs
        Additional (possibly inherited) options. See
        https://leafletjs.com/reference.html#control-layers

    )z"leaflet.groupedlayercontrol.min.jszkhttps://cdnjs.cloudflare.com/ajax/libs/leaflet-groupedlayercontrol/0.6.1/leaflet.groupedlayercontrol.min.js)z#leaflet.groupedlayercontrol.min.csszlhttps://cdnjs.cloudflare.com/ajax/libs/leaflet-groupedlayercontrol/0.6.1/leaflet.groupedlayercontrol.min.cssaÛ  
        {% macro script(this,kwargs) %}

            L.control.groupedLayers(
                null,
                {
                    {%- for group_name, overlays in this.grouped_overlays.items() %}
                    {{ group_name|tojson }} : {
                        {%- for overlaykey, val in overlays.items() %}
                        {{ overlaykey|tojson }} : {{val}},
                        {%- endfor %}
                    },
                    {%- endfor %}
                },
                {{ this.options|tojson }},
            ).addTo({{this._parent.get_name()}});

            {%- for val in this.layers_untoggle %}
            {{ val }}.remove();
            {%- endfor %}

        {% endmacro %}
        Tc                    sÄ   t ƒ  ¡  d| _tdi |¤Ž| _|rt| ¡ ƒ| jd< tƒ | _i | _	| 
¡ D ]9\}}i | j	|< |D ]}| ¡ | j	| |j< |jsH| j | ¡ ¡ d|_q1|r_|dd … D ]
}| j | ¡ ¡ qTq&d S )Nr   ÚexclusiveGroupsFé   © )ÚsuperÚ__init__Ú_namer   ÚoptionsÚlistÚkeysÚsetÚlayers_untoggleÚgrouped_overlaysÚitemsÚget_nameÚ
layer_nameÚshowÚaddÚcontrol)ÚselfÚgroupsÚexclusive_groupsÚkwargsÚ
group_nameÚsublistÚelement©Ú	__class__r	   ún/home/deployuser/azure_apps/autowriter/venv/lib/python3.10/site-packages/folium/plugins/groupedlayercontrol.pyr   E   s,   

þÿ€òzGroupedLayerControl.__init__)T)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
default_jsÚdefault_cssr   Ú	_templater   Ú__classcell__r	   r	   r    r"   r      s    ÿÿÿr   N)	Úbranca.elementr   Újinja2r   Úfolium.elementsr   Úfolium.utilitiesr   r   r	   r	   r	   r"   Ú<module>   s
    