zenit-sdk 0.1.2 → 0.1.4

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.
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ ChevronDown: () => import_lucide_react.ChevronDown,
33
34
  ChevronLeft: () => import_lucide_react.ChevronLeft,
34
35
  ChevronRight: () => import_lucide_react.ChevronRight,
35
36
  DEFAULT_MAX_FEATURES_FULL_GEOJSON: () => DEFAULT_MAX_FEATURES_FULL_GEOJSON,
@@ -50,6 +51,7 @@ __export(src_exports, {
50
51
  ZenitMap: () => ZenitMap,
51
52
  ZenitMapsClient: () => ZenitMapsClient,
52
53
  ZenitSdkAuthClient: () => ZenitSdkAuthClient,
54
+ ZenitSelect: () => ZenitSelect,
53
55
  ZoomIn: () => import_lucide_react.ZoomIn,
54
56
  applyFilteredGeoJSONStrategy: () => applyFilteredGeoJSONStrategy,
55
57
  applyLayerOverrides: () => applyLayerOverrides,
@@ -3350,13 +3352,366 @@ var ZenitMap = (0, import_react5.forwardRef)(({
3350
3352
  ZenitMap.displayName = "ZenitMap";
3351
3353
 
3352
3354
  // src/react/ZenitLayerManager.tsx
3353
- var import_react6 = __toESM(require("react"));
3355
+ var import_react7 = __toESM(require("react"));
3354
3356
 
3355
3357
  // src/react/icons.tsx
3356
3358
  var import_lucide_react = require("lucide-react");
3357
3359
 
3358
- // src/react/ZenitLayerManager.tsx
3360
+ // src/react/ui/ZenitSelect.tsx
3361
+ var import_react6 = __toESM(require("react"));
3362
+ var import_react_dom2 = require("react-dom");
3359
3363
  var import_jsx_runtime4 = require("react/jsx-runtime");
3364
+ var DEFAULT_SAFE_MENU_Z_INDEX = 4e3;
3365
+ function readCssMenuZIndex() {
3366
+ if (typeof document === "undefined") return null;
3367
+ const rootStyles = getComputedStyle(document.documentElement);
3368
+ const configuredValue = rootStyles.getPropertyValue("--zenit-select-z-index").trim() || rootStyles.getPropertyValue("--zenit-overlay-z-index").trim();
3369
+ if (!configuredValue) return null;
3370
+ const parsed = Number.parseInt(configuredValue, 10);
3371
+ return Number.isFinite(parsed) ? parsed : null;
3372
+ }
3373
+ function shouldUseNativeSelect() {
3374
+ if (typeof window === "undefined" || typeof navigator === "undefined") return false;
3375
+ const hasCoarsePointer = typeof window.matchMedia === "function" ? window.matchMedia("(pointer: coarse)").matches : false;
3376
+ return hasCoarsePointer || navigator.maxTouchPoints > 0;
3377
+ }
3378
+ var ZenitSelect = ({
3379
+ id,
3380
+ value,
3381
+ placeholder = "Seleccionar\u2026",
3382
+ options,
3383
+ onValueChange,
3384
+ disabled = false,
3385
+ className,
3386
+ menuZIndex,
3387
+ maxMenuHeight = 384,
3388
+ ariaLabel,
3389
+ useNativeOnMobile = true
3390
+ }) => {
3391
+ const rootRef = import_react6.default.useRef(null);
3392
+ const triggerRef = import_react6.default.useRef(null);
3393
+ const menuRef = import_react6.default.useRef(null);
3394
+ const lastTouchTsRef = import_react6.default.useRef(0);
3395
+ const [isOpen, setIsOpen] = import_react6.default.useState(false);
3396
+ const [menuPosition, setMenuPosition] = import_react6.default.useState({ top: 0, left: 0, width: 0 });
3397
+ const selectedOption = import_react6.default.useMemo(
3398
+ () => options.find((option) => option.value === value),
3399
+ [options, value]
3400
+ );
3401
+ const effectiveMenuZIndex = import_react6.default.useMemo(
3402
+ () => menuZIndex ?? readCssMenuZIndex() ?? DEFAULT_SAFE_MENU_Z_INDEX,
3403
+ [menuZIndex]
3404
+ );
3405
+ const useNative = import_react6.default.useMemo(
3406
+ () => useNativeOnMobile && shouldUseNativeSelect(),
3407
+ [useNativeOnMobile]
3408
+ );
3409
+ const updateMenuPosition = import_react6.default.useCallback(() => {
3410
+ const trigger = triggerRef.current;
3411
+ if (!trigger) return;
3412
+ const rect = trigger.getBoundingClientRect();
3413
+ const viewportPadding = 8;
3414
+ const minWidth = 200;
3415
+ const width = Math.max(rect.width, minWidth);
3416
+ const maxLeft = window.innerWidth - width - viewportPadding;
3417
+ const nextLeft = Math.max(viewportPadding, Math.min(rect.left, maxLeft));
3418
+ const nextTop = rect.bottom + 4;
3419
+ setMenuPosition({ top: nextTop, left: nextLeft, width });
3420
+ }, []);
3421
+ const getEffectiveMaxHeight = import_react6.default.useCallback(() => {
3422
+ const available = Math.max(160, window.innerHeight - menuPosition.top - 12);
3423
+ return Math.min(maxMenuHeight, available);
3424
+ }, [maxMenuHeight, menuPosition.top]);
3425
+ import_react6.default.useEffect(() => {
3426
+ if (!isOpen) return;
3427
+ updateMenuPosition();
3428
+ const isEventInsideSelect = (targetNode) => Boolean(rootRef.current?.contains(targetNode) || menuRef.current?.contains(targetNode));
3429
+ const handleOutsideTouchStart = (event) => {
3430
+ lastTouchTsRef.current = Date.now();
3431
+ const targetNode = event.target;
3432
+ if (isEventInsideSelect(targetNode)) return;
3433
+ setIsOpen(false);
3434
+ };
3435
+ const handleOutsideMouseDown = (event) => {
3436
+ if (Date.now() - lastTouchTsRef.current < 500) return;
3437
+ const targetNode = event.target;
3438
+ if (isEventInsideSelect(targetNode)) return;
3439
+ setIsOpen(false);
3440
+ };
3441
+ const handleEscape = (event) => {
3442
+ if (event.key === "Escape") {
3443
+ setIsOpen(false);
3444
+ triggerRef.current?.focus();
3445
+ }
3446
+ };
3447
+ const handleWindowChanges = () => updateMenuPosition();
3448
+ document.addEventListener("touchstart", handleOutsideTouchStart, { capture: true });
3449
+ document.addEventListener("mousedown", handleOutsideMouseDown, true);
3450
+ document.addEventListener("keydown", handleEscape);
3451
+ window.addEventListener("resize", handleWindowChanges);
3452
+ window.addEventListener("scroll", handleWindowChanges, true);
3453
+ return () => {
3454
+ document.removeEventListener("touchstart", handleOutsideTouchStart, true);
3455
+ document.removeEventListener("mousedown", handleOutsideMouseDown, true);
3456
+ document.removeEventListener("keydown", handleEscape);
3457
+ window.removeEventListener("resize", handleWindowChanges);
3458
+ window.removeEventListener("scroll", handleWindowChanges, true);
3459
+ };
3460
+ }, [isOpen, updateMenuPosition]);
3461
+ const handleTriggerDown = (event) => {
3462
+ if (event.type === "touchstart") {
3463
+ lastTouchTsRef.current = Date.now();
3464
+ }
3465
+ if (event.type === "mousedown" && Date.now() - lastTouchTsRef.current < 500) {
3466
+ return;
3467
+ }
3468
+ event.preventDefault();
3469
+ event.stopPropagation();
3470
+ if (disabled) return;
3471
+ if (!isOpen) updateMenuPosition();
3472
+ setIsOpen((prev) => !prev);
3473
+ };
3474
+ const handleTriggerClick = (event) => {
3475
+ if (event.detail !== 0) return;
3476
+ event.preventDefault();
3477
+ event.stopPropagation();
3478
+ if (disabled) return;
3479
+ if (!isOpen) updateMenuPosition();
3480
+ setIsOpen((prev) => !prev);
3481
+ };
3482
+ const selectValue = (nextValue, isDisabled) => {
3483
+ if (isDisabled) return;
3484
+ onValueChange?.(nextValue);
3485
+ setIsOpen(false);
3486
+ triggerRef.current?.focus();
3487
+ };
3488
+ if (useNative) {
3489
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: rootRef, className: [className, "zenit-select-root"].filter(Boolean).join(" "), children: [
3490
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
3491
+ .zenit-select-native {
3492
+ width: 100%;
3493
+ min-height: 40px;
3494
+ height: 40px;
3495
+ border: 1px solid #cbd5e1;
3496
+ border-radius: 6px;
3497
+ background: #ffffff;
3498
+ color: #0f172a;
3499
+ padding: 0 12px;
3500
+ font-size: 14px;
3501
+ line-height: 1.25;
3502
+ cursor: pointer;
3503
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
3504
+ appearance: none;
3505
+ -webkit-appearance: none;
3506
+ }
3507
+ .zenit-select-native:disabled {
3508
+ opacity: 0.6;
3509
+ cursor: not-allowed;
3510
+ }
3511
+ .zenit-select-native:focus-visible {
3512
+ outline: none;
3513
+ border-color: #60a5fa;
3514
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
3515
+ }
3516
+
3517
+ @media (max-width: 640px) {
3518
+ .zenit-select-native {
3519
+ min-height: 38px;
3520
+ height: 38px;
3521
+ }
3522
+ }
3523
+ ` }),
3524
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3525
+ "select",
3526
+ {
3527
+ id,
3528
+ className: "zenit-select-native",
3529
+ value: value ?? "",
3530
+ "aria-label": ariaLabel,
3531
+ disabled,
3532
+ onChange: (event) => {
3533
+ onValueChange?.(event.target.value);
3534
+ },
3535
+ children: [
3536
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", disabled: true, hidden: true, children: placeholder }),
3537
+ options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value))
3538
+ ]
3539
+ }
3540
+ )
3541
+ ] });
3542
+ }
3543
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: rootRef, className: [className, "zenit-select-root"].filter(Boolean).join(" "), children: [
3544
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
3545
+ .zenit-select-trigger {
3546
+ width: 100%;
3547
+ min-height: 40px;
3548
+ height: 40px;
3549
+ border: 1px solid #cbd5e1;
3550
+ border-radius: 6px;
3551
+ background: #ffffff;
3552
+ color: #0f172a;
3553
+ display: inline-flex;
3554
+ align-items: center;
3555
+ justify-content: space-between;
3556
+ gap: 8px;
3557
+ padding: 0 12px;
3558
+ font-size: 14px;
3559
+ line-height: 1.25;
3560
+ cursor: pointer;
3561
+ text-align: left;
3562
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
3563
+ touch-action: manipulation;
3564
+ -webkit-tap-highlight-color: transparent;
3565
+ }
3566
+ .zenit-select-trigger.is-disabled {
3567
+ opacity: 0.6;
3568
+ cursor: not-allowed;
3569
+ }
3570
+ .zenit-select-trigger:focus-visible {
3571
+ outline: none;
3572
+ border-color: #60a5fa;
3573
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
3574
+ }
3575
+ .zenit-select-label {
3576
+ white-space: nowrap;
3577
+ overflow: hidden;
3578
+ text-overflow: ellipsis;
3579
+ }
3580
+ .zenit-select-label.is-placeholder {
3581
+ color: #64748b;
3582
+ }
3583
+ .zenit-select-chevron {
3584
+ opacity: 0.5;
3585
+ flex-shrink: 0;
3586
+ }
3587
+
3588
+ /* Contenedor: aqu\xED debe GANAR el scroll en m\xF3vil */
3589
+ .zenit-select-content {
3590
+ position: fixed;
3591
+ border: 1px solid #cbd5e1;
3592
+ border-radius: 6px;
3593
+ background: #ffffff;
3594
+ box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
3595
+ overflow-y: auto;
3596
+ padding: 4px;
3597
+ pointer-events: auto;
3598
+
3599
+ /* Lo importante: permitir pan vertical dentro del men\xFA */
3600
+ touch-action: pan-y;
3601
+ overscroll-behavior: contain;
3602
+ -webkit-overflow-scrolling: touch;
3603
+ }
3604
+
3605
+ /* Items NO son button: evitamos que WebView \u201Csecuestr\xE9\u201D el gesto */
3606
+ .zenit-select-item {
3607
+ width: 100%;
3608
+ border-radius: 4px;
3609
+ text-align: left;
3610
+ color: #0f172a;
3611
+ font-size: 14px;
3612
+ min-height: 34px;
3613
+ padding: 8px 10px;
3614
+ cursor: pointer;
3615
+ -webkit-tap-highlight-color: transparent;
3616
+ user-select: none;
3617
+ }
3618
+ .zenit-select-item:hover {
3619
+ background: #f1f5f9;
3620
+ }
3621
+ .zenit-select-item.is-selected {
3622
+ background: #e2e8f0;
3623
+ font-weight: 600;
3624
+ }
3625
+ .zenit-select-item.is-disabled {
3626
+ color: #94a3b8;
3627
+ cursor: not-allowed;
3628
+ }
3629
+ .zenit-select-item:focus-visible {
3630
+ outline: none;
3631
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
3632
+ }
3633
+
3634
+ @media (max-width: 640px) {
3635
+ .zenit-select-trigger {
3636
+ height: 38px;
3637
+ min-height: 38px;
3638
+ }
3639
+ .zenit-select-content {
3640
+ max-width: calc(100vw - 16px);
3641
+ }
3642
+ }
3643
+ ` }),
3644
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3645
+ "button",
3646
+ {
3647
+ id,
3648
+ ref: triggerRef,
3649
+ type: "button",
3650
+ className: `zenit-select-trigger${disabled ? " is-disabled" : ""}`,
3651
+ onTouchStart: handleTriggerDown,
3652
+ onMouseDown: handleTriggerDown,
3653
+ onClick: handleTriggerClick,
3654
+ "aria-haspopup": "listbox",
3655
+ "aria-expanded": isOpen,
3656
+ "aria-label": ariaLabel,
3657
+ disabled,
3658
+ children: [
3659
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `zenit-select-label${selectedOption ? "" : " is-placeholder"}`, children: selectedOption?.label ?? placeholder }),
3660
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronDown, { className: "zenit-select-chevron", size: 16, "aria-hidden": "true" })
3661
+ ]
3662
+ }
3663
+ ),
3664
+ isOpen && typeof document !== "undefined" && (0, import_react_dom2.createPortal)(
3665
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3666
+ "div",
3667
+ {
3668
+ ref: menuRef,
3669
+ className: "zenit-select-content",
3670
+ role: "listbox",
3671
+ style: {
3672
+ top: menuPosition.top,
3673
+ left: menuPosition.left,
3674
+ width: menuPosition.width,
3675
+ zIndex: effectiveMenuZIndex,
3676
+ maxHeight: getEffectiveMaxHeight()
3677
+ },
3678
+ children: options.map((option) => {
3679
+ const isSelected = option.value === value;
3680
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3681
+ "div",
3682
+ {
3683
+ role: "option",
3684
+ "aria-selected": isSelected,
3685
+ tabIndex: option.disabled ? -1 : 0,
3686
+ className: `zenit-select-item${isSelected ? " is-selected" : ""}${option.disabled ? " is-disabled" : ""}`,
3687
+ onClick: (event) => {
3688
+ event.preventDefault();
3689
+ event.stopPropagation();
3690
+ if (option.disabled) return;
3691
+ selectValue(option.value, option.disabled);
3692
+ },
3693
+ onKeyDown: (event) => {
3694
+ if (option.disabled) return;
3695
+ if (event.key === "Enter" || event.key === " ") {
3696
+ event.preventDefault();
3697
+ event.stopPropagation();
3698
+ selectValue(option.value, option.disabled);
3699
+ }
3700
+ },
3701
+ children: option.label
3702
+ },
3703
+ option.value
3704
+ );
3705
+ })
3706
+ }
3707
+ ),
3708
+ document.body
3709
+ )
3710
+ ] });
3711
+ };
3712
+
3713
+ // src/react/ZenitLayerManager.tsx
3714
+ var import_jsx_runtime5 = require("react/jsx-runtime");
3360
3715
  var FLOAT_TOLERANCE = 1e-3;
