zenit-sdk 0.0.9 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  // src/react/ZenitMap.tsx
2
- import React3, { useCallback as useCallback2, useEffect as useEffect4, useImperativeHandle, useMemo as useMemo2, useState as useState2, forwardRef } from "react";
2
+ import React4, { useCallback as useCallback2, useEffect as useEffect5, useImperativeHandle, useMemo as useMemo2, useState as useState2, forwardRef } from "react";
3
3
  import { MapContainer, Marker as Marker2, TileLayer, ZoomControl } from "react-leaflet";
4
4
  import L4 from "leaflet";
5
5
 
@@ -246,6 +246,7 @@ function getEffectiveLayerOpacity(baseOpacity, zoom, layerType, geometryType, op
246
246
  }
247
247
 
248
248
  // src/react/map/layer-geojson.tsx
249
+ import { useEffect, useRef } from "react";
249
250
  import { GeoJSON } from "react-leaflet";
250
251
  import L from "leaflet";
251
252
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -287,6 +288,44 @@ var LayerGeoJson = ({
287
288
  const pointFeatures = features.filter(isPointGeometry);
288
289
  const fillData = fillFeatures.length > 0 ? buildFeatureCollection(fillFeatures) : null;
289
290
  const pointsData = pointFeatures.length > 0 ? buildFeatureCollection(pointFeatures) : null;
291
+ const clusterLayerRef = useRef(null);
292
+ const canCluster = typeof L.markerClusterGroup === "function";
293
+ useEffect(() => {
294
+ if (!mapInstance || !panesReady || !pointsData || !canCluster) return;
295
+ const markerClusterGroup = L.markerClusterGroup;
296
+ const clusterLayer = clusterLayerRef.current ?? markerClusterGroup();
297
+ clusterLayerRef.current = clusterLayer;
298
+ if (!mapInstance.hasLayer(clusterLayer)) {
299
+ mapInstance.addLayer(clusterLayer);
300
+ }
301
+ clusterLayer.clearLayers();
302
+ const geoJsonLayer = L.geoJSON(pointsData, {
303
+ pointToLayer: (feature, latlng) => L.circleMarker(latlng, {
304
+ radius: isMobile ? 8 : 6,
305
+ pane: mapInstance.getPane(pointsPaneName) ? pointsPaneName : void 0,
306
+ ...styleFn(feature, layerType, baseOpacity)
307
+ }),
308
+ onEachFeature
309
+ });
310
+ clusterLayer.addLayer(geoJsonLayer);
311
+ return () => {
312
+ clusterLayer.clearLayers();
313
+ if (mapInstance.hasLayer(clusterLayer)) {
314
+ mapInstance.removeLayer(clusterLayer);
315
+ }
316
+ };
317
+ }, [
318
+ baseOpacity,
319
+ canCluster,
320
+ isMobile,
321
+ layerType,
322
+ mapInstance,
323
+ onEachFeature,
324
+ panesReady,
325
+ pointsData,
326
+ pointsPaneName,
327
+ styleFn
328
+ ]);
290
329
  return /* @__PURE__ */ jsxs(Fragment, { children: [
291
330
  fillData && /* @__PURE__ */ jsx(
292
331
  GeoJSON,
@@ -301,7 +340,7 @@ var LayerGeoJson = ({
301
340
  },
302
341
  `fill-${layerId}`
303
342
  ),
304
- pointsData && /* @__PURE__ */ jsx(
343
+ pointsData && !canCluster && /* @__PURE__ */ jsx(
305
344
  GeoJSON,
306
345
  {
307
346
  data: pointsData,
@@ -318,18 +357,18 @@ var LayerGeoJson = ({
318
357
  };
319
358
 
320
359
  // src/react/map/location-control.tsx
321
- import { useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
360
+ import { useEffect as useEffect3, useMemo, useRef as useRef3 } from "react";
322
361
  import { createPortal } from "react-dom";
323
362
  import { Circle, Marker, useMap } from "react-leaflet";
324
363
  import L3 from "leaflet";
325
364
 
326
365
  // src/react/hooks/use-geolocation.ts
327
- import { useCallback, useEffect, useRef, useState } from "react";
366
+ import { useCallback, useEffect as useEffect2, useRef as useRef2, useState } from "react";
328
367
  function useGeolocation(options) {
329
368
  const [isTracking, setIsTracking] = useState(false);
330
369
  const [location, setLocation] = useState(null);
331
370
  const [error, setError] = useState(null);
332
- const watchIdRef = useRef(null);
371
+ const watchIdRef = useRef2(null);
333
372
  const stopTracking = useCallback(() => {
334
373
  if (watchIdRef.current !== null && typeof navigator !== "undefined" && navigator.geolocation) {
335
374
  navigator.geolocation.clearWatch(watchIdRef.current);
@@ -371,7 +410,7 @@ function useGeolocation(options) {
371
410
  }
372
411
  }, [isTracking, startTracking, stopTracking]);
373
412
  const clearError = useCallback(() => setError(null), []);
374
- useEffect(() => {
413
+ useEffect2(() => {
375
414
  return () => {
376
415
  stopTracking();
377
416
  };
@@ -798,10 +837,10 @@ var LocateIcon = () => /* @__PURE__ */ jsxs2("svg", { width: "18", height: "18",
798
837
  ] });
799
838
  var LocationControl = ({ position = "bottomleft", zoom = 16 }) => {
800
839
  const map = useMap();
801
- const controlRef = useRef2(null);
802
- const hasCenteredRef = useRef2(false);
840
+ const controlRef = useRef3(null);
841
+ const hasCenteredRef = useRef3(false);
803
842
  const { isTracking, location, error, toggleTracking, clearError } = useGeolocation();
804
- useEffect2(() => {
843
+ useEffect3(() => {
805
844
  if (typeof document === "undefined") return;
806
845
  if (document.getElementById(LOCATION_STYLE_ID)) return;
807
846
  const styleTag = document.createElement("style");
@@ -809,7 +848,7 @@ var LocationControl = ({ position = "bottomleft", zoom = 16 }) => {
809
848
  styleTag.textContent = LOCATION_STYLES;
810
849
  document.head.appendChild(styleTag);
811
850
  }, []);
812
- useEffect2(() => {
851
+ useEffect3(() => {
813
852
  const control = L3.control({ position });
814
853
  control.onAdd = () => {
815
854
  const container = L3.DomUtil.create("div", "zenit-location-control");
@@ -823,7 +862,7 @@ var LocationControl = ({ position = "bottomleft", zoom = 16 }) => {
823
862
  controlRef.current = null;
824
863
  };
825
864
  }, [map, position]);
826
- useEffect2(() => {
865
+ useEffect3(() => {
827
866
  if (!location || !isTracking) return;
828
867
  if (hasCenteredRef.current) return;
829
868
  hasCenteredRef.current = true;
@@ -870,7 +909,7 @@ var LocationControl = ({ position = "bottomleft", zoom = 16 }) => {
870
909
  };
871
910
 
872
911
  // src/react/map/map-handlers.tsx
873
- import { useEffect as useEffect3, useRef as useRef3 } from "react";
912
+ import { useEffect as useEffect4, useRef as useRef4 } from "react";
874
913
  import { useMap as useMap2 } from "react-leaflet";
875
914
  function computeBBoxFromGeojson(geojson) {
876
915
  if (!geojson || !Array.isArray(geojson.features)) return null;
@@ -918,9 +957,9 @@ var BBoxZoomHandler = ({
918
957
  enabled = true
919
958
  }) => {
920
959
  const map = useMap2();
921
- const lastAppliedBBox = useRef3(null);
922
- const lastUserInteracted = useRef3(false);
923
- useEffect3(() => {
960
+ const lastAppliedBBox = useRef4(null);
961
+ const lastUserInteracted = useRef4(false);
962
+ useEffect4(() => {
924
963
  const handleInteraction = () => {
925
964
  lastUserInteracted.current = true;
926
965
  };
@@ -931,7 +970,7 @@ var BBoxZoomHandler = ({
931
970
  map.off("zoomstart", handleInteraction);
932
971
  };
933
972
  }, [map]);
934
- useEffect3(() => {
973
+ useEffect4(() => {
935
974
  if (!enabled) return;
936
975
  let resolvedBBox = bbox ?? null;
937
976
  if (!resolvedBBox && geojson) {
@@ -959,7 +998,7 @@ var BBoxZoomHandler = ({
959
998
  };
960
999
  var ZoomBasedOpacityHandler = ({ onZoomChange }) => {
961
1000
  const map = useMap2();
962
- useEffect3(() => {
1001
+ useEffect4(() => {
963
1002
  const handleZoom = () => {
964
1003
  onZoomChange(map.getZoom());
965
1004
  };
@@ -973,7 +1012,7 @@ var ZoomBasedOpacityHandler = ({ onZoomChange }) => {
973
1012
  };
974
1013
  var MapInstanceBridge = ({ onReady }) => {
975
1014
  const map = useMap2();
976
- useEffect3(() => {
1015
+ useEffect4(() => {
977
1016
  onReady(map);
978
1017
  }, [map, onReady]);
979
1018
  return null;
@@ -1108,7 +1147,7 @@ var ZenitMap = forwardRef(({
1108
1147
  return window.matchMedia("(max-width: 768px)").matches;
1109
1148
  });
1110
1149
  const normalizedLayers = useMemo2(() => normalizeMapLayers(map), [map]);
1111
- useEffect4(() => {
1150
+ useEffect5(() => {
1112
1151
  if (typeof window === "undefined") return;
1113
1152
  const mql = window.matchMedia("(max-width: 768px)");
1114
1153
  const onChange = (e) => {
@@ -1126,17 +1165,17 @@ var ZenitMap = forwardRef(({
1126
1165
  }
1127
1166
  return;
1128
1167
  }, []);
1129
- useEffect4(() => {
1168
+ useEffect5(() => {
1130
1169
  if (featureInfoMode === "popup") {
1131
1170
  ensurePopupStyles();
1132
1171
  }
1133
1172
  }, [featureInfoMode]);
1134
- useEffect4(() => {
1173
+ useEffect5(() => {
1135
1174
  if (featureInfoMode !== "popup") {
1136
1175
  setIsPopupOpen(false);
1137
1176
  }
1138
1177
  }, [featureInfoMode]);
1139
- useEffect4(() => {
1178
+ useEffect5(() => {
1140
1179
  if (!mapInstance) return;
1141
1180
  const popupPane = mapInstance.getPane("popupPane");
1142
1181
  if (popupPane) {
@@ -1145,7 +1184,7 @@ var ZenitMap = forwardRef(({
1145
1184
  const labelsPane = mapInstance.getPane(LABELS_PANE_NAME) ?? mapInstance.createPane(LABELS_PANE_NAME);
1146
1185
  labelsPane.style.zIndex = "600";
1147
1186
  }, [mapInstance]);
1148
- useEffect4(() => {
1187
+ useEffect5(() => {
1149
1188
  if (!mapInstance) return;
1150
1189
  const handlePopupOpen = () => setIsPopupOpen(true);
1151
1190
  const handlePopupClose = () => setIsPopupOpen(false);
@@ -1214,7 +1253,7 @@ var ZenitMap = forwardRef(({
1214
1253
  const [mapOverrides, setMapOverrides] = useState2([]);
1215
1254
  const [controlOverrides, setControlOverrides] = useState2([]);
1216
1255
  const [uiOverrides, setUiOverrides] = useState2([]);
1217
- useEffect4(() => {
1256
+ useEffect5(() => {
1218
1257
  let isMounted = true;
1219
1258
  setLoadingMap(true);
1220
1259
  setMapError(null);
@@ -1237,7 +1276,7 @@ var ZenitMap = forwardRef(({
1237
1276
  isMounted = false;
1238
1277
  };
1239
1278
  }, [client.maps, mapId, onError, onLoadingChange]);
1240
- useEffect4(() => {
1279
+ useEffect5(() => {
1241
1280
  if (normalizedLayers.length === 0) {
1242
1281
  setLayers([]);
1243
1282
  setBaseStates([]);
@@ -1268,7 +1307,7 @@ var ZenitMap = forwardRef(({
1268
1307
  setMapOverrides(initialOverrides);
1269
1308
  setUiOverrides([]);
1270
1309
  }, [normalizedLayers]);
1271
- useEffect4(() => {
1310
+ useEffect5(() => {
1272
1311
  if (!layerControls) {
1273
1312
  setControlOverrides([]);
1274
1313
  return;
@@ -1280,7 +1319,7 @@ var ZenitMap = forwardRef(({
1280
1319
  }));
1281
1320
  setControlOverrides(overrides);
1282
1321
  }, [layerControls]);
1283
- useEffect4(() => {
1322
+ useEffect5(() => {
1284
1323
  if (layerStates) {
1285
1324
  return;
1286
1325
  }
@@ -1290,12 +1329,12 @@ var ZenitMap = forwardRef(({
1290
1329
  onLayerStateChange?.(reset);
1291
1330
  }
1292
1331
  }, [baseStates, effectiveStates.length, layerControls, layerStates, onLayerStateChange]);
1293
- useEffect4(() => {
1332
+ useEffect5(() => {
1294
1333
  if (layerStates) {
1295
1334
  setEffectiveStates(layerStates);
1296
1335
  }
1297
1336
  }, [layerStates]);
1298
- useEffect4(() => {
1337
+ useEffect5(() => {
1299
1338
  if (layerStates) {
1300
1339
  return;
1301
1340
  }
@@ -1308,11 +1347,11 @@ var ZenitMap = forwardRef(({
1308
1347
  setEffectiveStates(next);
1309
1348
  onLayerStateChange?.(next);
1310
1349
  }, [baseStates, controlOverrides, layerStates, mapOverrides, onLayerStateChange, uiOverrides]);
1311
- useEffect4(() => {
1350
+ useEffect5(() => {
1312
1351
  if (!Array.isArray(layerControls) || layerControls.length > 0) return;
1313
1352
  setUiOverrides([]);
1314
1353
  }, [layerControls]);
1315
- useEffect4(() => {
1354
+ useEffect5(() => {
1316
1355
  if (layerStates) {
1317
1356
  return;
1318
1357
  }
@@ -1382,7 +1421,7 @@ var ZenitMap = forwardRef(({
1382
1421
  return DEFAULT_CENTER;
1383
1422
  }, [initialCenter, map?.settings?.center]);
1384
1423
  const zoom = initialZoom ?? map?.settings?.zoom ?? DEFAULT_ZOOM;
1385
- useEffect4(() => {
1424
+ useEffect5(() => {
1386
1425
  setCurrentZoom(zoom);
1387
1426
  }, [zoom]);
1388
1427
  const decoratedLayers = useMemo2(() => {
@@ -1466,7 +1505,7 @@ var ZenitMap = forwardRef(({
1466
1505
  },
1467
1506
  [onMapReady]
1468
1507
  );
1469
- useEffect4(() => {
1508
+ useEffect5(() => {
1470
1509
  if (!mapInstance) {
1471
1510
  setPanesReady(false);
1472
1511
  return;
@@ -1714,7 +1753,7 @@ var ZenitMap = forwardRef(({
1714
1753
  const pointsPaneName = `zenit-layer-${layerState.mapLayer.layerId}-points`;
1715
1754
  const layerType = layerState.layer?.layerType ?? layerState.mapLayer.layerType ?? void 0;
1716
1755
  const labelKey = labelKeyIndex.get(String(layerState.mapLayer.layerId));
1717
- return /* @__PURE__ */ jsxs3(React3.Fragment, { children: [
1756
+ return /* @__PURE__ */ jsxs3(React4.Fragment, { children: [
1718
1757
  layerState.data && /* @__PURE__ */ jsx3(
1719
1758
  LayerGeoJson,
1720
1759
  {
@@ -1871,7 +1910,7 @@ var ZenitMap = forwardRef(({
1871
1910
  ZenitMap.displayName = "ZenitMap";
1872
1911
 
1873
1912
  // src/react/ZenitLayerManager.tsx
1874
- import React4, { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef5, useState as useState3 } from "react";
1913
+ import React5, { useEffect as useEffect6, useMemo as useMemo3, useRef as useRef6, useState as useState3 } from "react";
1875
1914
 
1876
1915
  // src/react/icons.tsx
1877
1916
  import { Eye, EyeOff, ChevronLeft, ChevronRight, Layers, Upload, X, ZoomIn } from "lucide-react";
@@ -1923,7 +1962,7 @@ var ZenitLayerManager = ({
1923
1962
  const [layers, setLayers] = useState3([]);
1924
1963
  const [activeTab, setActiveTab] = useState3("layers");
1925
1964
  const [panelVisible, setPanelVisible] = useState3(true);
1926
- const lastEmittedStatesRef = useRef5(null);
1965
+ const lastEmittedStatesRef = useRef6(null);
1927
1966
  const isControlled = Array.isArray(layerStates) && typeof onLayerStatesChange === "function";
1928
1967
  const baseStates = useMemo3(
1929
1968
  () => initLayerStates(
@@ -1964,7 +2003,7 @@ var ZenitLayerManager = ({
1964
2003
  });
1965
2004
  return index;
1966
2005
  }, [map, mapLayers]);
1967
- const resolveUserOpacity = React4.useCallback((state) => {
2006
+ const resolveUserOpacity = React5.useCallback((state) => {
1968
2007
  if (typeof state.overrideOpacity === "number") return state.overrideOpacity;
1969
2008
  if (typeof state.overrideOpacity === "string") {
1970
2009
  const parsed = Number.parseFloat(state.overrideOpacity);
@@ -1972,7 +2011,7 @@ var ZenitLayerManager = ({
1972
2011
  }
1973
2012
  return state.opacity ?? 1;
1974
2013
  }, []);
1975
- const resolveEffectiveOpacity = React4.useCallback(
2014
+ const resolveEffectiveOpacity = React5.useCallback(
1976
2015
  (layerId, userOpacity) => {
1977
2016
  if (!autoOpacityOnZoom || typeof mapZoom !== "number") {
1978
2017
  return userOpacity;
@@ -2002,7 +2041,7 @@ var ZenitLayerManager = ({
2002
2041
  };
2003
2042
  });
2004
2043
  }, [autoOpacityOnZoom, effectiveStates, mapZoom, resolveEffectiveOpacity, resolveUserOpacity]);
2005
- useEffect5(() => {
2044
+ useEffect6(() => {
2006
2045
  let cancelled = false;
2007
2046
  setLoadingMap(true);
2008
2047
  setMapError(null);
@@ -2034,12 +2073,12 @@ var ZenitLayerManager = ({
2034
2073
  cancelled = true;
2035
2074
  };
2036
2075
  }, [client.maps, mapId]);
2037
- useEffect5(() => {
2076
+ useEffect6(() => {
2038
2077
  if (!showUploadTab && activeTab === "upload") {
2039
2078
  setActiveTab("layers");
2040
2079
  }
2041
2080
  }, [activeTab, showUploadTab]);
2042
- useEffect5(() => {
2081
+ useEffect6(() => {
2043
2082
  if (isControlled) return;
2044
2083
  if (!onLayerStatesChange) return;
2045
2084
  const emitStates = autoOpacityOnZoom && typeof mapZoom === "number" ? effectiveStatesWithZoom : effectiveStates;
@@ -2057,7 +2096,7 @@ var ZenitLayerManager = ({
2057
2096
  mapZoom,
2058
2097
  onLayerStatesChange
2059
2098
  ]);
2060
- const updateLayerVisible = React4.useCallback(
2099
+ const updateLayerVisible = React5.useCallback(
2061
2100
  (layerId, visible) => {
2062
2101
  if (!onLayerStatesChange) return;
2063
2102
  const next = effectiveStates.map(
@@ -2067,7 +2106,7 @@ var ZenitLayerManager = ({
2067
2106
  },
2068
2107
  [effectiveStates, onLayerStatesChange]
2069
2108
  );
2070
- const updateLayerOpacity = React4.useCallback(
2109
+ const updateLayerOpacity = React5.useCallback(
2071
2110
  (layerId, opacity) => {
2072
2111
  if (!onLayerStatesChange) return;
2073
2112
  const adjustedOpacity = resolveEffectiveOpacity(layerId, opacity);
@@ -2078,7 +2117,7 @@ var ZenitLayerManager = ({
2078
2117
  },
2079
2118
  [effectiveStates, onLayerStatesChange, resolveEffectiveOpacity]
2080
2119
  );
2081
- const resolveFeatureCount = React4.useCallback(
2120
+ const resolveFeatureCount = React5.useCallback(
2082
2121
  (layerId, layer) => {
2083
2122
  const resolvedFeatureCount = layerFeatureCounts?.[layerId] ?? layerFeatureCounts?.[String(layerId)];
2084
2123
  if (typeof resolvedFeatureCount === "number") return resolvedFeatureCount;
@@ -2116,7 +2155,7 @@ var ZenitLayerManager = ({
2116
2155
  return String(a.mapLayer.layerId).localeCompare(String(b.mapLayer.layerId));
2117
2156
  });
2118
2157
  }, [effectiveStates, layers, resolveFeatureCount]);
2119
- const resolveLayerStyle = React4.useCallback(
2158
+ const resolveLayerStyle = React5.useCallback(
2120
2159
  (layerId) => {
2121
2160
  const layerKey = String(layerId);
2122
2161
  const fromProp = mapLayers?.find((entry) => String(entry.layerId) === layerKey)?.style;
@@ -2499,11 +2538,11 @@ var ZenitFeatureFilterPanel = ({
2499
2538
  };
2500
2539
 
2501
2540
  // src/react/ai/FloatingChatBox.tsx
2502
- import { useCallback as useCallback4, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef7, useState as useState5 } from "react";
2541
+ import { useCallback as useCallback4, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef8, useState as useState5 } from "react";
2503
2542
  import { createPortal as createPortal2 } from "react-dom";
2504
2543
 
2505
2544
  // src/react/hooks/use-chat.ts
2506
- import { useCallback as useCallback3, useRef as useRef6, useState as useState4 } from "react";
2545
+ import { useCallback as useCallback3, useRef as useRef7, useState as useState4 } from "react";
2507
2546
 
2508
2547
  // src/ai/chat.service.ts
2509
2548
  var DEFAULT_ERROR_MESSAGE = "No fue posible completar la solicitud al asistente.";
@@ -2663,7 +2702,7 @@ var useSendMessageStream = (config) => {
2663
2702
  const [streamingText, setStreamingText] = useState4("");
2664
2703
  const [completeResponse, setCompleteResponse] = useState4(null);
2665
2704
  const [error, setError] = useState4(null);
2666
- const requestIdRef = useRef6(0);
2705
+ const requestIdRef = useRef7(0);
2667
2706
  const reset = useCallback3(() => {
2668
2707
  setIsStreaming(false);
2669
2708
  setStreamingText("");
@@ -2961,6 +3000,17 @@ var styles = {
2961
3000
  width: 480,
2962
3001
  height: 640
2963
3002
  },
3003
+ panelMobileFullscreen: {
3004
+ position: "fixed",
3005
+ top: 0,
3006
+ left: 0,
3007
+ right: 0,
3008
+ bottom: 0,
3009
+ width: "100%",
3010
+ height: "100%",
3011
+ borderRadius: 0,
3012
+ margin: 0
3013
+ },
2964
3014
  // Header with green gradient
2965
3015
  header: {
2966
3016
  padding: "14px 16px",
@@ -3210,16 +3260,16 @@ var FloatingChatBox = ({
3210
3260
  const [errorMessage, setErrorMessage] = useState5(null);
3211
3261
  const [isFocused, setIsFocused] = useState5(false);
3212
3262
  const [isMobile, setIsMobile] = useState5(false);
3213
- const messagesEndRef = useRef7(null);
3214
- const messagesContainerRef = useRef7(null);
3215
- const chatBoxRef = useRef7(null);
3263
+ const messagesEndRef = useRef8(null);
3264
+ const messagesContainerRef = useRef8(null);
3265
+ const chatBoxRef = useRef8(null);
3216
3266
  const chatConfig = useMemo4(() => {
3217
3267
  if (!baseUrl) return void 0;
3218
3268
  return { baseUrl, accessToken, getAccessToken };
3219
3269
  }, [accessToken, baseUrl, getAccessToken]);
3220
3270
  const { sendMessage: sendMessage2, isStreaming, streamingText, completeResponse } = useSendMessageStream(chatConfig);
3221
3271
  const canSend = Boolean(mapId) && Boolean(baseUrl) && inputValue.trim().length > 0 && !isStreaming;
3222
- useEffect6(() => {
3272
+ useEffect7(() => {
3223
3273
  if (open && isMobile) {
3224
3274
  setExpanded(true);
3225
3275
  }
@@ -3229,7 +3279,7 @@ var FloatingChatBox = ({
3229
3279
  messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
3230
3280
  }
3231
3281
  }, []);
3232
- useEffect6(() => {
3282
+ useEffect7(() => {
3233
3283
  if (open && messages.length === 0) {
3234
3284
  setMessages([
3235
3285
  {
@@ -3240,10 +3290,10 @@ var FloatingChatBox = ({
3240
3290
  ]);
3241
3291
  }
3242
3292
  }, [open, messages.length]);
3243
- useEffect6(() => {
3293
+ useEffect7(() => {
3244
3294
  scrollToBottom();
3245
3295
  }, [messages, streamingText, scrollToBottom]);
3246
- useEffect6(() => {
3296
+ useEffect7(() => {
3247
3297
  if (!open) return;
3248
3298
  if (isMobile && expanded) return;
3249
3299
  const handleClickOutside = (event) => {
@@ -3256,7 +3306,7 @@ var FloatingChatBox = ({
3256
3306
  document.removeEventListener("mousedown", handleClickOutside);
3257
3307
  };
3258
3308
  }, [open, isMobile, expanded]);
3259
- useEffect6(() => {
3309
+ useEffect7(() => {
3260
3310
  if (typeof window === "undefined") return;
3261
3311
  const mediaQuery = window.matchMedia("(max-width: 768px)");
3262
3312
  const updateMobile = () => setIsMobile(mediaQuery.matches);
@@ -3274,7 +3324,7 @@ var FloatingChatBox = ({
3274
3324
  }
3275
3325
  };
3276
3326
  }, []);
3277
- useEffect6(() => {
3327
+ useEffect7(() => {
3278
3328
  if (typeof document === "undefined") return;
3279
3329
  if (!open || !isMobile) return;
3280
3330
  document.body.style.overflow = "hidden";
@@ -3486,22 +3536,6 @@ var FloatingChatBox = ({
3486
3536
  box-sizing: border-box;
3487
3537
  }
3488
3538
  @media (max-width: 768px) {
3489
- .zenit-chat-panel.zenit-chat-panel--fullscreen {
3490
- position: fixed !important;
3491
- left: 0 !important;
3492
- right: 0 !important;
3493
- top: 4rem !important;
3494
- bottom: 0 !important;
3495
- width: 100% !important;
3496
- max-width: 100% !important;
3497
- height: auto !important;
3498
- border-radius: 0 !important;
3499
- display: flex !important;
3500
- flex-direction: column !important;
3501
- overflow: hidden !important;
3502
- z-index: 100000 !important;
3503
- padding-top: env(safe-area-inset-top);
3504
- }
3505
3539
  .zenit-chat-panel.zenit-chat-panel--fullscreen .zenit-ai-body {
3506
3540
  flex: 1;
3507
3541
  min-height: 0;
@@ -3521,16 +3555,20 @@ var FloatingChatBox = ({
3521
3555
  "div",
3522
3556
  {
3523
3557
  ref: chatBoxRef,
3524
- className: `zenit-chat-panel${expanded ? " zenit-chat-panel--expanded" : ""}${isMobile ? " zenit-chat-panel--fullscreen" : ""}`,
3525
- style: {
3526
- ...styles.panel,
3527
- ...expanded ? styles.panelExpanded : styles.panelNormal
3528
- },
3558
+ className: `zenit-chat-panel${expanded && !isMobile ? " zenit-chat-panel--expanded" : ""}${isMobile ? " zenit-chat-panel--fullscreen" : ""}`,
3559
+ style: (() => {
3560
+ const desktopStyle = expanded ? styles.panelExpanded : styles.panelNormal;
3561
+ const mobileStyle = styles.panelMobileFullscreen;
3562
+ return {
3563
+ ...styles.panel,
3564
+ ...isMobile ? mobileStyle : desktopStyle
3565
+ };
3566
+ })(),
3529
3567
  children: [
3530
3568
  /* @__PURE__ */ jsxs6("header", { style: styles.header, children: [
3531
3569
  /* @__PURE__ */ jsx7("h3", { style: styles.title, children: "Asistente Zenit AI" }),
3532
3570
  /* @__PURE__ */ jsxs6("div", { style: styles.headerButtons, children: [
3533
- /* @__PURE__ */ jsx7(
3571
+ !isMobile && /* @__PURE__ */ jsx7(
3534
3572
  "button",
3535
3573
  {
3536
3574
  type: "button",
@@ -3722,4 +3760,4 @@ export {
3722
3760
  useSendMessageStream,
3723
3761
  FloatingChatBox
3724
3762
  };
3725
- //# sourceMappingURL=chunk-PCTRVN4O.mjs.map
3763
+ //# sourceMappingURL=chunk-OOK4DBG5.mjs.map