frontend-plus-react 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4190,8 +4190,8 @@ var GenericDataGrid = ({
4190
4190
  var GenericDataGrid_default = GenericDataGrid;
4191
4191
 
4192
4192
  // src/App.tsx
4193
- var import_react37 = __toESM(require("react"), 1);
4194
- var import_react_router_dom14 = require("react-router-dom");
4193
+ var import_react39 = __toESM(require("react"), 1);
4194
+ var import_react_router_dom15 = require("react-router-dom");
4195
4195
 
4196
4196
  // src/components/MainLayout.tsx
4197
4197
  var import_react26 = require("react");
@@ -4312,13 +4312,33 @@ var import_ExpandMore = __toESM(require("@mui/icons-material/ExpandMore"), 1);
4312
4312
  var import_TableChart = __toESM(require("@mui/icons-material/TableChart"), 1);
4313
4313
  var import_Folder = __toESM(require("@mui/icons-material/Folder"), 1);
4314
4314
  var import_Dns = __toESM(require("@mui/icons-material/Dns"), 1);
4315
- var import_Home = __toESM(require("@mui/icons-material/Home"), 1);
4316
4315
  var import_WarningAmber3 = __toESM(require("@mui/icons-material/WarningAmber"), 1);
4317
4316
  var import_DesktopWindows = __toESM(require("@mui/icons-material/DesktopWindows"), 1);
4318
4317
  var import_UnfoldMore = __toESM(require("@mui/icons-material/UnfoldMore"), 1);
4319
4318
  var import_UnfoldLess = __toESM(require("@mui/icons-material/UnfoldLess"), 1);
4320
4319
  var import_react_router_dom2 = require("react-router-dom");
4321
4320
  var import_colors = require("@mui/material/colors");
4321
+
4322
+ // src/utils/menuInicial.ts
4323
+ function rutaDeItemDeMenu(item) {
4324
+ if (item.menuType === "table") {
4325
+ const consulta = new URLSearchParams();
4326
+ if (item.td) consulta.append("td", JSON.stringify(item.td));
4327
+ if (item.fc) consulta.append("fc", JSON.stringify(item.fc));
4328
+ return `/menu/${item.name}${consulta.size ? `?${consulta.toString()}` : ""}`;
4329
+ }
4330
+ if (item.menuType === "proc") return `/procedures/${item.name}`;
4331
+ if (wScreens[item.menuType] !== void 0) return `/wScreens/${item.menuType}`;
4332
+ console.warn(`Menu type '${item.menuType}' no reconocido o WScreen no mapeada.`);
4333
+ return `/wScreens-fallback/${item.menuType}`;
4334
+ }
4335
+ function itemInicial(menu) {
4336
+ const elegido = menu.find((item) => item.selectedByDefault);
4337
+ if (!elegido) return void 0;
4338
+ return elegido.menuType === "menu" ? itemInicial(elegido.menuContent) : elegido;
4339
+ }
4340
+
4341
+ // src/components/SideMenu.tsx
4322
4342
  var import_jsx_runtime20 = require("react/jsx-runtime");
4323
4343
  var MenuListItem = ({ item, level, onMenuItemClick }) => {
4324
4344
  const navigate = (0, import_react_router_dom2.useNavigate)();
@@ -4329,29 +4349,7 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
4329
4349
  if (item.menuType === "menu") {
4330
4350
  dispatch(toggleSubMenu(item.name));
4331
4351
  } else {
4332
- let path = "";
4333
- const queryParams = new URLSearchParams();
4334
- if (item.menuType === "table") {
4335
- path = `/menu/${item.name}`;
4336
- if (item.td) queryParams.append("td", JSON.stringify(item.td));
4337
- if (item.fc) queryParams.append("fc", JSON.stringify(item.fc));
4338
- if (queryParams.toString()) {
4339
- path = `${path}?${queryParams.toString()}`;
4340
- }
4341
- } else if (item.menuType === "proc") {
4342
- path = `/procedures/${item.name}`;
4343
- } else {
4344
- const WScreenComponent = wScreens[item.menuType];
4345
- if (WScreenComponent !== void 0) {
4346
- path = `/wScreens/${item.menuType}`;
4347
- } else {
4348
- path = `/wScreens-fallback/${item.menuType}`;
4349
- console.warn(`Menu type '${item.menuType}' no reconocido o WScreen no mapeada.`);
4350
- }
4351
- }
4352
- if (path) {
4353
- navigate(path);
4354
- }
4352
+ navigate(rutaDeItemDeMenu(item));
4355
4353
  if (onMenuItemClick) {
4356
4354
  onMenuItemClick();
4357
4355
  }
@@ -4424,19 +4422,12 @@ var SideMenu = ({ onMenuItemClick }) => {
4424
4422
  const allSubMenusKeys = Object.keys(subMenuOpenStates);
4425
4423
  const openSubMenusCount = allSubMenusKeys.filter((key) => subMenuOpenStates[key]).length;
4426
4424
  const isMostlyOpen = allSubMenusKeys.length > 0 && openSubMenusCount / allSubMenusKeys.length > 0.5;
4427
- const handleHomeClick = () => {
4428
- navigate("/home");
4429
- if (onMenuItemClick) {
4430
- onMenuItemClick();
4431
- }
4432
- };
4433
4425
  const handleToggleAllSubMenus = () => {
4434
4426
  dispatch(setAllSubMenusOpen(!isMostlyOpen));
4435
4427
  };
4436
4428
  if (!clientContext || !clientContext.menu) {
4437
4429
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Typography, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
4438
4430
  }
4439
- const isHomeSelected = location.pathname === "/home";
4440
4431
  (0, import_react24.useEffect)(() => {
4441
4432
  if (!clientContext?.menu) return;
4442
4433
  const expandParents = (items, targetPath, parentNames = []) => {
@@ -4472,22 +4463,15 @@ var SideMenu = ({ onMenuItemClick }) => {
4472
4463
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
4473
4464
  ] }) }),
4474
4465
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Divider, {}),
4475
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.List, { children: [
4476
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItem, { disablePadding: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.ListItemButton, { onClick: handleHomeClick, selected: isHomeSelected, children: [
4477
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItemIcon, { sx: { minWidth: "38px" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Home.default, {}) }),
4478
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItemText, { primary: "Inicio" })
4479
- ] }) }),
4480
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Divider, {}),
4481
- clientContext.menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4482
- MenuListItem,
4483
- {
4484
- item: menuItem,
4485
- level: 1,
4486
- onMenuItemClick
4487
- },
4488
- menuItem.name
4489
- ))
4490
- ] })
4466
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.List, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
4467
+ MenuListItem,
4468
+ {
4469
+ item: menuItem,
4470
+ level: 1,
4471
+ onMenuItemClick
4472
+ },
4473
+ menuItem.name
4474
+ )) })
4491
4475
  ] });
