
    Dh3                     l    S SK JrJr  S SKJr  S SKJr  S SKJr  S SK	J
r
  S SKJrJr   " S S\\5      rg	)
    )OptionalUnion)
JSCSSMixin)GeoJson)FeatureGroup)Template)JsCoderemove_emptyc                      ^  \ rS rSrSr\" S5      rS/r      SS\\	\
\4   S\S\S	\\\	S4   S
\\\	S4   S\S\\\\4      4U 4S jjjrSrU =r$ )Realtime
   a	  Put realtime data on a Leaflet map: live tracking GPS units,
sensor data or just about anything.

Based on: https://github.com/perliedman/leaflet-realtime

Parameters
----------
source: str, dict, JsCode
    The source can be one of:

    * a string with the URL to get data from
    * a dict that is passed to javascript's `fetch` function
      for fetching the data
    * a `folium.JsCode` object in case you need more freedom.
start: bool, default True
    Should automatic updates be enabled when layer is added
    on the map and stopped when layer is removed from the map
interval: int, default 60000
    Automatic update interval, in milliseconds
get_feature_id: str or JsCode, optional
    A JS function with a geojson `feature` as parameter
    default returns `feature.properties.id`
    Function to get an identifier to uniquely identify a feature over time
update_feature: str or JsCode, optional
    A JS function with a geojson `feature` as parameter
    Used to update an existing feature's layer;
    by default, points (markers) are updated, other layers are discarded
    and replaced with a new, updated layer.
    Allows to create more complex transitions,
    for example, when a feature is updated
remove_missing: bool, default False
    Should missing features between updates been automatically
    removed from the layer
container: FeatureGroup or GeoJson, default GeoJson
    The container will typically be a `FeatureGroup`, `MarkerCluster` or
    `GeoJson`, but it can be anything that generates a javascript
    L.LayerGroup object, i.e. something that has the methods
    `addLayer` and `removeLayer`.

Other keyword arguments are passed to the GeoJson layer, so you can pass
`style`, `point_to_layer` and/or `on_each_feature`. Make sure to wrap
Javascript functions in the JsCode class.

Examples
--------
>>> from folium import JsCode
>>> m = folium.Map(location=[40.73, -73.94], zoom_start=12)
>>> rt = Realtime(
...     "https://raw.githubusercontent.com/python-visualization/folium-example-data/main/subway_stations.geojson",
...     get_feature_id=JsCode("(f) => { return f.properties.objectid; }"),
...     point_to_layer=JsCode(
...         "(f, latlng) => { return L.circleMarker(latlng, {radius: 8, fillOpacity: 0.2})}"
...     ),
...     interval=10000,
... )
>>> rt.add_to(m)
a  
        {% macro script(this, kwargs) %}
            var {{ this.get_name() }} = L.realtime(
            {% if this.src is string or this.src is mapping -%}
                {{ this.src|tojson }},
            {% else -%}
                {{ this.src.js_code }},
            {% endif -%}
                {{ this.options | tojavascript }}
            );
            {{ this._parent.get_name() }}.addLayer(
                {{ this.get_name() }}._container
            );
        {% endmacro %}
    )Leaflet_Realtime_jszQhttps://cdnjs.cloudflare.com/ajax/libs/leaflet-realtime/2.2.0/leaflet-realtime.jsNsourcestartintervalget_feature_idupdate_featureremove_missing	containerc                    > [         T	U ]  5         SU l        Xl        X(S'   X8S'   Ub  [	        U5      US'   Ub  [	        U5      US'   XhS'   XxS'   [        S0 UD6U l        g )	Nr   r   r   r   r   r   r    )super__init___namesrcr	   r
   options)
selfr   r   r   r   r   r   r   kwargs	__class__s
            jC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\folium/plugins/realtime.pyr   Realtime.__init__^   sw     	
w%z%'-n'=F#$%'-n'=F#$#1 '{#-f-    )r   r   r   )Ti`  NNFN)__name__
__module____qualname____firstlineno____doc__r   	_template
default_jsr   strdictr	   boolintr   r   r   r   __static_attributes____classcell__)r   s   @r    r   r   
   s    8t 	I&	
J 3737$<@.c4'(. . 	.
 fc4/0. fc4/0. . E,"789. .r"   r   N)typingr   r   folium.elementsr   folium.featuresr   
folium.mapr   folium.templater   folium.utilitiesr	   r
   r   r   r"   r    <module>r6      s'    " & # # $ 1l.z< l.r"   