3361
3716
  function areEffectiveStatesEqual(a, b) {
3362
3717
  if (a.length !== b.length) return false;
@@ -3398,24 +3753,24 @@ var ZenitLayerManager = ({
3398
3753
  onApplyLayerFilter,
3399
3754
  onClearLayerFilter
3400
3755
  }) => {
3401
- const [map, setMap] = (0, import_react6.useState)(null);
3402
- const [loadingMap, setLoadingMap] = (0, import_react6.useState)(false);
3403
- const [mapError, setMapError] = (0, import_react6.useState)(null);
3404
- const [layers, setLayers] = (0, import_react6.useState)([]);
3405
- const [activeTab, setActiveTab] = (0, import_react6.useState)("layers");
3406
- const [panelVisible, setPanelVisible] = (0, import_react6.useState)(true);
3407
- const [selectedFilterLayerId, setSelectedFilterLayerId] = (0, import_react6.useState)("");
3408
- const [selectedFilterField, setSelectedFilterField] = (0, import_react6.useState)("");
3409
- const [selectedFilterValue, setSelectedFilterValue] = (0, import_react6.useState)("");
3410
- const [catalogByLayerField, setCatalogByLayerField] = (0, import_react6.useState)({});
3411
- const [loadingCatalog, setLoadingCatalog] = (0, import_react6.useState)(false);
3412
- const [applyingFilter, setApplyingFilter] = (0, import_react6.useState)(false);
3413
- const [filterError, setFilterError] = (0, import_react6.useState)(null);
3414
- const [appliedFilter, setAppliedFilter] = (0, import_react6.useState)(null);
3415
- const catalogAbortRef = (0, import_react6.useRef)(null);
3416
- const lastEmittedStatesRef = (0, import_react6.useRef)(null);
3756
+ const [map, setMap] = (0, import_react7.useState)(null);
3757
+ const [loadingMap, setLoadingMap] = (0, import_react7.useState)(false);
3758
+ const [mapError, setMapError] = (0, import_react7.useState)(null);
3759
+ const [layers, setLayers] = (0, import_react7.useState)([]);
3760
+ const [activeTab, setActiveTab] = (0, import_react7.useState)("layers");
3761
+ const [panelVisible, setPanelVisible] = (0, import_react7.useState)(true);
3762
+ const [selectedFilterLayerId, setSelectedFilterLayerId] = (0, import_react7.useState)("");
3763
+ const [selectedFilterField, setSelectedFilterField] = (0, import_react7.useState)("");
3764
+ const [selectedFilterValue, setSelectedFilterValue] = (0, import_react7.useState)("");
3765
+ const [catalogByLayerField, setCatalogByLayerField] = (0, import_react7.useState)({});
3766
+ const [loadingCatalog, setLoadingCatalog] = (0, import_react7.useState)(false);
3767
+ const [applyingFilter, setApplyingFilter] = (0, import_react7.useState)(false);
3768
+ const [filterError, setFilterError] = (0, import_react7.useState)(null);
3769
+ const [appliedFilter, setAppliedFilter] = (0, import_react7.useState)(null);
3770
+ const catalogAbortRef = (0, import_react7.useRef)(null);
3771
+ const lastEmittedStatesRef = (0, import_react7.useRef)(null);
3417
3772
  const isControlled = Array.isArray(layerStates) && typeof onLayerStatesChange === "function";
3418
- const baseStates = (0, import_react6.useMemo)(
3773
+ const baseStates = (0, import_react7.useMemo)(
3419
3774
  () => initLayerStates(
3420
3775
  layers.map((entry) => ({
3421
3776
  ...entry.mapLayer,
@@ -3426,7 +3781,7 @@ var ZenitLayerManager = ({
3426
3781
  ),
3427
3782
  [layers]
3428
3783
  );
3429
- const overrideStates = (0, import_react6.useMemo)(
3784
+ const overrideStates = (0, import_react7.useMemo)(
3430
3785
  () => layers.map(
3431
3786
  (entry) => ({
3432
3787
  layerId: entry.mapLayer.layerId,
@@ -3436,11 +3791,11 @@ var ZenitLayerManager = ({
3436
3791
  ),
3437
3792
  [layers]
3438
3793
  );
3439
- const effectiveStates = (0, import_react6.useMemo)(
3794
+ const effectiveStates = (0, import_react7.useMemo)(
3440
3795
  () => layerStates ?? applyLayerOverrides(baseStates, overrideStates),
3441
3796
  [baseStates, layerStates, overrideStates]
3442
3797
  );
3443
- const layerMetaIndex = (0, import_react6.useMemo)(() => {
3798
+ const layerMetaIndex = (0, import_react7.useMemo)(() => {
3444
3799
  const index = /* @__PURE__ */ new Map();
3445
3800
  mapLayers?.forEach((entry) => {
3446
3801
  const key = String(entry.layerId);
@@ -3454,7 +3809,7 @@ var ZenitLayerManager = ({
3454
3809
  });
3455
3810
  return index;
3456
3811
  }, [map, mapLayers]);
3457
- const resolveUserOpacity = import_react6.default.useCallback((state) => {
3812
+ const resolveUserOpacity = import_react7.default.useCallback((state) => {
3458
3813
  if (typeof state.overrideOpacity === "number") return state.overrideOpacity;
3459
3814
  if (typeof state.overrideOpacity === "string") {
3460
3815
  const parsed = Number.parseFloat(state.overrideOpacity);
@@ -3462,7 +3817,7 @@ var ZenitLayerManager = ({
3462
3817
  }
3463
3818
  return state.opacity ?? 1;
3464
3819
  }, []);
3465
- const resolveEffectiveOpacity = import_react6.default.useCallback(
3820
+ const resolveEffectiveOpacity = import_react7.default.useCallback(
3466
3821
  (layerId, userOpacity) => {
3467
3822
  if (!autoOpacityOnZoom || typeof mapZoom !== "number") {
3468
3823
  return userOpacity;
@@ -3478,7 +3833,7 @@ var ZenitLayerManager = ({
3478
3833
  },
3479
3834
  [autoOpacityConfig, autoOpacityOnZoom, layerMetaIndex, mapZoom]
3480
3835
  );
3481
- const effectiveStatesWithZoom = (0, import_react6.useMemo)(() => {
3836
+ const effectiveStatesWithZoom = (0, import_react7.useMemo)(() => {
3482
3837
  if (!autoOpacityOnZoom || typeof mapZoom !== "number") {
3483
3838
  return effectiveStates;
3484
3839
  }
@@ -3492,7 +3847,7 @@ var ZenitLayerManager = ({
3492
3847
  };
3493
3848
  });
3494
3849
  }, [autoOpacityOnZoom, effectiveStates, mapZoom, resolveEffectiveOpacity, resolveUserOpacity]);
3495
- (0, import_react6.useEffect)(() => {
3850
+ (0, import_react7.useEffect)(() => {
3496
3851
  let cancelled = false;
3497
3852
  setLoadingMap(true);
3498
3853
  setMapError(null);
@@ -3524,12 +3879,12 @@ var ZenitLayerManager = ({
3524
3879
  cancelled = true;
3525
3880
  };
3526
3881
  }, [client.maps, mapId]);
3527
- (0, import_react6.useEffect)(() => {
3882
+ (0, import_react7.useEffect)(() => {
3528
3883
  if (!showUploadTab && activeTab === "upload") {
3529
3884
  setActiveTab("layers");
3530
3885
  }
3531
3886
  }, [activeTab, showUploadTab]);
3532
- (0, import_react6.useEffect)(() => {
3887
+ (0, import_react7.useEffect)(() => {
3533
3888
  if (isControlled) return;
3534
3889
  if (!onLayerStatesChange) return;
3535
3890
  const emitStates = autoOpacityOnZoom && typeof mapZoom === "number" ? effectiveStatesWithZoom : effectiveStates;
@@ -3547,7 +3902,7 @@ var ZenitLayerManager = ({
3547
3902
  mapZoom,
3548
3903
  onLayerStatesChange
3549
3904
  ]);
3550
- const updateLayerVisible = import_react6.default.useCallback(
3905
+ const updateLayerVisible = import_react7.default.useCallback(
3551
3906
  (layerId, visible) => {
3552
3907
  if (!onLayerStatesChange) return;
3553
3908
  const next = effectiveStates.map(
@@ -3557,7 +3912,7 @@ var ZenitLayerManager = ({
3557
3912
  },
3558
3913
  [effectiveStates, onLayerStatesChange]
3559
3914
  );
3560
- const updateLayerOpacity = import_react6.default.useCallback(
3915
+ const updateLayerOpacity = import_react7.default.useCallback(
3561
3916
  (layerId, opacity) => {
3562
3917
  if (!onLayerStatesChange) return;
3563
3918
  const adjustedOpacity = resolveEffectiveOpacity(layerId, opacity);
@@ -3568,7 +3923,7 @@ var ZenitLayerManager = ({
3568
3923
  },
3569
3924
  [effectiveStates, onLayerStatesChange, resolveEffectiveOpacity]
3570
3925
  );
3571
- const resolveFeatureCount = import_react6.default.useCallback(
3926
+ const resolveFeatureCount = import_react7.default.useCallback(
3572
3927
  (layerId, layer) => {
3573
3928
  const resolvedFeatureCount = layerFeatureCounts?.[layerId] ?? layerFeatureCounts?.[String(layerId)];
3574
3929
  if (typeof resolvedFeatureCount === "number") return resolvedFeatureCount;
@@ -3577,7 +3932,7 @@ var ZenitLayerManager = ({
3577
3932
  },
3578
3933
  [layerFeatureCounts]
3579
3934
  );
3580
- const decoratedLayers = (0, import_react6.useMemo)(() => {
3935
+ const decoratedLayers = (0, import_react7.useMemo)(() => {
3581
3936
  return layers.map((entry) => ({
3582
3937
  ...entry,
3583
3938
  effective: effectiveStates.find((state) => state.layerId === entry.mapLayer.layerId),
@@ -3606,23 +3961,23 @@ var ZenitLayerManager = ({
3606
3961
  return String(a.mapLayer.layerId).localeCompare(String(b.mapLayer.layerId));
3607
3962
  });
3608
3963
  }, [effectiveStates, layers, resolveFeatureCount]);
3609
- const filterableLayers = (0, import_react6.useMemo)(() => {
3964
+ const filterableLayers = (0, import_react7.useMemo)(() => {
3610
3965
  return decoratedLayers.filter((entry) => {
3611
3966
  const prefilters = entry.mapLayer.layerConfig?.prefilters;
3612
3967
  return !!prefilters && Object.keys(prefilters).length > 0;
3613
3968
  });
3614
3969
  }, [decoratedLayers]);
3615
- const selectedFilterLayer = (0, import_react6.useMemo)(
3970
+ const selectedFilterLayer = (0, import_react7.useMemo)(
3616
3971
  () => filterableLayers.find((layer) => String(layer.mapLayer.layerId) === selectedFilterLayerId) ?? null,
3617
3972
  [filterableLayers, selectedFilterLayerId]
3618
3973
  );
3619
- const filterFields = (0, import_react6.useMemo)(() => {
3974
+ const filterFields = (0, import_react7.useMemo)(() => {
3620
3975
  const prefilters = selectedFilterLayer?.mapLayer.layerConfig?.prefilters;
3621
3976
  return prefilters ? Object.keys(prefilters) : [];
3622
3977
  }, [selectedFilterLayer]);
3623
3978
  const activeCatalogKey = selectedFilterLayer ? `${selectedFilterLayer.mapLayer.layerId}:${selectedFilterField}` : null;
3624
3979
  const activeCatalogValues = activeCatalogKey ? catalogByLayerField[activeCatalogKey] ?? [] : [];
3625
- const extractCatalogValues = import_react6.default.useCallback((catalogData, field) => {
3980
+ const extractCatalogValues = import_react7.default.useCallback((catalogData, field) => {
3626
3981
  const values = /* @__PURE__ */ new Set();
3627
3982
  const pushValue = (value) => {
3628
3983
  if (value === null || value === void 0) return;
@@ -3659,7 +4014,7 @@ var ZenitLayerManager = ({
3659
4014
  }
3660
4015
  return [...values].sort((a, b) => a.localeCompare(b, void 0, { sensitivity: "base" }));
3661
4016
  }, []);
3662
- (0, import_react6.useEffect)(() => {
4017
+ (0, import_react7.useEffect)(() => {
3663
4018
  if (!filterableLayers.length) {
3664
4019
  setSelectedFilterLayerId("");
3665
4020
  return;
@@ -3668,7 +4023,7 @@ var ZenitLayerManager = ({
3668
4023
  setSelectedFilterLayerId(String(filterableLayers[0].mapLayer.layerId));
3669
4024
  }
3670
4025
  }, [filterableLayers, selectedFilterLayerId]);
3671
- (0, import_react6.useEffect)(() => {
4026
+ (0, import_react7.useEffect)(() => {
3672
4027
  if (!filterFields.length) {
3673
4028
  setSelectedFilterField("");
3674
4029
  return;
@@ -3678,7 +4033,7 @@ var ZenitLayerManager = ({
3678
4033
  setSelectedFilterValue("");
3679
4034
  }
3680
4035
  }, [filterFields, selectedFilterField]);
3681
- (0, import_react6.useEffect)(() => {
4036
+ (0, import_react7.useEffect)(() => {
3682
4037
  if (activeTab !== "filters") return;
3683
4038
  if (!selectedFilterLayer || !selectedFilterField || !activeCatalogKey) return;
3684
4039
  if (catalogByLayerField[activeCatalogKey]) return;
@@ -3702,7 +4057,7 @@ var ZenitLayerManager = ({
3702
4057
  controller.abort();
3703
4058
  };
3704
4059
  }, [activeCatalogKey, activeTab, catalogByLayerField, client.layers, extractCatalogValues, selectedFilterField, selectedFilterLayer]);
3705
- const handleApplyFilter = import_react6.default.useCallback(async () => {
4060
+ const handleApplyFilter = import_react7.default.useCallback(async () => {
3706
4061
  if (!selectedFilterLayer || !selectedFilterField || !selectedFilterValue || !onApplyLayerFilter) return;
3707
4062
  setApplyingFilter(true);
3708
4063
  setFilterError(null);
@@ -3724,7 +4079,7 @@ var ZenitLayerManager = ({
3724
4079
  setApplyingFilter(false);
3725
4080
  }
3726
4081
  }, [onApplyLayerFilter, selectedFilterField, selectedFilterLayer, selectedFilterValue]);
3727
- const handleClearFilter = import_react6.default.useCallback(async () => {
4082
+ const handleClearFilter = import_react7.default.useCallback(async () => {
3728
4083
  if (!selectedFilterLayer) return;
3729
4084
  setApplyingFilter(true);
3730
4085
  setFilterError(null);
@@ -3739,7 +4094,7 @@ var ZenitLayerManager = ({
3739
4094
  setApplyingFilter(false);
3740
4095
  }
3741
4096
  }, [onClearLayerFilter, selectedFilterField, selectedFilterLayer]);
3742
- const resolveLayerStyle = import_react6.default.useCallback(
4097
+ const resolveLayerStyle = import_react7.default.useCallback(
3743
4098
  (layerId) => {
3744
4099
  const layerKey = String(layerId);
3745
4100
  const fromProp = mapLayers?.find((entry) => String(entry.layerId) === layerKey)?.style;
@@ -3769,10 +4124,10 @@ var ZenitLayerManager = ({
3769
4124
  ...height ? { height } : {}
3770
4125
  };
3771
4126
  if (loadingMap) {
3772
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className, style: panelStyle, children: "Cargando capas\u2026" });
4127
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className, style: panelStyle, children: "Cargando capas\u2026" });
3773
4128
  }
3774
4129
  if (mapError) {
3775
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className, style: { ...panelStyle, color: "#c53030" }, children: [
4130
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className, style: { ...panelStyle, color: "#c53030" }, children: [
3776
4131
  "Error al cargar mapa: ",
3777
4132
  mapError
3778
4133
  ] });
@@ -3790,7 +4145,7 @@ var ZenitLayerManager = ({
3790
4145
  boxShadow: "0 1px 0 rgba(148, 163, 184, 0.25)"
3791
4146
  };
3792
4147
  const renderLayerCards = () => {
3793
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: decoratedLayers.map((layerState) => {
4148
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: decoratedLayers.map((layerState) => {
3794
4149
  const layerId = layerState.mapLayer.layerId;
3795
4150
  const layerName = layerState.layerName ?? `Capa ${layerId}`;
3796
4151
  const visible = layerState.effective?.visible ?? false;
@@ -3800,7 +4155,7 @@ var ZenitLayerManager = ({
3800
4155
  const muted = !visible;
3801
4156
  const opacityPercent = Math.round(userOpacity * 100);
3802
4157
  const sliderBackground = `linear-gradient(to right, ${layerColor} 0%, ${layerColor} ${opacityPercent}%, #e5e7eb ${opacityPercent}%, #e5e7eb 100%)`;
3803
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4158
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
3804
4159
  "div",
3805
4160
  {
3806
4161
  className: `zlm-card${muted ? " is-muted" : ""}`,
@@ -3815,9 +4170,9 @@ var ZenitLayerManager = ({
3815
4170
  width: "100%"
3816
4171
  },
3817
4172
  children: [
3818
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", gap: 12 }, children: [
3819
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: 10, alignItems: "flex-start", minWidth: 0, flex: 1 }, children: [
3820
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4173
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", gap: 12 }, children: [
4174
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", gap: 10, alignItems: "flex-start", minWidth: 0, flex: 1 }, children: [
4175
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3821
4176
  "div",
3822
4177
  {
3823
4178
  style: {
@@ -3832,7 +4187,7 @@ var ZenitLayerManager = ({
3832
4187
  title: "Color de la capa"
3833
4188
  }
3834
4189
  ),
3835
- showLayerVisibilityIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4190
+ showLayerVisibilityIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3836
4191
  "button",
3837
4192
  {
3838
4193
  type: "button",
@@ -3843,11 +4198,11 @@ var ZenitLayerManager = ({
3843
4198
  )
3844
4199
  ),
3845
4200
  "aria-label": visible ? "Ocultar capa" : "Mostrar capa",
3846
- children: visible ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Eye, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.EyeOff, { size: 16 })
4201
+ children: visible ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Eye, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.EyeOff, { size: 16 })
3847
4202
  }
3848
4203
  ),
3849
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { minWidth: 0, flex: 1 }, children: [
3850
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4204
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { minWidth: 0, flex: 1 }, children: [
4205
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3851
4206
  "div",
3852
4207
  {
3853
4208
  className: "zlm-layer-name",
@@ -3865,26 +4220,26 @@ var ZenitLayerManager = ({
3865
4220
  children: layerName
3866
4221
  }
3867
4222
  ),
3868
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { color: muted ? "#94a3b8" : "#64748b", fontSize: 12 }, children: [
4223
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { color: muted ? "#94a3b8" : "#64748b", fontSize: 12 }, children: [
3869
4224
  "ID ",
3870
4225
  layerId
3871
4226
  ] })
3872
4227
  ] })
3873
4228
  ] }),
3874
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", alignItems: "flex-start", gap: 6, flexShrink: 0 }, children: typeof featureCount === "number" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "zlm-badge", children: [
4229
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "flex", alignItems: "flex-start", gap: 6, flexShrink: 0 }, children: typeof featureCount === "number" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "zlm-badge", children: [
3875
4230
  featureCount.toLocaleString(),
3876
4231
  " features"
3877
4232
  ] }) })
3878
4233
  ] }),
3879
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { display: "flex", gap: 10, alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1 }, children: [
3880
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: 6, color: "#64748b", fontSize: 12 }, children: [
3881
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Opacidad" }),
3882
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
4234
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "flex", gap: 10, alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { flex: 1 }, children: [
4235
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: 6, color: "#64748b", fontSize: 12 }, children: [
4236
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Opacidad" }),
4237
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
3883
4238
  opacityPercent,
3884
4239
  "%"
3885
4240
  ] })
3886
4241
  ] }),
3887
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4242
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3888
4243
  "input",
3889
4244
  {
3890
4245
  className: "zlm-range",
@@ -3922,8 +4277,8 @@ var ZenitLayerManager = ({
3922
4277
  );
3923
4278
  }) });
3924
4279
  };
3925
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: ["zenit-layer-manager", className].filter(Boolean).join(" "), style: panelStyle, children: [
3926
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
4280
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: ["zenit-layer-manager", className].filter(Boolean).join(" "), style: panelStyle, children: [
4281
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("style", { children: `
3927
4282
  .zenit-layer-manager .zlm-card {
3928
4283
  transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
3929
4284
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
@@ -4018,16 +4373,16 @@ var ZenitLayerManager = ({
4018
4373
  outline-offset: 2px;
4019
4374
  }
4020
4375
  ` }),
4021
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: headerStyle, children: [
4022
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
4023
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
4024
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontWeight: 800, fontSize: 16, color: "#0f172a" }, children: "Gesti\xF3n de Capas" }),
4025
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { color: "#64748b", fontSize: 12 }, children: [
4376
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: headerStyle, children: [
4377
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
4378
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
4379
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontWeight: 800, fontSize: 16, color: "#0f172a" }, children: "Gesti\xF3n de Capas" }),
4380
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { color: "#64748b", fontSize: 12 }, children: [
4026
4381
  "Mapa #",
4027
4382
  map.id
4028
4383
  ] })
4029
4384
  ] }),
4030
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4385
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4031
4386
  "button",
4032
4387
  {
4033
4388
  type: "button",
@@ -4035,13 +4390,13 @@ var ZenitLayerManager = ({
4035
4390
  className: "zlm-panel-toggle",
4036
4391
  "aria-label": panelVisible ? "Ocultar panel de capas" : "Mostrar panel de capas",
4037
4392
  children: [
4038
- panelVisible ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Eye, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.EyeOff, { size: 16 }),
4393
+ panelVisible ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Eye, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.EyeOff, { size: 16 }),
4039
4394
  panelVisible ? "Ocultar" : "Mostrar"
4040
4395
  ]
4041
4396
  }
4042
4397
  )
4043
4398
  ] }),
4044
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4399
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4045
4400
  "div",
4046
4401
  {
4047
4402
  style: {
@@ -4054,38 +4409,38 @@ var ZenitLayerManager = ({
4054
4409
  background: "#f1f5f9"
4055
4410
  },
4056
4411
  children: [
4057
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4412
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4058
4413
  "button",
4059
4414
  {
4060
4415
  type: "button",
4061
4416
  className: `zlm-tab${activeTab === "layers" ? " is-active" : ""}`,
4062
4417
  onClick: () => setActiveTab("layers"),
4063
4418
  children: [
4064
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Layers, { size: 16 }),
4419
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Layers, { size: 16 }),
4065
4420
  "Capas"
4066
4421
  ]
4067
4422
  }
4068
4423
  ),
4069
- showUploadTab && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4424
+ showUploadTab && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4070
4425
  "button",
4071
4426
  {
4072
4427
  type: "button",
4073
4428
  className: `zlm-tab${activeTab === "upload" ? " is-active" : ""}`,
4074
4429
  onClick: () => setActiveTab("upload"),
4075
4430
  children: [
4076
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Upload, { size: 16 }),
4431
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Upload, { size: 16 }),
4077
4432
  "Subir"
4078
4433
  ]
4079
4434
  }
4080
4435
  ),
4081
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4436
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4082
4437
  "button",
4083
4438
  {
4084
4439
  type: "button",
4085
4440
  className: `zlm-tab${activeTab === "filters" ? " is-active" : ""}`,
4086
4441
  onClick: () => setActiveTab("filters"),
4087
4442
  children: [
4088
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.Layers, { size: 16 }),
4443
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Layers, { size: 16 }),
4089
4444
  "Filtros"
4090
4445
  ]
4091
4446
  }
@@ -4094,49 +4449,67 @@ var ZenitLayerManager = ({
4094
4449
  }
4095
4450
  )
4096
4451
  ] }),
4097
- panelVisible && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { padding: "12px 10px 18px", overflowY: "auto", flex: 1, minHeight: 0 }, children: [
4452
+ panelVisible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { padding: "12px 10px 18px", overflowY: "auto", flex: 1, minHeight: 0 }, children: [
4098
4453
  activeTab === "layers" && renderLayerCards(),
4099
- activeTab === "filters" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "zlm-filter-panel", style: { display: "flex", flexDirection: "column", gap: 10, background: "#fff", border: "1px solid #e2e8f0", borderRadius: 12, padding: 12 }, children: !filterableLayers.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { color: "#64748b", fontSize: 13 }, children: "No hay filtros disponibles para las capas de este mapa." }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4100
- filterableLayers.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
4454
+ activeTab === "filters" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "zlm-filter-panel", style: { display: "flex", flexDirection: "column", gap: 12, background: "#fff", border: "1px solid #e2e8f0", borderRadius: 12, padding: 12 }, children: !filterableLayers.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#64748b", fontSize: 13 }, children: "No hay filtros disponibles para las capas de este mapa." }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
4455
+ filterableLayers.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
4101
4456
  "Capa",
4102
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { className: "zlm-filter-select", value: selectedFilterLayerId, onChange: (e) => setSelectedFilterLayerId(e.target.value), children: filterableLayers.map((layer) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: String(layer.mapLayer.layerId), children: layer.layerName ?? `Capa ${layer.mapLayer.layerId}` }, String(layer.mapLayer.layerId))) })
4457
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4458
+ ZenitSelect,
4459
+ {
4460
+ ariaLabel: "Seleccionar capa para filtrar",
4461
+ value: selectedFilterLayerId,
4462
+ onValueChange: setSelectedFilterLayerId,
4463
+ options: filterableLayers.map((layer) => ({
4464
+ value: String(layer.mapLayer.layerId),
4465
+ label: layer.layerName ?? `Capa ${layer.mapLayer.layerId}`
4466
+ }))
4467
+ }
4468
+ )
4103
4469
  ] }),
4104
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
4470
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
4105
4471
  "Campo",
4106
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("select", { className: "zlm-filter-select", value: selectedFilterField, onChange: (e) => {
4107
- setSelectedFilterField(e.target.value);
4108
- setSelectedFilterValue("");
4109
- }, children: filterFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: field, children: field }, field)) })
4472
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4473
+ ZenitSelect,
4474
+ {
4475
+ ariaLabel: "Seleccionar campo de filtrado",
4476
+ value: selectedFilterField,
4477
+ onValueChange: (nextField) => {
4478
+ setSelectedFilterField(nextField);
4479
+ setSelectedFilterValue("");
4480
+ },
4481
+ options: filterFields.map((field) => ({ value: field, label: field }))
4482
+ }
4483
+ )
4110
4484
  ] }),
4111
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
4485
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
4112
4486
  "Valor",
4113
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4114
- "select",
4487
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4488
+ ZenitSelect,
4115
4489
  {
4116
- className: "zlm-filter-select",
4490
+ ariaLabel: "Seleccionar valor de filtrado",
4117
4491
  value: selectedFilterValue,
4118
- onChange: (e) => {
4119
- const value = e.target.value;
4120
- setSelectedFilterValue(value);
4121
- },
4122
- children: [
4123
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: "Seleccionar\u2026" }),
4124
- activeCatalogValues.map((value) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value, children: value }, value))
4125
- ]
4492
+ placeholder: "Seleccionar\u2026",
4493
+ onValueChange: (nextValue) => setSelectedFilterValue(nextValue),
4494
+ disabled: loadingCatalog || activeCatalogValues.length === 0,
4495
+ options: activeCatalogValues.map((catalogValue) => ({
4496
+ value: catalogValue,
4497
+ label: catalogValue
4498
+ }))
4126
4499
  }
4127
4500
  )
4128
4501
  ] }),
4129
- loadingCatalog && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { color: "#64748b", fontSize: 12 }, children: "Cargando cat\xE1logo\u2026" }),
4130
- !loadingCatalog && selectedFilterField && activeCatalogValues.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { color: "#64748b", fontSize: 12 }, children: "No hay cat\xE1logo disponible para este filtro." }),
4131
- filterError && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { color: "#b91c1c", fontSize: 12 }, children: filterError }),
4132
- appliedFilter && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "zlm-badge", style: { alignSelf: "flex-start" }, children: [
4502
+ loadingCatalog && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#64748b", fontSize: 12 }, children: "Cargando cat\xE1logo\u2026" }),
4503
+ !loadingCatalog && selectedFilterField && activeCatalogValues.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#64748b", fontSize: 12 }, children: "No hay cat\xE1logo disponible para este filtro." }),
4504
+ filterError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#b91c1c", fontSize: 12 }, children: filterError }),
4505
+ appliedFilter && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "zlm-badge", style: { alignSelf: "flex-start" }, children: [
4133
4506
  "Activo: ",
4134
4507
  appliedFilter.field,
4135
4508
  " = ",
4136
4509
  appliedFilter.value
4137
4510
  ] }),
4138
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "zlm-filter-actions", style: { display: "flex", gap: 8 }, children: [
4139
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4511
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "zlm-filter-actions", style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: [
4512
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4140
4513
  "button",
4141
4514
  {
4142
4515
  type: "button",
@@ -4146,7 +4519,7 @@ var ZenitLayerManager = ({
4146
4519
  children: applyingFilter ? "Aplicando\u2026" : "Aplicar"
4147
4520
  }
4148
4521
  ),
4149
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4522
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4150
4523
  "button",
4151
4524
  {
4152
4525
  type: "button",
@@ -4158,13 +4531,13 @@ var ZenitLayerManager = ({
4158
4531
  )
4159
4532
  ] })
4160
4533
  ] }) }),
4161
- showUploadTab && activeTab === "upload" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { color: "#475569", fontSize: 13 }, children: "Pr\xF3ximamente podr\xE1s subir capas desde este panel." })
4534
+ showUploadTab && activeTab === "upload" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#475569", fontSize: 13 }, children: "Pr\xF3ximamente podr\xE1s subir capas desde este panel." })
4162
4535
  ] })
4163
4536
  ] });
4164
4537
  };
4165
4538
 
4166
4539
  // src/react/ZenitFeatureFilterPanel.tsx
4167
- var import_jsx_runtime5 = require("react/jsx-runtime");
4540
+ var import_jsx_runtime6 = require("react/jsx-runtime");
4168
4541
  var ZenitFeatureFilterPanel = ({
4169
4542
  title = "Filtros",
4170
4543
  description,
@@ -4172,7 +4545,7 @@ var ZenitFeatureFilterPanel = ({
4172
4545
  style,
4173
4546
  children
4174
4547
  }) => {
4175
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4548
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
4176
4549
  "section",
4177
4550
  {
4178
4551
  className,
@@ -4185,26 +4558,26 @@ var ZenitFeatureFilterPanel = ({
4185
4558
  ...style
4186
4559
  },
4187
4560
  children: [
4188
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("header", { style: { marginBottom: 12 }, children: [
4189
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { style: { margin: 0, fontSize: 16 }, children: title }),
4190
- description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { style: { margin: "6px 0 0", color: "#475569", fontSize: 13 }, children: description })
4561
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { style: { marginBottom: 12 }, children: [
4562
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { style: { margin: 0, fontSize: 16 }, children: title }),
4563
+ description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { style: { margin: "6px 0 0", color: "#475569", fontSize: 13 }, children: description })
4191
4564
  ] }),
4192
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children })
4565
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children })
4193
4566
  ]
4194
4567
  }
4195
4568
  );
4196
4569
  };
4197
4570
 
4198
4571
  // src/react/ai/FloatingChatBox.tsx
4199
- var import_react8 = require("react");
4200
- var import_react_dom2 = require("react-dom");
4572
+ var import_react9 = require("react");
4573
+ var import_react_dom3 = require("react-dom");
4201
4574
 
4202
4575
  // src/react/hooks/use-chat.ts
4203
- var import_react7 = require("react");
4576
+ var import_react8 = require("react");
4204
4577
  var useSendMessage = (config) => {
4205
- const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
4206
- const [error, setError] = (0, import_react7.useState)(null);
4207
- const send = (0, import_react7.useCallback)(
4578
+ const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
4579
+ const [error, setError] = (0, import_react8.useState)(null);
4580
+ const send = (0, import_react8.useCallback)(
4208
4581
  async (mapId, request, options) => {
4209
4582
  setIsLoading(true);
4210
4583
  setError(null);
@@ -4222,18 +4595,18 @@ var useSendMessage = (config) => {
4222
4595
  return { sendMessage: send, isLoading, error };
4223
4596
  };
4224
4597
  var useSendMessageStream = (config) => {
4225
- const [isStreaming, setIsStreaming] = (0, import_react7.useState)(false);
4226
- const [streamingText, setStreamingText] = (0, import_react7.useState)("");
4227
- const [completeResponse, setCompleteResponse] = (0, import_react7.useState)(null);
4228
- const [error, setError] = (0, import_react7.useState)(null);
4229
- const requestIdRef = (0, import_react7.useRef)(0);
4230
- const reset = (0, import_react7.useCallback)(() => {
4598
+ const [isStreaming, setIsStreaming] = (0, import_react8.useState)(false);
4599
+ const [streamingText, setStreamingText] = (0, import_react8.useState)("");
4600
+ const [completeResponse, setCompleteResponse] = (0, import_react8.useState)(null);
4601
+ const [error, setError] = (0, import_react8.useState)(null);
4602
+ const requestIdRef = (0, import_react8.useRef)(0);
4603
+ const reset = (0, import_react8.useCallback)(() => {
4231
4604
  setIsStreaming(false);
4232
4605
  setStreamingText("");
4233
4606
  setCompleteResponse(null);
4234
4607
  setError(null);
4235
4608
  }, []);
4236
- const send = (0, import_react7.useCallback)(
4609
+ const send = (0, import_react8.useCallback)(
4237
4610
  async (mapId, request, options) => {
4238
4611
  const requestId = requestIdRef.current + 1;
4239
4612
  requestIdRef.current = requestId;
@@ -4287,7 +4660,7 @@ var useSendMessageStream = (config) => {
4287
4660
  // src/react/components/MarkdownRenderer.tsx
4288
4661
  var import_react_markdown = __toESM(require("react-markdown"));
4289
4662
  var import_remark_gfm = __toESM(require("remark-gfm"));
4290
- var import_jsx_runtime6 = require("react/jsx-runtime");
4663
+ var import_jsx_runtime7 = require("react/jsx-runtime");
4291
4664
  function normalizeAssistantMarkdown(text) {
4292
4665
  if (!text || typeof text !== "string") return "";
4293
4666
  let normalized = text;
@@ -4303,28 +4676,28 @@ var MarkdownRenderer = ({ content, className }) => {
4303
4676
  if (!normalizedContent) {
4304
4677
  return null;
4305
4678
  }
4306
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className, style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4679
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className, style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4307
4680
  import_react_markdown.default,
4308
4681
  {
4309
4682
  remarkPlugins: [import_remark_gfm.default],
4310
4683
  components: {
4311
4684
  // Headings with proper spacing
4312
- h1: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { style: { fontSize: "1.5em", fontWeight: 700, marginTop: "1em", marginBottom: "0.5em" }, ...props, children }),
4313
- h2: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { style: { fontSize: "1.3em", fontWeight: 700, marginTop: "0.9em", marginBottom: "0.45em" }, ...props, children }),
4314
- h3: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { style: { fontSize: "1.15em", fontWeight: 600, marginTop: "0.75em", marginBottom: "0.4em" }, ...props, children }),
4315
- h4: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { style: { fontSize: "1.05em", fontWeight: 600, marginTop: "0.6em", marginBottom: "0.35em" }, ...props, children }),
4316
- h5: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h5", { style: { fontSize: "1em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
4317
- h6: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h6", { style: { fontSize: "0.95em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
4685
+ h1: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { style: { fontSize: "1.5em", fontWeight: 700, marginTop: "1em", marginBottom: "0.5em" }, ...props, children }),
4686
+ h2: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { style: { fontSize: "1.3em", fontWeight: 700, marginTop: "0.9em", marginBottom: "0.45em" }, ...props, children }),
4687
+ h3: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { style: { fontSize: "1.15em", fontWeight: 600, marginTop: "0.75em", marginBottom: "0.4em" }, ...props, children }),
4688
+ h4: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h4", { style: { fontSize: "1.05em", fontWeight: 600, marginTop: "0.6em", marginBottom: "0.35em" }, ...props, children }),
4689
+ h5: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h5", { style: { fontSize: "1em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
4690
+ h6: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h6", { style: { fontSize: "0.95em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
4318
4691
  // Paragraphs with comfortable line height
4319
- p: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { style: { marginTop: "0.5em", marginBottom: "0.5em", lineHeight: 1.6 }, ...props, children }),
4692
+ p: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { marginTop: "0.5em", marginBottom: "0.5em", lineHeight: 1.6 }, ...props, children }),
4320
4693
  // Lists with proper indentation
4321
- ul: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
4322
- ol: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ol", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
4323
- li: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { style: { marginTop: "0.25em", marginBottom: "0.25em" }, ...props, children }),
4694
+ ul: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
4695
+ ol: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
4696
+ li: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { style: { marginTop: "0.25em", marginBottom: "0.25em" }, ...props, children }),
4324
4697
  // Code blocks
4325
4698
  code: ({ inline, children, ...props }) => {
4326
4699
  if (inline) {
4327
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4700
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4328
4701
  "code",
4329
4702
  {
4330
4703
  style: {
@@ -4339,7 +4712,7 @@ var MarkdownRenderer = ({ content, className }) => {
4339
4712
  }
4340
4713
  );
4341
4714
  }
4342
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4715
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4343
4716
  "code",
4344
4717
  {
4345
4718
  style: {
@@ -4359,9 +4732,9 @@ var MarkdownRenderer = ({ content, className }) => {
4359
4732
  );
4360
4733
  },
4361
4734
  // Pre (code block wrapper)
4362
- pre: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("pre", { style: { margin: 0 }, ...props, children }),
4735
+ pre: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { style: { margin: 0 }, ...props, children }),
4363
4736
  // Blockquotes
4364
- blockquote: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4737
+ blockquote: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4365
4738
  "blockquote",
4366
4739
  {
4367
4740
  style: {
@@ -4377,11 +4750,11 @@ var MarkdownRenderer = ({ content, className }) => {
4377
4750
  }
4378
4751
  ),
4379
4752
  // Strong/bold
4380
- strong: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { style: { fontWeight: 600 }, ...props, children }),
4753
+ strong: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { style: { fontWeight: 600 }, ...props, children }),
4381
4754
  // Emphasis/italic
4382
- em: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("em", { style: { fontStyle: "italic" }, ...props, children }),
4755
+ em: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("em", { style: { fontStyle: "italic" }, ...props, children }),
4383
4756
  // Horizontal rule
4384
- hr: (props) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4757
+ hr: (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4385
4758
  "hr",
4386
4759
  {
4387
4760
  style: {
@@ -4394,7 +4767,7 @@ var MarkdownRenderer = ({ content, className }) => {
4394
4767
  }
4395
4768
  ),
4396
4769
  // Tables (GFM)
4397
- table: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { overflowX: "auto", marginTop: "0.5em", marginBottom: "0.5em" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4770
+ table: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { overflowX: "auto", marginTop: "0.5em", marginBottom: "0.5em" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4398
4771
  "table",
4399
4772
  {
4400
4773
  style: {
@@ -4406,7 +4779,7 @@ var MarkdownRenderer = ({ content, className }) => {
4406
4779
  children
4407
4780
  }
4408
4781
  ) }),
4409
- th: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4782
+ th: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4410
4783
  "th",
4411
4784
  {
4412
4785
  style: {
@@ -4420,7 +4793,7 @@ var MarkdownRenderer = ({ content, className }) => {
4420
4793
  children
4421
4794
  }
4422
4795
  ),
4423
- td: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4796
+ td: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4424
4797
  "td",
4425
4798
  {
4426
4799
  style: {
@@ -4438,32 +4811,32 @@ var MarkdownRenderer = ({ content, className }) => {
4438
4811
  };
4439
4812
 
4440
4813
  // src/react/ai/FloatingChatBox.tsx
4441
- var import_jsx_runtime7 = require("react/jsx-runtime");
4442
- var ChatIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
4443
- var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4444
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
4445
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
4814
+ var import_jsx_runtime8 = require("react/jsx-runtime");
4815
+ var ChatIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
4816
+ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4817
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
4818
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
4446
4819
  ] });
4447
- var ExpandIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4448
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "15 3 21 3 21 9" }),
4449
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "9 21 3 21 3 15" }),
4450
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "21", y1: "3", x2: "14", y2: "10" }),
4451
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
4820
+ var ExpandIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4821
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "15 3 21 3 21 9" }),
4822
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "9 21 3 21 3 15" }),
4823
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "21", y1: "3", x2: "14", y2: "10" }),
4824
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
4452
4825
  ] });