4492
4476
  };
4493
4477
  var SideMenu_default = SideMenu;
@@ -4546,7 +4530,6 @@ var MainLayout = () => {
4546
4530
  if (!clientContext) {
4547
4531
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Typography, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
4548
4532
  }
4549
- const appBarOffset = theme.mixins.toolbar;
4550
4533
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", height: "100vh" }, children: [
4551
4534
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.CssBaseline, {}),
4552
4535
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -4650,7 +4633,7 @@ var MainLayout = () => {
4650
4633
  ]
4651
4634
  }
4652
4635
  ),
4653
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4636
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4654
4637
  import_material17.Box,
4655
4638
  {
4656
4639
  component: "main",
@@ -4670,15 +4653,16 @@ var MainLayout = () => {
4670
4653
  },
4671
4654
  minWidth: 0,
4672
4655
  flexShrink: 0,
4673
- // Asegúrate de que el paddingTop sea suficiente para la AppBar
4674
- paddingTop: `${appBarOffset.minHeight}px`,
4675
4656
  height: "100%",
4676
4657
  boxSizing: "border-box",
4677
4658
  display: "flex",
4678
4659
  flexDirection: "column",
4679
4660
  width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
4680
4661
  },
4681
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_router_dom4.Outlet, {})
4662
+ children: [
4663
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Toolbar, {}),
4664
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_router_dom4.Outlet, {}) })
4665
+ ]
4682
4666
  }
4683
4667
  )
4684
4668
  ] });
@@ -4736,28 +4720,26 @@ var SessionExpiredMessage = () => {
4736
4720
  };
4737
4721
  var SessionExpiredMessage_default = SessionExpiredMessage;
4738
4722
 
4739
- // src/pages/HomePage.tsx
4740
- var import_material19 = require("@mui/material");
4723
+ // src/pages/PantallaInicial.tsx
4724
+ var import_react_router_dom5 = require("react-router-dom");
4741
4725
  var import_jsx_runtime23 = require("react/jsx-runtime");
4742
- var HomePage = () => {
4726
+ var PantallaInicial = () => {
4743
4727
  const { clientContext } = useApp();
4744
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { p: 3 }, children: [
4745
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { variant: "h4", component: "h1", gutterBottom: true, children: `Bienvenido/a ${clientContext?.username}` }),
4746
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { variant: "body1", children: "Usa el men\xFA lateral para navegar por las diferentes secciones." })
4747
- ] });
4728
+ const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
4729
+ return item ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_router_dom5.Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
4748
4730
  };
4749
- var HomePage_default = HomePage;
4731
+ var PantallaInicial_default = PantallaInicial;
4750
4732
 
4751
4733
  // src/pages/LogoutPage.tsx
4752
4734
  var import_react27 = require("react");
4753
- var import_material20 = require("@mui/material");
4735
+ var import_material19 = require("@mui/material");
4754
4736
  var import_jsx_runtime24 = require("react/jsx-runtime");
4755
4737
  var LogoutPage = () => {
4756
4738
  const logout = useLogout_default();
4757
4739
  (0, import_react27.useEffect)(() => {
4758
4740
  logout();
4759
4741
  }, [logout]);
4760
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: {
4742
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material19.Box, { sx: {
4761
4743
  display: "flex",
4762
4744
  flexDirection: "column",
4763
4745
  justifyContent: "center",
@@ -4765,19 +4747,18 @@ var LogoutPage = () => {
4765
4747
  height: "100vh",
4766
4748
  textAlign: "center"
4767
4749
  }, children: [
4768
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CircularProgress, { size: 60 }),
4769
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
4750
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.CircularProgress, { size: 60 }),
4751
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
4770
4752
  ] });
4771
4753
  };
4772
4754
  var LogoutPage_default = LogoutPage;
4773
4755
 
4774
4756
  // src/pages/LoginPage.tsx
4775
4757
  var import_react28 = require("react");
4776
- var import_material21 = require("@mui/material");
4758
+ var import_material20 = require("@mui/material");
4777
4759
  var import_react_hook_form = require("react-hook-form");
4778
4760
  var import_zod = require("@hookform/resolvers/zod");
4779
4761
  var z = __toESM(require("zod"), 1);
4780
- var import_react_router_dom5 = require("react-router-dom");
4781
4762
  var import_react_redux4 = require("react-redux");
4782
4763
  var import_jsx_runtime25 = require("react/jsx-runtime");
4783
4764
  var loginSchema = z.object({
@@ -4787,7 +4768,6 @@ var loginSchema = z.object({
4787
4768
  // Añadir validación básica
4788
4769
  });
4789
4770
  var LoginPage = () => {
4790
- const navigate = (0, import_react_router_dom5.useNavigate)();
4791
4771
  const [loginError, setLoginError] = (0, import_react28.useState)(null);
4792
4772
  const [isSubmitting, setIsSubmitting] = (0, import_react28.useState)(false);
4793
4773
  const { setIsLoggedIn, checkSession } = useApp();
@@ -4825,7 +4805,6 @@ var LoginPage = () => {
4825
4805
  setIsLoggedIn(true);
4826
4806
  await dispatch(fetchClientContext()).unwrap();
4827
4807
  console.log("Login exitoso y clientContext cargado.");
4828
- navigate("/home");
4829
4808
  reset();
4830
4809
  } catch (error) {
4831
4810
  console.error("Error al iniciar sesi\xF3n:", error);
@@ -4836,7 +4815,7 @@ var LoginPage = () => {
4836
4815
  }
4837
4816
  };
4838
4817
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4839
- import_material21.Box,
4818
+ import_material20.Box,
4840
4819
  {
4841
4820
  display: "flex",
4842
4821
  alignItems: "center",
@@ -4844,7 +4823,7 @@ var LoginPage = () => {
4844
4823
  minHeight: "100vh",
4845
4824
  bgcolor: "#f5f5f5",
4846
4825
  children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4847
- import_material21.Box,
4826
+ import_material20.Box,
4848
4827
  {
4849
4828
  width: "100%",
4850
4829
  maxWidth: "400px",
@@ -4853,7 +4832,7 @@ var LoginPage = () => {
4853
4832
  borderRadius: 8,
4854
4833
  boxShadow: 3,
4855
4834
  children: [
4856
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4835
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4857
4836
  "img",
4858
4837
  {
4859
4838
  src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
@@ -4861,17 +4840,17 @@ var LoginPage = () => {
4861
4840
  style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
4862
4841
  }
4863
4842
  ) }),
4864
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
4843
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
4865
4844
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
4866
4845
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
4867
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
4846
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
4868
4847
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4869
4848
  import_react_hook_form.Controller,
4870
4849
  {
4871
4850
  name: "username",
4872
4851
  control,
4873
4852
  render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4874
- import_material21.TextField,
4853
+ import_material20.TextField,
4875
4854
  {
4876
4855
  ...field,
4877
4856
  type: "text",
@@ -4887,14 +4866,14 @@ var LoginPage = () => {
4887
4866
  )
4888
4867
  ] }),
4889
4868
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
4890
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
4869
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
4891
4870
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4892
4871
  import_react_hook_form.Controller,
4893
4872
  {
4894
4873
  name: "password",
4895
4874
  control,
4896
4875
  render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4897
- import_material21.TextField,
4876
+ import_material20.TextField,
4898
4877
  {
4899
4878
  ...field,
4900
4879
  type: "password",
@@ -4909,14 +4888,14 @@ var LoginPage = () => {
4909
4888
  }
4910
4889
  )
4911
4890
  ] }),
4912
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4913
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.CircularProgress, { size: 20, sx: { mr: 1 } }),
4891
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4892
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.CircularProgress, { size: 20, sx: { mr: 1 } }),
4914
4893
  "Iniciando sesi\xF3n..."
4915
4894
  ] }) : "Iniciar Sesi\xF3n" })
