zenit-sdk 0.1.3 → 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/{chunk-URDEEWUZ.mjs → chunk-R5WJ7K2D.mjs} +550 -177
- package/dist/chunk-R5WJ7K2D.mjs.map +1 -0
- package/dist/{index-BSljZaYk.d.mts → index-uCIChcHJ.d.mts} +21 -1
- package/dist/{index-BSljZaYk.d.ts → index-uCIChcHJ.d.ts} +21 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +618 -243
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +618 -243
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +5 -1
- package/package.json +1 -1
- package/dist/chunk-URDEEWUZ.mjs.map +0 -1
|
@@ -2006,13 +2006,366 @@ var ZenitMap = forwardRef(({
|
|
|
2006
2006
|
ZenitMap.displayName = "ZenitMap";
|
|
2007
2007
|
|
|
2008
2008
|
// src/react/ZenitLayerManager.tsx
|
|
2009
|
-
import
|
|
2009
|
+
import React6, { useEffect as useEffect6, useMemo as useMemo3, useRef as useRef6, useState as useState3 } from "react";
|
|
2010
2010
|
|
|
2011
2011
|
// src/react/icons.tsx
|
|
2012
|
-
import { Eye, EyeOff, ChevronLeft, ChevronRight, Layers, Upload, X, ZoomIn } from "lucide-react";
|
|
2012
|
+
import { Eye, EyeOff, ChevronDown, ChevronLeft, ChevronRight, Layers, Upload, X, ZoomIn } from "lucide-react";
|
|
2013
|
+
|
|
2014
|
+
// src/react/ui/ZenitSelect.tsx
|
|
2015
|
+
import React5 from "react";
|
|
2016
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
2017
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2018
|
+
var DEFAULT_SAFE_MENU_Z_INDEX = 4e3;
|
|
2019
|
+
function readCssMenuZIndex() {
|
|
2020
|
+
if (typeof document === "undefined") return null;
|
|
2021
|
+
const rootStyles = getComputedStyle(document.documentElement);
|
|
2022
|
+
const configuredValue = rootStyles.getPropertyValue("--zenit-select-z-index").trim() || rootStyles.getPropertyValue("--zenit-overlay-z-index").trim();
|
|
2023
|
+
if (!configuredValue) return null;
|
|
2024
|
+
const parsed = Number.parseInt(configuredValue, 10);
|
|
2025
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2026
|
+
}
|
|
2027
|
+
function shouldUseNativeSelect() {
|
|
2028
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
2029
|
+
const hasCoarsePointer = typeof window.matchMedia === "function" ? window.matchMedia("(pointer: coarse)").matches : false;
|
|
2030
|
+
return hasCoarsePointer || navigator.maxTouchPoints > 0;
|
|
2031
|
+
}
|
|
2032
|
+
var ZenitSelect = ({
|
|
2033
|
+
id,
|
|
2034
|
+
value,
|
|
2035
|
+
placeholder = "Seleccionar\u2026",
|
|
2036
|
+
options,
|
|
2037
|
+
onValueChange,
|
|
2038
|
+
disabled = false,
|
|
2039
|
+
className,
|
|
2040
|
+
menuZIndex,
|
|
2041
|
+
maxMenuHeight = 384,
|
|
2042
|
+
ariaLabel,
|
|
2043
|
+
useNativeOnMobile = true
|
|
2044
|
+
}) => {
|
|
2045
|
+
const rootRef = React5.useRef(null);
|
|
2046
|
+
const triggerRef = React5.useRef(null);
|
|
2047
|
+
const menuRef = React5.useRef(null);
|
|
2048
|
+
const lastTouchTsRef = React5.useRef(0);
|
|
2049
|
+
const [isOpen, setIsOpen] = React5.useState(false);
|
|
2050
|
+
const [menuPosition, setMenuPosition] = React5.useState({ top: 0, left: 0, width: 0 });
|
|
2051
|
+
const selectedOption = React5.useMemo(
|
|
2052
|
+
() => options.find((option) => option.value === value),
|
|
2053
|
+
[options, value]
|
|
2054
|
+
);
|
|
2055
|
+
const effectiveMenuZIndex = React5.useMemo(
|
|
2056
|
+
() => menuZIndex ?? readCssMenuZIndex() ?? DEFAULT_SAFE_MENU_Z_INDEX,
|
|
2057
|
+
[menuZIndex]
|
|
2058
|
+
);
|
|
2059
|
+
const useNative = React5.useMemo(
|
|
2060
|
+
() => useNativeOnMobile && shouldUseNativeSelect(),
|
|
2061
|
+
[useNativeOnMobile]
|
|
2062
|
+
);
|
|
2063
|
+
const updateMenuPosition = React5.useCallback(() => {
|
|
2064
|
+
const trigger = triggerRef.current;
|
|
2065
|
+
if (!trigger) return;
|
|
2066
|
+
const rect = trigger.getBoundingClientRect();
|
|
2067
|
+
const viewportPadding = 8;
|
|
2068
|
+
const minWidth = 200;
|
|
2069
|
+
const width = Math.max(rect.width, minWidth);
|
|
2070
|
+
const maxLeft = window.innerWidth - width - viewportPadding;
|
|
2071
|
+
const nextLeft = Math.max(viewportPadding, Math.min(rect.left, maxLeft));
|
|
2072
|
+
const nextTop = rect.bottom + 4;
|
|
2073
|
+
setMenuPosition({ top: nextTop, left: nextLeft, width });
|
|
2074
|
+
}, []);
|
|
2075
|
+
const getEffectiveMaxHeight = React5.useCallback(() => {
|
|
2076
|
+
const available = Math.max(160, window.innerHeight - menuPosition.top - 12);
|
|
2077
|
+
return Math.min(maxMenuHeight, available);
|
|
2078
|
+
}, [maxMenuHeight, menuPosition.top]);
|
|
2079
|
+
React5.useEffect(() => {
|
|
2080
|
+
if (!isOpen) return;
|
|
2081
|
+
updateMenuPosition();
|
|
2082
|
+
const isEventInsideSelect = (targetNode) => Boolean(rootRef.current?.contains(targetNode) || menuRef.current?.contains(targetNode));
|
|
2083
|
+
const handleOutsideTouchStart = (event) => {
|
|
2084
|
+
lastTouchTsRef.current = Date.now();
|
|
2085
|
+
const targetNode = event.target;
|
|
2086
|
+
if (isEventInsideSelect(targetNode)) return;
|
|
2087
|
+
setIsOpen(false);
|
|
2088
|
+
};
|
|
2089
|
+
const handleOutsideMouseDown = (event) => {
|
|
2090
|
+
if (Date.now() - lastTouchTsRef.current < 500) return;
|
|
2091
|
+
const targetNode = event.target;
|
|
2092
|
+
if (isEventInsideSelect(targetNode)) return;
|
|
2093
|
+
setIsOpen(false);
|
|
2094
|
+
};
|
|
2095
|
+
const handleEscape = (event) => {
|
|
2096
|
+
if (event.key === "Escape") {
|
|
2097
|
+
setIsOpen(false);
|
|
2098
|
+
triggerRef.current?.focus();
|
|
2099
|
+
}
|
|
2100
|
+
};
|
|
2101
|
+
const handleWindowChanges = () => updateMenuPosition();
|
|
2102
|
+
document.addEventListener("touchstart", handleOutsideTouchStart, { capture: true });
|
|
2103
|
+
document.addEventListener("mousedown", handleOutsideMouseDown, true);
|
|
2104
|
+
document.addEventListener("keydown", handleEscape);
|
|
2105
|
+
window.addEventListener("resize", handleWindowChanges);
|
|
2106
|
+
window.addEventListener("scroll", handleWindowChanges, true);
|
|
2107
|
+
return () => {
|
|
2108
|
+
document.removeEventListener("touchstart", handleOutsideTouchStart, true);
|
|
2109
|
+
document.removeEventListener("mousedown", handleOutsideMouseDown, true);
|
|
2110
|
+
document.removeEventListener("keydown", handleEscape);
|
|
2111
|
+
window.removeEventListener("resize", handleWindowChanges);
|
|
2112
|
+
window.removeEventListener("scroll", handleWindowChanges, true);
|
|
2113
|
+
};
|
|
2114
|
+
}, [isOpen, updateMenuPosition]);
|
|
2115
|
+
const handleTriggerDown = (event) => {
|
|
2116
|
+
if (event.type === "touchstart") {
|
|
2117
|
+
lastTouchTsRef.current = Date.now();
|
|
2118
|
+
}
|
|
2119
|
+
if (event.type === "mousedown" && Date.now() - lastTouchTsRef.current < 500) {
|
|
2120
|
+
return;
|
|
2121
|
+
}
|
|
2122
|
+
event.preventDefault();
|
|
2123
|
+
event.stopPropagation();
|
|
2124
|
+
if (disabled) return;
|
|
2125
|
+
if (!isOpen) updateMenuPosition();
|
|
2126
|
+
setIsOpen((prev) => !prev);
|
|
2127
|
+
};
|
|
2128
|
+
const handleTriggerClick = (event) => {
|
|
2129
|
+
if (event.detail !== 0) return;
|
|
2130
|
+
event.preventDefault();
|
|
2131
|
+
event.stopPropagation();
|
|
2132
|
+
if (disabled) return;
|
|
2133
|
+
if (!isOpen) updateMenuPosition();
|
|
2134
|
+
setIsOpen((prev) => !prev);
|
|
2135
|
+
};
|
|
2136
|
+
const selectValue = (nextValue, isDisabled) => {
|
|
2137
|
+
if (isDisabled) return;
|
|
2138
|
+
onValueChange?.(nextValue);
|
|
2139
|
+
setIsOpen(false);
|
|
2140
|
+
triggerRef.current?.focus();
|
|
2141
|
+
};
|
|
2142
|
+
if (useNative) {
|
|
2143
|
+
return /* @__PURE__ */ jsxs4("div", { ref: rootRef, className: [className, "zenit-select-root"].filter(Boolean).join(" "), children: [
|
|
2144
|
+
/* @__PURE__ */ jsx4("style", { children: `
|
|
2145
|
+
.zenit-select-native {
|
|
2146
|
+
width: 100%;
|
|
2147
|
+
min-height: 40px;
|
|
2148
|
+
height: 40px;
|
|
2149
|
+
border: 1px solid #cbd5e1;
|
|
2150
|
+
border-radius: 6px;
|
|
2151
|
+
background: #ffffff;
|
|
2152
|
+
color: #0f172a;
|
|
2153
|
+
padding: 0 12px;
|
|
2154
|
+
font-size: 14px;
|
|
2155
|
+
line-height: 1.25;
|
|
2156
|
+
cursor: pointer;
|
|
2157
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
2158
|
+
appearance: none;
|
|
2159
|
+
-webkit-appearance: none;
|
|
2160
|
+
}
|
|
2161
|
+
.zenit-select-native:disabled {
|
|
2162
|
+
opacity: 0.6;
|
|
2163
|
+
cursor: not-allowed;
|
|
2164
|
+
}
|
|
2165
|
+
.zenit-select-native:focus-visible {
|
|
2166
|
+
outline: none;
|
|
2167
|
+
border-color: #60a5fa;
|
|
2168
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
@media (max-width: 640px) {
|
|
2172
|
+
.zenit-select-native {
|
|
2173
|
+
min-height: 38px;
|
|
2174
|
+
height: 38px;
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
` }),
|
|
2178
|
+
/* @__PURE__ */ jsxs4(
|
|
2179
|
+
"select",
|
|
2180
|
+
{
|
|
2181
|
+
id,
|
|
2182
|
+
className: "zenit-select-native",
|
|
2183
|
+
value: value ?? "",
|
|
2184
|
+
"aria-label": ariaLabel,
|
|
2185
|
+
disabled,
|
|
2186
|
+
onChange: (event) => {
|
|
2187
|
+
onValueChange?.(event.target.value);
|
|
2188
|
+
},
|
|
2189
|
+
children: [
|
|
2190
|
+
/* @__PURE__ */ jsx4("option", { value: "", disabled: true, hidden: true, children: placeholder }),
|
|
2191
|
+
options.map((option) => /* @__PURE__ */ jsx4("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value))
|
|
2192
|
+
]
|
|
2193
|
+
}
|
|
2194
|
+
)
|
|
2195
|
+
] });
|
|
2196
|
+
}
|
|
2197
|
+
return /* @__PURE__ */ jsxs4("div", { ref: rootRef, className: [className, "zenit-select-root"].filter(Boolean).join(" "), children: [
|
|
2198
|
+
/* @__PURE__ */ jsx4("style", { children: `
|
|
2199
|
+
.zenit-select-trigger {
|
|
2200
|
+
width: 100%;
|
|
2201
|
+
min-height: 40px;
|
|
2202
|
+
height: 40px;
|
|
2203
|
+
border: 1px solid #cbd5e1;
|
|
2204
|
+
border-radius: 6px;
|
|
2205
|
+
background: #ffffff;
|
|
2206
|
+
color: #0f172a;
|
|
2207
|
+
display: inline-flex;
|
|
2208
|
+
align-items: center;
|
|
2209
|
+
justify-content: space-between;
|
|
2210
|
+
gap: 8px;
|
|
2211
|
+
padding: 0 12px;
|
|
2212
|
+
font-size: 14px;
|
|
2213
|
+
line-height: 1.25;
|
|
2214
|
+
cursor: pointer;
|
|
2215
|
+
text-align: left;
|
|
2216
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
2217
|
+
touch-action: manipulation;
|
|
2218
|
+
-webkit-tap-highlight-color: transparent;
|
|
2219
|
+
}
|
|
2220
|
+
.zenit-select-trigger.is-disabled {
|
|
2221
|
+
opacity: 0.6;
|
|
2222
|
+
cursor: not-allowed;
|
|
2223
|
+
}
|
|
2224
|
+
.zenit-select-trigger:focus-visible {
|
|
2225
|
+
outline: none;
|
|
2226
|
+
border-color: #60a5fa;
|
|
2227
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
|
|
2228
|
+
}
|
|
2229
|
+
.zenit-select-label {
|
|
2230
|
+
white-space: nowrap;
|
|
2231
|
+
overflow: hidden;
|
|
2232
|
+
text-overflow: ellipsis;
|
|
2233
|
+
}
|
|
2234
|
+
.zenit-select-label.is-placeholder {
|
|
2235
|
+
color: #64748b;
|
|
2236
|
+
}
|
|
2237
|
+
.zenit-select-chevron {
|
|
2238
|
+
opacity: 0.5;
|
|
2239
|
+
flex-shrink: 0;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
/* Contenedor: aqu\xED debe GANAR el scroll en m\xF3vil */
|
|
2243
|
+
.zenit-select-content {
|
|
2244
|
+
position: fixed;
|
|
2245
|
+
border: 1px solid #cbd5e1;
|
|
2246
|
+
border-radius: 6px;
|
|
2247
|
+
background: #ffffff;
|
|
2248
|
+
box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
|
|
2249
|
+
overflow-y: auto;
|
|
2250
|
+
padding: 4px;
|
|
2251
|
+
pointer-events: auto;
|
|
2252
|
+
|
|
2253
|
+
/* Lo importante: permitir pan vertical dentro del men\xFA */
|
|
2254
|
+
touch-action: pan-y;
|
|
2255
|
+
overscroll-behavior: contain;
|
|
2256
|
+
-webkit-overflow-scrolling: touch;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
/* Items NO son button: evitamos que WebView \u201Csecuestr\xE9\u201D el gesto */
|
|
2260
|
+
.zenit-select-item {
|
|
2261
|
+
width: 100%;
|
|
2262
|
+
border-radius: 4px;
|
|
2263
|
+
text-align: left;
|
|
2264
|
+
color: #0f172a;
|
|
2265
|
+
font-size: 14px;
|
|
2266
|
+
min-height: 34px;
|
|
2267
|
+
padding: 8px 10px;
|
|
2268
|
+
cursor: pointer;
|
|
2269
|
+
-webkit-tap-highlight-color: transparent;
|
|
2270
|
+
user-select: none;
|
|
2271
|
+
}
|
|
2272
|
+
.zenit-select-item:hover {
|
|
2273
|
+
background: #f1f5f9;
|
|
2274
|
+
}
|
|
2275
|
+
.zenit-select-item.is-selected {
|
|
2276
|
+
background: #e2e8f0;
|
|
2277
|
+
font-weight: 600;
|
|
2278
|
+
}
|
|
2279
|
+
.zenit-select-item.is-disabled {
|
|
2280
|
+
color: #94a3b8;
|
|
2281
|
+
cursor: not-allowed;
|
|
2282
|
+
}
|
|
2283
|
+
.zenit-select-item:focus-visible {
|
|
2284
|
+
outline: none;
|
|
2285
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
@media (max-width: 640px) {
|
|
2289
|
+
.zenit-select-trigger {
|
|
2290
|
+
height: 38px;
|
|
2291
|
+
min-height: 38px;
|
|
2292
|
+
}
|
|
2293
|
+
.zenit-select-content {
|
|
2294
|
+
max-width: calc(100vw - 16px);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
` }),
|
|
2298
|
+
/* @__PURE__ */ jsxs4(
|
|
2299
|
+
"button",
|
|
2300
|
+
{
|
|
2301
|
+
id,
|
|
2302
|
+
ref: triggerRef,
|
|
2303
|
+
type: "button",
|
|
2304
|
+
className: `zenit-select-trigger${disabled ? " is-disabled" : ""}`,
|
|
2305
|
+
onTouchStart: handleTriggerDown,
|
|
2306
|
+
onMouseDown: handleTriggerDown,
|
|
2307
|
+
onClick: handleTriggerClick,
|
|
2308
|
+
"aria-haspopup": "listbox",
|
|
2309
|
+
"aria-expanded": isOpen,
|
|
2310
|
+
"aria-label": ariaLabel,
|
|
2311
|
+
disabled,
|
|
2312
|
+
children: [
|
|
2313
|
+
/* @__PURE__ */ jsx4("span", { className: `zenit-select-label${selectedOption ? "" : " is-placeholder"}`, children: selectedOption?.label ?? placeholder }),
|
|
2314
|
+
/* @__PURE__ */ jsx4(ChevronDown, { className: "zenit-select-chevron", size: 16, "aria-hidden": "true" })
|
|
2315
|
+
]
|
|
2316
|
+
}
|
|
2317
|
+
),
|
|
2318
|
+
isOpen && typeof document !== "undefined" && createPortal2(
|
|
2319
|
+
/* @__PURE__ */ jsx4(
|
|
2320
|
+
"div",
|
|
2321
|
+
{
|
|
2322
|
+
ref: menuRef,
|
|
2323
|
+
className: "zenit-select-content",
|
|
2324
|
+
role: "listbox",
|
|
2325
|
+
style: {
|
|
2326
|
+
top: menuPosition.top,
|
|
2327
|
+
left: menuPosition.left,
|
|
2328
|
+
width: menuPosition.width,
|
|
2329
|
+
zIndex: effectiveMenuZIndex,
|
|
2330
|
+
maxHeight: getEffectiveMaxHeight()
|
|
2331
|
+
},
|
|
2332
|
+
children: options.map((option) => {
|
|
2333
|
+
const isSelected = option.value === value;
|
|
2334
|
+
return /* @__PURE__ */ jsx4(
|
|
2335
|
+
"div",
|
|
2336
|
+
{
|
|
2337
|
+
role: "option",
|
|
2338
|
+
"aria-selected": isSelected,
|
|
2339
|
+
tabIndex: option.disabled ? -1 : 0,
|
|
2340
|
+
className: `zenit-select-item${isSelected ? " is-selected" : ""}${option.disabled ? " is-disabled" : ""}`,
|
|
2341
|
+
onClick: (event) => {
|
|
2342
|
+
event.preventDefault();
|
|
2343
|
+
event.stopPropagation();
|
|
2344
|
+
if (option.disabled) return;
|
|
2345
|
+
selectValue(option.value, option.disabled);
|
|
2346
|
+
},
|
|
2347
|
+
onKeyDown: (event) => {
|
|
2348
|
+
if (option.disabled) return;
|
|
2349
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
2350
|
+
event.preventDefault();
|
|
2351
|
+
event.stopPropagation();
|
|
2352
|
+
selectValue(option.value, option.disabled);
|
|
2353
|
+
}
|
|
2354
|
+
},
|
|
2355
|
+
children: option.label
|
|
2356
|
+
},
|
|
2357
|
+
option.value
|
|
2358
|
+
);
|
|
2359
|
+
})
|
|
2360
|
+
}
|
|
2361
|
+
),
|
|
2362
|
+
document.body
|
|
2363
|
+
)
|
|
2364
|
+
] });
|
|
2365
|
+
};
|
|
2013
2366
|
|
|
2014
2367
|
// src/react/ZenitLayerManager.tsx
|
|
2015
|
-
import { Fragment as Fragment3, jsx as
|
|
2368
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2016
2369
|
var FLOAT_TOLERANCE = 1e-3;
|
|
2017
2370
|
function areEffectiveStatesEqual(a, b) {
|
|
2018
2371
|
if (a.length !== b.length) return false;
|
|
@@ -2110,7 +2463,7 @@ var ZenitLayerManager = ({
|
|
|
2110
2463
|
});
|
|
2111
2464
|
return index;
|
|
2112
2465
|
}, [map, mapLayers]);
|
|
2113
|
-
const resolveUserOpacity =
|
|
2466
|
+
const resolveUserOpacity = React6.useCallback((state) => {
|
|
2114
2467
|
if (typeof state.overrideOpacity === "number") return state.overrideOpacity;
|
|
2115
2468
|
if (typeof state.overrideOpacity === "string") {
|
|
2116
2469
|
const parsed = Number.parseFloat(state.overrideOpacity);
|
|
@@ -2118,7 +2471,7 @@ var ZenitLayerManager = ({
|
|
|
2118
2471
|
}
|
|
2119
2472
|
return state.opacity ?? 1;
|
|
2120
2473
|
}, []);
|
|
2121
|
-
const resolveEffectiveOpacity =
|
|
2474
|
+
const resolveEffectiveOpacity = React6.useCallback(
|
|
2122
2475
|
(layerId, userOpacity) => {
|
|
2123
2476
|
if (!autoOpacityOnZoom || typeof mapZoom !== "number") {
|
|
2124
2477
|
return userOpacity;
|
|
@@ -2203,7 +2556,7 @@ var ZenitLayerManager = ({
|
|
|
2203
2556
|
mapZoom,
|
|
2204
2557
|
onLayerStatesChange
|
|
2205
2558
|
]);
|
|
2206
|
-
const updateLayerVisible =
|
|
2559
|
+
const updateLayerVisible = React6.useCallback(
|
|
2207
2560
|
(layerId, visible) => {
|
|
2208
2561
|
if (!onLayerStatesChange) return;
|
|
2209
2562
|
const next = effectiveStates.map(
|
|
@@ -2213,7 +2566,7 @@ var ZenitLayerManager = ({
|
|
|
2213
2566
|
},
|
|
2214
2567
|
[effectiveStates, onLayerStatesChange]
|
|
2215
2568
|
);
|
|
2216
|
-
const updateLayerOpacity =
|
|
2569
|
+
const updateLayerOpacity = React6.useCallback(
|
|
2217
2570
|
(layerId, opacity) => {
|
|
2218
2571
|
if (!onLayerStatesChange) return;
|
|
2219
2572
|
const adjustedOpacity = resolveEffectiveOpacity(layerId, opacity);
|
|
@@ -2224,7 +2577,7 @@ var ZenitLayerManager = ({
|
|
|
2224
2577
|
},
|
|
2225
2578
|
[effectiveStates, onLayerStatesChange, resolveEffectiveOpacity]
|
|
2226
2579
|
);
|
|
2227
|
-
const resolveFeatureCount =
|
|
2580
|
+
const resolveFeatureCount = React6.useCallback(
|
|
2228
2581
|
(layerId, layer) => {
|
|
2229
2582
|
const resolvedFeatureCount = layerFeatureCounts?.[layerId] ?? layerFeatureCounts?.[String(layerId)];
|
|
2230
2583
|
if (typeof resolvedFeatureCount === "number") return resolvedFeatureCount;
|
|
@@ -2278,7 +2631,7 @@ var ZenitLayerManager = ({
|
|
|
2278
2631
|
}, [selectedFilterLayer]);
|
|
2279
2632
|
const activeCatalogKey = selectedFilterLayer ? `${selectedFilterLayer.mapLayer.layerId}:${selectedFilterField}` : null;
|
|
2280
2633
|
const activeCatalogValues = activeCatalogKey ? catalogByLayerField[activeCatalogKey] ?? [] : [];
|
|
2281
|
-
const extractCatalogValues =
|
|
2634
|
+
const extractCatalogValues = React6.useCallback((catalogData, field) => {
|
|
2282
2635
|
const values = /* @__PURE__ */ new Set();
|
|
2283
2636
|
const pushValue = (value) => {
|
|
2284
2637
|
if (value === null || value === void 0) return;
|
|
@@ -2358,7 +2711,7 @@ var ZenitLayerManager = ({
|
|
|
2358
2711
|
controller.abort();
|
|
2359
2712
|
};
|
|
2360
2713
|
}, [activeCatalogKey, activeTab, catalogByLayerField, client.layers, extractCatalogValues, selectedFilterField, selectedFilterLayer]);
|
|
2361
|
-
const handleApplyFilter =
|
|
2714
|
+
const handleApplyFilter = React6.useCallback(async () => {
|
|
2362
2715
|
if (!selectedFilterLayer || !selectedFilterField || !selectedFilterValue || !onApplyLayerFilter) return;
|
|
2363
2716
|
setApplyingFilter(true);
|
|
2364
2717
|
setFilterError(null);
|
|
@@ -2380,7 +2733,7 @@ var ZenitLayerManager = ({
|
|
|
2380
2733
|
setApplyingFilter(false);
|
|
2381
2734
|
}
|
|
2382
2735
|
}, [onApplyLayerFilter, selectedFilterField, selectedFilterLayer, selectedFilterValue]);
|
|
2383
|
-
const handleClearFilter =
|
|
2736
|
+
const handleClearFilter = React6.useCallback(async () => {
|
|
2384
2737
|
if (!selectedFilterLayer) return;
|
|
2385
2738
|
setApplyingFilter(true);
|
|
2386
2739
|
setFilterError(null);
|
|
@@ -2395,7 +2748,7 @@ var ZenitLayerManager = ({
|
|
|
2395
2748
|
setApplyingFilter(false);
|
|
2396
2749
|
}
|
|
2397
2750
|
}, [onClearLayerFilter, selectedFilterField, selectedFilterLayer]);
|
|
2398
|
-
const resolveLayerStyle =
|
|
2751
|
+
const resolveLayerStyle = React6.useCallback(
|
|
2399
2752
|
(layerId) => {
|
|
2400
2753
|
const layerKey = String(layerId);
|
|
2401
2754
|
const fromProp = mapLayers?.find((entry) => String(entry.layerId) === layerKey)?.style;
|
|
@@ -2425,10 +2778,10 @@ var ZenitLayerManager = ({
|
|
|
2425
2778
|
...height ? { height } : {}
|
|
2426
2779
|
};
|
|
2427
2780
|
if (loadingMap) {
|
|
2428
|
-
return /* @__PURE__ */
|
|
2781
|
+
return /* @__PURE__ */ jsx5("div", { className, style: panelStyle, children: "Cargando capas\u2026" });
|
|
2429
2782
|
}
|
|
2430
2783
|
if (mapError) {
|
|
2431
|
-
return /* @__PURE__ */
|
|
2784
|
+
return /* @__PURE__ */ jsxs5("div", { className, style: { ...panelStyle, color: "#c53030" }, children: [
|
|
2432
2785
|
"Error al cargar mapa: ",
|
|
2433
2786
|
mapError
|
|
2434
2787
|
] });
|
|
@@ -2446,7 +2799,7 @@ var ZenitLayerManager = ({
|
|
|
2446
2799
|
boxShadow: "0 1px 0 rgba(148, 163, 184, 0.25)"
|
|
2447
2800
|
};
|
|
2448
2801
|
const renderLayerCards = () => {
|
|
2449
|
-
return /* @__PURE__ */
|
|
2802
|
+
return /* @__PURE__ */ jsx5("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: decoratedLayers.map((layerState) => {
|
|
2450
2803
|
const layerId = layerState.mapLayer.layerId;
|
|
2451
2804
|
const layerName = layerState.layerName ?? `Capa ${layerId}`;
|
|
2452
2805
|
const visible = layerState.effective?.visible ?? false;
|
|
@@ -2456,7 +2809,7 @@ var ZenitLayerManager = ({
|
|
|
2456
2809
|
const muted = !visible;
|
|
2457
2810
|
const opacityPercent = Math.round(userOpacity * 100);
|
|
2458
2811
|
const sliderBackground = `linear-gradient(to right, ${layerColor} 0%, ${layerColor} ${opacityPercent}%, #e5e7eb ${opacityPercent}%, #e5e7eb 100%)`;
|
|
2459
|
-
return /* @__PURE__ */
|
|
2812
|
+
return /* @__PURE__ */ jsxs5(
|
|
2460
2813
|
"div",
|
|
2461
2814
|
{
|
|
2462
2815
|
className: `zlm-card${muted ? " is-muted" : ""}`,
|
|
@@ -2471,9 +2824,9 @@ var ZenitLayerManager = ({
|
|
|
2471
2824
|
width: "100%"
|
|
2472
2825
|
},
|
|
2473
2826
|
children: [
|
|
2474
|
-
/* @__PURE__ */
|
|
2475
|
-
/* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2827
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", justifyContent: "space-between", gap: 12 }, children: [
|
|
2828
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", gap: 10, alignItems: "flex-start", minWidth: 0, flex: 1 }, children: [
|
|
2829
|
+
/* @__PURE__ */ jsx5(
|
|
2477
2830
|
"div",
|
|
2478
2831
|
{
|
|
2479
2832
|
style: {
|
|
@@ -2488,7 +2841,7 @@ var ZenitLayerManager = ({
|
|
|
2488
2841
|
title: "Color de la capa"
|
|
2489
2842
|
}
|
|
2490
2843
|
),
|
|
2491
|
-
showLayerVisibilityIcon && /* @__PURE__ */
|
|
2844
|
+
showLayerVisibilityIcon && /* @__PURE__ */ jsx5(
|
|
2492
2845
|
"button",
|
|
2493
2846
|
{
|
|
2494
2847
|
type: "button",
|
|
@@ -2499,11 +2852,11 @@ var ZenitLayerManager = ({
|
|
|
2499
2852
|
)
|
|
2500
2853
|
),
|
|
2501
2854
|
"aria-label": visible ? "Ocultar capa" : "Mostrar capa",
|
|
2502
|
-
children: visible ? /* @__PURE__ */
|
|
2855
|
+
children: visible ? /* @__PURE__ */ jsx5(Eye, { size: 16 }) : /* @__PURE__ */ jsx5(EyeOff, { size: 16 })
|
|
2503
2856
|
}
|
|
2504
2857
|
),
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
2858
|
+
/* @__PURE__ */ jsxs5("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
2859
|
+
/* @__PURE__ */ jsx5(
|
|
2507
2860
|
"div",
|
|
2508
2861
|
{
|
|
2509
2862
|
className: "zlm-layer-name",
|
|
@@ -2521,26 +2874,26 @@ var ZenitLayerManager = ({
|
|
|
2521
2874
|
children: layerName
|
|
2522
2875
|
}
|
|
2523
2876
|
),
|
|
2524
|
-
/* @__PURE__ */
|
|
2877
|
+
/* @__PURE__ */ jsxs5("div", { style: { color: muted ? "#94a3b8" : "#64748b", fontSize: 12 }, children: [
|
|
2525
2878
|
"ID ",
|
|
2526
2879
|
layerId
|
|
2527
2880
|
] })
|
|
2528
2881
|
] })
|
|
2529
2882
|
] }),
|
|
2530
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ jsx5("div", { style: { display: "flex", alignItems: "flex-start", gap: 6, flexShrink: 0 }, children: typeof featureCount === "number" && /* @__PURE__ */ jsxs5("span", { className: "zlm-badge", children: [
|
|
2531
2884
|
featureCount.toLocaleString(),
|
|
2532
2885
|
" features"
|
|
2533
2886
|
] }) })
|
|
2534
2887
|
] }),
|
|
2535
|
-
/* @__PURE__ */
|
|
2536
|
-
/* @__PURE__ */
|
|
2537
|
-
/* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2888
|
+
/* @__PURE__ */ jsx5("div", { style: { display: "flex", gap: 10, alignItems: "center" }, children: /* @__PURE__ */ jsxs5("div", { style: { flex: 1 }, children: [
|
|
2889
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: 6, color: "#64748b", fontSize: 12 }, children: [
|
|
2890
|
+
/* @__PURE__ */ jsx5("span", { children: "Opacidad" }),
|
|
2891
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
2539
2892
|
opacityPercent,
|
|
2540
2893
|
"%"
|
|
2541
2894
|
] })
|
|
2542
2895
|
] }),
|
|
2543
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ jsx5(
|
|
2544
2897
|
"input",
|
|
2545
2898
|
{
|
|
2546
2899
|
className: "zlm-range",
|
|
@@ -2578,8 +2931,8 @@ var ZenitLayerManager = ({
|
|
|
2578
2931
|
);
|
|
2579
2932
|
}) });
|
|
2580
2933
|
};
|
|
2581
|
-
return /* @__PURE__ */
|
|
2582
|
-
/* @__PURE__ */
|
|
2934
|
+
return /* @__PURE__ */ jsxs5("div", { className: ["zenit-layer-manager", className].filter(Boolean).join(" "), style: panelStyle, children: [
|
|
2935
|
+
/* @__PURE__ */ jsx5("style", { children: `
|
|
2583
2936
|
.zenit-layer-manager .zlm-card {
|
|
2584
2937
|
transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
|
|
2585
2938
|
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
|
|
@@ -2674,16 +3027,16 @@ var ZenitLayerManager = ({
|
|
|
2674
3027
|
outline-offset: 2px;
|
|
2675
3028
|
}
|
|
2676
3029
|
` }),
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2679
|
-
/* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
/* @__PURE__ */
|
|
3030
|
+
/* @__PURE__ */ jsxs5("div", { style: headerStyle, children: [
|
|
3031
|
+
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3032
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
3033
|
+
/* @__PURE__ */ jsx5("div", { style: { fontWeight: 800, fontSize: 16, color: "#0f172a" }, children: "Gesti\xF3n de Capas" }),
|
|
3034
|
+
/* @__PURE__ */ jsxs5("div", { style: { color: "#64748b", fontSize: 12 }, children: [
|
|
2682
3035
|
"Mapa #",
|
|
2683
3036
|
map.id
|
|
2684
3037
|
] })
|
|
2685
3038
|
] }),
|
|
2686
|
-
/* @__PURE__ */
|
|
3039
|
+
/* @__PURE__ */ jsxs5(
|
|
2687
3040
|
"button",
|
|
2688
3041
|
{
|
|
2689
3042
|
type: "button",
|
|
@@ -2691,13 +3044,13 @@ var ZenitLayerManager = ({
|
|
|
2691
3044
|
className: "zlm-panel-toggle",
|
|
2692
3045
|
"aria-label": panelVisible ? "Ocultar panel de capas" : "Mostrar panel de capas",
|
|
2693
3046
|
children: [
|
|
2694
|
-
panelVisible ? /* @__PURE__ */
|
|
3047
|
+
panelVisible ? /* @__PURE__ */ jsx5(Eye, { size: 16 }) : /* @__PURE__ */ jsx5(EyeOff, { size: 16 }),
|
|
2695
3048
|
panelVisible ? "Ocultar" : "Mostrar"
|
|
2696
3049
|
]
|
|
2697
3050
|
}
|
|
2698
3051
|
)
|
|
2699
3052
|
] }),
|
|
2700
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ jsxs5(
|
|
2701
3054
|
"div",
|
|
2702
3055
|
{
|
|
2703
3056
|
style: {
|
|
@@ -2710,38 +3063,38 @@ var ZenitLayerManager = ({
|
|
|
2710
3063
|
background: "#f1f5f9"
|
|
2711
3064
|
},
|
|
2712
3065
|
children: [
|
|
2713
|
-
/* @__PURE__ */
|
|
3066
|
+
/* @__PURE__ */ jsxs5(
|
|
2714
3067
|
"button",
|
|
2715
3068
|
{
|
|
2716
3069
|
type: "button",
|
|
2717
3070
|
className: `zlm-tab${activeTab === "layers" ? " is-active" : ""}`,
|
|
2718
3071
|
onClick: () => setActiveTab("layers"),
|
|
2719
3072
|
children: [
|
|
2720
|
-
/* @__PURE__ */
|
|
3073
|
+
/* @__PURE__ */ jsx5(Layers, { size: 16 }),
|
|
2721
3074
|
"Capas"
|
|
2722
3075
|
]
|
|
2723
3076
|
}
|
|
2724
3077
|
),
|
|
2725
|
-
showUploadTab && /* @__PURE__ */
|
|
3078
|
+
showUploadTab && /* @__PURE__ */ jsxs5(
|
|
2726
3079
|
"button",
|
|
2727
3080
|
{
|
|
2728
3081
|
type: "button",
|
|
2729
3082
|
className: `zlm-tab${activeTab === "upload" ? " is-active" : ""}`,
|
|
2730
3083
|
onClick: () => setActiveTab("upload"),
|
|
2731
3084
|
children: [
|
|
2732
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsx5(Upload, { size: 16 }),
|
|
2733
3086
|
"Subir"
|
|
2734
3087
|
]
|
|
2735
3088
|
}
|
|
2736
3089
|
),
|
|
2737
|
-
/* @__PURE__ */
|
|
3090
|
+
/* @__PURE__ */ jsxs5(
|
|
2738
3091
|
"button",
|
|
2739
3092
|
{
|
|
2740
3093
|
type: "button",
|
|
2741
3094
|
className: `zlm-tab${activeTab === "filters" ? " is-active" : ""}`,
|
|
2742
3095
|
onClick: () => setActiveTab("filters"),
|
|
2743
3096
|
children: [
|
|
2744
|
-
/* @__PURE__ */
|
|
3097
|
+
/* @__PURE__ */ jsx5(Layers, { size: 16 }),
|
|
2745
3098
|
"Filtros"
|
|
2746
3099
|
]
|
|
2747
3100
|
}
|
|
@@ -2750,49 +3103,67 @@ var ZenitLayerManager = ({
|
|
|
2750
3103
|
}
|
|
2751
3104
|
)
|
|
2752
3105
|
] }),
|
|
2753
|
-
panelVisible && /* @__PURE__ */
|
|
3106
|
+
panelVisible && /* @__PURE__ */ jsxs5("div", { style: { padding: "12px 10px 18px", overflowY: "auto", flex: 1, minHeight: 0 }, children: [
|
|
2754
3107
|
activeTab === "layers" && renderLayerCards(),
|
|
2755
|
-
activeTab === "filters" && /* @__PURE__ */
|
|
2756
|
-
filterableLayers.length > 1 && /* @__PURE__ */
|
|
3108
|
+
activeTab === "filters" && /* @__PURE__ */ jsx5("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__ */ jsx5("div", { style: { color: "#64748b", fontSize: 13 }, children: "No hay filtros disponibles para las capas de este mapa." }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
3109
|
+
filterableLayers.length > 1 && /* @__PURE__ */ jsxs5("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
|
|
2757
3110
|
"Capa",
|
|
2758
|
-
/* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ jsx5(
|
|
3112
|
+
ZenitSelect,
|
|
3113
|
+
{
|
|
3114
|
+
ariaLabel: "Seleccionar capa para filtrar",
|
|
3115
|
+
value: selectedFilterLayerId,
|
|
3116
|
+
onValueChange: setSelectedFilterLayerId,
|
|
3117
|
+
options: filterableLayers.map((layer) => ({
|
|
3118
|
+
value: String(layer.mapLayer.layerId),
|
|
3119
|
+
label: layer.layerName ?? `Capa ${layer.mapLayer.layerId}`
|
|
3120
|
+
}))
|
|
3121
|
+
}
|
|
3122
|
+
)
|
|
2759
3123
|
] }),
|
|
2760
|
-
/* @__PURE__ */
|
|
3124
|
+
/* @__PURE__ */ jsxs5("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
|
|
2761
3125
|
"Campo",
|
|
2762
|
-
/* @__PURE__ */
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
3126
|
+
/* @__PURE__ */ jsx5(
|
|
3127
|
+
ZenitSelect,
|
|
3128
|
+
{
|
|
3129
|
+
ariaLabel: "Seleccionar campo de filtrado",
|
|
3130
|
+
value: selectedFilterField,
|
|
3131
|
+
onValueChange: (nextField) => {
|
|
3132
|
+
setSelectedFilterField(nextField);
|
|
3133
|
+
setSelectedFilterValue("");
|
|
3134
|
+
},
|
|
3135
|
+
options: filterFields.map((field) => ({ value: field, label: field }))
|
|
3136
|
+
}
|
|
3137
|
+
)
|
|
2766
3138
|
] }),
|
|
2767
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsxs5("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
|
|
2768
3140
|
"Valor",
|
|
2769
|
-
/* @__PURE__ */
|
|
2770
|
-
|
|
3141
|
+
/* @__PURE__ */ jsx5(
|
|
3142
|
+
ZenitSelect,
|
|
2771
3143
|
{
|
|
2772
|
-
|
|
3144
|
+
ariaLabel: "Seleccionar valor de filtrado",
|
|
2773
3145
|
value: selectedFilterValue,
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
]
|
|
3146
|
+
placeholder: "Seleccionar\u2026",
|
|
3147
|
+
onValueChange: (nextValue) => setSelectedFilterValue(nextValue),
|
|
3148
|
+
disabled: loadingCatalog || activeCatalogValues.length === 0,
|
|
3149
|
+
options: activeCatalogValues.map((catalogValue) => ({
|
|
3150
|
+
value: catalogValue,
|
|
3151
|
+
label: catalogValue
|
|
3152
|
+
}))
|
|
2782
3153
|
}
|
|
2783
3154
|
)
|
|
2784
3155
|
] }),
|
|
2785
|
-
loadingCatalog && /* @__PURE__ */
|
|
2786
|
-
!loadingCatalog && selectedFilterField && activeCatalogValues.length === 0 && /* @__PURE__ */
|
|
2787
|
-
filterError && /* @__PURE__ */
|
|
2788
|
-
appliedFilter && /* @__PURE__ */
|
|
3156
|
+
loadingCatalog && /* @__PURE__ */ jsx5("div", { style: { color: "#64748b", fontSize: 12 }, children: "Cargando cat\xE1logo\u2026" }),
|
|
3157
|
+
!loadingCatalog && selectedFilterField && activeCatalogValues.length === 0 && /* @__PURE__ */ jsx5("div", { style: { color: "#64748b", fontSize: 12 }, children: "No hay cat\xE1logo disponible para este filtro." }),
|
|
3158
|
+
filterError && /* @__PURE__ */ jsx5("div", { style: { color: "#b91c1c", fontSize: 12 }, children: filterError }),
|
|
3159
|
+
appliedFilter && /* @__PURE__ */ jsxs5("div", { className: "zlm-badge", style: { alignSelf: "flex-start" }, children: [
|
|
2789
3160
|
"Activo: ",
|
|
2790
3161
|
appliedFilter.field,
|
|
2791
3162
|
" = ",
|
|
2792
3163
|
appliedFilter.value
|
|
2793
3164
|
] }),
|
|
2794
|
-
/* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
3165
|
+
/* @__PURE__ */ jsxs5("div", { className: "zlm-filter-actions", style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: [
|
|
3166
|
+
/* @__PURE__ */ jsx5(
|
|
2796
3167
|
"button",
|
|
2797
3168
|
{
|
|
2798
3169
|
type: "button",
|
|
@@ -2802,7 +3173,7 @@ var ZenitLayerManager = ({
|
|
|
2802
3173
|
children: applyingFilter ? "Aplicando\u2026" : "Aplicar"
|
|
2803
3174
|
}
|
|
2804
3175
|
),
|
|
2805
|
-
/* @__PURE__ */
|
|
3176
|
+
/* @__PURE__ */ jsx5(
|
|
2806
3177
|
"button",
|
|
2807
3178
|
{
|
|
2808
3179
|
type: "button",
|
|
@@ -2814,13 +3185,13 @@ var ZenitLayerManager = ({
|
|
|
2814
3185
|
)
|
|
2815
3186
|
] })
|
|
2816
3187
|
] }) }),
|
|
2817
|
-
showUploadTab && activeTab === "upload" && /* @__PURE__ */
|
|
3188
|
+
showUploadTab && activeTab === "upload" && /* @__PURE__ */ jsx5("div", { style: { color: "#475569", fontSize: 13 }, children: "Pr\xF3ximamente podr\xE1s subir capas desde este panel." })
|
|
2818
3189
|
] })
|
|
2819
3190
|
] });
|
|
2820
3191
|
};
|
|
2821
3192
|
|
|
2822
3193
|
// src/react/ZenitFeatureFilterPanel.tsx
|
|
2823
|
-
import { jsx as
|
|
3194
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2824
3195
|
var ZenitFeatureFilterPanel = ({
|
|
2825
3196
|
title = "Filtros",
|
|
2826
3197
|
description,
|
|
@@ -2828,7 +3199,7 @@ var ZenitFeatureFilterPanel = ({
|
|
|
2828
3199
|
style,
|
|
2829
3200
|
children
|
|
2830
3201
|
}) => {
|
|
2831
|
-
return /* @__PURE__ */
|
|
3202
|
+
return /* @__PURE__ */ jsxs6(
|
|
2832
3203
|
"section",
|
|
2833
3204
|
{
|
|
2834
3205
|
className,
|
|
@@ -2841,11 +3212,11 @@ var ZenitFeatureFilterPanel = ({
|
|
|
2841
3212
|
...style
|
|
2842
3213
|
},
|
|
2843
3214
|
children: [
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
description && /* @__PURE__ */
|
|
3215
|
+
/* @__PURE__ */ jsxs6("header", { style: { marginBottom: 12 }, children: [
|
|
3216
|
+
/* @__PURE__ */ jsx6("h3", { style: { margin: 0, fontSize: 16 }, children: title }),
|
|
3217
|
+
description && /* @__PURE__ */ jsx6("p", { style: { margin: "6px 0 0", color: "#475569", fontSize: 13 }, children: description })
|
|
2847
3218
|
] }),
|
|
2848
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx6("div", { children })
|
|
2849
3220
|
]
|
|
2850
3221
|
}
|
|
2851
3222
|
);
|
|
@@ -2853,7 +3224,7 @@ var ZenitFeatureFilterPanel = ({
|
|
|
2853
3224
|
|
|
2854
3225
|
// src/react/ai/FloatingChatBox.tsx
|
|
2855
3226
|
import { useCallback as useCallback4, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef8, useState as useState5 } from "react";
|
|
2856
|
-
import { createPortal as
|
|
3227
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
2857
3228
|
|
|
2858
3229
|
// src/react/hooks/use-chat.ts
|
|
2859
3230
|
import { useCallback as useCallback3, useRef as useRef7, useState as useState4 } from "react";
|
|
@@ -3077,7 +3448,7 @@ var useSendMessageStream = (config) => {
|
|
|
3077
3448
|
// src/react/components/MarkdownRenderer.tsx
|
|
3078
3449
|
import ReactMarkdown from "react-markdown";
|
|
3079
3450
|
import remarkGfm from "remark-gfm";
|
|
3080
|
-
import { jsx as
|
|
3451
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
3081
3452
|
function normalizeAssistantMarkdown(text) {
|
|
3082
3453
|
if (!text || typeof text !== "string") return "";
|
|
3083
3454
|
let normalized = text;
|
|
@@ -3093,28 +3464,28 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3093
3464
|
if (!normalizedContent) {
|
|
3094
3465
|
return null;
|
|
3095
3466
|
}
|
|
3096
|
-
return /* @__PURE__ */
|
|
3467
|
+
return /* @__PURE__ */ jsx7("div", { className, style: { wordBreak: "break-word" }, children: /* @__PURE__ */ jsx7(
|
|
3097
3468
|
ReactMarkdown,
|
|
3098
3469
|
{
|
|
3099
3470
|
remarkPlugins: [remarkGfm],
|
|
3100
3471
|
components: {
|
|
3101
3472
|
// Headings with proper spacing
|
|
3102
|
-
h1: ({ children, ...props }) => /* @__PURE__ */
|
|
3103
|
-
h2: ({ children, ...props }) => /* @__PURE__ */
|
|
3104
|
-
h3: ({ children, ...props }) => /* @__PURE__ */
|
|
3105
|
-
h4: ({ children, ...props }) => /* @__PURE__ */
|
|
3106
|
-
h5: ({ children, ...props }) => /* @__PURE__ */
|
|
3107
|
-
h6: ({ children, ...props }) => /* @__PURE__ */
|
|
3473
|
+
h1: ({ children, ...props }) => /* @__PURE__ */ jsx7("h1", { style: { fontSize: "1.5em", fontWeight: 700, marginTop: "1em", marginBottom: "0.5em" }, ...props, children }),
|
|
3474
|
+
h2: ({ children, ...props }) => /* @__PURE__ */ jsx7("h2", { style: { fontSize: "1.3em", fontWeight: 700, marginTop: "0.9em", marginBottom: "0.45em" }, ...props, children }),
|
|
3475
|
+
h3: ({ children, ...props }) => /* @__PURE__ */ jsx7("h3", { style: { fontSize: "1.15em", fontWeight: 600, marginTop: "0.75em", marginBottom: "0.4em" }, ...props, children }),
|
|
3476
|
+
h4: ({ children, ...props }) => /* @__PURE__ */ jsx7("h4", { style: { fontSize: "1.05em", fontWeight: 600, marginTop: "0.6em", marginBottom: "0.35em" }, ...props, children }),
|
|
3477
|
+
h5: ({ children, ...props }) => /* @__PURE__ */ jsx7("h5", { style: { fontSize: "1em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
|
|
3478
|
+
h6: ({ children, ...props }) => /* @__PURE__ */ jsx7("h6", { style: { fontSize: "0.95em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
|
|
3108
3479
|
// Paragraphs with comfortable line height
|
|
3109
|
-
p: ({ children, ...props }) => /* @__PURE__ */
|
|
3480
|
+
p: ({ children, ...props }) => /* @__PURE__ */ jsx7("p", { style: { marginTop: "0.5em", marginBottom: "0.5em", lineHeight: 1.6 }, ...props, children }),
|
|
3110
3481
|
// Lists with proper indentation
|
|
3111
|
-
ul: ({ children, ...props }) => /* @__PURE__ */
|
|
3112
|
-
ol: ({ children, ...props }) => /* @__PURE__ */
|
|
3113
|
-
li: ({ children, ...props }) => /* @__PURE__ */
|
|
3482
|
+
ul: ({ children, ...props }) => /* @__PURE__ */ jsx7("ul", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
|
|
3483
|
+
ol: ({ children, ...props }) => /* @__PURE__ */ jsx7("ol", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
|
|
3484
|
+
li: ({ children, ...props }) => /* @__PURE__ */ jsx7("li", { style: { marginTop: "0.25em", marginBottom: "0.25em" }, ...props, children }),
|
|
3114
3485
|
// Code blocks
|
|
3115
3486
|
code: ({ inline, children, ...props }) => {
|
|
3116
3487
|
if (inline) {
|
|
3117
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsx7(
|
|
3118
3489
|
"code",
|
|
3119
3490
|
{
|
|
3120
3491
|
style: {
|
|
@@ -3129,7 +3500,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3129
3500
|
}
|
|
3130
3501
|
);
|
|
3131
3502
|
}
|
|
3132
|
-
return /* @__PURE__ */
|
|
3503
|
+
return /* @__PURE__ */ jsx7(
|
|
3133
3504
|
"code",
|
|
3134
3505
|
{
|
|
3135
3506
|
style: {
|
|
@@ -3149,9 +3520,9 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3149
3520
|
);
|
|
3150
3521
|
},
|
|
3151
3522
|
// Pre (code block wrapper)
|
|
3152
|
-
pre: ({ children, ...props }) => /* @__PURE__ */
|
|
3523
|
+
pre: ({ children, ...props }) => /* @__PURE__ */ jsx7("pre", { style: { margin: 0 }, ...props, children }),
|
|
3153
3524
|
// Blockquotes
|
|
3154
|
-
blockquote: ({ children, ...props }) => /* @__PURE__ */
|
|
3525
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx7(
|
|
3155
3526
|
"blockquote",
|
|
3156
3527
|
{
|
|
3157
3528
|
style: {
|
|
@@ -3167,11 +3538,11 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3167
3538
|
}
|
|
3168
3539
|
),
|
|
3169
3540
|
// Strong/bold
|
|
3170
|
-
strong: ({ children, ...props }) => /* @__PURE__ */
|
|
3541
|
+
strong: ({ children, ...props }) => /* @__PURE__ */ jsx7("strong", { style: { fontWeight: 600 }, ...props, children }),
|
|
3171
3542
|
// Emphasis/italic
|
|
3172
|
-
em: ({ children, ...props }) => /* @__PURE__ */
|
|
3543
|
+
em: ({ children, ...props }) => /* @__PURE__ */ jsx7("em", { style: { fontStyle: "italic" }, ...props, children }),
|
|
3173
3544
|
// Horizontal rule
|
|
3174
|
-
hr: (props) => /* @__PURE__ */
|
|
3545
|
+
hr: (props) => /* @__PURE__ */ jsx7(
|
|
3175
3546
|
"hr",
|
|
3176
3547
|
{
|
|
3177
3548
|
style: {
|
|
@@ -3184,7 +3555,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3184
3555
|
}
|
|
3185
3556
|
),
|
|
3186
3557
|
// Tables (GFM)
|
|
3187
|
-
table: ({ children, ...props }) => /* @__PURE__ */
|
|
3558
|
+
table: ({ children, ...props }) => /* @__PURE__ */ jsx7("div", { style: { overflowX: "auto", marginTop: "0.5em", marginBottom: "0.5em" }, children: /* @__PURE__ */ jsx7(
|
|
3188
3559
|
"table",
|
|
3189
3560
|
{
|
|
3190
3561
|
style: {
|
|
@@ -3196,7 +3567,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3196
3567
|
children
|
|
3197
3568
|
}
|
|
3198
3569
|
) }),
|
|
3199
|
-
th: ({ children, ...props }) => /* @__PURE__ */
|
|
3570
|
+
th: ({ children, ...props }) => /* @__PURE__ */ jsx7(
|
|
3200
3571
|
"th",
|
|
3201
3572
|
{
|
|
3202
3573
|
style: {
|
|
@@ -3210,7 +3581,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3210
3581
|
children
|
|
3211
3582
|
}
|
|
3212
3583
|
),
|
|
3213
|
-
td: ({ children, ...props }) => /* @__PURE__ */
|
|
3584
|
+
td: ({ children, ...props }) => /* @__PURE__ */ jsx7(
|
|
3214
3585
|
"td",
|
|
3215
3586
|
{
|
|
3216
3587
|
style: {
|
|
@@ -3228,32 +3599,32 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3228
3599
|
};
|
|
3229
3600
|
|
|
3230
3601
|
// src/react/ai/FloatingChatBox.tsx
|
|
3231
|
-
import { Fragment as Fragment4, jsx as
|
|
3232
|
-
var ChatIcon = () => /* @__PURE__ */
|
|
3233
|
-
var CloseIcon = () => /* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3235
|
-
/* @__PURE__ */
|
|
3602
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3603
|
+
var ChatIcon = () => /* @__PURE__ */ jsx8("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx8("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
3604
|
+
var CloseIcon = () => /* @__PURE__ */ jsxs7("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
3605
|
+
/* @__PURE__ */ jsx8("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
3606
|
+
/* @__PURE__ */ jsx8("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
3236
3607
|
] });
|
|
3237
|
-
var ExpandIcon = () => /* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3239
|
-
/* @__PURE__ */
|
|
3240
|
-
/* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3608
|
+
var ExpandIcon = () => /* @__PURE__ */ jsxs7("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
3609
|
+
/* @__PURE__ */ jsx8("polyline", { points: "15 3 21 3 21 9" }),
|
|
3610
|
+
/* @__PURE__ */ jsx8("polyline", { points: "9 21 3 21 3 15" }),
|
|
3611
|
+
/* @__PURE__ */ jsx8("line", { x1: "21", y1: "3", x2: "14", y2: "10" }),
|
|
3612
|
+
/* @__PURE__ */ jsx8("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
3242
3613
|
] });
|
|
3243
|
-
var CollapseIcon = () => /* @__PURE__ */
|
|
3244
|
-
/* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
3246
|
-
/* @__PURE__ */
|
|
3247
|
-
/* @__PURE__ */
|
|
3614
|
+
var CollapseIcon = () => /* @__PURE__ */ jsxs7("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
3615
|
+
/* @__PURE__ */ jsx8("polyline", { points: "4 14 10 14 10 20" }),
|
|
3616
|
+
/* @__PURE__ */ jsx8("polyline", { points: "20 10 14 10 14 4" }),
|
|
3617
|
+
/* @__PURE__ */ jsx8("line", { x1: "14", y1: "10", x2: "21", y2: "3" }),
|
|
3618
|
+
/* @__PURE__ */ jsx8("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
3248
3619
|
] });
|
|
3249
|
-
var SendIcon = () => /* @__PURE__ */
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
/* @__PURE__ */
|
|
3620
|
+
var SendIcon = () => /* @__PURE__ */ jsxs7("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
3621
|
+
/* @__PURE__ */ jsx8("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
3622
|
+
/* @__PURE__ */ jsx8("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
3252
3623
|
] });
|
|
3253
|
-
var LayersIcon = () => /* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3255
|
-
/* @__PURE__ */
|
|
3256
|
-
/* @__PURE__ */
|
|
3624
|
+
var LayersIcon = () => /* @__PURE__ */ jsxs7("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
3625
|
+
/* @__PURE__ */ jsx8("polygon", { points: "12 2 2 7 12 12 22 7 12 2" }),
|
|
3626
|
+
/* @__PURE__ */ jsx8("polyline", { points: "2 17 12 22 22 17" }),
|
|
3627
|
+
/* @__PURE__ */ jsx8("polyline", { points: "2 12 12 17 22 12" })
|
|
3257
3628
|
] });
|
|
3258
3629
|
var styles = {
|
|
3259
3630
|
root: {
|
|
@@ -3720,13 +4091,13 @@ var FloatingChatBox = ({
|
|
|
3720
4091
|
if (!response?.metadata) return null;
|
|
3721
4092
|
const referencedLayers = response.metadata.referencedLayers;
|
|
3722
4093
|
if (!referencedLayers || referencedLayers.length === 0) return null;
|
|
3723
|
-
return /* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
/* @__PURE__ */
|
|
4094
|
+
return /* @__PURE__ */ jsxs7("div", { style: styles.metadataSection, children: [
|
|
4095
|
+
/* @__PURE__ */ jsxs7("div", { style: styles.metadataTitle, children: [
|
|
4096
|
+
/* @__PURE__ */ jsx8(LayersIcon, {}),
|
|
3726
4097
|
"Capas Analizadas"
|
|
3727
4098
|
] }),
|
|
3728
|
-
/* @__PURE__ */
|
|
3729
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsx8("ul", { style: styles.metadataList, children: referencedLayers.map((layer, index) => /* @__PURE__ */ jsxs7("li", { style: styles.metadataItem, children: [
|
|
4100
|
+
/* @__PURE__ */ jsx8("strong", { children: layer.layerName }),
|
|
3730
4101
|
" (",
|
|
3731
4102
|
layer.featureCount,
|
|
3732
4103
|
" ",
|
|
@@ -3744,9 +4115,9 @@ var FloatingChatBox = ({
|
|
|
3744
4115
|
}, [isStreaming, setOpen, onActionClick]);
|
|
3745
4116
|
const renderActions = (response) => {
|
|
3746
4117
|
if (!response?.suggestedActions?.length) return null;
|
|
3747
|
-
return /* @__PURE__ */
|
|
3748
|
-
/* @__PURE__ */
|
|
3749
|
-
/* @__PURE__ */
|
|
4118
|
+
return /* @__PURE__ */ jsxs7("div", { style: styles.actionsSection, children: [
|
|
4119
|
+
/* @__PURE__ */ jsx8("div", { style: styles.sectionLabel, children: "Acciones Sugeridas" }),
|
|
4120
|
+
/* @__PURE__ */ jsx8("div", { style: styles.actionsGrid, children: response.suggestedActions.map((action, index) => /* @__PURE__ */ jsx8(
|
|
3750
4121
|
"button",
|
|
3751
4122
|
{
|
|
3752
4123
|
type: "button",
|
|
@@ -3777,9 +4148,9 @@ var FloatingChatBox = ({
|
|
|
3777
4148
|
};
|
|
3778
4149
|
const renderFollowUps = (response) => {
|
|
3779
4150
|
if (!response?.followUpQuestions?.length) return null;
|
|
3780
|
-
return /* @__PURE__ */
|
|
3781
|
-
/* @__PURE__ */
|
|
3782
|
-
/* @__PURE__ */
|
|
4151
|
+
return /* @__PURE__ */ jsxs7("div", { style: styles.actionsSection, children: [
|
|
4152
|
+
/* @__PURE__ */ jsx8("div", { style: styles.sectionLabel, children: "Preguntas Relacionadas" }),
|
|
4153
|
+
/* @__PURE__ */ jsx8("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: response.followUpQuestions.map((question, index) => /* @__PURE__ */ jsx8(
|
|
3783
4154
|
"button",
|
|
3784
4155
|
{
|
|
3785
4156
|
type: "button",
|
|
@@ -3808,8 +4179,8 @@ var FloatingChatBox = ({
|
|
|
3808
4179
|
)) })
|
|
3809
4180
|
] });
|
|
3810
4181
|
};
|
|
3811
|
-
const chatContent = /* @__PURE__ */
|
|
3812
|
-
/* @__PURE__ */
|
|
4182
|
+
const chatContent = /* @__PURE__ */ jsxs7("div", { style: styles.root, children: [
|
|
4183
|
+
/* @__PURE__ */ jsx8("style", { children: `
|
|
3813
4184
|
@keyframes zenitBlink {
|
|
3814
4185
|
0%, 49% { opacity: 1; }
|
|
3815
4186
|
50%, 100% { opacity: 0; }
|
|
@@ -3865,7 +4236,7 @@ var FloatingChatBox = ({
|
|
|
3865
4236
|
}
|
|
3866
4237
|
}
|
|
3867
4238
|
` }),
|
|
3868
|
-
open && /* @__PURE__ */
|
|
4239
|
+
open && /* @__PURE__ */ jsxs7(
|
|
3869
4240
|
"div",
|
|
3870
4241
|
{
|
|
3871
4242
|
ref: chatBoxRef,
|
|
@@ -3879,10 +4250,10 @@ var FloatingChatBox = ({
|
|
|
3879
4250
|
};
|
|
3880
4251
|
})(),
|
|
3881
4252
|
children: [
|
|
3882
|
-
/* @__PURE__ */
|
|
3883
|
-
/* @__PURE__ */
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
!isMobile && /* @__PURE__ */
|
|
4253
|
+
/* @__PURE__ */ jsxs7("header", { style: styles.header, children: [
|
|
4254
|
+
/* @__PURE__ */ jsx8("h3", { style: styles.title, children: "Asistente Zenit AI" }),
|
|
4255
|
+
/* @__PURE__ */ jsxs7("div", { style: styles.headerButtons, children: [
|
|
4256
|
+
!isMobile && /* @__PURE__ */ jsx8(
|
|
3886
4257
|
"button",
|
|
3887
4258
|
{
|
|
3888
4259
|
type: "button",
|
|
@@ -3895,10 +4266,10 @@ var FloatingChatBox = ({
|
|
|
3895
4266
|
e.currentTarget.style.background = "rgba(255, 255, 255, 0.15)";
|
|
3896
4267
|
},
|
|
3897
4268
|
"aria-label": expanded ? "Contraer" : "Expandir",
|
|
3898
|
-
children: expanded ? /* @__PURE__ */
|
|
4269
|
+
children: expanded ? /* @__PURE__ */ jsx8(CollapseIcon, {}) : /* @__PURE__ */ jsx8(ExpandIcon, {})
|
|
3899
4270
|
}
|
|
3900
4271
|
),
|
|
3901
|
-
/* @__PURE__ */
|
|
4272
|
+
/* @__PURE__ */ jsx8(
|
|
3902
4273
|
"button",
|
|
3903
4274
|
{
|
|
3904
4275
|
type: "button",
|
|
@@ -3911,20 +4282,20 @@ var FloatingChatBox = ({
|
|
|
3911
4282
|
e.currentTarget.style.background = "rgba(255, 255, 255, 0.15)";
|
|
3912
4283
|
},
|
|
3913
4284
|
"aria-label": "Cerrar",
|
|
3914
|
-
children: /* @__PURE__ */
|
|
4285
|
+
children: /* @__PURE__ */ jsx8(CloseIcon, {})
|
|
3915
4286
|
}
|
|
3916
4287
|
)
|
|
3917
4288
|
] })
|
|
3918
4289
|
] }),
|
|
3919
|
-
/* @__PURE__ */
|
|
3920
|
-
messages.map((message) => /* @__PURE__ */
|
|
4290
|
+
/* @__PURE__ */ jsxs7("div", { ref: messagesContainerRef, className: "zenit-ai-body", style: styles.messages, children: [
|
|
4291
|
+
messages.map((message) => /* @__PURE__ */ jsx8(
|
|
3921
4292
|
"div",
|
|
3922
4293
|
{
|
|
3923
4294
|
style: {
|
|
3924
4295
|
...styles.messageWrapper,
|
|
3925
4296
|
alignItems: message.role === "user" ? "flex-end" : "flex-start"
|
|
3926
4297
|
},
|
|
3927
|
-
children: /* @__PURE__ */
|
|
4298
|
+
children: /* @__PURE__ */ jsxs7(
|
|
3928
4299
|
"div",
|
|
3929
4300
|
{
|
|
3930
4301
|
style: {
|
|
@@ -3932,7 +4303,7 @@ var FloatingChatBox = ({
|
|
|
3932
4303
|
...message.role === "user" ? styles.userMessage : styles.assistantMessage
|
|
3933
4304
|
},
|
|
3934
4305
|
children: [
|
|
3935
|
-
message.role === "assistant" ? /* @__PURE__ */
|
|
4306
|
+
message.role === "assistant" ? /* @__PURE__ */ jsx8(MarkdownRenderer, { content: message.content }) : message.content,
|
|
3936
4307
|
message.role === "assistant" && renderMetadata(message.response),
|
|
3937
4308
|
message.role === "assistant" && renderActions(message.response),
|
|
3938
4309
|
message.role === "assistant" && renderFollowUps(message.response)
|
|
@@ -3942,39 +4313,39 @@ var FloatingChatBox = ({
|
|
|
3942
4313
|
},
|
|
3943
4314
|
message.id
|
|
3944
4315
|
)),
|
|
3945
|
-
isStreaming && /* @__PURE__ */
|
|
4316
|
+
isStreaming && /* @__PURE__ */ jsx8(
|
|
3946
4317
|
"div",
|
|
3947
4318
|
{
|
|
3948
4319
|
style: {
|
|
3949
4320
|
...styles.messageWrapper,
|
|
3950
4321
|
alignItems: "flex-start"
|
|
3951
4322
|
},
|
|
3952
|
-
children: /* @__PURE__ */
|
|
4323
|
+
children: /* @__PURE__ */ jsx8(
|
|
3953
4324
|
"div",
|
|
3954
4325
|
{
|
|
3955
4326
|
style: {
|
|
3956
4327
|
...styles.messageBubble,
|
|
3957
4328
|
...styles.assistantMessage
|
|
3958
4329
|
},
|
|
3959
|
-
children: streamingText ? /* @__PURE__ */
|
|
3960
|
-
/* @__PURE__ */
|
|
3961
|
-
/* @__PURE__ */
|
|
3962
|
-
] }) : /* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
3964
|
-
/* @__PURE__ */
|
|
3965
|
-
/* @__PURE__ */
|
|
3966
|
-
/* @__PURE__ */
|
|
3967
|
-
/* @__PURE__ */
|
|
4330
|
+
children: streamingText ? /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
4331
|
+
/* @__PURE__ */ jsx8(MarkdownRenderer, { content: streamingText }),
|
|
4332
|
+
/* @__PURE__ */ jsx8("span", { style: styles.cursor })
|
|
4333
|
+
] }) : /* @__PURE__ */ jsxs7("div", { style: styles.thinkingText, children: [
|
|
4334
|
+
/* @__PURE__ */ jsx8("span", { children: "Pensando" }),
|
|
4335
|
+
/* @__PURE__ */ jsxs7("div", { style: styles.typingIndicator, children: [
|
|
4336
|
+
/* @__PURE__ */ jsx8("div", { className: "zenit-typing-dot", style: styles.typingDot }),
|
|
4337
|
+
/* @__PURE__ */ jsx8("div", { className: "zenit-typing-dot", style: styles.typingDot }),
|
|
4338
|
+
/* @__PURE__ */ jsx8("div", { className: "zenit-typing-dot", style: styles.typingDot })
|
|
3968
4339
|
] })
|
|
3969
4340
|
] })
|
|
3970
4341
|
}
|
|
3971
4342
|
)
|
|
3972
4343
|
}
|
|
3973
4344
|
),
|
|
3974
|
-
/* @__PURE__ */
|
|
4345
|
+
/* @__PURE__ */ jsx8("div", { ref: messagesEndRef })
|
|
3975
4346
|
] }),
|
|
3976
|
-
/* @__PURE__ */
|
|
3977
|
-
/* @__PURE__ */
|
|
4347
|
+
/* @__PURE__ */ jsxs7("div", { className: "zenit-ai-input-area", style: styles.inputWrapper, children: [
|
|
4348
|
+
/* @__PURE__ */ jsx8(
|
|
3978
4349
|
"textarea",
|
|
3979
4350
|
{
|
|
3980
4351
|
style: {
|
|
@@ -3991,7 +4362,7 @@ var FloatingChatBox = ({
|
|
|
3991
4362
|
disabled: !mapId || !baseUrl || isStreaming
|
|
3992
4363
|
}
|
|
3993
4364
|
),
|
|
3994
|
-
/* @__PURE__ */
|
|
4365
|
+
/* @__PURE__ */ jsx8(
|
|
3995
4366
|
"button",
|
|
3996
4367
|
{
|
|
3997
4368
|
type: "button",
|
|
@@ -4000,18 +4371,18 @@ var FloatingChatBox = ({
|
|
|
4000
4371
|
onClick: () => void handleSend(),
|
|
4001
4372
|
disabled: !canSend,
|
|
4002
4373
|
"aria-label": "Enviar mensaje",
|
|
4003
|
-
children: /* @__PURE__ */
|
|
4374
|
+
children: /* @__PURE__ */ jsx8(SendIcon, {})
|
|
4004
4375
|
}
|
|
4005
4376
|
)
|
|
4006
4377
|
] }),
|
|
4007
|
-
errorMessage && /* @__PURE__ */
|
|
4008
|
-
isStreaming && !errorMessage && /* @__PURE__ */
|
|
4009
|
-
!mapId && !errorMessage && /* @__PURE__ */
|
|
4010
|
-
!baseUrl && !errorMessage && /* @__PURE__ */
|
|
4378
|
+
errorMessage && /* @__PURE__ */ jsx8("div", { style: styles.errorText, children: errorMessage }),
|
|
4379
|
+
isStreaming && !errorMessage && /* @__PURE__ */ jsx8("div", { style: styles.statusNote, children: "Generando sugerencias..." }),
|
|
4380
|
+
!mapId && !errorMessage && /* @__PURE__ */ jsx8("div", { style: styles.statusNote, children: "Selecciona un mapa para usar el asistente" }),
|
|
4381
|
+
!baseUrl && !errorMessage && /* @__PURE__ */ jsx8("div", { style: styles.statusNote, children: "Configura la baseUrl del SDK" })
|
|
4011
4382
|
]
|
|
4012
4383
|
}
|
|
4013
4384
|
),
|
|
4014
|
-
!(hideButton && !open) && /* @__PURE__ */
|
|
4385
|
+
!(hideButton && !open) && /* @__PURE__ */ jsx8(
|
|
4015
4386
|
"button",
|
|
4016
4387
|
{
|
|
4017
4388
|
type: "button",
|
|
@@ -4023,15 +4394,15 @@ var FloatingChatBox = ({
|
|
|
4023
4394
|
},
|
|
4024
4395
|
onClick: () => setOpen((prev) => !prev),
|
|
4025
4396
|
"aria-label": open ? "Cerrar asistente" : "Abrir asistente Zenit AI",
|
|
4026
|
-
children: open ? /* @__PURE__ */
|
|
4027
|
-
/* @__PURE__ */
|
|
4028
|
-
!isMobile && /* @__PURE__ */
|
|
4397
|
+
children: open ? /* @__PURE__ */ jsx8(CloseIcon, {}) : /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
4398
|
+
/* @__PURE__ */ jsx8(ChatIcon, {}),
|
|
4399
|
+
!isMobile && /* @__PURE__ */ jsx8("span", { children: "Asistente IA" })
|
|
4029
4400
|
] })
|
|
4030
4401
|
}
|
|
4031
4402
|
)
|
|
4032
4403
|
] });
|
|
4033
4404
|
if (typeof document !== "undefined") {
|
|
4034
|
-
return
|
|
4405
|
+
return createPortal3(chatContent, document.body);
|
|
4035
4406
|
}
|
|
4036
4407
|
return chatContent;
|
|
4037
4408
|
};
|
|
@@ -4062,16 +4433,18 @@ export {
|
|
|
4062
4433
|
ZenitMap,
|
|
4063
4434
|
Eye,
|
|
4064
4435
|
EyeOff,
|
|
4436
|
+
ChevronDown,
|
|
4065
4437
|
ChevronLeft,
|
|
4066
4438
|
ChevronRight,
|
|
4067
4439
|
Layers,
|
|
4068
4440
|
Upload,
|
|
4069
4441
|
X,
|
|
4070
4442
|
ZoomIn,
|
|
4443
|
+
ZenitSelect,
|
|
4071
4444
|
ZenitLayerManager,
|
|
4072
4445
|
ZenitFeatureFilterPanel,
|
|
4073
4446
|
useSendMessage,
|
|
4074
4447
|
useSendMessageStream,
|
|
4075
4448
|
FloatingChatBox
|
|
4076
4449
|
};
|
|
4077
|
-
//# sourceMappingURL=chunk-
|
|
4450
|
+
//# sourceMappingURL=chunk-R5WJ7K2D.mjs.map
|