4453
- var CollapseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4454
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "4 14 10 14 10 20" }),
4455
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "20 10 14 10 14 4" }),
4456
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "14", y1: "10", x2: "21", y2: "3" }),
4457
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
4826
+ var CollapseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4827
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "4 14 10 14 10 20" }),
4828
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "20 10 14 10 14 4" }),
4829
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "14", y1: "10", x2: "21", y2: "3" }),
4830
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
4458
4831
  ] });
4459
- var SendIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4460
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
4461
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
4832
+ var SendIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4833
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
4834
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
4462
4835
  ] });
4463
- var LayersIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4464
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polygon", { points: "12 2 2 7 12 12 22 7 12 2" }),
4465
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "2 17 12 22 22 17" }),
4466
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "2 12 12 17 22 12" })
4836
+ var LayersIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4837
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polygon", { points: "12 2 2 7 12 12 22 7 12 2" }),
4838
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "2 17 12 22 22 17" }),
4839
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "2 12 12 17 22 12" })
4467
4840
  ] });
4468
4841
  var styles = {
4469
4842
  root: {
@@ -4768,42 +5141,42 @@ var FloatingChatBox = ({
4768
5141
  open: openProp
4769
5142
  }) => {
4770
5143
  const isControlled = openProp !== void 0;
4771
- const [internalOpen, setInternalOpen] = (0, import_react8.useState)(false);
5144
+ const [internalOpen, setInternalOpen] = (0, import_react9.useState)(false);
4772
5145
  const open = isControlled ? openProp : internalOpen;
4773
- const setOpen = (0, import_react8.useCallback)((value) => {
5146
+ const setOpen = (0, import_react9.useCallback)((value) => {
4774
5147
  const newValue = typeof value === "function" ? value(open) : value;
4775
5148
  if (!isControlled) {
4776
5149
  setInternalOpen(newValue);
4777
5150
  }
4778
5151
  onOpenChange?.(newValue);
4779
5152
  }, [isControlled, open, onOpenChange]);
4780
- const [expanded, setExpanded] = (0, import_react8.useState)(false);
4781
- const [messages, setMessages] = (0, import_react8.useState)([]);
4782
- const [inputValue, setInputValue] = (0, import_react8.useState)("");
4783
- const [conversationId, setConversationId] = (0, import_react8.useState)();
4784
- const [errorMessage, setErrorMessage] = (0, import_react8.useState)(null);
4785
- const [isFocused, setIsFocused] = (0, import_react8.useState)(false);
4786
- const [isMobile, setIsMobile] = (0, import_react8.useState)(false);
4787
- const messagesEndRef = (0, import_react8.useRef)(null);
4788
- const messagesContainerRef = (0, import_react8.useRef)(null);
4789
- const chatBoxRef = (0, import_react8.useRef)(null);
4790
- const chatConfig = (0, import_react8.useMemo)(() => {
5153
+ const [expanded, setExpanded] = (0, import_react9.useState)(false);
5154
+ const [messages, setMessages] = (0, import_react9.useState)([]);
5155
+ const [inputValue, setInputValue] = (0, import_react9.useState)("");
5156
+ const [conversationId, setConversationId] = (0, import_react9.useState)();
5157
+ const [errorMessage, setErrorMessage] = (0, import_react9.useState)(null);
5158
+ const [isFocused, setIsFocused] = (0, import_react9.useState)(false);
5159
+ const [isMobile, setIsMobile] = (0, import_react9.useState)(false);
5160
+ const messagesEndRef = (0, import_react9.useRef)(null);
5161
+ const messagesContainerRef = (0, import_react9.useRef)(null);
5162
+ const chatBoxRef = (0, import_react9.useRef)(null);
5163
+ const chatConfig = (0, import_react9.useMemo)(() => {
4791
5164
  if (!baseUrl) return void 0;
4792
5165
  return { baseUrl, accessToken, getAccessToken };
4793
5166
  }, [accessToken, baseUrl, getAccessToken]);
4794
5167
  const { sendMessage: sendMessage2, isStreaming, streamingText, completeResponse } = useSendMessageStream(chatConfig);
4795
5168
  const canSend = Boolean(mapId) && Boolean(baseUrl) && inputValue.trim().length > 0 && !isStreaming;
4796
- (0, import_react8.useEffect)(() => {
5169
+ (0, import_react9.useEffect)(() => {
4797
5170
  if (open && isMobile) {
4798
5171
  setExpanded(true);
4799
5172
  }
4800
5173
  }, [open, isMobile]);
4801
- const scrollToBottom = (0, import_react8.useCallback)(() => {
5174
+ const scrollToBottom = (0, import_react9.useCallback)(() => {
4802
5175
  if (messagesEndRef.current) {
4803
5176
  messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
4804
5177
  }
4805
5178
  }, []);
4806
- (0, import_react8.useEffect)(() => {
5179
+ (0, import_react9.useEffect)(() => {
4807
5180
  if (open && messages.length === 0) {
4808
5181
  setMessages([
4809
5182
  {
@@ -4814,10 +5187,10 @@ var FloatingChatBox = ({
4814
5187
  ]);
4815
5188
  }
4816
5189
  }, [open, messages.length]);
4817
- (0, import_react8.useEffect)(() => {
5190
+ (0, import_react9.useEffect)(() => {
4818
5191
  scrollToBottom();
4819
5192
  }, [messages, streamingText, scrollToBottom]);
4820
- (0, import_react8.useEffect)(() => {
5193
+ (0, import_react9.useEffect)(() => {
4821
5194
  if (!open) return;
4822
5195
  if (isMobile && expanded) return;
4823
5196
  const handleClickOutside = (event) => {
@@ -4830,7 +5203,7 @@ var FloatingChatBox = ({
4830
5203
  document.removeEventListener("mousedown", handleClickOutside);
4831
5204
  };
4832
5205
  }, [open, isMobile, expanded]);
4833
- (0, import_react8.useEffect)(() => {
5206
+ (0, import_react9.useEffect)(() => {
4834
5207
  if (typeof window === "undefined") return;
4835
5208
  const mediaQuery = window.matchMedia("(max-width: 768px)");
4836
5209
  const updateMobile = () => setIsMobile(mediaQuery.matches);
@@ -4848,7 +5221,7 @@ var FloatingChatBox = ({
4848
5221
  }
4849
5222
  };
4850
5223
  }, []);
4851
- (0, import_react8.useEffect)(() => {
5224
+ (0, import_react9.useEffect)(() => {
4852
5225
  if (typeof document === "undefined") return;
4853
5226
  if (!open || !isMobile) return;
4854
5227
  document.body.style.overflow = "hidden";
@@ -4856,10 +5229,10 @@ var FloatingChatBox = ({
4856
5229
  document.body.style.overflow = "";
4857
5230
  };
4858
5231
  }, [open, isMobile]);
4859
- const addMessage = (0, import_react8.useCallback)((message) => {
5232
+ const addMessage = (0, import_react9.useCallback)((message) => {
4860
5233
  setMessages((prev) => [...prev, message]);
4861
5234
  }, []);
4862
- const handleSend = (0, import_react8.useCallback)(async () => {
5235
+ const handleSend = (0, import_react9.useCallback)(async () => {
4863
5236
  if (!mapId) {
4864
5237
  setErrorMessage("Selecciona un mapa para usar el asistente.");
4865
5238
  return;
@@ -4912,7 +5285,7 @@ var FloatingChatBox = ({
4912
5285
  sendMessage2,
4913
5286
  userId
4914
5287
  ]);
4915
- const handleKeyDown = (0, import_react8.useCallback)(
5288
+ const handleKeyDown = (0, import_react9.useCallback)(
4916
5289
  (event) => {
4917
5290
  if (event.key === "Enter" && !event.shiftKey) {
4918
5291
  event.preventDefault();
@@ -4923,20 +5296,20 @@ var FloatingChatBox = ({
4923
5296
  },
4924
5297
  [canSend, handleSend]
4925
5298
  );
4926
- const handleFollowUpClick = (0, import_react8.useCallback)((question) => {
5299
+ const handleFollowUpClick = (0, import_react9.useCallback)((question) => {
4927
5300
  setInputValue(question);
4928
5301
  }, []);
4929
5302
  const renderMetadata = (response) => {
4930
5303
  if (!response?.metadata) return null;
4931
5304
  const referencedLayers = response.metadata.referencedLayers;
4932
5305
  if (!referencedLayers || referencedLayers.length === 0) return null;
4933
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.metadataSection, children: [
4934
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.metadataTitle, children: [
4935
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LayersIcon, {}),
5306
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.metadataSection, children: [
5307
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.metadataTitle, children: [
5308
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LayersIcon, {}),
4936
5309
  "Capas Analizadas"
4937
5310
  ] }),
4938
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { style: styles.metadataList, children: referencedLayers.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { style: styles.metadataItem, children: [
4939
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { children: layer.layerName }),
5311
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { style: styles.metadataList, children: referencedLayers.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { style: styles.metadataItem, children: [
5312
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: layer.layerName }),
4940
5313
  " (",
4941
5314
  layer.featureCount,
4942
5315
  " ",
@@ -4945,7 +5318,7 @@ var FloatingChatBox = ({
4945
5318
  ] }, index)) })
4946
5319
  ] });
4947
5320
  };
4948
- const handleActionClick = (0, import_react8.useCallback)((action) => {
5321
+ const handleActionClick = (0, import_react9.useCallback)((action) => {
4949
5322
  if (isStreaming) return;
4950
5323
  setOpen(false);
4951
5324
  requestAnimationFrame(() => {
@@ -4954,9 +5327,9 @@ var FloatingChatBox = ({
4954
5327
  }, [isStreaming, setOpen, onActionClick]);
4955
5328
  const renderActions = (response) => {
4956
5329
  if (!response?.suggestedActions?.length) return null;
4957
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.actionsSection, children: [
4958
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: styles.sectionLabel, children: "Acciones Sugeridas" }),
4959
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: styles.actionsGrid, children: response.suggestedActions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5330
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.actionsSection, children: [
5331
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.sectionLabel, children: "Acciones Sugeridas" }),
5332
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.actionsGrid, children: response.suggestedActions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4960
5333
  "button",
4961
5334
  {
4962
5335
  type: "button",
@@ -4987,9 +5360,9 @@ var FloatingChatBox = ({
4987
5360
  };
4988
5361
  const renderFollowUps = (response) => {
4989
5362
  if (!response?.followUpQuestions?.length) return null;
4990
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.actionsSection, children: [
4991
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: styles.sectionLabel, children: "Preguntas Relacionadas" }),
4992
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: response.followUpQuestions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5363
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.actionsSection, children: [
5364
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.sectionLabel, children: "Preguntas Relacionadas" }),
5365
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: response.followUpQuestions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4993
5366
  "button",
4994
5367
  {
4995
5368
  type: "button",
@@ -5018,8 +5391,8 @@ var FloatingChatBox = ({
5018
5391
  )) })
5019
5392
  ] });
5020
5393
  };
5021
- const chatContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.root, children: [
5022
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: `
5394
+ const chatContent = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.root, children: [
5395
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: `
5023
5396
  @keyframes zenitBlink {
5024
5397
  0%, 49% { opacity: 1; }
5025
5398
  50%, 100% { opacity: 0; }
@@ -5075,7 +5448,7 @@ var FloatingChatBox = ({
5075
5448
  }
5076
5449
  }
5077
5450
  ` }),
5078
- open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5451
+ open && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5079
5452
  "div",
5080
5453
  {
5081
5454
  ref: chatBoxRef,
@@ -5089,10 +5462,10 @@ var FloatingChatBox = ({
5089
5462
  };
5090
5463
  })(),
5091
5464
  children: [
5092
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { style: styles.header, children: [
5093
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { style: styles.title, children: "Asistente Zenit AI" }),
5094
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.headerButtons, children: [
5095
- !isMobile && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5465
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { style: styles.header, children: [
5466
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { style: styles.title, children: "Asistente Zenit AI" }),
5467
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.headerButtons, children: [
5468
+ !isMobile && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5096
5469
  "button",
5097
5470
  {
5098
5471
  type: "button",
@@ -5105,10 +5478,10 @@ var FloatingChatBox = ({
5105
5478
  e.currentTarget.style.background = "rgba(255, 255, 255, 0.15)";
5106
5479
  },
5107
5480
  "aria-label": expanded ? "Contraer" : "Expandir",
5108
- children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CollapseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ExpandIcon, {})
5481
+ children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CollapseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExpandIcon, {})
5109
5482
  }
5110
5483
  ),
5111
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5484
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5112
5485
  "button",
5113
5486
  {
5114
5487
  type: "button",
@@ -5121,20 +5494,20 @@ var FloatingChatBox = ({
5121
5494
  e.currentTarget.style.background = "rgba(255, 255, 255, 0.15)";
5122
5495
  },
5123
5496
  "aria-label": "Cerrar",
5124
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon, {})
5497
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseIcon, {})
5125
5498
  }
5126
5499
  )
5127
5500
  ] })
5128
5501
  ] }),
5129
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: messagesContainerRef, className: "zenit-ai-body", style: styles.messages, children: [
5130
- messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5502
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: messagesContainerRef, className: "zenit-ai-body", style: styles.messages, children: [
5503
+ messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5131
5504
  "div",
5132
5505
  {
5133
5506
  style: {
5134
5507
  ...styles.messageWrapper,
5135
5508
  alignItems: message.role === "user" ? "flex-end" : "flex-start"
5136
5509
  },
5137
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5510
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5138
5511
  "div",
5139
5512
  {
5140
5513
  style: {
@@ -5142,7 +5515,7 @@ var FloatingChatBox = ({
5142
5515
  ...message.role === "user" ? styles.userMessage : styles.assistantMessage
5143
5516
  },
5144
5517
  children: [
5145
- message.role === "assistant" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MarkdownRenderer, { content: message.content }) : message.content,
5518
+ message.role === "assistant" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MarkdownRenderer, { content: message.content }) : message.content,
5146
5519
  message.role === "assistant" && renderMetadata(message.response),
5147
5520
  message.role === "assistant" && renderActions(message.response),
5148
5521
  message.role === "assistant" && renderFollowUps(message.response)
@@ -5152,39 +5525,39 @@ var FloatingChatBox = ({
5152
5525
  },
5153
5526
  message.id
5154
5527
  )),
5155
- isStreaming && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5528
+ isStreaming && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5156
5529
  "div",
5157
5530
  {
5158
5531
  style: {
5159
5532
  ...styles.messageWrapper,
5160
5533
  alignItems: "flex-start"
5161
5534
  },
5162
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5535
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5163
5536
  "div",
5164
5537
  {
5165
5538
  style: {
5166
5539
  ...styles.messageBubble,
5167
5540
  ...styles.assistantMessage
5168
5541
  },
5169
- children: streamingText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
5170
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MarkdownRenderer, { content: streamingText }),
5171
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: styles.cursor })
5172
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.thinkingText, children: [
5173
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Pensando" }),
5174
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: styles.typingIndicator, children: [
5175
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot }),
5176
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot }),
5177
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot })
5542
+ children: streamingText ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
5543
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MarkdownRenderer, { content: streamingText }),
5544
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: styles.cursor })
5545
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.thinkingText, children: [
5546
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pensando" }),
5547
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.typingIndicator, children: [
5548
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot }),
5549
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot }),
5550
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot })
5178
5551
  ] })
5179
5552
  ] })
5180
5553
  }
5181
5554
  )
5182
5555
  }
5183
5556
  ),
5184
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: messagesEndRef })
5557
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: messagesEndRef })
5185
5558
  ] }),
5186
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "zenit-ai-input-area", style: styles.inputWrapper, children: [
5187
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5559
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "zenit-ai-input-area", style: styles.inputWrapper, children: [
5560
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5188
5561
  "textarea",
5189
5562
  {
5190
5563
  style: {
@@ -5201,7 +5574,7 @@ var FloatingChatBox = ({
5201
5574
  disabled: !mapId || !baseUrl || isStreaming
5202
5575
  }
5203
5576
  ),
5204
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5577
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5205
5578
  "button",
5206
5579
  {
5207
5580
  type: "button",
@@ -5210,18 +5583,18 @@ var FloatingChatBox = ({
5210
5583
  onClick: () => void handleSend(),
5211
5584
  disabled: !canSend,
5212
5585
  "aria-label": "Enviar mensaje",
5213
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SendIcon, {})
5586
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SendIcon, {})
5214
5587
  }
5215
5588
  )
5216
5589
  ] }),
5217
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: styles.errorText, children: errorMessage }),
5218
- isStreaming && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: styles.statusNote, children: "Generando sugerencias..." }),
5219
- !mapId && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: styles.statusNote, children: "Selecciona un mapa para usar el asistente" }),
5220
- !baseUrl && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: styles.statusNote, children: "Configura la baseUrl del SDK" })
5590
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.errorText, children: errorMessage }),
5591
+ isStreaming && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.statusNote, children: "Generando sugerencias..." }),
5592
+ !mapId && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.statusNote, children: "Selecciona un mapa para usar el asistente" }),
5593
+ !baseUrl && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.statusNote, children: "Configura la baseUrl del SDK" })
5221
5594
  ]
5222
5595
  }
5223
5596
  ),
5224
- !(hideButton && !open) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5597
+ !(hideButton && !open) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5225
5598
  "button",
5226
5599
  {
5227
5600
  type: "button",
@@ -5233,20 +5606,21 @@ var FloatingChatBox = ({
5233
5606
  },
5234
5607
  onClick: () => setOpen((prev) => !prev),
5235
5608
  "aria-label": open ? "Cerrar asistente" : "Abrir asistente Zenit AI",
5236
- children: open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
5237
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChatIcon, {}),
5238
- !isMobile && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Asistente IA" })
5609
+ children: open ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
5610
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChatIcon, {}),
5611
+ !isMobile && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Asistente IA" })
5239
5612
  ] })
5240
5613
  }
5241
5614
  )
5242
5615
  ] });
5243
5616
  if (typeof document !== "undefined") {
5244
- return (0, import_react_dom2.createPortal)(chatContent, document.body);
5617
+ return (0, import_react_dom3.createPortal)(chatContent, document.body);
5245
5618
  }
5246
5619
  return chatContent;
5247
5620
  };
5248
5621
  // Annotate the CommonJS export names for ESM import in node:
5249
5622
  0 && (module.exports = {
5623
+ ChevronDown,
5250
5624
  ChevronLeft,
5251
5625
  ChevronRight,
5252
5626
  DEFAULT_MAX_FEATURES_FULL_GEOJSON,
@@ -5267,6 +5641,7 @@ var FloatingChatBox = ({
5267
5641
  ZenitMap,
5268
5642
  ZenitMapsClient,
5269
5643
  ZenitSdkAuthClient,
5644
+ ZenitSelect,
5270
5645
  ZoomIn,
5271
5646
  applyFilteredGeoJSONStrategy,
5272
5647
  applyLayerOverrides,