4916
4895
  ] }),
4917
- loginError && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
4896
+ loginError && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material20.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
4918
4897
  " ",
4919
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.AlertTitle, { children: "Error" }),
4898
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.AlertTitle, { children: "Error" }),
4920
4899
  loginError
4921
4900
  ] })
4922
4901
  ]
@@ -4930,17 +4909,17 @@ var LoginPage_default = LoginPage;
4930
4909
  // src/components/ProcedureForm.tsx
4931
4910
  var import_react29 = __toESM(require("react"), 1);
4932
4911
  var import_react_router_dom6 = require("react-router-dom");
4933
- var import_material23 = require("@mui/material");
4912
+ var import_material22 = require("@mui/material");
4934
4913
 
4935
4914
  // src/pages/procedure-results/SuccessDisplay.tsx
4936
- var import_material22 = require("@mui/material");
4915
+ var import_material21 = require("@mui/material");
4937
4916
  var import_jsx_runtime26 = require("react/jsx-runtime");
4938
4917
  var SuccessDisplay = ({ data }) => {
4939
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material22.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
4940
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material22.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
4941
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material22.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
4942
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material22.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
4943
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material22.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
4918
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
4919
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
4920
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
4921
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
4922
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
4944
4923
  ] });
4945
4924
  };
4946
4925
  var SuccessDisplay_default = SuccessDisplay;
@@ -5169,10 +5148,10 @@ var ProcedureForm = () => {
5169
5148
  sx: { fontSize: "0.8rem" }
5170
5149
  };
5171
5150
  if (param.options && param.options.length > 0) {
5172
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
5173
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
5151
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
5152
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
5174
5153
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5175
- import_material23.Select,
5154
+ import_material22.Select,
5176
5155
  {
5177
5156
  labelId: `${param.name}-label`,
5178
5157
  value: formValues[param.name] === void 0 ? "" : formValues[param.name],
@@ -5182,14 +5161,14 @@ var ProcedureForm = () => {
5182
5161
  label: param.label || param.name,
5183
5162
  disabled: apiLoading,
5184
5163
  sx: { fontSize: "0.8rem" },
5185
- renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
5164
+ renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
5186
5165
  children: [
5187
- (!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("em", { children: "Seleccione..." }) }),
5188
- param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
5166
+ (!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("em", { children: "Seleccione..." }) }),
5167
+ param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
5189
5168
  ]
5190
5169
  }
5191
5170
  ),
5192
- (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5171
+ (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5193
5172
  ] });
5194
5173
  }
5195
5174
  switch (param.typeName) {
@@ -5198,19 +5177,19 @@ var ProcedureForm = () => {
5198
5177
  case "tsrange":
5199
5178
  case "time_range":
5200
5179
  case "daterange":
5201
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5180
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5202
5181
  case "decimal":
5203
5182
  case "double":
5204
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5183
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5205
5184
  case "integer":
5206
5185
  case "bigint":
5207
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5186
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5208
5187
  case "boolean":
5209
5188
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5210
- import_material23.FormControlLabel,
5189
+ import_material22.FormControlLabel,
5211
5190
  {
5212
5191
  control: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5213
- import_material23.Checkbox,
5192
+ import_material22.Checkbox,
5214
5193
  {
5215
5194
  checked: !!formValues[param.name],
5216
5195
  onChange: handleChange,
@@ -5220,20 +5199,20 @@ var ProcedureForm = () => {
5220
5199
  size: "small"
5221
5200
  }
5222
5201
  ),
5223
- label: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
5202
+ label: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
5224
5203
  sx: { mt: 1, mb: 0 }
5225
5204
  }
5226
5205
  );
5227
5206
  case "date":
5228
5207
  case "timestamp":
5229
5208
  case "time":
5230
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
5209
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
5231
5210
  case "jsonb":
5232
5211
  case "jsona":
5233
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
5212
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
5234
5213
  case "bytea":
5235
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
5236
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Typography, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
5214
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
5215
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
5237
5216
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5238
5217
  "input",
5239
5218
  {
@@ -5248,10 +5227,10 @@ var ProcedureForm = () => {
5248
5227
  style: { padding: "6px 0", fontSize: "0.8rem" }
5249
5228
  }
5250
5229
  ),
5251
- (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5230
+ (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5252
5231
  ] });
5253
5232
  default:
5254
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5233
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5255
5234
  }
5256
5235
  }, [formValues, handleChange, apiLoading, validationErrors]);
5257
5236
  const ResultDisplayContent = (0, import_react29.useMemo)(() => {
@@ -5260,13 +5239,13 @@ var ProcedureForm = () => {
5260
5239
  if (ComponentToRender) {
5261
5240
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComponentToRender, { data: procedureResultData });
5262
5241
  } else {
5263
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
5264
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
5242
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
5243
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
5265
5244
  "el componente para resolver el resultOk: '",
5266
5245
  procedure.resultOk,
5267
5246
  "' definido en el procedure no existe o no est\xE1 mapeado."
5268
5247
  ] }),
