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/{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
package/dist/react/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/react/index.ts
|
|
31
31
|
var react_exports = {};
|
|
32
32
|
__export(react_exports, {
|
|
33
|
+
ChevronDown: () => import_lucide_react.ChevronDown,
|
|
33
34
|
ChevronLeft: () => import_lucide_react.ChevronLeft,
|
|
34
35
|
ChevronRight: () => import_lucide_react.ChevronRight,
|
|
35
36
|
Eye: () => import_lucide_react.Eye,
|
|
@@ -41,6 +42,7 @@ __export(react_exports, {
|
|
|
41
42
|
ZenitFeatureFilterPanel: () => ZenitFeatureFilterPanel,
|
|
42
43
|
ZenitLayerManager: () => ZenitLayerManager,
|
|
43
44
|
ZenitMap: () => ZenitMap,
|
|
45
|
+
ZenitSelect: () => ZenitSelect,
|
|
44
46
|
ZoomIn: () => import_lucide_react.ZoomIn,
|
|
45
47
|
clampNumber: () => clampNumber,
|
|
46
48
|
clampOpacity: () => clampOpacity3,
|
|
@@ -2053,13 +2055,366 @@ var ZenitMap = (0, import_react5.forwardRef)(({
|
|
|
2053
2055
|
ZenitMap.displayName = "ZenitMap";
|
|
2054
2056
|
|
|
2055
2057
|
// src/react/ZenitLayerManager.tsx
|
|
2056
|
-
var
|
|
2058
|
+
var import_react7 = __toESM(require("react"));
|
|
2057
2059
|
|
|
2058
2060
|
// src/react/icons.tsx
|
|
2059
2061
|
var import_lucide_react = require("lucide-react");
|
|
2060
2062
|
|
|
2061
|
-
// src/react/
|
|
2063
|
+
// src/react/ui/ZenitSelect.tsx
|
|
2064
|
+
var import_react6 = __toESM(require("react"));
|
|
2065
|
+
var import_react_dom2 = require("react-dom");
|
|
2062
2066
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2067
|
+
var DEFAULT_SAFE_MENU_Z_INDEX = 4e3;
|
|
2068
|
+
function readCssMenuZIndex() {
|
|
2069
|
+
if (typeof document === "undefined") return null;
|
|
2070
|
+
const rootStyles = getComputedStyle(document.documentElement);
|
|
2071
|
+
const configuredValue = rootStyles.getPropertyValue("--zenit-select-z-index").trim() || rootStyles.getPropertyValue("--zenit-overlay-z-index").trim();
|
|
2072
|
+
if (!configuredValue) return null;
|
|
2073
|
+
const parsed = Number.parseInt(configuredValue, 10);
|
|
2074
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2075
|
+
}
|
|
2076
|
+
function shouldUseNativeSelect() {
|
|
2077
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
2078
|
+
const hasCoarsePointer = typeof window.matchMedia === "function" ? window.matchMedia("(pointer: coarse)").matches : false;
|
|
2079
|
+
return hasCoarsePointer || navigator.maxTouchPoints > 0;
|
|
2080
|
+
}
|
|
2081
|
+
var ZenitSelect = ({
|
|
2082
|
+
id,
|
|
2083
|
+
value,
|
|
2084
|
+
placeholder = "Seleccionar\u2026",
|
|
2085
|
+
options,
|
|
2086
|
+
onValueChange,
|
|
2087
|
+
disabled = false,
|
|
2088
|
+
className,
|
|
2089
|
+
menuZIndex,
|
|
2090
|
+
maxMenuHeight = 384,
|
|
2091
|
+
ariaLabel,
|
|
2092
|
+
useNativeOnMobile = true
|
|
2093
|
+
}) => {
|
|
2094
|
+
const rootRef = import_react6.default.useRef(null);
|
|
2095
|
+
const triggerRef = import_react6.default.useRef(null);
|
|
2096
|
+
const menuRef = import_react6.default.useRef(null);
|
|
2097
|
+
const lastTouchTsRef = import_react6.default.useRef(0);
|
|
2098
|
+
const [isOpen, setIsOpen] = import_react6.default.useState(false);
|
|
2099
|
+
const [menuPosition, setMenuPosition] = import_react6.default.useState({ top: 0, left: 0, width: 0 });
|
|
2100
|
+
const selectedOption = import_react6.default.useMemo(
|
|
2101
|
+
() => options.find((option) => option.value === value),
|
|
2102
|
+
[options, value]
|
|
2103
|
+
);
|
|
2104
|
+
const effectiveMenuZIndex = import_react6.default.useMemo(
|
|
2105
|
+
() => menuZIndex ?? readCssMenuZIndex() ?? DEFAULT_SAFE_MENU_Z_INDEX,
|
|
2106
|
+
[menuZIndex]
|
|
2107
|
+
);
|
|
2108
|
+
const useNative = import_react6.default.useMemo(
|
|
2109
|
+
() => useNativeOnMobile && shouldUseNativeSelect(),
|
|
2110
|
+
[useNativeOnMobile]
|
|
2111
|
+
);
|
|
2112
|
+
const updateMenuPosition = import_react6.default.useCallback(() => {
|
|
2113
|
+
const trigger = triggerRef.current;
|
|
2114
|
+
if (!trigger) return;
|
|
2115
|
+
const rect = trigger.getBoundingClientRect();
|
|
2116
|
+
const viewportPadding = 8;
|
|
2117
|
+
const minWidth = 200;
|
|
2118
|
+
const width = Math.max(rect.width, minWidth);
|
|
2119
|
+
const maxLeft = window.innerWidth - width - viewportPadding;
|
|
2120
|
+
const nextLeft = Math.max(viewportPadding, Math.min(rect.left, maxLeft));
|
|
2121
|
+
const nextTop = rect.bottom + 4;
|
|
2122
|
+
setMenuPosition({ top: nextTop, left: nextLeft, width });
|
|
2123
|
+
}, []);
|
|
2124
|
+
const getEffectiveMaxHeight = import_react6.default.useCallback(() => {
|
|
2125
|
+
const available = Math.max(160, window.innerHeight - menuPosition.top - 12);
|
|
2126
|
+
return Math.min(maxMenuHeight, available);
|
|
2127
|
+
}, [maxMenuHeight, menuPosition.top]);
|
|
2128
|
+
import_react6.default.useEffect(() => {
|
|
2129
|
+
if (!isOpen) return;
|
|
2130
|
+
updateMenuPosition();
|
|
2131
|
+
const isEventInsideSelect = (targetNode) => Boolean(rootRef.current?.contains(targetNode) || menuRef.current?.contains(targetNode));
|
|
2132
|
+
const handleOutsideTouchStart = (event) => {
|
|
2133
|
+
lastTouchTsRef.current = Date.now();
|
|
2134
|
+
const targetNode = event.target;
|
|
2135
|
+
if (isEventInsideSelect(targetNode)) return;
|
|
2136
|
+
setIsOpen(false);
|
|
2137
|
+
};
|
|
2138
|
+
const handleOutsideMouseDown = (event) => {
|
|
2139
|
+
if (Date.now() - lastTouchTsRef.current < 500) return;
|
|
2140
|
+
const targetNode = event.target;
|
|
2141
|
+
if (isEventInsideSelect(targetNode)) return;
|
|
2142
|
+
setIsOpen(false);
|
|
2143
|
+
};
|
|
2144
|
+
const handleEscape = (event) => {
|
|
2145
|
+
if (event.key === "Escape") {
|
|
2146
|
+
setIsOpen(false);
|
|
2147
|
+
triggerRef.current?.focus();
|
|
2148
|
+
}
|
|
2149
|
+
};
|
|
2150
|
+
const handleWindowChanges = () => updateMenuPosition();
|
|
2151
|
+
document.addEventListener("touchstart", handleOutsideTouchStart, { capture: true });
|
|
2152
|
+
document.addEventListener("mousedown", handleOutsideMouseDown, true);
|
|
2153
|
+
document.addEventListener("keydown", handleEscape);
|
|
2154
|
+
window.addEventListener("resize", handleWindowChanges);
|
|
2155
|
+
window.addEventListener("scroll", handleWindowChanges, true);
|
|
2156
|
+
return () => {
|
|
2157
|
+
document.removeEventListener("touchstart", handleOutsideTouchStart, true);
|
|
2158
|
+
document.removeEventListener("mousedown", handleOutsideMouseDown, true);
|
|
2159
|
+
document.removeEventListener("keydown", handleEscape);
|
|
2160
|
+
window.removeEventListener("resize", handleWindowChanges);
|
|
2161
|
+
window.removeEventListener("scroll", handleWindowChanges, true);
|
|
2162
|
+
};
|
|
2163
|
+
}, [isOpen, updateMenuPosition]);
|
|
2164
|
+
const handleTriggerDown = (event) => {
|
|
2165
|
+
if (event.type === "touchstart") {
|
|
2166
|
+
lastTouchTsRef.current = Date.now();
|
|
2167
|
+
}
|
|
2168
|
+
if (event.type === "mousedown" && Date.now() - lastTouchTsRef.current < 500) {
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
event.preventDefault();
|
|
2172
|
+
event.stopPropagation();
|
|
2173
|
+
if (disabled) return;
|
|
2174
|
+
if (!isOpen) updateMenuPosition();
|
|
2175
|
+
setIsOpen((prev) => !prev);
|
|
2176
|
+
};
|
|
2177
|
+
const handleTriggerClick = (event) => {
|
|
2178
|
+
if (event.detail !== 0) return;
|
|
2179
|
+
event.preventDefault();
|
|
2180
|
+
event.stopPropagation();
|
|
2181
|
+
if (disabled) return;
|
|
2182
|
+
if (!isOpen) updateMenuPosition();
|
|
2183
|
+
setIsOpen((prev) => !prev);
|
|
2184
|
+
};
|
|
2185
|
+
const selectValue = (nextValue, isDisabled) => {
|
|
2186
|
+
if (isDisabled) return;
|
|
2187
|
+
onValueChange?.(nextValue);
|
|
2188
|
+
setIsOpen(false);
|
|
2189
|
+
triggerRef.current?.focus();
|
|
2190
|
+
};
|
|
2191
|
+
if (useNative) {
|
|
2192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: rootRef, className: [className, "zenit-select-root"].filter(Boolean).join(" "), children: [
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
|
|
2194
|
+
.zenit-select-native {
|
|
2195
|
+
width: 100%;
|
|
2196
|
+
min-height: 40px;
|
|
2197
|
+
height: 40px;
|
|
2198
|
+
border: 1px solid #cbd5e1;
|
|
2199
|
+
border-radius: 6px;
|
|
2200
|
+
background: #ffffff;
|
|
2201
|
+
color: #0f172a;
|
|
2202
|
+
padding: 0 12px;
|
|
2203
|
+
font-size: 14px;
|
|
2204
|
+
line-height: 1.25;
|
|
2205
|
+
cursor: pointer;
|
|
2206
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
2207
|
+
appearance: none;
|
|
2208
|
+
-webkit-appearance: none;
|
|
2209
|
+
}
|
|
2210
|
+
.zenit-select-native:disabled {
|
|
2211
|
+
opacity: 0.6;
|
|
2212
|
+
cursor: not-allowed;
|
|
2213
|
+
}
|
|
2214
|
+
.zenit-select-native:focus-visible {
|
|
2215
|
+
outline: none;
|
|
2216
|
+
border-color: #60a5fa;
|
|
2217
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
@media (max-width: 640px) {
|
|
2221
|
+
.zenit-select-native {
|
|
2222
|
+
min-height: 38px;
|
|
2223
|
+
height: 38px;
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
` }),
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2228
|
+
"select",
|
|
2229
|
+
{
|
|
2230
|
+
id,
|
|
2231
|
+
className: "zenit-select-native",
|
|
2232
|
+
value: value ?? "",
|
|
2233
|
+
"aria-label": ariaLabel,
|
|
2234
|
+
disabled,
|
|
2235
|
+
onChange: (event) => {
|
|
2236
|
+
onValueChange?.(event.target.value);
|
|
2237
|
+
},
|
|
2238
|
+
children: [
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", disabled: true, hidden: true, children: placeholder }),
|
|
2240
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value))
|
|
2241
|
+
]
|
|
2242
|
+
}
|
|
2243
|
+
)
|
|
2244
|
+
] });
|
|
2245
|
+
}
|
|
2246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: rootRef, className: [className, "zenit-select-root"].filter(Boolean).join(" "), children: [
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
|
|
2248
|
+
.zenit-select-trigger {
|
|
2249
|
+
width: 100%;
|
|
2250
|
+
min-height: 40px;
|
|
2251
|
+
height: 40px;
|
|
2252
|
+
border: 1px solid #cbd5e1;
|
|
2253
|
+
border-radius: 6px;
|
|
2254
|
+
background: #ffffff;
|
|
2255
|
+
color: #0f172a;
|
|
2256
|
+
display: inline-flex;
|
|
2257
|
+
align-items: center;
|
|
2258
|
+
justify-content: space-between;
|
|
2259
|
+
gap: 8px;
|
|
2260
|
+
padding: 0 12px;
|
|
2261
|
+
font-size: 14px;
|
|
2262
|
+
line-height: 1.25;
|
|
2263
|
+
cursor: pointer;
|
|
2264
|
+
text-align: left;
|
|
2265
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
2266
|
+
touch-action: manipulation;
|
|
2267
|
+
-webkit-tap-highlight-color: transparent;
|
|
2268
|
+
}
|
|
2269
|
+
.zenit-select-trigger.is-disabled {
|
|
2270
|
+
opacity: 0.6;
|
|
2271
|
+
cursor: not-allowed;
|
|
2272
|
+
}
|
|
2273
|
+
.zenit-select-trigger:focus-visible {
|
|
2274
|
+
outline: none;
|
|
2275
|
+
border-color: #60a5fa;
|
|
2276
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
|
|
2277
|
+
}
|
|
2278
|
+
.zenit-select-label {
|
|
2279
|
+
white-space: nowrap;
|
|
2280
|
+
overflow: hidden;
|
|
2281
|
+
text-overflow: ellipsis;
|
|
2282
|
+
}
|
|
2283
|
+
.zenit-select-label.is-placeholder {
|
|
2284
|
+
color: #64748b;
|
|
2285
|
+
}
|
|
2286
|
+
.zenit-select-chevron {
|
|
2287
|
+
opacity: 0.5;
|
|
2288
|
+
flex-shrink: 0;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
/* Contenedor: aqu\xED debe GANAR el scroll en m\xF3vil */
|
|
2292
|
+
.zenit-select-content {
|
|
2293
|
+
position: fixed;
|
|
2294
|
+
border: 1px solid #cbd5e1;
|
|
2295
|
+
border-radius: 6px;
|
|
2296
|
+
background: #ffffff;
|
|
2297
|
+
box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
|
|
2298
|
+
overflow-y: auto;
|
|
2299
|
+
padding: 4px;
|
|
2300
|
+
pointer-events: auto;
|
|
2301
|
+
|
|
2302
|
+
/* Lo importante: permitir pan vertical dentro del men\xFA */
|
|
2303
|
+
touch-action: pan-y;
|
|
2304
|
+
overscroll-behavior: contain;
|
|
2305
|
+
-webkit-overflow-scrolling: touch;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
/* Items NO son button: evitamos que WebView \u201Csecuestr\xE9\u201D el gesto */
|
|
2309
|
+
.zenit-select-item {
|
|
2310
|
+
width: 100%;
|
|
2311
|
+
border-radius: 4px;
|
|
2312
|
+
text-align: left;
|
|
2313
|
+
color: #0f172a;
|
|
2314
|
+
font-size: 14px;
|
|
2315
|
+
min-height: 34px;
|
|
2316
|
+
padding: 8px 10px;
|
|
2317
|
+
cursor: pointer;
|
|
2318
|
+
-webkit-tap-highlight-color: transparent;
|
|
2319
|
+
user-select: none;
|
|
2320
|
+
}
|
|
2321
|
+
.zenit-select-item:hover {
|
|
2322
|
+
background: #f1f5f9;
|
|
2323
|
+
}
|
|
2324
|
+
.zenit-select-item.is-selected {
|
|
2325
|
+
background: #e2e8f0;
|
|
2326
|
+
font-weight: 600;
|
|
2327
|
+
}
|
|
2328
|
+
.zenit-select-item.is-disabled {
|
|
2329
|
+
color: #94a3b8;
|
|
2330
|
+
cursor: not-allowed;
|
|
2331
|
+
}
|
|
2332
|
+
.zenit-select-item:focus-visible {
|
|
2333
|
+
outline: none;
|
|
2334
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
@media (max-width: 640px) {
|
|
2338
|
+
.zenit-select-trigger {
|
|
2339
|
+
height: 38px;
|
|
2340
|
+
min-height: 38px;
|
|
2341
|
+
}
|
|
2342
|
+
.zenit-select-content {
|
|
2343
|
+
max-width: calc(100vw - 16px);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
` }),
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2348
|
+
"button",
|
|
2349
|
+
{
|
|
2350
|
+
id,
|
|
2351
|
+
ref: triggerRef,
|
|
2352
|
+
type: "button",
|
|
2353
|
+
className: `zenit-select-trigger${disabled ? " is-disabled" : ""}`,
|
|
2354
|
+
onTouchStart: handleTriggerDown,
|
|
2355
|
+
onMouseDown: handleTriggerDown,
|
|
2356
|
+
onClick: handleTriggerClick,
|
|
2357
|
+
"aria-haspopup": "listbox",
|
|
2358
|
+
"aria-expanded": isOpen,
|
|
2359
|
+
"aria-label": ariaLabel,
|
|
2360
|
+
disabled,
|
|
2361
|
+
children: [
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: `zenit-select-label${selectedOption ? "" : " is-placeholder"}`, children: selectedOption?.label ?? placeholder }),
|
|
2363
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.ChevronDown, { className: "zenit-select-chevron", size: 16, "aria-hidden": "true" })
|
|
2364
|
+
]
|
|
2365
|
+
}
|
|
2366
|
+
),
|
|
2367
|
+
isOpen && typeof document !== "undefined" && (0, import_react_dom2.createPortal)(
|
|
2368
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2369
|
+
"div",
|
|
2370
|
+
{
|
|
2371
|
+
ref: menuRef,
|
|
2372
|
+
className: "zenit-select-content",
|
|
2373
|
+
role: "listbox",
|
|
2374
|
+
style: {
|
|
2375
|
+
top: menuPosition.top,
|
|
2376
|
+
left: menuPosition.left,
|
|
2377
|
+
width: menuPosition.width,
|
|
2378
|
+
zIndex: effectiveMenuZIndex,
|
|
2379
|
+
maxHeight: getEffectiveMaxHeight()
|
|
2380
|
+
},
|
|
2381
|
+
children: options.map((option) => {
|
|
2382
|
+
const isSelected = option.value === value;
|
|
2383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2384
|
+
"div",
|
|
2385
|
+
{
|
|
2386
|
+
role: "option",
|
|
2387
|
+
"aria-selected": isSelected,
|
|
2388
|
+
tabIndex: option.disabled ? -1 : 0,
|
|
2389
|
+
className: `zenit-select-item${isSelected ? " is-selected" : ""}${option.disabled ? " is-disabled" : ""}`,
|
|
2390
|
+
onClick: (event) => {
|
|
2391
|
+
event.preventDefault();
|
|
2392
|
+
event.stopPropagation();
|
|
2393
|
+
if (option.disabled) return;
|
|
2394
|
+
selectValue(option.value, option.disabled);
|
|
2395
|
+
},
|
|
2396
|
+
onKeyDown: (event) => {
|
|
2397
|
+
if (option.disabled) return;
|
|
2398
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
2399
|
+
event.preventDefault();
|
|
2400
|
+
event.stopPropagation();
|
|
2401
|
+
selectValue(option.value, option.disabled);
|
|
2402
|
+
}
|
|
2403
|
+
},
|
|
2404
|
+
children: option.label
|
|
2405
|
+
},
|
|
2406
|
+
option.value
|
|
2407
|
+
);
|
|
2408
|
+
})
|
|
2409
|
+
}
|
|
2410
|
+
),
|
|
2411
|
+
document.body
|
|
2412
|
+
)
|
|
2413
|
+
] });
|
|
2414
|
+
};
|
|
2415
|
+
|
|
2416
|
+
// src/react/ZenitLayerManager.tsx
|
|
2417
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2063
2418
|
var FLOAT_TOLERANCE = 1e-3;
|
|
2064
2419
|
function areEffectiveStatesEqual(a, b) {
|
|
2065
2420
|
if (a.length !== b.length) return false;
|
|
@@ -2101,24 +2456,24 @@ var ZenitLayerManager = ({
|
|
|
2101
2456
|
onApplyLayerFilter,
|
|
2102
2457
|
onClearLayerFilter
|
|
2103
2458
|
}) => {
|
|
2104
|
-
const [map, setMap] = (0,
|
|
2105
|
-
const [loadingMap, setLoadingMap] = (0,
|
|
2106
|
-
const [mapError, setMapError] = (0,
|
|
2107
|
-
const [layers, setLayers] = (0,
|
|
2108
|
-
const [activeTab, setActiveTab] = (0,
|
|
2109
|
-
const [panelVisible, setPanelVisible] = (0,
|
|
2110
|
-
const [selectedFilterLayerId, setSelectedFilterLayerId] = (0,
|
|
2111
|
-
const [selectedFilterField, setSelectedFilterField] = (0,
|
|
2112
|
-
const [selectedFilterValue, setSelectedFilterValue] = (0,
|
|
2113
|
-
const [catalogByLayerField, setCatalogByLayerField] = (0,
|
|
2114
|
-
const [loadingCatalog, setLoadingCatalog] = (0,
|
|
2115
|
-
const [applyingFilter, setApplyingFilter] = (0,
|
|
2116
|
-
const [filterError, setFilterError] = (0,
|
|
2117
|
-
const [appliedFilter, setAppliedFilter] = (0,
|
|
2118
|
-
const catalogAbortRef = (0,
|
|
2119
|
-
const lastEmittedStatesRef = (0,
|
|
2459
|
+
const [map, setMap] = (0, import_react7.useState)(null);
|
|
2460
|
+
const [loadingMap, setLoadingMap] = (0, import_react7.useState)(false);
|
|
2461
|
+
const [mapError, setMapError] = (0, import_react7.useState)(null);
|
|
2462
|
+
const [layers, setLayers] = (0, import_react7.useState)([]);
|
|
2463
|
+
const [activeTab, setActiveTab] = (0, import_react7.useState)("layers");
|
|
2464
|
+
const [panelVisible, setPanelVisible] = (0, import_react7.useState)(true);
|
|
2465
|
+
const [selectedFilterLayerId, setSelectedFilterLayerId] = (0, import_react7.useState)("");
|
|
2466
|
+
const [selectedFilterField, setSelectedFilterField] = (0, import_react7.useState)("");
|
|
2467
|
+
const [selectedFilterValue, setSelectedFilterValue] = (0, import_react7.useState)("");
|
|
2468
|
+
const [catalogByLayerField, setCatalogByLayerField] = (0, import_react7.useState)({});
|
|
2469
|
+
const [loadingCatalog, setLoadingCatalog] = (0, import_react7.useState)(false);
|
|
2470
|
+
const [applyingFilter, setApplyingFilter] = (0, import_react7.useState)(false);
|
|
2471
|
+
const [filterError, setFilterError] = (0, import_react7.useState)(null);
|
|
2472
|
+
const [appliedFilter, setAppliedFilter] = (0, import_react7.useState)(null);
|
|
2473
|
+
const catalogAbortRef = (0, import_react7.useRef)(null);
|
|
2474
|
+
const lastEmittedStatesRef = (0, import_react7.useRef)(null);
|
|
2120
2475
|
const isControlled = Array.isArray(layerStates) && typeof onLayerStatesChange === "function";
|
|
2121
|
-
const baseStates = (0,
|
|
2476
|
+
const baseStates = (0, import_react7.useMemo)(
|
|
2122
2477
|
() => initLayerStates(
|
|
2123
2478
|
layers.map((entry) => ({
|
|
2124
2479
|
...entry.mapLayer,
|
|
@@ -2129,7 +2484,7 @@ var ZenitLayerManager = ({
|
|
|
2129
2484
|
),
|
|
2130
2485
|
[layers]
|
|
2131
2486
|
);
|
|
2132
|
-
const overrideStates = (0,
|
|
2487
|
+
const overrideStates = (0, import_react7.useMemo)(
|
|
2133
2488
|
() => layers.map(
|
|
2134
2489
|
(entry) => ({
|
|
2135
2490
|
layerId: entry.mapLayer.layerId,
|
|
@@ -2139,11 +2494,11 @@ var ZenitLayerManager = ({
|
|
|
2139
2494
|
),
|
|
2140
2495
|
[layers]
|
|
2141
2496
|
);
|
|
2142
|
-
const effectiveStates = (0,
|
|
2497
|
+
const effectiveStates = (0, import_react7.useMemo)(
|
|
2143
2498
|
() => layerStates ?? applyLayerOverrides(baseStates, overrideStates),
|
|
2144
2499
|
[baseStates, layerStates, overrideStates]
|
|
2145
2500
|
);
|
|
2146
|
-
const layerMetaIndex = (0,
|
|
2501
|
+
const layerMetaIndex = (0, import_react7.useMemo)(() => {
|
|
2147
2502
|
const index = /* @__PURE__ */ new Map();
|
|
2148
2503
|
mapLayers?.forEach((entry) => {
|
|
2149
2504
|
const key = String(entry.layerId);
|
|
@@ -2157,7 +2512,7 @@ var ZenitLayerManager = ({
|
|
|
2157
2512
|
});
|
|
2158
2513
|
return index;
|
|
2159
2514
|
}, [map, mapLayers]);
|
|
2160
|
-
const resolveUserOpacity =
|
|
2515
|
+
const resolveUserOpacity = import_react7.default.useCallback((state) => {
|
|
2161
2516
|
if (typeof state.overrideOpacity === "number") return state.overrideOpacity;
|
|
2162
2517
|
if (typeof state.overrideOpacity === "string") {
|
|
2163
2518
|
const parsed = Number.parseFloat(state.overrideOpacity);
|
|
@@ -2165,7 +2520,7 @@ var ZenitLayerManager = ({
|
|
|
2165
2520
|
}
|
|
2166
2521
|
return state.opacity ?? 1;
|
|
2167
2522
|
}, []);
|
|
2168
|
-
const resolveEffectiveOpacity =
|
|
2523
|
+
const resolveEffectiveOpacity = import_react7.default.useCallback(
|
|
2169
2524
|
(layerId, userOpacity) => {
|
|
2170
2525
|
if (!autoOpacityOnZoom || typeof mapZoom !== "number") {
|
|
2171
2526
|
return userOpacity;
|
|
@@ -2181,7 +2536,7 @@ var ZenitLayerManager = ({
|
|
|
2181
2536
|
},
|
|
2182
2537
|
[autoOpacityConfig, autoOpacityOnZoom, layerMetaIndex, mapZoom]
|
|
2183
2538
|
);
|
|
2184
|
-
const effectiveStatesWithZoom = (0,
|
|
2539
|
+
const effectiveStatesWithZoom = (0, import_react7.useMemo)(() => {
|
|
2185
2540
|
if (!autoOpacityOnZoom || typeof mapZoom !== "number") {
|
|
2186
2541
|
return effectiveStates;
|
|
2187
2542
|
}
|
|
@@ -2195,7 +2550,7 @@ var ZenitLayerManager = ({
|
|
|
2195
2550
|
};
|
|
2196
2551
|
});
|
|
2197
2552
|
}, [autoOpacityOnZoom, effectiveStates, mapZoom, resolveEffectiveOpacity, resolveUserOpacity]);
|
|
2198
|
-
(0,
|
|
2553
|
+
(0, import_react7.useEffect)(() => {
|
|
2199
2554
|
let cancelled = false;
|
|
2200
2555
|
setLoadingMap(true);
|
|
2201
2556
|
setMapError(null);
|
|
@@ -2227,12 +2582,12 @@ var ZenitLayerManager = ({
|
|
|
2227
2582
|
cancelled = true;
|
|
2228
2583
|
};
|
|
2229
2584
|
}, [client.maps, mapId]);
|
|
2230
|
-
(0,
|
|
2585
|
+
(0, import_react7.useEffect)(() => {
|
|
2231
2586
|
if (!showUploadTab && activeTab === "upload") {
|
|
2232
2587
|
setActiveTab("layers");
|
|
2233
2588
|
}
|
|
2234
2589
|
}, [activeTab, showUploadTab]);
|
|
2235
|
-
(0,
|
|
2590
|
+
(0, import_react7.useEffect)(() => {
|
|
2236
2591
|
if (isControlled) return;
|
|
2237
2592
|
if (!onLayerStatesChange) return;
|
|
2238
2593
|
const emitStates = autoOpacityOnZoom && typeof mapZoom === "number" ? effectiveStatesWithZoom : effectiveStates;
|
|
@@ -2250,7 +2605,7 @@ var ZenitLayerManager = ({
|
|
|
2250
2605
|
mapZoom,
|
|
2251
2606
|
onLayerStatesChange
|
|
2252
2607
|
]);
|
|
2253
|
-
const updateLayerVisible =
|
|
2608
|
+
const updateLayerVisible = import_react7.default.useCallback(
|
|
2254
2609
|
(layerId, visible) => {
|
|
2255
2610
|
if (!onLayerStatesChange) return;
|
|
2256
2611
|
const next = effectiveStates.map(
|
|
@@ -2260,7 +2615,7 @@ var ZenitLayerManager = ({
|
|
|
2260
2615
|
},
|
|
2261
2616
|
[effectiveStates, onLayerStatesChange]
|
|
2262
2617
|
);
|
|
2263
|
-
const updateLayerOpacity =
|
|
2618
|
+
const updateLayerOpacity = import_react7.default.useCallback(
|
|
2264
2619
|
(layerId, opacity) => {
|
|
2265
2620
|
if (!onLayerStatesChange) return;
|
|
2266
2621
|
const adjustedOpacity = resolveEffectiveOpacity(layerId, opacity);
|
|
@@ -2271,7 +2626,7 @@ var ZenitLayerManager = ({
|
|
|
2271
2626
|
},
|
|
2272
2627
|
[effectiveStates, onLayerStatesChange, resolveEffectiveOpacity]
|
|
2273
2628
|
);
|
|
2274
|
-
const resolveFeatureCount =
|
|
2629
|
+
const resolveFeatureCount = import_react7.default.useCallback(
|
|
2275
2630
|
(layerId, layer) => {
|
|
2276
2631
|
const resolvedFeatureCount = layerFeatureCounts?.[layerId] ?? layerFeatureCounts?.[String(layerId)];
|
|
2277
2632
|
if (typeof resolvedFeatureCount === "number") return resolvedFeatureCount;
|
|
@@ -2280,7 +2635,7 @@ var ZenitLayerManager = ({
|
|
|
2280
2635
|
},
|
|
2281
2636
|
[layerFeatureCounts]
|
|
2282
2637
|
);
|
|
2283
|
-
const decoratedLayers = (0,
|
|
2638
|
+
const decoratedLayers = (0, import_react7.useMemo)(() => {
|
|
2284
2639
|
return layers.map((entry) => ({
|
|
2285
2640
|
...entry,
|
|
2286
2641
|
effective: effectiveStates.find((state) => state.layerId === entry.mapLayer.layerId),
|
|
@@ -2309,23 +2664,23 @@ var ZenitLayerManager = ({
|
|
|
2309
2664
|
return String(a.mapLayer.layerId).localeCompare(String(b.mapLayer.layerId));
|
|
2310
2665
|
});
|
|
2311
2666
|
}, [effectiveStates, layers, resolveFeatureCount]);
|
|
2312
|
-
const filterableLayers = (0,
|
|
2667
|
+
const filterableLayers = (0, import_react7.useMemo)(() => {
|
|
2313
2668
|
return decoratedLayers.filter((entry) => {
|
|
2314
2669
|
const prefilters = entry.mapLayer.layerConfig?.prefilters;
|
|
2315
2670
|
return !!prefilters && Object.keys(prefilters).length > 0;
|
|
2316
2671
|
});
|
|
2317
2672
|
}, [decoratedLayers]);
|
|
2318
|
-
const selectedFilterLayer = (0,
|
|
2673
|
+
const selectedFilterLayer = (0, import_react7.useMemo)(
|
|
2319
2674
|
() => filterableLayers.find((layer) => String(layer.mapLayer.layerId) === selectedFilterLayerId) ?? null,
|
|
2320
2675
|
[filterableLayers, selectedFilterLayerId]
|
|
2321
2676
|
);
|
|
2322
|
-
const filterFields = (0,
|
|
2677
|
+
const filterFields = (0, import_react7.useMemo)(() => {
|
|
2323
2678
|
const prefilters = selectedFilterLayer?.mapLayer.layerConfig?.prefilters;
|
|
2324
2679
|
return prefilters ? Object.keys(prefilters) : [];
|
|
2325
2680
|
}, [selectedFilterLayer]);
|
|
2326
2681
|
const activeCatalogKey = selectedFilterLayer ? `${selectedFilterLayer.mapLayer.layerId}:${selectedFilterField}` : null;
|
|
2327
2682
|
const activeCatalogValues = activeCatalogKey ? catalogByLayerField[activeCatalogKey] ?? [] : [];
|
|
2328
|
-
const extractCatalogValues =
|
|
2683
|
+
const extractCatalogValues = import_react7.default.useCallback((catalogData, field) => {
|
|
2329
2684
|
const values = /* @__PURE__ */ new Set();
|
|
2330
2685
|
const pushValue = (value) => {
|
|
2331
2686
|
if (value === null || value === void 0) return;
|
|
@@ -2362,7 +2717,7 @@ var ZenitLayerManager = ({
|
|
|
2362
2717
|
}
|
|
2363
2718
|
return [...values].sort((a, b) => a.localeCompare(b, void 0, { sensitivity: "base" }));
|
|
2364
2719
|
}, []);
|
|
2365
|
-
(0,
|
|
2720
|
+
(0, import_react7.useEffect)(() => {
|
|
2366
2721
|
if (!filterableLayers.length) {
|
|
2367
2722
|
setSelectedFilterLayerId("");
|
|
2368
2723
|
return;
|
|
@@ -2371,7 +2726,7 @@ var ZenitLayerManager = ({
|
|
|
2371
2726
|
setSelectedFilterLayerId(String(filterableLayers[0].mapLayer.layerId));
|
|
2372
2727
|
}
|
|
2373
2728
|
}, [filterableLayers, selectedFilterLayerId]);
|
|
2374
|
-
(0,
|
|
2729
|
+
(0, import_react7.useEffect)(() => {
|
|
2375
2730
|
if (!filterFields.length) {
|
|
2376
2731
|
setSelectedFilterField("");
|
|
2377
2732
|
return;
|
|
@@ -2381,7 +2736,7 @@ var ZenitLayerManager = ({
|
|
|
2381
2736
|
setSelectedFilterValue("");
|
|
2382
2737
|
}
|
|
2383
2738
|
}, [filterFields, selectedFilterField]);
|
|
2384
|
-
(0,
|
|
2739
|
+
(0, import_react7.useEffect)(() => {
|
|
2385
2740
|
if (activeTab !== "filters") return;
|
|
2386
2741
|
if (!selectedFilterLayer || !selectedFilterField || !activeCatalogKey) return;
|
|
2387
2742
|
if (catalogByLayerField[activeCatalogKey]) return;
|
|
@@ -2405,7 +2760,7 @@ var ZenitLayerManager = ({
|
|
|
2405
2760
|
controller.abort();
|
|
2406
2761
|
};
|
|
2407
2762
|
}, [activeCatalogKey, activeTab, catalogByLayerField, client.layers, extractCatalogValues, selectedFilterField, selectedFilterLayer]);
|
|
2408
|
-
const handleApplyFilter =
|
|
2763
|
+
const handleApplyFilter = import_react7.default.useCallback(async () => {
|
|
2409
2764
|
if (!selectedFilterLayer || !selectedFilterField || !selectedFilterValue || !onApplyLayerFilter) return;
|
|
2410
2765
|
setApplyingFilter(true);
|
|
2411
2766
|
setFilterError(null);
|
|
@@ -2427,7 +2782,7 @@ var ZenitLayerManager = ({
|
|
|
2427
2782
|
setApplyingFilter(false);
|
|
2428
2783
|
}
|
|
2429
2784
|
}, [onApplyLayerFilter, selectedFilterField, selectedFilterLayer, selectedFilterValue]);
|
|
2430
|
-
const handleClearFilter =
|
|
2785
|
+
const handleClearFilter = import_react7.default.useCallback(async () => {
|
|
2431
2786
|
if (!selectedFilterLayer) return;
|
|
2432
2787
|
setApplyingFilter(true);
|
|
2433
2788
|
setFilterError(null);
|
|
@@ -2442,7 +2797,7 @@ var ZenitLayerManager = ({
|
|
|
2442
2797
|
setApplyingFilter(false);
|
|
2443
2798
|
}
|
|
2444
2799
|
}, [onClearLayerFilter, selectedFilterField, selectedFilterLayer]);
|
|
2445
|
-
const resolveLayerStyle =
|
|
2800
|
+
const resolveLayerStyle = import_react7.default.useCallback(
|
|
2446
2801
|
(layerId) => {
|
|
2447
2802
|
const layerKey = String(layerId);
|
|
2448
2803
|
const fromProp = mapLayers?.find((entry) => String(entry.layerId) === layerKey)?.style;
|
|
@@ -2472,10 +2827,10 @@ var ZenitLayerManager = ({
|
|
|
2472
2827
|
...height ? { height } : {}
|
|
2473
2828
|
};
|
|
2474
2829
|
if (loadingMap) {
|
|
2475
|
-
return /* @__PURE__ */ (0,
|
|
2830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className, style: panelStyle, children: "Cargando capas\u2026" });
|
|
2476
2831
|
}
|
|
2477
2832
|
if (mapError) {
|
|
2478
|
-
return /* @__PURE__ */ (0,
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className, style: { ...panelStyle, color: "#c53030" }, children: [
|
|
2479
2834
|
"Error al cargar mapa: ",
|
|
2480
2835
|
mapError
|
|
2481
2836
|
] });
|
|
@@ -2493,7 +2848,7 @@ var ZenitLayerManager = ({
|
|
|
2493
2848
|
boxShadow: "0 1px 0 rgba(148, 163, 184, 0.25)"
|
|
2494
2849
|
};
|
|
2495
2850
|
const renderLayerCards = () => {
|
|
2496
|
-
return /* @__PURE__ */ (0,
|
|
2851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: decoratedLayers.map((layerState) => {
|
|
2497
2852
|
const layerId = layerState.mapLayer.layerId;
|
|
2498
2853
|
const layerName = layerState.layerName ?? `Capa ${layerId}`;
|
|
2499
2854
|
const visible = layerState.effective?.visible ?? false;
|
|
@@ -2503,7 +2858,7 @@ var ZenitLayerManager = ({
|
|
|
2503
2858
|
const muted = !visible;
|
|
2504
2859
|
const opacityPercent = Math.round(userOpacity * 100);
|
|
2505
2860
|
const sliderBackground = `linear-gradient(to right, ${layerColor} 0%, ${layerColor} ${opacityPercent}%, #e5e7eb ${opacityPercent}%, #e5e7eb 100%)`;
|
|
2506
|
-
return /* @__PURE__ */ (0,
|
|
2861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2507
2862
|
"div",
|
|
2508
2863
|
{
|
|
2509
2864
|
className: `zlm-card${muted ? " is-muted" : ""}`,
|
|
@@ -2518,9 +2873,9 @@ var ZenitLayerManager = ({
|
|
|
2518
2873
|
width: "100%"
|
|
2519
2874
|
},
|
|
2520
2875
|
children: [
|
|
2521
|
-
/* @__PURE__ */ (0,
|
|
2522
|
-
/* @__PURE__ */ (0,
|
|
2523
|
-
/* @__PURE__ */ (0,
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", gap: 12 }, children: [
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", gap: 10, alignItems: "flex-start", minWidth: 0, flex: 1 }, children: [
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2524
2879
|
"div",
|
|
2525
2880
|
{
|
|
2526
2881
|
style: {
|
|
@@ -2535,7 +2890,7 @@ var ZenitLayerManager = ({
|
|
|
2535
2890
|
title: "Color de la capa"
|
|
2536
2891
|
}
|
|
2537
2892
|
),
|
|
2538
|
-
showLayerVisibilityIcon && /* @__PURE__ */ (0,
|
|
2893
|
+
showLayerVisibilityIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2539
2894
|
"button",
|
|
2540
2895
|
{
|
|
2541
2896
|
type: "button",
|
|
@@ -2546,11 +2901,11 @@ var ZenitLayerManager = ({
|
|
|
2546
2901
|
)
|
|
2547
2902
|
),
|
|
2548
2903
|
"aria-label": visible ? "Ocultar capa" : "Mostrar capa",
|
|
2549
|
-
children: visible ? /* @__PURE__ */ (0,
|
|
2904
|
+
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 })
|
|
2550
2905
|
}
|
|
2551
2906
|
),
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2907
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2554
2909
|
"div",
|
|
2555
2910
|
{
|
|
2556
2911
|
className: "zlm-layer-name",
|
|
@@ -2568,26 +2923,26 @@ var ZenitLayerManager = ({
|
|
|
2568
2923
|
children: layerName
|
|
2569
2924
|
}
|
|
2570
2925
|
),
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2926
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { color: muted ? "#94a3b8" : "#64748b", fontSize: 12 }, children: [
|
|
2572
2927
|
"ID ",
|
|
2573
2928
|
layerId
|
|
2574
2929
|
] })
|
|
2575
2930
|
] })
|
|
2576
2931
|
] }),
|
|
2577
|
-
/* @__PURE__ */ (0,
|
|
2932
|
+
/* @__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: [
|
|
2578
2933
|
featureCount.toLocaleString(),
|
|
2579
2934
|
" features"
|
|
2580
2935
|
] }) })
|
|
2581
2936
|
] }),
|
|
2582
|
-
/* @__PURE__ */ (0,
|
|
2583
|
-
/* @__PURE__ */ (0,
|
|
2584
|
-
/* @__PURE__ */ (0,
|
|
2585
|
-
/* @__PURE__ */ (0,
|
|
2937
|
+
/* @__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: [
|
|
2938
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: 6, color: "#64748b", fontSize: 12 }, children: [
|
|
2939
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Opacidad" }),
|
|
2940
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
2586
2941
|
opacityPercent,
|
|
2587
2942
|
"%"
|
|
2588
2943
|
] })
|
|
2589
2944
|
] }),
|
|
2590
|
-
/* @__PURE__ */ (0,
|
|
2945
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2591
2946
|
"input",
|
|
2592
2947
|
{
|
|
2593
2948
|
className: "zlm-range",
|
|
@@ -2625,8 +2980,8 @@ var ZenitLayerManager = ({
|
|
|
2625
2980
|
);
|
|
2626
2981
|
}) });
|
|
2627
2982
|
};
|
|
2628
|
-
return /* @__PURE__ */ (0,
|
|
2629
|
-
/* @__PURE__ */ (0,
|
|
2983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: ["zenit-layer-manager", className].filter(Boolean).join(" "), style: panelStyle, children: [
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("style", { children: `
|
|
2630
2985
|
.zenit-layer-manager .zlm-card {
|
|
2631
2986
|
transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
|
|
2632
2987
|
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
|
|
@@ -2721,16 +3076,16 @@ var ZenitLayerManager = ({
|
|
|
2721
3076
|
outline-offset: 2px;
|
|
2722
3077
|
}
|
|
2723
3078
|
` }),
|
|
2724
|
-
/* @__PURE__ */ (0,
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2726
|
-
/* @__PURE__ */ (0,
|
|
2727
|
-
/* @__PURE__ */ (0,
|
|
2728
|
-
/* @__PURE__ */ (0,
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: headerStyle, children: [
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
3082
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontWeight: 800, fontSize: 16, color: "#0f172a" }, children: "Gesti\xF3n de Capas" }),
|
|
3083
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { color: "#64748b", fontSize: 12 }, children: [
|
|
2729
3084
|
"Mapa #",
|
|
2730
3085
|
map.id
|
|
2731
3086
|
] })
|
|
2732
3087
|
] }),
|
|
2733
|
-
/* @__PURE__ */ (0,
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2734
3089
|
"button",
|
|
2735
3090
|
{
|
|
2736
3091
|
type: "button",
|
|
@@ -2738,13 +3093,13 @@ var ZenitLayerManager = ({
|
|
|
2738
3093
|
className: "zlm-panel-toggle",
|
|
2739
3094
|
"aria-label": panelVisible ? "Ocultar panel de capas" : "Mostrar panel de capas",
|
|
2740
3095
|
children: [
|
|
2741
|
-
panelVisible ? /* @__PURE__ */ (0,
|
|
3096
|
+
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 }),
|
|
2742
3097
|
panelVisible ? "Ocultar" : "Mostrar"
|
|
2743
3098
|
]
|
|
2744
3099
|
}
|
|
2745
3100
|
)
|
|
2746
3101
|
] }),
|
|
2747
|
-
/* @__PURE__ */ (0,
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2748
3103
|
"div",
|
|
2749
3104
|
{
|
|
2750
3105
|
style: {
|
|
@@ -2757,38 +3112,38 @@ var ZenitLayerManager = ({
|
|
|
2757
3112
|
background: "#f1f5f9"
|
|
2758
3113
|
},
|
|
2759
3114
|
children: [
|
|
2760
|
-
/* @__PURE__ */ (0,
|
|
3115
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2761
3116
|
"button",
|
|
2762
3117
|
{
|
|
2763
3118
|
type: "button",
|
|
2764
3119
|
className: `zlm-tab${activeTab === "layers" ? " is-active" : ""}`,
|
|
2765
3120
|
onClick: () => setActiveTab("layers"),
|
|
2766
3121
|
children: [
|
|
2767
|
-
/* @__PURE__ */ (0,
|
|
3122
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Layers, { size: 16 }),
|
|
2768
3123
|
"Capas"
|
|
2769
3124
|
]
|
|
2770
3125
|
}
|
|
2771
3126
|
),
|
|
2772
|
-
showUploadTab && /* @__PURE__ */ (0,
|
|
3127
|
+
showUploadTab && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2773
3128
|
"button",
|
|
2774
3129
|
{
|
|
2775
3130
|
type: "button",
|
|
2776
3131
|
className: `zlm-tab${activeTab === "upload" ? " is-active" : ""}`,
|
|
2777
3132
|
onClick: () => setActiveTab("upload"),
|
|
2778
3133
|
children: [
|
|
2779
|
-
/* @__PURE__ */ (0,
|
|
3134
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Upload, { size: 16 }),
|
|
2780
3135
|
"Subir"
|
|
2781
3136
|
]
|
|
2782
3137
|
}
|
|
2783
3138
|
),
|
|
2784
|
-
/* @__PURE__ */ (0,
|
|
3139
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2785
3140
|
"button",
|
|
2786
3141
|
{
|
|
2787
3142
|
type: "button",
|
|
2788
3143
|
className: `zlm-tab${activeTab === "filters" ? " is-active" : ""}`,
|
|
2789
3144
|
onClick: () => setActiveTab("filters"),
|
|
2790
3145
|
children: [
|
|
2791
|
-
/* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Layers, { size: 16 }),
|
|
2792
3147
|
"Filtros"
|
|
2793
3148
|
]
|
|
2794
3149
|
}
|
|
@@ -2797,49 +3152,67 @@ var ZenitLayerManager = ({
|
|
|
2797
3152
|
}
|
|
2798
3153
|
)
|
|
2799
3154
|
] }),
|
|
2800
|
-
panelVisible && /* @__PURE__ */ (0,
|
|
3155
|
+
panelVisible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { padding: "12px 10px 18px", overflowY: "auto", flex: 1, minHeight: 0 }, children: [
|
|
2801
3156
|
activeTab === "layers" && renderLayerCards(),
|
|
2802
|
-
activeTab === "filters" && /* @__PURE__ */ (0,
|
|
2803
|
-
filterableLayers.length > 1 && /* @__PURE__ */ (0,
|
|
3157
|
+
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: [
|
|
3158
|
+
filterableLayers.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
|
|
2804
3159
|
"Capa",
|
|
2805
|
-
/* @__PURE__ */ (0,
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3161
|
+
ZenitSelect,
|
|
3162
|
+
{
|
|
3163
|
+
ariaLabel: "Seleccionar capa para filtrar",
|
|
3164
|
+
value: selectedFilterLayerId,
|
|
3165
|
+
onValueChange: setSelectedFilterLayerId,
|
|
3166
|
+
options: filterableLayers.map((layer) => ({
|
|
3167
|
+
value: String(layer.mapLayer.layerId),
|
|
3168
|
+
label: layer.layerName ?? `Capa ${layer.mapLayer.layerId}`
|
|
3169
|
+
}))
|
|
3170
|
+
}
|
|
3171
|
+
)
|
|
2806
3172
|
] }),
|
|
2807
|
-
/* @__PURE__ */ (0,
|
|
3173
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
|
|
2808
3174
|
"Campo",
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3176
|
+
ZenitSelect,
|
|
3177
|
+
{
|
|
3178
|
+
ariaLabel: "Seleccionar campo de filtrado",
|
|
3179
|
+
value: selectedFilterField,
|
|
3180
|
+
onValueChange: (nextField) => {
|
|
3181
|
+
setSelectedFilterField(nextField);
|
|
3182
|
+
setSelectedFilterValue("");
|
|
3183
|
+
},
|
|
3184
|
+
options: filterFields.map((field) => ({ value: field, label: field }))
|
|
3185
|
+
}
|
|
3186
|
+
)
|
|
2813
3187
|
] }),
|
|
2814
|
-
/* @__PURE__ */ (0,
|
|
3188
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: 6, fontSize: 12, color: "#475569" }, children: [
|
|
2815
3189
|
"Valor",
|
|
2816
|
-
/* @__PURE__ */ (0,
|
|
2817
|
-
|
|
3190
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3191
|
+
ZenitSelect,
|
|
2818
3192
|
{
|
|
2819
|
-
|
|
3193
|
+
ariaLabel: "Seleccionar valor de filtrado",
|
|
2820
3194
|
value: selectedFilterValue,
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
]
|
|
3195
|
+
placeholder: "Seleccionar\u2026",
|
|
3196
|
+
onValueChange: (nextValue) => setSelectedFilterValue(nextValue),
|
|
3197
|
+
disabled: loadingCatalog || activeCatalogValues.length === 0,
|
|
3198
|
+
options: activeCatalogValues.map((catalogValue) => ({
|
|
3199
|
+
value: catalogValue,
|
|
3200
|
+
label: catalogValue
|
|
3201
|
+
}))
|
|
2829
3202
|
}
|
|
2830
3203
|
)
|
|
2831
3204
|
] }),
|
|
2832
|
-
loadingCatalog && /* @__PURE__ */ (0,
|
|
2833
|
-
!loadingCatalog && selectedFilterField && activeCatalogValues.length === 0 && /* @__PURE__ */ (0,
|
|
2834
|
-
filterError && /* @__PURE__ */ (0,
|
|
2835
|
-
appliedFilter && /* @__PURE__ */ (0,
|
|
3205
|
+
loadingCatalog && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#64748b", fontSize: 12 }, children: "Cargando cat\xE1logo\u2026" }),
|
|
3206
|
+
!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." }),
|
|
3207
|
+
filterError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#b91c1c", fontSize: 12 }, children: filterError }),
|
|
3208
|
+
appliedFilter && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "zlm-badge", style: { alignSelf: "flex-start" }, children: [
|
|
2836
3209
|
"Activo: ",
|
|
2837
3210
|
appliedFilter.field,
|
|
2838
3211
|
" = ",
|
|
2839
3212
|
appliedFilter.value
|
|
2840
3213
|
] }),
|
|
2841
|
-
/* @__PURE__ */ (0,
|
|
2842
|
-
/* @__PURE__ */ (0,
|
|
3214
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "zlm-filter-actions", style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: [
|
|
3215
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2843
3216
|
"button",
|
|
2844
3217
|
{
|
|
2845
3218
|
type: "button",
|
|
@@ -2849,7 +3222,7 @@ var ZenitLayerManager = ({
|
|
|
2849
3222
|
children: applyingFilter ? "Aplicando\u2026" : "Aplicar"
|
|
2850
3223
|
}
|
|
2851
3224
|
),
|
|
2852
|
-
/* @__PURE__ */ (0,
|
|
3225
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2853
3226
|
"button",
|
|
2854
3227
|
{
|
|
2855
3228
|
type: "button",
|
|
@@ -2861,13 +3234,13 @@ var ZenitLayerManager = ({
|
|
|
2861
3234
|
)
|
|
2862
3235
|
] })
|
|
2863
3236
|
] }) }),
|
|
2864
|
-
showUploadTab && activeTab === "upload" && /* @__PURE__ */ (0,
|
|
3237
|
+
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." })
|
|
2865
3238
|
] })
|
|
2866
3239
|
] });
|
|
2867
3240
|
};
|
|
2868
3241
|
|
|
2869
3242
|
// src/react/ZenitFeatureFilterPanel.tsx
|
|
2870
|
-
var
|
|
3243
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2871
3244
|
var ZenitFeatureFilterPanel = ({
|
|
2872
3245
|
title = "Filtros",
|
|
2873
3246
|
description,
|
|
@@ -2875,7 +3248,7 @@ var ZenitFeatureFilterPanel = ({
|
|
|
2875
3248
|
style,
|
|
2876
3249
|
children
|
|
2877
3250
|
}) => {
|
|
2878
|
-
return /* @__PURE__ */ (0,
|
|
3251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2879
3252
|
"section",
|
|
2880
3253
|
{
|
|
2881
3254
|
className,
|
|
@@ -2888,22 +3261,22 @@ var ZenitFeatureFilterPanel = ({
|
|
|
2888
3261
|
...style
|
|
2889
3262
|
},
|
|
2890
3263
|
children: [
|
|
2891
|
-
/* @__PURE__ */ (0,
|
|
2892
|
-
/* @__PURE__ */ (0,
|
|
2893
|
-
description && /* @__PURE__ */ (0,
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { style: { marginBottom: 12 }, children: [
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { style: { margin: 0, fontSize: 16 }, children: title }),
|
|
3266
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { style: { margin: "6px 0 0", color: "#475569", fontSize: 13 }, children: description })
|
|
2894
3267
|
] }),
|
|
2895
|
-
/* @__PURE__ */ (0,
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children })
|
|
2896
3269
|
]
|
|
2897
3270
|
}
|
|
2898
3271
|
);
|
|
2899
3272
|
};
|
|
2900
3273
|
|
|
2901
3274
|
// src/react/ai/FloatingChatBox.tsx
|
|
2902
|
-
var
|
|
2903
|
-
var
|
|
3275
|
+
var import_react9 = require("react");
|
|
3276
|
+
var import_react_dom3 = require("react-dom");
|
|
2904
3277
|
|
|
2905
3278
|
// src/react/hooks/use-chat.ts
|
|
2906
|
-
var
|
|
3279
|
+
var import_react8 = require("react");
|
|
2907
3280
|
|
|
2908
3281
|
// src/ai/chat.service.ts
|
|
2909
3282
|
var DEFAULT_ERROR_MESSAGE = "No fue posible completar la solicitud al asistente.";
|
|
@@ -3035,9 +3408,9 @@ var sendMessageStream = async (mapId, request, callbacks = {}, options, config)
|
|
|
3035
3408
|
|
|
3036
3409
|
// src/react/hooks/use-chat.ts
|
|
3037
3410
|
var useSendMessage = (config) => {
|
|
3038
|
-
const [isLoading, setIsLoading] = (0,
|
|
3039
|
-
const [error, setError] = (0,
|
|
3040
|
-
const send = (0,
|
|
3411
|
+
const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
|
|
3412
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
3413
|
+
const send = (0, import_react8.useCallback)(
|
|
3041
3414
|
async (mapId, request, options) => {
|
|
3042
3415
|
setIsLoading(true);
|
|
3043
3416
|
setError(null);
|
|
@@ -3055,18 +3428,18 @@ var useSendMessage = (config) => {
|
|
|
3055
3428
|
return { sendMessage: send, isLoading, error };
|
|
3056
3429
|
};
|
|
3057
3430
|
var useSendMessageStream = (config) => {
|
|
3058
|
-
const [isStreaming, setIsStreaming] = (0,
|
|
3059
|
-
const [streamingText, setStreamingText] = (0,
|
|
3060
|
-
const [completeResponse, setCompleteResponse] = (0,
|
|
3061
|
-
const [error, setError] = (0,
|
|
3062
|
-
const requestIdRef = (0,
|
|
3063
|
-
const reset = (0,
|
|
3431
|
+
const [isStreaming, setIsStreaming] = (0, import_react8.useState)(false);
|
|
3432
|
+
const [streamingText, setStreamingText] = (0, import_react8.useState)("");
|
|
3433
|
+
const [completeResponse, setCompleteResponse] = (0, import_react8.useState)(null);
|
|
3434
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
3435
|
+
const requestIdRef = (0, import_react8.useRef)(0);
|
|
3436
|
+
const reset = (0, import_react8.useCallback)(() => {
|
|
3064
3437
|
setIsStreaming(false);
|
|
3065
3438
|
setStreamingText("");
|
|
3066
3439
|
setCompleteResponse(null);
|
|
3067
3440
|
setError(null);
|
|
3068
3441
|
}, []);
|
|
3069
|
-
const send = (0,
|
|
3442
|
+
const send = (0, import_react8.useCallback)(
|
|
3070
3443
|
async (mapId, request, options) => {
|
|
3071
3444
|
const requestId = requestIdRef.current + 1;
|
|
3072
3445
|
requestIdRef.current = requestId;
|
|
@@ -3120,7 +3493,7 @@ var useSendMessageStream = (config) => {
|
|
|
3120
3493
|
// src/react/components/MarkdownRenderer.tsx
|
|
3121
3494
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
3122
3495
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
3123
|
-
var
|
|
3496
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3124
3497
|
function normalizeAssistantMarkdown(text) {
|
|
3125
3498
|
if (!text || typeof text !== "string") return "";
|
|
3126
3499
|
let normalized = text;
|
|
@@ -3136,28 +3509,28 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3136
3509
|
if (!normalizedContent) {
|
|
3137
3510
|
return null;
|
|
3138
3511
|
}
|
|
3139
|
-
return /* @__PURE__ */ (0,
|
|
3512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className, style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3140
3513
|
import_react_markdown.default,
|
|
3141
3514
|
{
|
|
3142
3515
|
remarkPlugins: [import_remark_gfm.default],
|
|
3143
3516
|
components: {
|
|
3144
3517
|
// Headings with proper spacing
|
|
3145
|
-
h1: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3146
|
-
h2: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3147
|
-
h3: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3148
|
-
h4: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3149
|
-
h5: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3150
|
-
h6: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3518
|
+
h1: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { style: { fontSize: "1.5em", fontWeight: 700, marginTop: "1em", marginBottom: "0.5em" }, ...props, children }),
|
|
3519
|
+
h2: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { style: { fontSize: "1.3em", fontWeight: 700, marginTop: "0.9em", marginBottom: "0.45em" }, ...props, children }),
|
|
3520
|
+
h3: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { style: { fontSize: "1.15em", fontWeight: 600, marginTop: "0.75em", marginBottom: "0.4em" }, ...props, children }),
|
|
3521
|
+
h4: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h4", { style: { fontSize: "1.05em", fontWeight: 600, marginTop: "0.6em", marginBottom: "0.35em" }, ...props, children }),
|
|
3522
|
+
h5: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h5", { style: { fontSize: "1em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
|
|
3523
|
+
h6: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h6", { style: { fontSize: "0.95em", fontWeight: 600, marginTop: "0.5em", marginBottom: "0.3em" }, ...props, children }),
|
|
3151
3524
|
// Paragraphs with comfortable line height
|
|
3152
|
-
p: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3525
|
+
p: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { marginTop: "0.5em", marginBottom: "0.5em", lineHeight: 1.6 }, ...props, children }),
|
|
3153
3526
|
// Lists with proper indentation
|
|
3154
|
-
ul: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3155
|
-
ol: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3156
|
-
li: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3527
|
+
ul: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
|
|
3528
|
+
ol: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", { style: { paddingLeft: "1.5em", marginTop: "0.5em", marginBottom: "0.5em" }, ...props, children }),
|
|
3529
|
+
li: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { style: { marginTop: "0.25em", marginBottom: "0.25em" }, ...props, children }),
|
|
3157
3530
|
// Code blocks
|
|
3158
3531
|
code: ({ inline, children, ...props }) => {
|
|
3159
3532
|
if (inline) {
|
|
3160
|
-
return /* @__PURE__ */ (0,
|
|
3533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3161
3534
|
"code",
|
|
3162
3535
|
{
|
|
3163
3536
|
style: {
|
|
@@ -3172,7 +3545,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3172
3545
|
}
|
|
3173
3546
|
);
|
|
3174
3547
|
}
|
|
3175
|
-
return /* @__PURE__ */ (0,
|
|
3548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3176
3549
|
"code",
|
|
3177
3550
|
{
|
|
3178
3551
|
style: {
|
|
@@ -3192,9 +3565,9 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3192
3565
|
);
|
|
3193
3566
|
},
|
|
3194
3567
|
// Pre (code block wrapper)
|
|
3195
|
-
pre: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3568
|
+
pre: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { style: { margin: 0 }, ...props, children }),
|
|
3196
3569
|
// Blockquotes
|
|
3197
|
-
blockquote: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3570
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3198
3571
|
"blockquote",
|
|
3199
3572
|
{
|
|
3200
3573
|
style: {
|
|
@@ -3210,11 +3583,11 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3210
3583
|
}
|
|
3211
3584
|
),
|
|
3212
3585
|
// Strong/bold
|
|
3213
|
-
strong: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3586
|
+
strong: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { style: { fontWeight: 600 }, ...props, children }),
|
|
3214
3587
|
// Emphasis/italic
|
|
3215
|
-
em: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3588
|
+
em: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("em", { style: { fontStyle: "italic" }, ...props, children }),
|
|
3216
3589
|
// Horizontal rule
|
|
3217
|
-
hr: (props) => /* @__PURE__ */ (0,
|
|
3590
|
+
hr: (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3218
3591
|
"hr",
|
|
3219
3592
|
{
|
|
3220
3593
|
style: {
|
|
@@ -3227,7 +3600,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3227
3600
|
}
|
|
3228
3601
|
),
|
|
3229
3602
|
// Tables (GFM)
|
|
3230
|
-
table: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3603
|
+
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)(
|
|
3231
3604
|
"table",
|
|
3232
3605
|
{
|
|
3233
3606
|
style: {
|
|
@@ -3239,7 +3612,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3239
3612
|
children
|
|
3240
3613
|
}
|
|
3241
3614
|
) }),
|
|
3242
|
-
th: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3615
|
+
th: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3243
3616
|
"th",
|
|
3244
3617
|
{
|
|
3245
3618
|
style: {
|
|
@@ -3253,7 +3626,7 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3253
3626
|
children
|
|
3254
3627
|
}
|
|
3255
3628
|
),
|
|
3256
|
-
td: ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
3629
|
+
td: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3257
3630
|
"td",
|
|
3258
3631
|
{
|
|
3259
3632
|
style: {
|
|
@@ -3271,32 +3644,32 @@ var MarkdownRenderer = ({ content, className }) => {
|
|
|
3271
3644
|
};
|
|
3272
3645
|
|
|
3273
3646
|
// src/react/ai/FloatingChatBox.tsx
|
|
3274
|
-
var
|
|
3275
|
-
var ChatIcon = () => /* @__PURE__ */ (0,
|
|
3276
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
3277
|
-
/* @__PURE__ */ (0,
|
|
3278
|
-
/* @__PURE__ */ (0,
|
|
3647
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3648
|
+
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" }) });
|
|
3649
|
+
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: [
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
3651
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
3279
3652
|
] });
|
|
3280
|
-
var ExpandIcon = () => /* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3282
|
-
/* @__PURE__ */ (0,
|
|
3283
|
-
/* @__PURE__ */ (0,
|
|
3284
|
-
/* @__PURE__ */ (0,
|
|
3653
|
+
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: [
|
|
3654
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
3655
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "9 21 3 21 3 15" }),
|
|
3656
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "21", y1: "3", x2: "14", y2: "10" }),
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
3285
3658
|
] });
|
|
3286
|
-
var CollapseIcon = () => /* @__PURE__ */ (0,
|
|
3287
|
-
/* @__PURE__ */ (0,
|
|
3288
|
-
/* @__PURE__ */ (0,
|
|
3289
|
-
/* @__PURE__ */ (0,
|
|
3290
|
-
/* @__PURE__ */ (0,
|
|
3659
|
+
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: [
|
|
3660
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "4 14 10 14 10 20" }),
|
|
3661
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "20 10 14 10 14 4" }),
|
|
3662
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "14", y1: "10", x2: "21", y2: "3" }),
|
|
3663
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
3291
3664
|
] });
|
|
3292
|
-
var SendIcon = () => /* @__PURE__ */ (0,
|
|
3293
|
-
/* @__PURE__ */ (0,
|
|
3294
|
-
/* @__PURE__ */ (0,
|
|
3665
|
+
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: [
|
|
3666
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
3667
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
3295
3668
|
] });
|
|
3296
|
-
var LayersIcon = () => /* @__PURE__ */ (0,
|
|
3297
|
-
/* @__PURE__ */ (0,
|
|
3298
|
-
/* @__PURE__ */ (0,
|
|
3299
|
-
/* @__PURE__ */ (0,
|
|
3669
|
+
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: [
|
|
3670
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polygon", { points: "12 2 2 7 12 12 22 7 12 2" }),
|
|
3671
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "2 17 12 22 22 17" }),
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "2 12 12 17 22 12" })
|
|
3300
3673
|
] });
|
|
3301
3674
|
var styles = {
|
|
3302
3675
|
root: {
|
|
@@ -3601,42 +3974,42 @@ var FloatingChatBox = ({
|
|
|
3601
3974
|
open: openProp
|
|
3602
3975
|
}) => {
|
|
3603
3976
|
const isControlled = openProp !== void 0;
|
|
3604
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
3977
|
+
const [internalOpen, setInternalOpen] = (0, import_react9.useState)(false);
|
|
3605
3978
|
const open = isControlled ? openProp : internalOpen;
|
|
3606
|
-
const setOpen = (0,
|
|
3979
|
+
const setOpen = (0, import_react9.useCallback)((value) => {
|
|
3607
3980
|
const newValue = typeof value === "function" ? value(open) : value;
|
|
3608
3981
|
if (!isControlled) {
|
|
3609
3982
|
setInternalOpen(newValue);
|
|
3610
3983
|
}
|
|
3611
3984
|
onOpenChange?.(newValue);
|
|
3612
3985
|
}, [isControlled, open, onOpenChange]);
|
|
3613
|
-
const [expanded, setExpanded] = (0,
|
|
3614
|
-
const [messages, setMessages] = (0,
|
|
3615
|
-
const [inputValue, setInputValue] = (0,
|
|
3616
|
-
const [conversationId, setConversationId] = (0,
|
|
3617
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3618
|
-
const [isFocused, setIsFocused] = (0,
|
|
3619
|
-
const [isMobile, setIsMobile] = (0,
|
|
3620
|
-
const messagesEndRef = (0,
|
|
3621
|
-
const messagesContainerRef = (0,
|
|
3622
|
-
const chatBoxRef = (0,
|
|
3623
|
-
const chatConfig = (0,
|
|
3986
|
+
const [expanded, setExpanded] = (0, import_react9.useState)(false);
|
|
3987
|
+
const [messages, setMessages] = (0, import_react9.useState)([]);
|
|
3988
|
+
const [inputValue, setInputValue] = (0, import_react9.useState)("");
|
|
3989
|
+
const [conversationId, setConversationId] = (0, import_react9.useState)();
|
|
3990
|
+
const [errorMessage, setErrorMessage] = (0, import_react9.useState)(null);
|
|
3991
|
+
const [isFocused, setIsFocused] = (0, import_react9.useState)(false);
|
|
3992
|
+
const [isMobile, setIsMobile] = (0, import_react9.useState)(false);
|
|
3993
|
+
const messagesEndRef = (0, import_react9.useRef)(null);
|
|
3994
|
+
const messagesContainerRef = (0, import_react9.useRef)(null);
|
|
3995
|
+
const chatBoxRef = (0, import_react9.useRef)(null);
|
|
3996
|
+
const chatConfig = (0, import_react9.useMemo)(() => {
|
|
3624
3997
|
if (!baseUrl) return void 0;
|
|
3625
3998
|
return { baseUrl, accessToken, getAccessToken };
|
|
3626
3999
|
}, [accessToken, baseUrl, getAccessToken]);
|
|
3627
4000
|
const { sendMessage: sendMessage2, isStreaming, streamingText, completeResponse } = useSendMessageStream(chatConfig);
|
|
3628
4001
|
const canSend = Boolean(mapId) && Boolean(baseUrl) && inputValue.trim().length > 0 && !isStreaming;
|
|
3629
|
-
(0,
|
|
4002
|
+
(0, import_react9.useEffect)(() => {
|
|
3630
4003
|
if (open && isMobile) {
|
|
3631
4004
|
setExpanded(true);
|
|
3632
4005
|
}
|
|
3633
4006
|
}, [open, isMobile]);
|
|
3634
|
-
const scrollToBottom = (0,
|
|
4007
|
+
const scrollToBottom = (0, import_react9.useCallback)(() => {
|
|
3635
4008
|
if (messagesEndRef.current) {
|
|
3636
4009
|
messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
|
|
3637
4010
|
}
|
|
3638
4011
|
}, []);
|
|
3639
|
-
(0,
|
|
4012
|
+
(0, import_react9.useEffect)(() => {
|
|
3640
4013
|
if (open && messages.length === 0) {
|
|
3641
4014
|
setMessages([
|
|
3642
4015
|
{
|
|
@@ -3647,10 +4020,10 @@ var FloatingChatBox = ({
|
|
|
3647
4020
|
]);
|
|
3648
4021
|
}
|
|
3649
4022
|
}, [open, messages.length]);
|
|
3650
|
-
(0,
|
|
4023
|
+
(0, import_react9.useEffect)(() => {
|
|
3651
4024
|
scrollToBottom();
|
|
3652
4025
|
}, [messages, streamingText, scrollToBottom]);
|
|
3653
|
-
(0,
|
|
4026
|
+
(0, import_react9.useEffect)(() => {
|
|
3654
4027
|
if (!open) return;
|
|
3655
4028
|
if (isMobile && expanded) return;
|
|
3656
4029
|
const handleClickOutside = (event) => {
|
|
@@ -3663,7 +4036,7 @@ var FloatingChatBox = ({
|
|
|
3663
4036
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
3664
4037
|
};
|
|
3665
4038
|
}, [open, isMobile, expanded]);
|
|
3666
|
-
(0,
|
|
4039
|
+
(0, import_react9.useEffect)(() => {
|
|
3667
4040
|
if (typeof window === "undefined") return;
|
|
3668
4041
|
const mediaQuery = window.matchMedia("(max-width: 768px)");
|
|
3669
4042
|
const updateMobile = () => setIsMobile(mediaQuery.matches);
|
|
@@ -3681,7 +4054,7 @@ var FloatingChatBox = ({
|
|
|
3681
4054
|
}
|
|
3682
4055
|
};
|
|
3683
4056
|
}, []);
|
|
3684
|
-
(0,
|
|
4057
|
+
(0, import_react9.useEffect)(() => {
|
|
3685
4058
|
if (typeof document === "undefined") return;
|
|
3686
4059
|
if (!open || !isMobile) return;
|
|
3687
4060
|
document.body.style.overflow = "hidden";
|
|
@@ -3689,10 +4062,10 @@ var FloatingChatBox = ({
|
|
|
3689
4062
|
document.body.style.overflow = "";
|
|
3690
4063
|
};
|
|
3691
4064
|
}, [open, isMobile]);
|
|
3692
|
-
const addMessage = (0,
|
|
4065
|
+
const addMessage = (0, import_react9.useCallback)((message) => {
|
|
3693
4066
|
setMessages((prev) => [...prev, message]);
|
|
3694
4067
|
}, []);
|
|
3695
|
-
const handleSend = (0,
|
|
4068
|
+
const handleSend = (0, import_react9.useCallback)(async () => {
|
|
3696
4069
|
if (!mapId) {
|
|
3697
4070
|
setErrorMessage("Selecciona un mapa para usar el asistente.");
|
|
3698
4071
|
return;
|
|
@@ -3745,7 +4118,7 @@ var FloatingChatBox = ({
|
|
|
3745
4118
|
sendMessage2,
|
|
3746
4119
|
userId
|
|
3747
4120
|
]);
|
|
3748
|
-
const handleKeyDown = (0,
|
|
4121
|
+
const handleKeyDown = (0, import_react9.useCallback)(
|
|
3749
4122
|
(event) => {
|
|
3750
4123
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
3751
4124
|
event.preventDefault();
|
|
@@ -3756,20 +4129,20 @@ var FloatingChatBox = ({
|
|
|
3756
4129
|
},
|
|
3757
4130
|
[canSend, handleSend]
|
|
3758
4131
|
);
|
|
3759
|
-
const handleFollowUpClick = (0,
|
|
4132
|
+
const handleFollowUpClick = (0, import_react9.useCallback)((question) => {
|
|
3760
4133
|
setInputValue(question);
|
|
3761
4134
|
}, []);
|
|
3762
4135
|
const renderMetadata = (response) => {
|
|
3763
4136
|
if (!response?.metadata) return null;
|
|
3764
4137
|
const referencedLayers = response.metadata.referencedLayers;
|
|
3765
4138
|
if (!referencedLayers || referencedLayers.length === 0) return null;
|
|
3766
|
-
return /* @__PURE__ */ (0,
|
|
3767
|
-
/* @__PURE__ */ (0,
|
|
3768
|
-
/* @__PURE__ */ (0,
|
|
4139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.metadataSection, children: [
|
|
4140
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.metadataTitle, children: [
|
|
4141
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LayersIcon, {}),
|
|
3769
4142
|
"Capas Analizadas"
|
|
3770
4143
|
] }),
|
|
3771
|
-
/* @__PURE__ */ (0,
|
|
3772
|
-
/* @__PURE__ */ (0,
|
|
4144
|
+
/* @__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: [
|
|
4145
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: layer.layerName }),
|
|
3773
4146
|
" (",
|
|
3774
4147
|
layer.featureCount,
|
|
3775
4148
|
" ",
|
|
@@ -3778,7 +4151,7 @@ var FloatingChatBox = ({
|
|
|
3778
4151
|
] }, index)) })
|
|
3779
4152
|
] });
|
|
3780
4153
|
};
|
|
3781
|
-
const handleActionClick = (0,
|
|
4154
|
+
const handleActionClick = (0, import_react9.useCallback)((action) => {
|
|
3782
4155
|
if (isStreaming) return;
|
|
3783
4156
|
setOpen(false);
|
|
3784
4157
|
requestAnimationFrame(() => {
|
|
@@ -3787,9 +4160,9 @@ var FloatingChatBox = ({
|
|
|
3787
4160
|
}, [isStreaming, setOpen, onActionClick]);
|
|
3788
4161
|
const renderActions = (response) => {
|
|
3789
4162
|
if (!response?.suggestedActions?.length) return null;
|
|
3790
|
-
return /* @__PURE__ */ (0,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3792
|
-
/* @__PURE__ */ (0,
|
|
4163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.actionsSection, children: [
|
|
4164
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.sectionLabel, children: "Acciones Sugeridas" }),
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.actionsGrid, children: response.suggestedActions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3793
4166
|
"button",
|
|
3794
4167
|
{
|
|
3795
4168
|
type: "button",
|
|
@@ -3820,9 +4193,9 @@ var FloatingChatBox = ({
|
|
|
3820
4193
|
};
|
|
3821
4194
|
const renderFollowUps = (response) => {
|
|
3822
4195
|
if (!response?.followUpQuestions?.length) return null;
|
|
3823
|
-
return /* @__PURE__ */ (0,
|
|
3824
|
-
/* @__PURE__ */ (0,
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
4196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.actionsSection, children: [
|
|
4197
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.sectionLabel, children: "Preguntas Relacionadas" }),
|
|
4198
|
+
/* @__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)(
|
|
3826
4199
|
"button",
|
|
3827
4200
|
{
|
|
3828
4201
|
type: "button",
|
|
@@ -3851,8 +4224,8 @@ var FloatingChatBox = ({
|
|
|
3851
4224
|
)) })
|
|
3852
4225
|
] });
|
|
3853
4226
|
};
|
|
3854
|
-
const chatContent = /* @__PURE__ */ (0,
|
|
3855
|
-
/* @__PURE__ */ (0,
|
|
4227
|
+
const chatContent = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.root, children: [
|
|
4228
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: `
|
|
3856
4229
|
@keyframes zenitBlink {
|
|
3857
4230
|
0%, 49% { opacity: 1; }
|
|
3858
4231
|
50%, 100% { opacity: 0; }
|
|
@@ -3908,7 +4281,7 @@ var FloatingChatBox = ({
|
|
|
3908
4281
|
}
|
|
3909
4282
|
}
|
|
3910
4283
|
` }),
|
|
3911
|
-
open && /* @__PURE__ */ (0,
|
|
4284
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3912
4285
|
"div",
|
|
3913
4286
|
{
|
|
3914
4287
|
ref: chatBoxRef,
|
|
@@ -3922,10 +4295,10 @@ var FloatingChatBox = ({
|
|
|
3922
4295
|
};
|
|
3923
4296
|
})(),
|
|
3924
4297
|
children: [
|
|
3925
|
-
/* @__PURE__ */ (0,
|
|
3926
|
-
/* @__PURE__ */ (0,
|
|
3927
|
-
/* @__PURE__ */ (0,
|
|
3928
|
-
!isMobile && /* @__PURE__ */ (0,
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { style: styles.header, children: [
|
|
4299
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { style: styles.title, children: "Asistente Zenit AI" }),
|
|
4300
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.headerButtons, children: [
|
|
4301
|
+
!isMobile && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3929
4302
|
"button",
|
|
3930
4303
|
{
|
|
3931
4304
|
type: "button",
|
|
@@ -3938,10 +4311,10 @@ var FloatingChatBox = ({
|
|
|
3938
4311
|
e.currentTarget.style.background = "rgba(255, 255, 255, 0.15)";
|
|
3939
4312
|
},
|
|
3940
4313
|
"aria-label": expanded ? "Contraer" : "Expandir",
|
|
3941
|
-
children: expanded ? /* @__PURE__ */ (0,
|
|
4314
|
+
children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CollapseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExpandIcon, {})
|
|
3942
4315
|
}
|
|
3943
4316
|
),
|
|
3944
|
-
/* @__PURE__ */ (0,
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3945
4318
|
"button",
|
|
3946
4319
|
{
|
|
3947
4320
|
type: "button",
|
|
@@ -3954,20 +4327,20 @@ var FloatingChatBox = ({
|
|
|
3954
4327
|
e.currentTarget.style.background = "rgba(255, 255, 255, 0.15)";
|
|
3955
4328
|
},
|
|
3956
4329
|
"aria-label": "Cerrar",
|
|
3957
|
-
children: /* @__PURE__ */ (0,
|
|
4330
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseIcon, {})
|
|
3958
4331
|
}
|
|
3959
4332
|
)
|
|
3960
4333
|
] })
|
|
3961
4334
|
] }),
|
|
3962
|
-
/* @__PURE__ */ (0,
|
|
3963
|
-
messages.map((message) => /* @__PURE__ */ (0,
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: messagesContainerRef, className: "zenit-ai-body", style: styles.messages, children: [
|
|
4336
|
+
messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3964
4337
|
"div",
|
|
3965
4338
|
{
|
|
3966
4339
|
style: {
|
|
3967
4340
|
...styles.messageWrapper,
|
|
3968
4341
|
alignItems: message.role === "user" ? "flex-end" : "flex-start"
|
|
3969
4342
|
},
|
|
3970
|
-
children: /* @__PURE__ */ (0,
|
|
4343
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3971
4344
|
"div",
|
|
3972
4345
|
{
|
|
3973
4346
|
style: {
|
|
@@ -3975,7 +4348,7 @@ var FloatingChatBox = ({
|
|
|
3975
4348
|
...message.role === "user" ? styles.userMessage : styles.assistantMessage
|
|
3976
4349
|
},
|
|
3977
4350
|
children: [
|
|
3978
|
-
message.role === "assistant" ? /* @__PURE__ */ (0,
|
|
4351
|
+
message.role === "assistant" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MarkdownRenderer, { content: message.content }) : message.content,
|
|
3979
4352
|
message.role === "assistant" && renderMetadata(message.response),
|
|
3980
4353
|
message.role === "assistant" && renderActions(message.response),
|
|
3981
4354
|
message.role === "assistant" && renderFollowUps(message.response)
|
|
@@ -3985,39 +4358,39 @@ var FloatingChatBox = ({
|
|
|
3985
4358
|
},
|
|
3986
4359
|
message.id
|
|
3987
4360
|
)),
|
|
3988
|
-
isStreaming && /* @__PURE__ */ (0,
|
|
4361
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3989
4362
|
"div",
|
|
3990
4363
|
{
|
|
3991
4364
|
style: {
|
|
3992
4365
|
...styles.messageWrapper,
|
|
3993
4366
|
alignItems: "flex-start"
|
|
3994
4367
|
},
|
|
3995
|
-
children: /* @__PURE__ */ (0,
|
|
4368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3996
4369
|
"div",
|
|
3997
4370
|
{
|
|
3998
4371
|
style: {
|
|
3999
4372
|
...styles.messageBubble,
|
|
4000
4373
|
...styles.assistantMessage
|
|
4001
4374
|
},
|
|
4002
|
-
children: streamingText ? /* @__PURE__ */ (0,
|
|
4003
|
-
/* @__PURE__ */ (0,
|
|
4004
|
-
/* @__PURE__ */ (0,
|
|
4005
|
-
] }) : /* @__PURE__ */ (0,
|
|
4006
|
-
/* @__PURE__ */ (0,
|
|
4007
|
-
/* @__PURE__ */ (0,
|
|
4008
|
-
/* @__PURE__ */ (0,
|
|
4009
|
-
/* @__PURE__ */ (0,
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4375
|
+
children: streamingText ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
4376
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MarkdownRenderer, { content: streamingText }),
|
|
4377
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: styles.cursor })
|
|
4378
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.thinkingText, children: [
|
|
4379
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Pensando" }),
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: styles.typingIndicator, children: [
|
|
4381
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot }),
|
|
4382
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot }),
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "zenit-typing-dot", style: styles.typingDot })
|
|
4011
4384
|
] })
|
|
4012
4385
|
] })
|
|
4013
4386
|
}
|
|
4014
4387
|
)
|
|
4015
4388
|
}
|
|
4016
4389
|
),
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: messagesEndRef })
|
|
4018
4391
|
] }),
|
|
4019
|
-
/* @__PURE__ */ (0,
|
|
4020
|
-
/* @__PURE__ */ (0,
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "zenit-ai-input-area", style: styles.inputWrapper, children: [
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4021
4394
|
"textarea",
|
|
4022
4395
|
{
|
|
4023
4396
|
style: {
|
|
@@ -4034,7 +4407,7 @@ var FloatingChatBox = ({
|
|
|
4034
4407
|
disabled: !mapId || !baseUrl || isStreaming
|
|
4035
4408
|
}
|
|
4036
4409
|
),
|
|
4037
|
-
/* @__PURE__ */ (0,
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4038
4411
|
"button",
|
|
4039
4412
|
{
|
|
4040
4413
|
type: "button",
|
|
@@ -4043,18 +4416,18 @@ var FloatingChatBox = ({
|
|
|
4043
4416
|
onClick: () => void handleSend(),
|
|
4044
4417
|
disabled: !canSend,
|
|
4045
4418
|
"aria-label": "Enviar mensaje",
|
|
4046
|
-
children: /* @__PURE__ */ (0,
|
|
4419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SendIcon, {})
|
|
4047
4420
|
}
|
|
4048
4421
|
)
|
|
4049
4422
|
] }),
|
|
4050
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
4051
|
-
isStreaming && !errorMessage && /* @__PURE__ */ (0,
|
|
4052
|
-
!mapId && !errorMessage && /* @__PURE__ */ (0,
|
|
4053
|
-
!baseUrl && !errorMessage && /* @__PURE__ */ (0,
|
|
4423
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.errorText, children: errorMessage }),
|
|
4424
|
+
isStreaming && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.statusNote, children: "Generando sugerencias..." }),
|
|
4425
|
+
!mapId && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.statusNote, children: "Selecciona un mapa para usar el asistente" }),
|
|
4426
|
+
!baseUrl && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: styles.statusNote, children: "Configura la baseUrl del SDK" })
|
|
4054
4427
|
]
|
|
4055
4428
|
}
|
|
4056
4429
|
),
|
|
4057
|
-
!(hideButton && !open) && /* @__PURE__ */ (0,
|
|
4430
|
+
!(hideButton && !open) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4058
4431
|
"button",
|
|
4059
4432
|
{
|
|
4060
4433
|
type: "button",
|
|
@@ -4066,20 +4439,21 @@ var FloatingChatBox = ({
|
|
|
4066
4439
|
},
|
|
4067
4440
|
onClick: () => setOpen((prev) => !prev),
|
|
4068
4441
|
"aria-label": open ? "Cerrar asistente" : "Abrir asistente Zenit AI",
|
|
4069
|
-
children: open ? /* @__PURE__ */ (0,
|
|
4070
|
-
/* @__PURE__ */ (0,
|
|
4071
|
-
!isMobile && /* @__PURE__ */ (0,
|
|
4442
|
+
children: open ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChatIcon, {}),
|
|
4444
|
+
!isMobile && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Asistente IA" })
|
|
4072
4445
|
] })
|
|
4073
4446
|
}
|
|
4074
4447
|
)
|
|
4075
4448
|
] });
|
|
4076
4449
|
if (typeof document !== "undefined") {
|
|
4077
|
-
return (0,
|
|
4450
|
+
return (0, import_react_dom3.createPortal)(chatContent, document.body);
|
|
4078
4451
|
}
|
|
4079
4452
|
return chatContent;
|
|
4080
4453
|
};
|
|
4081
4454
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4082
4455
|
0 && (module.exports = {
|
|
4456
|
+
ChevronDown,
|
|
4083
4457
|
ChevronLeft,
|
|
4084
4458
|
ChevronRight,
|
|
4085
4459
|
Eye,
|
|
@@ -4091,6 +4465,7 @@ var FloatingChatBox = ({
|
|
|
4091
4465
|
ZenitFeatureFilterPanel,
|
|
4092
4466
|
ZenitLayerManager,
|
|
4093
4467
|
ZenitMap,
|
|
4468
|
+
ZenitSelect,
|
|
4094
4469
|
ZoomIn,
|
|
4095
4470
|
clampNumber,
|
|
4096
4471
|
clampOpacity,
|