5269
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Box, { sx: {
5248
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Box, { sx: {
5270
5249
  bgcolor: "warning.dark",
5271
5250
  p: 1,
5272
5251
  borderRadius: 1
@@ -5275,7 +5254,7 @@ var ProcedureForm = () => {
5275
5254
  }
5276
5255
  }, [procedureResultData, procedure]);
5277
5256
  if (!procedure) {
5278
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.Box, { sx: {
5257
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: {
5279
5258
  p: 2,
5280
5259
  width: "100%",
5281
5260
  boxSizing: "border-box",
@@ -5285,13 +5264,13 @@ var ProcedureForm = () => {
5285
5264
  boxShadow: 3,
5286
5265
  textAlign: "center"
5287
5266
  }, children: [
5288
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.CircularProgress, { sx: { mb: 2 } }),
5289
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
5267
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.CircularProgress, { sx: { mb: 2 } }),
5268
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
5290
5269
  ] });
5291
5270
  }
5292
5271
  return (
5293
5272
  // Esta es la Box más externa que ahora controlará el scroll
5294
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.Box, { sx: {
5273
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: {
5295
5274
  p: 2,
5296
5275
  ml: 1,
5297
5276
  mt: 2,
@@ -5308,17 +5287,17 @@ var ProcedureForm = () => {
5308
5287
  overflowX: "hidden"
5309
5288
  // Oculta el scroll horizontal si no es necesario para el contenedor principal
5310
5289
  }, children: [
5311
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
5312
- Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
5290
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
5291
+ Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
5313
5292
  "Por favor, corrige los errores en el formulario antes de enviar.",
5314
5293
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { children: err }, idx)) })
5315
5294
  ] }),
5316
- !Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
5317
- !Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
5295
+ !Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
5296
+ !Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
5318
5297
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("form", { onSubmit: handleSubmit, children: [
5319
5298
  procedure.parameters.map((param) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: renderInputField(param) }, param.name)),
5320
5299
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5321
- import_material23.Button,
5300
+ import_material22.Button,
5322
5301
  {
5323
5302
  type: "submit",
5324
5303
  variant: "contained",
@@ -5326,20 +5305,20 @@ var ProcedureForm = () => {
5326
5305
  disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
5327
5306
  sx: { mt: 2 },
5328
5307
  size: "medium",
5329
- startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.CircularProgress, { size: 20, color: "inherit" }) : null,
5308
+ startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.CircularProgress, { size: 20, color: "inherit" }) : null,
5330
5309
  children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
5331
5310
  }
5332
5311
  )
5333
5312
  ] }),
5334
- ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.Box, { sx: { mt: 2 }, children: [
5313
+ ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: { mt: 2 }, children: [
5335
5314
  " ",
5336
5315
  ResultDisplayContent
5337
5316
  ] }),
5338
- executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material23.Box, { sx: { mt: 3 }, children: [
5339
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Divider, { sx: { mb: 2 } }),
5340
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material23.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
5317
+ executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: { mt: 3 }, children: [
5318
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Divider, { sx: { mb: 2 } }),
5319
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
5341
5320
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5342
- import_material23.Box,
5321
+ import_material22.Box,
5343
5322
  {
5344
5323
  sx: {
5345
5324
  bgcolor: "grey.100",
@@ -5353,7 +5332,7 @@ var ProcedureForm = () => {
5353
5332
  whiteSpace: "pre-wrap"
5354
5333
  },
5355
5334
  children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5356
- import_material23.Typography,
5335
+ import_material22.Typography,
5357
5336
  {
5358
5337
  component: "pre",
5359
5338
  sx: {
@@ -5375,7 +5354,7 @@ var ProcedureForm_default = ProcedureForm;
5375
5354
 
5376
5355
  // src/App.tsx
5377
5356
  var import_react_redux5 = require("react-redux");
5378
- var import_react38 = require("redux-persist/integration/react");
5357
+ var import_react40 = require("redux-persist/integration/react");
5379
5358
 
5380
5359
  // src/components/PrivateRoute.tsx
5381
5360
  var import_react30 = require("react");
@@ -5391,7 +5370,7 @@ var PrivateRoute = ({ children }) => {
5391
5370
  (0, import_react30.useEffect)(() => {
5392
5371
  console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
5393
5372
  if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login") {
5394
- const path = location.pathname + location.search;
5373
+ const path = location.pathname + location.search + location.hash;
5395
5374
  console.log(`[PrivateRoute] ACTION: Dispatching setRedirectPath(${path})`);
5396
5375
  dispatch(setRedirectPath(path));
5397
5376
  } else if (isAuthenticated) {
@@ -5438,9 +5417,9 @@ var InitialRedirectHandler = () => {
5438
5417
  navegandoRef.current = true;
5439
5418
  navigate(redirectPath);
5440
5419
  dispatch(setRedirectPath(null));
5441
- } else if (!navegandoRef.current && (location.pathname === "/login" || location.pathname === "/")) {
5442
- console.log("Usuario autenticado, redirigiendo a /home por defecto.");
5443
- navigate("/home");
5420
+ } else if (!navegandoRef.current && location.pathname === "/login") {
5421
+ console.log("Usuario autenticado, redirigiendo a la pantalla de inicio.");
5422
+ navigate("/");
5444
5423
  }
5445
5424
  }
5446
5425
  }, [clientContextStatus, redirectPath, location.pathname, navigate, dispatch]);
@@ -5451,7 +5430,7 @@ var InitialRedirectHandler_default = InitialRedirectHandler;
5451
5430
  // src/pages/GenericDataGridPage.tsx
5452
5431
  var import_react32 = __toESM(require("react"), 1);
5453
5432
  var import_react_router_dom9 = require("react-router-dom");
5454
- var import_material24 = require("@mui/material");
5433
+ var import_material23 = require("@mui/material");
5455
5434
  var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
5456
5435
  var import_jsx_runtime29 = require("react/jsx-runtime");
5457
5436
  var GenericDataGridPage = ({
@@ -5499,21 +5478,21 @@ var GenericDataGridPage = ({
5499
5478
  else if (activeTabIdx === index) setActiveTabIdx(index - 1);
5500
5479
  };
5501
5480
  if (!effectiveTableName) {
5502
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
5481
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
5503
5482
  }
5504
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material24.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
5505
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5506
- import_material24.Tab,
5483
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
5484
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5485
+ import_material23.Tab,
5507
5486
  {
5508
- label: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material24.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
5509
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
5510
- index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Close2.default, { fontSize: "inherit" }) })
5487
+ label: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
5488
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
5489
+ index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Close2.default, { fontSize: "inherit" }) })
5511
5490
  ] })
5512
5491
  },
5513
5492
  tab.id
5514
5493
  )) }) }),
5515
5494
  tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5516
- import_material24.Box,
5495
+ import_material23.Box,
5517
5496
  {
5518
5497
  role: "tabpanel",
5519
5498
  hidden: activeTabIdx !== index,
@@ -5537,19 +5516,19 @@ var GenericDataGridPage_default = GenericDataGridPage;
5537
5516
  // src/pages/PantallaDeRuta.tsx
5538
5517
  var import_react33 = require("react");
5539
5518
  var import_react_router_dom10 = require("react-router-dom");
5540
- var import_material25 = require("@mui/material");
5519
+ var import_material24 = require("@mui/material");
5541
5520
  var import_jsx_runtime30 = require("react/jsx-runtime");
5542
5521
  var PantallaDeRuta = ({ screenName }) => {
5543
5522
  const [busqueda] = (0, import_react_router_dom10.useSearchParams)();
5544
5523
  const params = (0, import_react33.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
5545
5524
  const Pantalla = wScreens[screenName];
5546
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FallbackWScreen, { screenName }) });
5525
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FallbackWScreen, { screenName }) });
5547
5526
  };
5548
5527
 
5549
5528
  // src/pages/MenuTablePage.tsx
5550
5529
  var import_react34 = require("react");
5551
5530
  var import_react_router_dom11 = require("react-router-dom");
5552
- var import_material26 = require("@mui/material");
5531
+ var import_material25 = require("@mui/material");
5553
5532
  var import_jsx_runtime31 = require("react/jsx-runtime");
5554
5533
  function fixedFieldsDeMenu(ff) {
5555
5534
  if (!ff) return [];
@@ -5591,9 +5570,9 @@ var MenuTablePage = () => {
5591
5570
  };
5592
5571
  }, [menuName, clientContext]);
5593
5572
  if (!currentTableName) {
5594
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material26.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material26.Alert, { severity: "error", children: [
5595
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material26.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
5596
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material26.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
5573
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Alert, { severity: "error", children: [
5574
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
5575
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
5597
5576
  ] }) });
5598
5577
  }
5599
5578
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
@@ -5607,7 +5586,7 @@ var MenuTablePage = () => {
5607
5586
  var MenuTablePage_default = MenuTablePage;
5608
5587
 
5609
5588
  // src/puente/PantallaBP.tsx
5610
- var import_react35 = require("react");
5589
+ var import_react36 = require("react");
5611
5590
  var import_react_router_dom12 = require("react-router-dom");
5612
5591
  var import_material27 = require("@mui/material");
5613
5592
 
@@ -5639,6 +5618,28 @@ function cargarScript(ruta) {
5639
5618
  document.head.appendChild(script);
5640
5619
  });
5641
5620
  }
5621
+ function esperarCargaDeVentana() {
5622
+ if (document.readyState === "complete") return Promise.resolve();
5623
+ return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
5624
+ }
5625
+ async function sinEscuchasDeVentana(tipos, inyectar) {
5626
+ const original = window.addEventListener;
5627
+ const filtrada = function(tipo, escucha, opciones) {
5628
+ if (tipos.includes(tipo)) return;
5629
+ original.call(this, tipo, escucha, opciones);
5630
+ };
5631
+ window.addEventListener = filtrada;
5632
+ try {
5633
+ return await inyectar();
5634
+ } finally {
5635
+ if (window.addEventListener === filtrada) window.addEventListener = original;
5636
+ }
5637
+ }
5638
+ async function cargarScripts(rutas) {
5639
+ for (const ruta of rutas) {
5640
+ await cargarScript(ruta);
5641
+ }
5642
+ }
5642
5643
  var carga = null;
5643
5644
  function cargarClienteBP(urlBackend) {
5644
5645
  if (!carga) {
@@ -5666,9 +5667,8 @@ async function cargarSinMemoria(urlBackend) {
5666
5667
  enlace.href = ruta;
5667
5668
  document.head.appendChild(enlace);
5668
5669
  });
5669
- for (const ruta of recursos.scripts) {
5670
- await cargarScript(ruta);
5671
- }
5670
+ await esperarCargaDeVentana();
5671
+ await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
5672
5672
  const myOwn = window.myOwn;
5673
5673
  if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
5674
5674
  window.my = myOwn;
@@ -5676,6 +5676,81 @@ async function cargarSinMemoria(urlBackend) {
5676
5676
  return myOwn;
5677
5677
  }
5678
5678
 
5679
+ // src/puente/ConsolaBP.tsx
5680
+ var import_react35 = require("react");
5681
+ var import_material26 = require("@mui/material");
5682
+ var import_jsx_runtime32 = require("react/jsx-runtime");
5683
+ var MARGEN_DE_REPETIDO_MS = 1e3;
5684
+ function descartarRepetidos(consola, agregados, ahora) {
5685
+ for (const nodo of agregados) {
5686
+ if (!(nodo instanceof HTMLElement)) continue;
5687
+ const repetido = Array.from(consola.children).find(
5688
+ (otro) => otro instanceof HTMLElement && otro !== nodo && otro.className === nodo.className && otro.textContent === nodo.textContent && ahora - Number(otro.dataset.instante) < MARGEN_DE_REPETIDO_MS
5689
+ );
5690
+ if (repetido) nodo.remove();
5691
+ else nodo.dataset.instante = String(ahora);
5692
+ }
5693
+ }
5694
+ var ConsolaBP = () => {
5695
+ (0, import_react35.useEffect)(() => {
5696
+ const consola = document.getElementById("mini-console");
5697
+ if (!consola) return;
5698
+ const observador = new MutationObserver(
5699
+ (registros) => descartarRepetidos(consola, registros.flatMap((registro) => Array.from(registro.addedNodes)), Date.now())
5700
+ );
5701
+ observador.observe(consola, { childList: true });
5702
+ return () => observador.disconnect();
5703
+ }, []);
5704
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5705
+ import_material26.Box,
5706
+ {
5707
+ id: "mini-console",
5708
+ sx: (tema) => ({
5709
+ "&#mini-console": {
5710
+ position: "fixed",
5711
+ top: { xs: 64, sm: 72 },
5712
+ left: "auto",
5713
+ right: 16,
5714
+ bottom: "auto",
5715
+ float: "none",
5716
+ zIndex: tema.zIndex.snackbar,
5717
+ width: "auto",
5718
+ minWidth: 0,
5719
+ maxWidth: "min(480px, calc(100vw - 32px))",
5720
+ minHeight: 0,
5721
+ maxHeight: "none",
5722
+ overflow: "visible",
5723
+ padding: 0,
5724
+ border: "none",
5725
+ borderRadius: 0,
5726
+ boxShadow: "none",
5727
+ backgroundColor: "transparent",
5728
+ fontSize: "inherit",
5729
+ display: "flex",
5730
+ flexDirection: "column",
5731
+ gap: 1
5732
+ },
5733
+ "&#mini-console:not(:empty)": { display: "flex" },
5734
+ "&#mini-console:empty": { display: "none" },
5735
+ "& > div": {
5736
+ p: "6px 12px",
5737
+ borderRadius: 1,
5738
+ boxShadow: tema.shadows[3],
5739
+ fontSize: "0.875rem",
5740
+ whiteSpace: "pre-wrap",
5741
+ overflowWrap: "anywhere",
5742
+ backgroundColor: tema.palette.grey[800],
5743
+ color: tema.palette.common.white
5744
+ },
5745
+ "& > .status-error": {
5746
+ backgroundColor: tema.palette.error.main,
5747
+ color: tema.palette.error.contrastText
5748
+ }
5749
+ })
5750
+ }
5751
+ );
5752
+ };
5753
+
5679
5754
  // src/puente/pantallaDeBP.ts
5680
5755
  var RUTA_PANTALLA_BP = "/bp/menu";
5681
5756
  function rutaDePantallaBP(nombre, parametros = "") {
@@ -5715,40 +5790,6 @@ function resolverPantallaBP(myOwn, nombre, contenedor) {
5715
5790
  return null;
5716
5791
  }
5717
5792
 
5718
- // src/puente/capturaDeNavegacion.ts
5719
- function apiDeNavegacion() {
5720
- const api = Reflect.get(window, "navigation");
5721
- return typeof api === "object" && api !== null && "addEventListener" in api && typeof api.addEventListener === "function" ? api : null;
5722
- }
5723
- function capturarNavegacionBP(urlBackend, navegar) {
5724
- const alHacerClick = (evento) => {
5725
- if (evento.defaultPrevented || evento.button !== 0 || evento.ctrlKey || evento.metaKey || evento.shiftKey) return;
5726
- const enlace = evento.target instanceof Element ? evento.target.closest("a[href]") : null;
5727
- if (!enlace || enlace.hasAttribute("download") || (enlace.getAttribute("target") ?? "_self") !== "_self") return;
5728
- const ruta = rutaDeEnlaceBP(enlace.getAttribute("href") ?? "", document.baseURI, urlBackend);
5729
- if (ruta) {
5730
- evento.preventDefault();
5731
- evento.stopPropagation();
5732
- navegar(ruta);
5733
- }
5734
- };
5735
- document.addEventListener("click", alHacerClick, true);
5736
- const navegacion = apiDeNavegacion();
5737
- const alNavegar = (evento) => {
5738
- if (!evento.cancelable || evento.destination.sameDocument || evento.downloadRequest !== null) return;
5739
- const ruta = rutaDeEnlaceBP(evento.destination.url, document.baseURI, urlBackend);
5740
- if (ruta) {
5741
- evento.preventDefault();
5742
- navegar(ruta);
5743
- }
5744
- };
5745
- navegacion?.addEventListener("navigate", alNavegar);
5746
- return () => {
5747
- document.removeEventListener("click", alHacerClick, true);
5748
- navegacion?.removeEventListener("navigate", alNavegar);
5749
- };
5750
- }
5751
-
5752
5793
  // src/puente/habilitacion.ts
5753
5794
  var habilitado = false;
5754
5795
  var habilitarPuenteBP = () => {
@@ -5757,7 +5798,7 @@ var habilitarPuenteBP = () => {
5757
5798
  var puenteBPHabilitado = () => habilitado;
5758
5799
 
5759
5800
  // src/puente/PantallaBP.tsx
5760
- var import_jsx_runtime32 = require("react/jsx-runtime");
5801
+ var import_jsx_runtime33 = require("react/jsx-runtime");
5761
5802
  function buscarItemDeMenu(items, tipo) {
5762
5803
  for (const item of items) {
5763
5804
  if (item.menuType === tipo) return item;
@@ -5769,21 +5810,19 @@ function buscarItemDeMenu(items, tipo) {
5769
5810
  return void 0;
5770
5811
  }
5771
5812
  var PantallaBP = ({ nombre, direccion }) => {
5772
- const navigate = (0, import_react_router_dom12.useNavigate)();
5773
5813
  const { clientContext } = useApp();
5774
- const [cargando, setCargando] = (0, import_react35.useState)(true);
5775
- const [error, setError] = (0, import_react35.useState)(null);
5776
- const [noExiste, setNoExiste] = (0, import_react35.useState)(false);
5777
- const contenedor = (0, import_react35.useRef)(null);
5814
+ const [cargando, setCargando] = (0, import_react36.useState)(true);
5815
+ const [error, setError] = (0, import_react36.useState)(null);
5816
+ const [noExiste, setNoExiste] = (0, import_react36.useState)(false);
5817
+ const contenedor = (0, import_react36.useRef)(null);
5778
5818
  const menu = clientContext.menu;
5779
- (0, import_react35.useEffect)(() => {
5819
+ (0, import_react36.useEffect)(() => {
5780
5820
  const elemento = contenedor.current;
5781
5821
  if (!elemento) return;
5782
5822
  let vigente = true;
5783
5823
  setError(null);
5784
5824
  setNoExiste(false);
5785
5825
  setCargando(true);
5786
- const dejarDeCapturar = capturarNavegacionBP(envConfig.backendUrl, navigate);
5787
5826
  cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
5788
5827
  if (!vigente) return;
5789
5828
  setCargando(false);
@@ -5805,49 +5844,55 @@ var PantallaBP = ({ nombre, direccion }) => {
5805
5844
  });
5806
5845
  return () => {
5807
5846
  vigente = false;
5808
- dejarDeCapturar();
5809
5847
  elemento.replaceChildren();
5810
5848
  };
5811
- }, [nombre, direccion, menu, navigate]);
5812
- if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FallbackWScreen, { screenName: nombre });
5813
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material27.Box, { children: [
5814
- cargando && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material27.CircularProgress, { size: 24, sx: { m: 2 } }),
5815
- error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material27.Alert, { severity: "error", sx: { m: 2 }, children: error }),
5816
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: "main_layout", ref: contenedor })
5817
- ] });
5849
+ }, [nombre, direccion, menu]);
5850
+ if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FallbackWScreen, { screenName: nombre });
5851
+ return (
5852
+ // el indicador de carga flota: si ocupara lugar, el contenido de backend-plus empezaría más abajo mientras carga y subiría al terminar
5853
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material27.Box, { sx: { position: "relative" }, children: [
5854
+ cargando && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
5855
+ error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Alert, { severity: "error", sx: { m: 2 }, children: error }),
5856
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "main_layout", ref: contenedor }),
5857
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ConsolaBP, {})
5858
+ ] })
5859
+ );
5818
5860
  };
5819
5861
  var PantallaDeRespaldo = () => {
5820
5862
  const { screenName = "" } = (0, import_react_router_dom12.useParams)();
5821
5863
  const { search } = (0, import_react_router_dom12.useLocation)();
5822
5864
  if (!puenteBPHabilitado()) {
5823
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material27.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FallbackWScreen, { screenName }) });
5865
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FallbackWScreen, { screenName }) });
5824
5866
  }
5825
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_router_dom12.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
5867
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_router_dom12.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
5826
5868
  };
5827
5869
  var PaginaBP = () => {
5828
5870
  const { hash, search } = (0, import_react_router_dom12.useLocation)();
5829
5871
  const direccion = hash || search;
5830
5872
  const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
5831
- if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_router_dom12.Navigate, { to: "/", replace: true });
5832
- if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material27.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material27.Alert, { severity: "warning", children: [
5873
+ if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_router_dom12.Navigate, { to: "/", replace: true });
5874
+ if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material27.Alert, { severity: "warning", children: [
5833
5875
  "Falta la pantalla de backend-plus (",
5834
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "#w=..." }),
5876
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("code", { children: "#w=..." }),
5835
5877
  ")."
5836
5878
  ] }) });
5837
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PantallaBP, { nombre, direccion }, nombre);
5879
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PantallaBP, { nombre, direccion }, nombre);
5838
5880
  };
5839
5881
 
5840
5882
  // src/puente/GrillaBP.tsx
5841
- var import_react36 = require("react");
5883
+ var import_react37 = require("react");
5842
5884
  var import_react_router_dom13 = require("react-router-dom");
5843
5885
  var import_material28 = require("@mui/material");
5844
- var import_jsx_runtime33 = require("react/jsx-runtime");
5886
+ var import_jsx_runtime34 = (
5887
+ // el indicador de carga flota: si ocupara lugar, el contenido de backend-plus empezaría más abajo mientras carga y subiría al terminar
5888
+ require("react/jsx-runtime")
5889
+ );
5845
5890
  var GrillaBP = ({ tabla, fixedFields }) => {
5846
- const contenedor = (0, import_react36.useRef)(null);
5847
- const [cargando, setCargando] = (0, import_react36.useState)(true);
5848
- const [error, setError] = (0, import_react36.useState)(null);
5891
+ const contenedor = (0, import_react37.useRef)(null);
5892
+ const [cargando, setCargando] = (0, import_react37.useState)(true);
5893
+ const [error, setError] = (0, import_react37.useState)(null);
5849
5894
  const clave = JSON.stringify(fixedFields ?? []);
5850
- (0, import_react36.useEffect)(() => {
5895
+ (0, import_react37.useEffect)(() => {
5851
5896
  const elemento = contenedor.current;
5852
5897
  if (!elemento) return;
5853
5898
  let vigente = true;
@@ -5868,68 +5913,121 @@ var GrillaBP = ({ tabla, fixedFields }) => {
5868
5913
  elemento.replaceChildren();
5869
5914
  };
5870
5915
  }, [tabla, clave]);
5871
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material28.Box, { children: [
5872
- cargando && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material28.CircularProgress, { size: 24, sx: { m: 2 } }),
5873
- error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material28.Alert, { severity: "error", sx: { m: 2 }, children: error }),
5874
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref: contenedor })
5916
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material28.Box, { sx: { position: "relative" }, children: [
5917
+ cargando && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
5918
+ error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Alert, { severity: "error", sx: { m: 2 }, children: error }),
5919
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: contenedor }),
5920
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ConsolaBP, {})
5875
5921
  ] });
5876
5922
  };
5877
5923
  var PaginaGrillaBP = () => {
5878
5924
  const { tableName = "" } = (0, import_react_router_dom13.useParams)();
5879
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GrillaBP, { tabla: tableName }, tableName);
5925
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(GrillaBP, { tabla: tableName }, tableName);
5926
+ };
5927
+
5928
+ // src/puente/CapturaBP.tsx
5929
+ var import_react38 = require("react");
5930
+ var import_react_router_dom14 = require("react-router-dom");
5931
+
5932
+ // src/puente/capturaDeNavegacion.ts
5933
+ function apiDeNavegacion() {
5934
+ const api = Reflect.get(window, "navigation");
5935
+ return typeof api === "object" && api !== null && "addEventListener" in api && typeof api.addEventListener === "function" ? api : null;
5936
+ }
5937
+ function capturarNavegacionBP(urlBackend, navegar) {
5938
+ const alHacerClick = (evento) => {
5939
+ if (evento.defaultPrevented || evento.button !== 0 || evento.ctrlKey || evento.metaKey || evento.shiftKey) return;
5940
+ const enlace = evento.target instanceof Element ? evento.target.closest("a[href]") : null;
5941
+ if (!enlace || enlace.hasAttribute("download") || (enlace.getAttribute("target") ?? "_self") !== "_self") return;
5942
+ const ruta = rutaDeEnlaceBP(enlace.getAttribute("href") ?? "", document.baseURI, urlBackend);
5943
+ if (ruta) {
5944
+ evento.preventDefault();
5945
+ evento.stopPropagation();
5946
+ navegar(ruta);
5947
+ }
5948
+ };
5949
+ document.addEventListener("click", alHacerClick, true);
5950
+ const navegacion = apiDeNavegacion();
5951
+ const alNavegar = (evento) => {
5952
+ if (!evento.cancelable || evento.destination.sameDocument || evento.downloadRequest !== null) return;
5953
+ const ruta = rutaDeEnlaceBP(evento.destination.url, document.baseURI, urlBackend);
5954
+ if (ruta) {
5955
+ evento.preventDefault();
5956
+ navegar(ruta);
5957
+ }
5958
+ };
5959
+ navegacion?.addEventListener("navigate", alNavegar);
5960
+ const reemplazarOriginal = history.replaceState;
5961
+ const reemplazar = (estado, titulo, url) => {
5962
+ const ruta = url === void 0 || url === null ? null : rutaDeEnlaceBP(String(url), document.baseURI, urlBackend);
5963
+ reemplazarOriginal.call(history, estado, titulo, ruta === null ? url : rutaBase + ruta);
5964
+ };
5965
+ history.replaceState = reemplazar;
5966
+ return () => {
5967
+ if (history.replaceState === reemplazar) history.replaceState = reemplazarOriginal;
5968
+ document.removeEventListener("click", alHacerClick, true);
5969
+ navegacion?.removeEventListener("navigate", alNavegar);
5970
+ };
5971
+ }
5972
+
5973
+ // src/puente/CapturaBP.tsx
5974
+ var CapturaBP = () => {
5975
+ const navigate = (0, import_react_router_dom14.useNavigate)();
5976
+ (0, import_react38.useEffect)(() => capturarNavegacionBP(envConfig.backendUrl, navigate), [navigate]);
5977
+ return null;
5880
5978
  };
5881
5979
 
5882
5980
  // src/App.tsx
5883
5981
  var import_type_store6 = __toESM(require("type-store"), 1);
5884
- var import_jsx_runtime34 = require("react/jsx-runtime");
5982
+ var import_jsx_runtime35 = require("react/jsx-runtime");
5885
5983
  var LocationTracker = () => {
5886
- const location = (0, import_react_router_dom14.useLocation)();
5984
+ const location = (0, import_react_router_dom15.useLocation)();
5887
5985
  const dispatch = useAppDispatch();
5888
- (0, import_react37.useEffect)(() => {
5986
+ (0, import_react39.useEffect)(() => {
5889
5987
  dispatch(setCurrentPath(location.pathname + location.search));
5890
5988
  }, [location, dispatch]);
5891
5989
  return null;
5892
5990
  };
5893
5991
  function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
5894
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
5895
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(InitialRedirectHandler_default, {}),
5896
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_router_dom14.Routes, { children: [
5897
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_router_dom14.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Outlet, {}), children: [
5898
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LoginPage_default, {}) }),
5899
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LogoutPage_default, {}) }),
5992
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
5993
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(InitialRedirectHandler_default, {}),
5994
+ puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CapturaBP, {}),
5995
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.Routes, { children: [
5996
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Outlet, {}), children: [
5997
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LoginPage_default, {}) }),
5998
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LogoutPage_default, {}) }),
5900
5999
  myUnloggedRoutes
5901
6000
  ] }),
5902
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_router_dom14.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layout, {}) }), children: [
5903
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(HomePage_default, {}) }),
5904
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/home", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(HomePage_default, {}) }),
5905
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(GenericDataGridPage_default, {}) }),
5906
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/menu/:menuName", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(MenuTablePage_default, {}) }),
5907
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ProcedureForm_default, {}) }),
5908
- Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5909
- import_react_router_dom14.Route,
6001
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Layout, {}) }), children: [
6002
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PantallaInicial_default, {}) }),
6003
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GenericDataGridPage_default, {}) }),
6004
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/menu/:menuName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MenuTablePage_default, {}) }),
6005
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ProcedureForm_default, {}) }),
6006
+ Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6007
+ import_react_router_dom15.Route,
5910
6008
  {
5911
6009
  path: `/wScreens/${screenName}`,
5912
- element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PantallaDeRuta, { screenName })
6010
+ element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PantallaDeRuta, { screenName })
5913
6011
  },
5914
6012
  screenName
5915
6013
  )),
5916
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PantallaDeRespaldo, {}) }),
5917
- puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaginaBP, {}) }),
5918
- puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PaginaGrillaBP, {}) }),
6014
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PantallaDeRespaldo, {}) }),
6015
+ puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaginaBP, {}) }),
6016
+ puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaginaGrillaBP, {}) }),
5919
6017
  myRoutes,
5920
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
6018
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
5921
6019
  ] }),
5922
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_router_dom14.Navigate, { to: "/", replace: true }) })
6020
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Navigate, { to: "/", replace: true }) })
5923
6021
  ] })
5924
6022
  ] });
5925
6023
  }
5926
6024
  var FrontendPlusProviders = ({ children, publicPaths }) => {
5927
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_redux5.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react38.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_router_dom14.BrowserRouter, { basename: rutaBase, children: [
5928
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LocationTracker, {}),
6025
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_redux5.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react40.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.BrowserRouter, { basename: rutaBase, children: [
6026
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LocationTracker, {}),
5929
6027
  " ",
5930
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(SnackbarProvider, { children: [
6028
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(SnackbarProvider, { children: [
5931
6029
  children,
5932
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SessionExpiredMessage_default, {})
6030
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SessionExpiredMessage_default, {})
5933
6031
  ] }) })
5934
6032
  ] }) }) });
5935
6033
  };
@@ -5943,7 +6041,7 @@ var App = ({
5943
6041
  myConditions,
5944
6042
  puenteBP
5945
6043
  }) => {
5946
- (0, import_react37.useMemo)(() => {
6044
+ (0, import_react39.useMemo)(() => {
5947
6045
  if (myClientSides) {
5948
6046
  extendClientSides(myClientSides);
5949
6047
  }
@@ -5960,7 +6058,7 @@ var App = ({
5960
6058
  habilitarPuenteBP();
5961
6059
  }
5962
6060
  }, [myClientSides, myResultsOk, myWScreens, myConditions, puenteBP]);
5963
- (0, import_react37.useEffect)(() => {
6061
+ (0, import_react39.useEffect)(() => {
5964
6062
  import_type_store6.default.messages = import_type_store6.default.i18n.messages.es;
5965
6063
  import_type_store6.default.locale = import_type_store6.default.i18n.locale.es;
5966
6064
  const link = document.querySelector("link[rel*='icon']") || document.createElement("link");
@@ -5969,11 +6067,11 @@ var App = ({
5969
6067
  link.href = `${envConfig.backendUrl}/img/logo-128.png`;
5970
6068
  document.getElementsByTagName("head")[0].appendChild(link);
5971
6069
  }, []);
5972
- const safePaths = import_react37.default.useMemo(() => {
6070
+ const safePaths = import_react39.default.useMemo(() => {
5973
6071
  const extracted = extractPathsFromRoutes(myUnloggedRoutes);
5974
6072
  return ["/login", "/logout", ...extracted];
5975
6073
  }, [myUnloggedRoutes]);
5976
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6074
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5977
6075
  FrontendPlusReactRoutes,
5978
6076
  {
5979
6077
  myRoutes,