@oondemand/oon-core-front 0.3.11 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { StrictMode } from "react";
3
3
  import { createRoot } from "react-dom/client";
4
4
 
5
5
  // src/app/OonApp.tsx
6
- import { useMemo as useMemo4 } from "react";
6
+ import { useMemo as useMemo7 } from "react";
7
7
  import { RouterProvider } from "react-router-dom";
8
8
 
9
9
  // src/api/createRestClient.ts
@@ -640,9 +640,9 @@ function OonProviders({ config, http, storage, children }) {
640
640
  }
641
641
 
642
642
  // src/components/CoreCollection.tsx
643
- import { useState as useState6 } from "react";
644
- import { Box as Box5, Heading as Heading3, Stack as Stack3, Text as Text6 } from "@chakra-ui/react";
645
- import { useMutation, useQueryClient } from "@tanstack/react-query";
643
+ import { useState as useState10 } from "react";
644
+ import { Box as Box9, Heading as Heading4, Stack as Stack4, Text as Text11 } from "@chakra-ui/react";
645
+ import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
646
646
 
647
647
  // src/components/internal/fieldUtils.ts
648
648
  var HIDDEN_FIELDS = /* @__PURE__ */ new Set(["__v", "_id", "createdAt", "updatedAt", "criadoEm", "atualizadoEm"]);
@@ -795,16 +795,21 @@ function DataGrid({
795
795
  onCreate,
796
796
  onEdit,
797
797
  onDelete,
798
- toolbarExtra
798
+ toolbarExtra,
799
+ filters = [],
800
+ queryExtra,
801
+ renderRowActions
799
802
  }) {
800
803
  const [pageIndex, setPageIndex] = useState3(0);
801
804
  const [pageSize, setPageSize] = useState3(20);
802
805
  const [searchTerm, setSearchTerm] = useState3("");
803
806
  const deferredSearch = useDeferredValue(searchTerm);
804
807
  const [sort, setSort] = useState3(void 0);
808
+ const [filterValues, setFilterValues] = useState3(() => Object.fromEntries(filters.map((filter) => [filter.field, filter.defaultValue ?? ""])));
809
+ const effectiveFilters = Object.fromEntries(Object.entries({ ...queryExtra, ...filterValues }).filter(([, value]) => value !== "" && value != null));
805
810
  const query = useQuery2({
806
- queryKey: ["oon", "list", resourceKey, { pageIndex, pageSize, searchTerm: deferredSearch, sort }],
807
- queryFn: () => resource.list({ pageIndex, pageSize, searchTerm: deferredSearch || void 0, sort }),
811
+ queryKey: ["oon", "list", resourceKey, { pageIndex, pageSize, searchTerm: deferredSearch, sort, filters: effectiveFilters }],
812
+ queryFn: () => resource.list({ pageIndex, pageSize, searchTerm: deferredSearch || void 0, sort, ...effectiveFilters }),
808
813
  placeholderData: keepPreviousData
809
814
  });
810
815
  const toggleSort = (field) => {
@@ -820,7 +825,7 @@ function DataGrid({
820
825
  const totalItems = pagination?.totalItems ?? rows.length;
821
826
  const totalPages = Math.max(1, pagination?.totalPages ?? 1);
822
827
  const currentPage = Math.min(pageIndex + 1, totalPages);
823
- const actionCount = onEdit || onDelete ? 1 : 0;
828
+ const actionCount = onEdit || onDelete || renderRowActions ? 1 : 0;
824
829
  return /* @__PURE__ */ jsxs3(Box2, { bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", boxShadow: "0 1px 2px rgba(15,23,42,.06)", overflow: "hidden", children: [
825
830
  /* @__PURE__ */ jsxs3(Flex2, { minH: "60px", px: "14px", py: "12px", align: "center", gap: 4, borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
826
831
  search ? /* @__PURE__ */ jsxs3(Flex2, { minW: { base: "100%", md: "min(420px, 55vw)" }, maxW: "420px", h: "35px", px: "10px", align: "center", gap: 2, color: "#98A2B3", bg: "white", borderWidth: "1px", borderColor: "#D5DDE3", borderRadius: "6px", _focusWithin: { borderColor: "#0F8DD0", boxShadow: "0 0 0 3px rgba(15,141,208,.10)" }, children: [
@@ -847,6 +852,16 @@ function DataGrid({
847
852
  )
848
853
  ] }) : null,
849
854
  /* @__PURE__ */ jsx7(Spacer, {}),
855
+ filters.map((filter) => filter.type === "select" ? /* @__PURE__ */ jsxs3(NativeSelect.Root, { size: "xs", w: "180px", children: [
856
+ /* @__PURE__ */ jsx7(NativeSelect.Field, { value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
857
+ setFilterValues((current) => ({ ...current, [filter.field]: event.currentTarget.value }));
858
+ setPageIndex(0);
859
+ }, children: (filter.options ?? []).map((option) => /* @__PURE__ */ jsx7("option", { value: String(option.value ?? ""), children: option.label }, String(option.value ?? ""))) }),
860
+ /* @__PURE__ */ jsx7(NativeSelect.Indicator, {})
861
+ ] }, filter.field) : /* @__PURE__ */ jsx7(Input, { w: "180px", h: "35px", fontSize: "11px", placeholder: filter.placeholder ?? filter.label ?? filter.field, type: filter.type === "date" ? "date" : filter.type === "boolean" ? "text" : "text", value: String(filterValues[filter.field] ?? ""), onChange: (event) => {
862
+ setFilterValues((current) => ({ ...current, [filter.field]: event.currentTarget.value }));
863
+ setPageIndex(0);
864
+ } }, filter.field)),
850
865
  /* @__PURE__ */ jsxs3(Flex2, { align: "center", gap: 3, color: "#98A2B3", fontSize: "10px", children: [
851
866
  query.isFetching ? /* @__PURE__ */ jsx7(Text3, { children: "Atualizando..." }) : null,
852
867
  /* @__PURE__ */ jsxs3(Text3, { as: "strong", color: "#667085", fontWeight: "600", children: [
@@ -892,7 +907,8 @@ function DataGrid({
892
907
  columns.map((column) => /* @__PURE__ */ jsx7(Table.Cell, { maxW: "250px", h: "42px", px: "10px", py: "8px", overflow: "hidden", color: "#52606D", borderBottomWidth: "1px", borderColor: "#EEF1F3", fontSize: "11px", textOverflow: "ellipsis", whiteSpace: "nowrap", children: renderCell(row[column.field], column.kind) }, column.field)),
893
908
  actionCount ? /* @__PURE__ */ jsx7(Table.Cell, { h: "42px", px: "10px", py: "5px", borderBottomWidth: "1px", borderColor: "#EEF1F3", textAlign: "center", children: /* @__PURE__ */ jsxs3(Flex2, { justify: "center", gap: "5px", children: [
894
909
  onEdit ? /* @__PURE__ */ jsx7(Button2, { type: "button", "aria-label": "Editar", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onEdit(row), _hover: { color: "#036491", bg: "#F0F7FF", borderColor: "#B8D9EB" }, children: /* @__PURE__ */ jsx7(EditIcon, {}) }) : null,
895
- onDelete ? /* @__PURE__ */ jsx7(Button2, { type: "button", "aria-label": "Excluir", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onDelete(row), _hover: { color: "#B42318", bg: "#FFF5F5", borderColor: "#FECACA" }, children: /* @__PURE__ */ jsx7(TrashIcon, {}) }) : null
910
+ onDelete ? /* @__PURE__ */ jsx7(Button2, { type: "button", "aria-label": "Excluir", w: "31px", minW: "31px", h: "31px", p: 0, color: "#667085", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "6px", onClick: () => onDelete(row), _hover: { color: "#B42318", bg: "#FFF5F5", borderColor: "#FECACA" }, children: /* @__PURE__ */ jsx7(TrashIcon, {}) }) : null,
911
+ renderRowActions?.(row)
896
912
  ] }) }) : null
897
913
  ] }, row._id ?? index)) })
898
914
  ] }) }),
@@ -937,7 +953,7 @@ function DataGrid({
937
953
  }
938
954
 
939
955
  // src/components/internal/DynamicForm.tsx
940
- import { useEffect as useEffect4, useState as useState5 } from "react";
956
+ import { useEffect as useEffect4, useMemo as useMemo4, useState as useState5 } from "react";
941
957
  import { Box as Box4, Button as Button4, Flex as Flex4, Heading as Heading2, Input as Input3, NativeSelect as NativeSelect2, SimpleGrid, Stack as Stack2, Text as Text5, Textarea } from "@chakra-ui/react";
942
958
 
943
959
  // src/components/internal/ReferenceSelect.tsx
@@ -1427,10 +1443,25 @@ var controlProps = (invalid) => ({
1427
1443
  boxShadow: invalid ? "0 0 0 3px rgba(220,38,38,.08)" : void 0,
1428
1444
  fontSize: "11px"
1429
1445
  });
1446
+ function buildItems(fields) {
1447
+ const items = [];
1448
+ const renderedGroups = /* @__PURE__ */ new Set();
1449
+ fields.forEach((field) => {
1450
+ if (!field.group) {
1451
+ items.push({ type: "field", field });
1452
+ return;
1453
+ }
1454
+ if (renderedGroups.has(field.group)) return;
1455
+ renderedGroups.add(field.group);
1456
+ items.push({ type: "group", id: field.group, fields: fields.filter((candidate) => candidate.group === field.group) });
1457
+ });
1458
+ return items;
1459
+ }
1430
1460
  function DynamicForm({ title, eyebrow = "Cadastro", fields, initialValues, submitting, error, onSubmit, onCancel, onFieldChange }) {
1431
1461
  const [values, setValues] = useState5(() => Object.fromEntries(fields.map((field) => [field.field, toValue(initialValues?.[field.field], field.kind)])));
1432
1462
  const [errors, setErrors] = useState5({});
1433
1463
  const [dismissed, setDismissed] = useState5(false);
1464
+ const items = useMemo4(() => buildItems(fields), [fields]);
1434
1465
  useEffect4(() => {
1435
1466
  const listener = (event) => {
1436
1467
  if (event.key !== "Escape" || event.defaultPrevented || submitting) return;
@@ -1480,6 +1511,83 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields, initialValues, submi
1480
1511
  setErrors({});
1481
1512
  onSubmit(payload);
1482
1513
  };
1514
+ const renderField = (field, grouped = false) => {
1515
+ const label = fieldLabel({ name: field.field, label: field.label });
1516
+ const message = errors[field.field];
1517
+ const id = idFor(field.field);
1518
+ const errorId = message ? errorIdFor(field.field) : void 0;
1519
+ const multiline = isMultiline(field);
1520
+ const span = field.span === 2 || multiline;
1521
+ const wrap = (control, showLabel = true) => /* @__PURE__ */ jsxs5(Box4, { minW: grouped ? "150px" : void 0, flex: grouped ? "0 1 auto" : void 0, gridColumn: !grouped && span ? "1 / -1" : void 0, children: [
1522
+ showLabel ? /* @__PURE__ */ jsx9(Label, { id, label, required: field.required }) : null,
1523
+ control,
1524
+ /* @__PURE__ */ jsx9(ErrorText, { id: errorId, text: message })
1525
+ ] }, field.field);
1526
+ if (field.widget === "checkbox") {
1527
+ const checkedValue = String(field.checkedValue ?? true);
1528
+ const uncheckedValue = String(field.uncheckedValue ?? false);
1529
+ const checked = (values[field.field] ?? uncheckedValue) === checkedValue;
1530
+ return wrap(
1531
+ /* @__PURE__ */ jsxs5(
1532
+ Box4,
1533
+ {
1534
+ as: "label",
1535
+ display: "flex",
1536
+ minH: "37px",
1537
+ px: "11px",
1538
+ alignItems: "center",
1539
+ gap: "8px",
1540
+ color: "#344054",
1541
+ bg: checked ? "#F0F7FF" : "white",
1542
+ borderWidth: "1px",
1543
+ borderColor: message ? "#DC2626" : checked ? "#8FC9E7" : "#D5DDE3",
1544
+ borderRadius: "7px",
1545
+ cursor: "pointer",
1546
+ transition: "background .15s ease, border-color .15s ease",
1547
+ _hover: { borderColor: "#8FC9E7", bg: "#F7FBFE" },
1548
+ children: [
1549
+ /* @__PURE__ */ jsx9(
1550
+ "input",
1551
+ {
1552
+ id,
1553
+ type: "checkbox",
1554
+ checked,
1555
+ "aria-invalid": !!message,
1556
+ "aria-describedby": errorId,
1557
+ style: { width: 16, height: 16, accentColor: "#0474AF", cursor: "pointer" },
1558
+ onChange: (event) => change(field.field, event.currentTarget.checked ? checkedValue : uncheckedValue)
1559
+ }
1560
+ ),
1561
+ /* @__PURE__ */ jsxs5(Text5, { as: "span", fontSize: "11px", fontWeight: "600", children: [
1562
+ label,
1563
+ field.required ? /* @__PURE__ */ jsx9(Text5, { as: "span", color: "#DC2626", children: " *" }) : null
1564
+ ] })
1565
+ ]
1566
+ }
1567
+ ),
1568
+ false
1569
+ );
1570
+ }
1571
+ if (field.kind === "ref" && field.ref) return wrap(/* @__PURE__ */ jsx9(ReferenceSelect, { field: field.field, inputId: id, errorId, label, refModel: field.ref, value: values[field.field] ?? "", initialValue: initialValues?.[field.field], required: field.required, invalid: !!message, error: message, onChange: (value) => change(field.field, value) }));
1572
+ if (field.kind === "enum" && field.options?.length) return wrap(/* @__PURE__ */ jsxs5(NativeSelect2.Root, { size: "sm", children: [
1573
+ /* @__PURE__ */ jsxs5(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), onChange: (event) => change(field.field, event.currentTarget.value), children: [
1574
+ /* @__PURE__ */ jsx9("option", { value: "", children: "\u2014 Selecione \u2014" }),
1575
+ field.options.map((option) => /* @__PURE__ */ jsx9("option", { value: option, children: option }, option))
1576
+ ] }),
1577
+ /* @__PURE__ */ jsx9(NativeSelect2.Indicator, {})
1578
+ ] }));
1579
+ if (field.kind === "boolean") return wrap(/* @__PURE__ */ jsxs5(NativeSelect2.Root, { size: "sm", children: [
1580
+ /* @__PURE__ */ jsxs5(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), onChange: (event) => change(field.field, event.currentTarget.value), children: [
1581
+ /* @__PURE__ */ jsx9("option", { value: "", children: "\u2014 Selecione \u2014" }),
1582
+ /* @__PURE__ */ jsx9("option", { value: "true", children: "Sim" }),
1583
+ /* @__PURE__ */ jsx9("option", { value: "false", children: "N\xE3o" })
1584
+ ] }),
1585
+ /* @__PURE__ */ jsx9(NativeSelect2.Indicator, {})
1586
+ ] }));
1587
+ if (multiline) return wrap(/* @__PURE__ */ jsx9(Textarea, { id, rows: field.rows ?? 4, resize: "vertical", "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), lineHeight: "1.5", onChange: (event) => change(field.field, event.currentTarget.value) }));
1588
+ const type = field.kind === "date" ? "date" : ["number", "currency", "currencyConverted"].includes(field.kind ?? "") ? "number" : "text";
1589
+ return wrap(/* @__PURE__ */ jsx9(Input3, { id, type, step: type === "number" ? "any" : void 0, autoComplete: "off", "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), onChange: (event) => change(field.field, event.currentTarget.value) }));
1590
+ };
1483
1591
  const invalid = fields.filter((field) => errors[field.field]);
1484
1592
  const generic = dismissed ? null : messageOf(error);
1485
1593
  return /* @__PURE__ */ jsx9(Flex4, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: { base: 2, md: 6 }, bg: "rgba(15,23,42,.48)", backdropFilter: "blur(2px)", onMouseDown: (event) => {
@@ -1509,38 +1617,15 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields, initialValues, submi
1509
1617
  /* @__PURE__ */ jsx9(AlertIcon, {}),
1510
1618
  generic
1511
1619
  ] }) : null,
1512
- /* @__PURE__ */ jsx9(SimpleGrid, { columns: { base: 1, lg: 2 }, gapX: "16px", gapY: "15px", children: fields.map((baseField) => {
1513
- const field = baseField;
1514
- const label = fieldLabel({ name: field.field, label: field.label });
1515
- const message = errors[field.field];
1516
- const id = idFor(field.field);
1517
- const errorId = message ? errorIdFor(field.field) : void 0;
1518
- const multiline = isMultiline(field);
1519
- const span = field.span === 2 || multiline;
1520
- const wrap = (control) => /* @__PURE__ */ jsxs5(Box4, { gridColumn: span ? "1 / -1" : void 0, children: [
1521
- /* @__PURE__ */ jsx9(Label, { id, label, required: field.required }),
1522
- control,
1523
- /* @__PURE__ */ jsx9(ErrorText, { id: errorId, text: message })
1524
- ] }, field.field);
1525
- if (field.kind === "ref" && field.ref) return wrap(/* @__PURE__ */ jsx9(ReferenceSelect, { field: field.field, inputId: id, errorId, label, refModel: field.ref, value: values[field.field] ?? "", initialValue: initialValues?.[field.field], required: field.required, invalid: !!message, error: message, onChange: (value) => change(field.field, value) }));
1526
- if (field.kind === "enum" && field.options?.length) return wrap(/* @__PURE__ */ jsxs5(NativeSelect2.Root, { size: "sm", children: [
1527
- /* @__PURE__ */ jsxs5(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), onChange: (event) => change(field.field, event.currentTarget.value), children: [
1528
- /* @__PURE__ */ jsx9("option", { value: "", children: "\u2014 Selecione \u2014" }),
1529
- field.options.map((option) => /* @__PURE__ */ jsx9("option", { value: option, children: option }, option))
1530
- ] }),
1531
- /* @__PURE__ */ jsx9(NativeSelect2.Indicator, {})
1532
- ] }));
1533
- if (field.kind === "boolean") return wrap(/* @__PURE__ */ jsxs5(NativeSelect2.Root, { size: "sm", children: [
1534
- /* @__PURE__ */ jsxs5(NativeSelect2.Field, { id, "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), onChange: (event) => change(field.field, event.currentTarget.value), children: [
1535
- /* @__PURE__ */ jsx9("option", { value: "", children: "\u2014 Selecione \u2014" }),
1536
- /* @__PURE__ */ jsx9("option", { value: "true", children: "Sim" }),
1537
- /* @__PURE__ */ jsx9("option", { value: "false", children: "N\xE3o" })
1538
- ] }),
1539
- /* @__PURE__ */ jsx9(NativeSelect2.Indicator, {})
1540
- ] }));
1541
- if (multiline) return wrap(/* @__PURE__ */ jsx9(Textarea, { id, rows: field.rows ?? 4, resize: "vertical", "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), lineHeight: "1.5", onChange: (event) => change(field.field, event.currentTarget.value) }));
1542
- const type = field.kind === "date" ? "date" : ["number", "currency", "currencyConverted"].includes(field.kind ?? "") ? "number" : "text";
1543
- return wrap(/* @__PURE__ */ jsx9(Input3, { id, type, step: type === "number" ? "any" : void 0, autoComplete: "off", "aria-invalid": !!message, "aria-describedby": errorId, value: values[field.field] ?? "", ...controlProps(!!message), onChange: (event) => change(field.field, event.currentTarget.value) }));
1620
+ /* @__PURE__ */ jsx9(SimpleGrid, { columns: { base: 1, lg: 2 }, gapX: "16px", gapY: "15px", children: items.map((item) => {
1621
+ if (item.type === "field") return renderField(item.field);
1622
+ const first = item.fields[0];
1623
+ const inline = item.fields.some((field) => field.inline !== false);
1624
+ return /* @__PURE__ */ jsxs5(Box4, { gridColumn: "1 / -1", p: "12px", bg: "#FAFCFD", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "9px", children: [
1625
+ /* @__PURE__ */ jsx9(Text5, { color: "#344054", fontSize: "11px", fontWeight: "700", children: first.groupLabel ?? item.id }),
1626
+ first.groupDescription ? /* @__PURE__ */ jsx9(Text5, { mt: "2px", mb: "10px", color: "#667085", fontSize: "10px", children: first.groupDescription }) : /* @__PURE__ */ jsx9(Box4, { h: "8px" }),
1627
+ /* @__PURE__ */ jsx9(Flex4, { direction: inline ? "row" : "column", wrap: "wrap", gap: "9px", children: item.fields.map((field) => renderField(field, true)) })
1628
+ ] }, item.id);
1544
1629
  }) })
1545
1630
  ] }) }),
1546
1631
  /* @__PURE__ */ jsxs5(Flex4, { minH: "68px", px: "20px", py: "14px", justify: "flex-end", gap: "9px", borderTopWidth: "1px", borderColor: "#E5E9ED", children: [
@@ -1554,21 +1639,373 @@ function DynamicForm({ title, eyebrow = "Cadastro", fields, initialValues, submi
1554
1639
  ] }) });
1555
1640
  }
1556
1641
 
1642
+ // src/components/internal/CoreDetailModal.tsx
1643
+ import { useEffect as useEffect6, useMemo as useMemo6, useState as useState9 } from "react";
1644
+ import { Box as Box8, Button as Button8, Flex as Flex7, Heading as Heading3, Text as Text10 } from "@chakra-ui/react";
1645
+ import { useQuery as useQuery6, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
1646
+
1647
+ // src/components/internal/CoreTabbedDetail.tsx
1648
+ import { useEffect as useEffect5, useState as useState8 } from "react";
1649
+ import { Box as Box7, Button as Button7, Flex as Flex6, Input as Input5, NativeSelect as NativeSelect4, SimpleGrid as SimpleGrid3, Stack as Stack3, Text as Text9 } from "@chakra-ui/react";
1650
+
1651
+ // src/components/internal/CoreSummaryCards.tsx
1652
+ import { SimpleGrid as SimpleGrid2, Box as Box5, Text as Text6, Badge as Badge2 } from "@chakra-ui/react";
1653
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
1654
+
1655
+ // src/components/internal/manifestUtils.ts
1656
+ function normalizeColumn(column, schema) {
1657
+ if (typeof column !== "string") {
1658
+ const meta2 = schema?.fields.find((field) => field.name === column.field);
1659
+ return { label: meta2 ? fieldLabel(meta2) : column.field, kind: meta2?.kind, ...column };
1660
+ }
1661
+ const meta = schema?.fields.find((field) => field.name === column);
1662
+ return { field: column, label: meta ? fieldLabel(meta) : fieldLabel({ name: column }), kind: meta?.kind, sortable: true };
1663
+ }
1664
+ function fieldsForTab(fields, selected) {
1665
+ if (!selected?.length) return fields;
1666
+ const wanted = new Set(selected);
1667
+ return fields.filter((field) => wanted.has(field.field));
1668
+ }
1669
+ function relationFrom(input, relations) {
1670
+ return typeof input === "string" ? relations?.[input] : input;
1671
+ }
1672
+
1673
+ // src/components/internal/CoreSummaryCards.tsx
1674
+ import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1675
+ function format(value, format2) {
1676
+ if (format2 === "currency") return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL" }).format(Number(value ?? 0));
1677
+ if (format2 === "percent") return `${Number(value ?? 0).toLocaleString("pt-BR")}%`;
1678
+ if (format2 === "date") return formatCell(value, "date");
1679
+ return value == null || value === "" ? "\u2014" : String(value);
1680
+ }
1681
+ function RelatedMetric({ card, relation, parent }) {
1682
+ const schema = useModelSchema(relation.model).data;
1683
+ const resource = useOonResource(schema?.basePath ?? `/${relation.model.toLowerCase()}s`);
1684
+ const parentValue = parent[relation.parentKey ?? "_id"];
1685
+ const query = useQuery4({ queryKey: ["oon", "summary", relation.model, relation.foreignKey, parentValue, card.source, card.field], queryFn: () => resource.list({ [relation.foreignKey]: parentValue, pageSize: 1e3 }) });
1686
+ const rows = query.data?.results ?? [];
1687
+ let value = rows.length;
1688
+ if (card.source === "relatedSum") value = rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0);
1689
+ if (card.source === "relatedAvg") value = rows.length ? rows.reduce((sum, row) => sum + Number(row[card.field ?? ""] ?? 0), 0) / rows.length : 0;
1690
+ return /* @__PURE__ */ jsx10(Fragment, { children: query.isLoading ? "..." : format(value, card.format) });
1691
+ }
1692
+ function CoreSummaryCards({ cards = [], parent, relations }) {
1693
+ return /* @__PURE__ */ jsx10(SimpleGrid2, { columns: { base: 1, md: 3 }, gap: 3, children: cards.map((card, index) => {
1694
+ const relation = card.relation ? relationFrom(card.relation, relations) : void 0;
1695
+ const content = relation && card.source?.startsWith("related") ? /* @__PURE__ */ jsx10(RelatedMetric, { card, relation, parent }) : format(parent[card.field ?? ""], card.format);
1696
+ return /* @__PURE__ */ jsxs6(Box5, { p: "14px", bg: "white", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: [
1697
+ /* @__PURE__ */ jsx10(Text6, { color: "#667085", fontSize: "10px", fontWeight: "600", children: card.label }),
1698
+ /* @__PURE__ */ jsx10(Text6, { mt: "6px", color: "#24323A", fontSize: "20px", fontWeight: "700", children: card.format === "badge" ? /* @__PURE__ */ jsx10(Badge2, { children: content }) : content })
1699
+ ] }, `${card.label}-${index}`);
1700
+ }) });
1701
+ }
1702
+
1703
+ // src/components/internal/CoreRelatedGrid.tsx
1704
+ import { useMemo as useMemo5, useState as useState7 } from "react";
1705
+ import { Badge as Badge3, Box as Box6, Button as Button6, Flex as Flex5, Table as Table2, Text as Text8 } from "@chakra-ui/react";
1706
+ import { useMutation, useQuery as useQuery5, useQueryClient } from "@tanstack/react-query";
1707
+
1708
+ // src/components/internal/CoreInlineEditableCell.tsx
1709
+ import { Input as Input4, NativeSelect as NativeSelect3, Textarea as Textarea2 } from "@chakra-ui/react";
1710
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1711
+ function CoreInlineEditableCell({ column, meta, value, onChange }) {
1712
+ const kind = column.editor ?? meta?.kind ?? column.kind ?? "string";
1713
+ const common = { size: "xs", fontSize: "11px", value: value == null ? "" : String(value), onChange: (event) => onChange(event.currentTarget.value) };
1714
+ if (kind === "boolean") return /* @__PURE__ */ jsxs7(NativeSelect3.Root, { size: "xs", children: [
1715
+ /* @__PURE__ */ jsxs7(NativeSelect3.Field, { ...common, children: [
1716
+ /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
1717
+ /* @__PURE__ */ jsx11("option", { value: "true", children: "Sim" }),
1718
+ /* @__PURE__ */ jsx11("option", { value: "false", children: "N\xE3o" })
1719
+ ] }),
1720
+ /* @__PURE__ */ jsx11(NativeSelect3.Indicator, {})
1721
+ ] });
1722
+ if ((kind === "enum" || kind === "select") && meta?.options?.length) return /* @__PURE__ */ jsxs7(NativeSelect3.Root, { size: "xs", children: [
1723
+ /* @__PURE__ */ jsxs7(NativeSelect3.Field, { ...common, children: [
1724
+ /* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
1725
+ meta.options.map((option) => /* @__PURE__ */ jsx11("option", { value: option, children: option }, option))
1726
+ ] }),
1727
+ /* @__PURE__ */ jsx11(NativeSelect3.Indicator, {})
1728
+ ] });
1729
+ if (kind === "textarea") return /* @__PURE__ */ jsx11(Textarea2, { ...common, rows: 2 });
1730
+ const type = kind === "date" ? "date" : ["number", "currency"].includes(kind) ? "number" : "text";
1731
+ return /* @__PURE__ */ jsx11(Input4, { ...common, type, step: type === "number" ? "any" : void 0 });
1732
+ }
1733
+
1734
+ // src/components/internal/CoreRowAction.tsx
1735
+ import { useState as useState6 } from "react";
1736
+ import { Button as Button5, Text as Text7 } from "@chakra-ui/react";
1737
+
1738
+ // src/components/internal/conditions.ts
1739
+ function valueAt(source, path) {
1740
+ if (!source) return void 0;
1741
+ return path.split(".").reduce((current, part) => {
1742
+ if (current && typeof current === "object") return current[part];
1743
+ return void 0;
1744
+ }, source);
1745
+ }
1746
+ function evaluateCondition(condition, row) {
1747
+ if (!condition) return false;
1748
+ const value = valueAt(row, condition.field);
1749
+ if ("exists" in condition) return condition.exists ? value != null && value !== "" : value == null || value === "";
1750
+ if ("equals" in condition) return value === condition.equals;
1751
+ if ("notEquals" in condition) return value !== condition.notEquals;
1752
+ if ("in" in condition) return condition.in.includes(value);
1753
+ const numeric = Number(value);
1754
+ if (Number.isNaN(numeric)) return false;
1755
+ if ("gt" in condition) return numeric > condition.gt;
1756
+ if ("gte" in condition) return numeric >= condition.gte;
1757
+ if ("lt" in condition) return numeric < condition.lt;
1758
+ if ("lte" in condition) return numeric <= condition.lte;
1759
+ return false;
1760
+ }
1761
+ function interpolateEndpoint(endpoint, row, parent) {
1762
+ return endpoint.replace(/:([A-Za-z0-9_.]+)/g, (_, token) => {
1763
+ if (token === "id") return encodeURIComponent(String(row._id ?? row.id ?? ""));
1764
+ if (token === "parentId") return encodeURIComponent(String(parent?._id ?? parent?.id ?? ""));
1765
+ if (token.startsWith("parent.")) return encodeURIComponent(String(valueAt(parent, token.slice(7)) ?? ""));
1766
+ return encodeURIComponent(String(valueAt(row, token) ?? ""));
1767
+ });
1768
+ }
1769
+
1770
+ // src/components/internal/CoreRowAction.tsx
1771
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
1772
+ function messageOf2(error) {
1773
+ return error instanceof Error ? error.message : typeof error === "string" ? error : "N\xE3o foi poss\xEDvel executar a a\xE7\xE3o.";
1774
+ }
1775
+ function CoreRowAction({ action, row, parent, onOpenDetail, onRefresh }) {
1776
+ const { http } = useOonApi();
1777
+ const [loading, setLoading] = useState6(false);
1778
+ const [error, setError] = useState6(null);
1779
+ if (evaluateCondition(action.hiddenWhen, row)) return null;
1780
+ const disabled = evaluateCondition(action.disabledWhen, row) || loading;
1781
+ const run = async () => {
1782
+ setError(null);
1783
+ if (action.type === "openDetailModal") return onOpenDetail?.(row, action.initialTab);
1784
+ if (action.type === "navigate") {
1785
+ const href = action.href ?? action.endpoint;
1786
+ if (href) window.location.assign(interpolateEndpoint(href, row, parent));
1787
+ return;
1788
+ }
1789
+ if (action.type !== "apiAction" || !action.endpoint) return;
1790
+ const ok = action.confirm ? window.confirm(action.confirm.description ?? action.confirm.title ?? `Executar ${action.label}?`) : true;
1791
+ if (!ok) return;
1792
+ setLoading(true);
1793
+ try {
1794
+ const url = interpolateEndpoint(action.endpoint, row, parent);
1795
+ await http.request({ url, method: action.method ?? "POST" });
1796
+ onRefresh?.(action.refresh);
1797
+ } catch (err) {
1798
+ setError(err);
1799
+ } finally {
1800
+ setLoading(false);
1801
+ }
1802
+ };
1803
+ return /* @__PURE__ */ jsxs8("span", { children: [
1804
+ /* @__PURE__ */ jsx12(Button5, { type: "button", size: "xs", minH: "28px", px: "9px", borderRadius: "6px", fontSize: "10px", loading, disabled, onClick: run, children: action.label }),
1805
+ error ? /* @__PURE__ */ jsx12(Text7, { mt: "3px", color: "#B42318", fontSize: "9px", children: messageOf2(error) }) : null
1806
+ ] });
1807
+ }
1808
+
1809
+ // src/components/internal/CoreRelatedGrid.tsx
1810
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1811
+ function CoreRelatedGrid({ tab, parent, relations, refreshToken, onRefresh }) {
1812
+ const relation = relationFrom(tab.relation, relations);
1813
+ const schemaQuery = useModelSchema(relation?.model ?? "");
1814
+ const schema = schemaQuery.data;
1815
+ const resource = useOonResource(schema?.basePath ?? `/${relation?.model?.toLowerCase() ?? "related"}s`);
1816
+ const queryClient = useQueryClient();
1817
+ const parentValue = relation ? parent[relation.parentKey ?? "_id"] : void 0;
1818
+ const key = ["oon", "related", relation?.model, relation?.foreignKey, parentValue, refreshToken];
1819
+ const query = useQuery5({ queryKey: key, enabled: !!relation && parentValue != null, queryFn: () => resource.list({ [relation.foreignKey]: parentValue, pageSize: 1e3 }) });
1820
+ const columns = useMemo5(() => (tab.columns?.length ? tab.columns : schema?.fields.slice(0, 8).map((f) => f.name) ?? []).map((column) => normalizeColumn(column, schema)).filter((column) => !column.hidden), [tab.columns, schema]);
1821
+ const [drafts, setDrafts] = useState7({});
1822
+ const [errors, setErrors] = useState7({});
1823
+ const editable = tab.type === "relatedGrid" && tab.editable && tab.editMode === "inline";
1824
+ const mutation = useMutation({ mutationFn: ({ id, values }) => resource.update(id, values), onSuccess: () => {
1825
+ queryClient.invalidateQueries({ queryKey: key });
1826
+ onRefresh?.(["self"]);
1827
+ } });
1828
+ if (!relation) return /* @__PURE__ */ jsx13(Text8, { color: "#B42318", children: "Rela\xE7\xE3o n\xE3o encontrada." });
1829
+ if (query.isLoading) return /* @__PURE__ */ jsx13(Text8, { color: "#667085", children: "Carregando..." });
1830
+ const rows = query.data?.results ?? [];
1831
+ const setDraft = (id, field, value) => setDrafts((current) => ({ ...current, [id]: { ...current[id] ?? {}, [field]: value } }));
1832
+ return /* @__PURE__ */ jsx13(Box6, { overflowX: "auto", borderWidth: "1px", borderColor: "#E5E9ED", borderRadius: "10px", children: /* @__PURE__ */ jsxs9(Table2.Root, { size: "sm", minW: "760px", children: [
1833
+ /* @__PURE__ */ jsx13(Table2.Header, { children: /* @__PURE__ */ jsxs9(Table2.Row, { bg: "#F4F7F9", children: [
1834
+ columns.map((c) => /* @__PURE__ */ jsx13(Table2.ColumnHeader, { fontSize: "10px", children: c.label ?? c.field }, c.field)),
1835
+ editable || tab.rowActions?.length ? /* @__PURE__ */ jsx13(Table2.ColumnHeader, { children: "A\xE7\xF5es" }) : null
1836
+ ] }) }),
1837
+ /* @__PURE__ */ jsxs9(Table2.Body, { children: [
1838
+ rows.map((row, index) => {
1839
+ const id = String(row._id ?? row.id ?? index);
1840
+ const draft = drafts[id] ?? {};
1841
+ const dirty = Object.keys(draft).length > 0;
1842
+ return /* @__PURE__ */ jsxs9(Table2.Row, { bg: dirty ? "#FFFBEB" : index % 2 ? "#FBFCFD" : "white", children: [
1843
+ columns.map((column) => {
1844
+ const value = column.field in draft ? draft[column.field] : row[column.field];
1845
+ const meta = schema?.fields.find((f) => f.name === column.field);
1846
+ const canEdit = editable && column.readonly !== true && (column.editable === true || !column.readonly);
1847
+ return /* @__PURE__ */ jsx13(Table2.Cell, { fontSize: "11px", children: canEdit ? /* @__PURE__ */ jsx13(CoreInlineEditableCell, { column, meta, value, onChange: (next) => setDraft(id, column.field, next) }) : column.display === "badgeExists" ? /* @__PURE__ */ jsx13(Badge3, { colorPalette: value ? "green" : "gray", children: value ? "Sim" : "N\xE3o" }) : formatCell(value, column.kind) }, column.field);
1848
+ }),
1849
+ editable || tab.rowActions?.length ? /* @__PURE__ */ jsx13(Table2.Cell, { children: /* @__PURE__ */ jsxs9(Flex5, { gap: "5px", align: "center", wrap: "wrap", children: [
1850
+ dirty ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
1851
+ /* @__PURE__ */ jsx13(Button6, { size: "xs", loading: mutation.isPending, onClick: () => {
1852
+ setErrors((e) => ({ ...e, [id]: void 0 }));
1853
+ mutation.mutate({ id, values: draft }, { onSuccess: () => setDrafts((d) => {
1854
+ const n = { ...d };
1855
+ delete n[id];
1856
+ return n;
1857
+ }), onError: (err) => setErrors((e) => ({ ...e, [id]: err })) });
1858
+ }, children: "Salvar" }),
1859
+ /* @__PURE__ */ jsx13(Button6, { size: "xs", variant: "outline", onClick: () => setDrafts((d) => {
1860
+ const n = { ...d };
1861
+ delete n[id];
1862
+ return n;
1863
+ }), children: "Cancelar" })
1864
+ ] }) : null,
1865
+ tab.rowActions?.map((action) => /* @__PURE__ */ jsx13(CoreRowAction, { action, row, parent, onRefresh }, action.id ?? action.label)),
1866
+ errors[id] ? /* @__PURE__ */ jsx13(Text8, { color: "#B42318", fontSize: "9px", children: "Erro ao salvar." }) : null
1867
+ ] }) }) : null
1868
+ ] }, id);
1869
+ }),
1870
+ rows.length === 0 ? /* @__PURE__ */ jsx13(Table2.Row, { children: /* @__PURE__ */ jsx13(Table2.Cell, { colSpan: columns.length + 1, children: /* @__PURE__ */ jsx13(Text8, { p: "8", textAlign: "center", color: "#98A2B3", children: "Nenhum registro relacionado." }) }) }) : null
1871
+ ] })
1872
+ ] }) });
1873
+ }
1874
+
1875
+ // src/components/internal/CoreTabbedDetail.tsx
1876
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1877
+ function coerce2(value, kind) {
1878
+ if (value === "") return void 0;
1879
+ if (["number", "currency", "currencyConverted"].includes(kind ?? "")) return Number(value);
1880
+ if (kind === "boolean") return value === "true";
1881
+ return value;
1882
+ }
1883
+ function toValue2(value) {
1884
+ return value == null ? "" : String(typeof value === "object" ? value._id ?? "" : value);
1885
+ }
1886
+ function InlineParentForm({ fields, parent, resource, onSaved }) {
1887
+ const [values, setValues] = useState8({});
1888
+ const [saving, setSaving] = useState8(false);
1889
+ const [error, setError] = useState8(null);
1890
+ useEffect5(() => setValues(Object.fromEntries(fields.map((f) => [f.field, toValue2(parent[f.field])]))), [parent, fields]);
1891
+ return /* @__PURE__ */ jsx14("form", { onSubmit: async (event) => {
1892
+ event.preventDefault();
1893
+ setSaving(true);
1894
+ setError(null);
1895
+ try {
1896
+ const payload = Object.fromEntries(fields.map((f) => [f.field, coerce2(values[f.field] ?? "", f.kind)]).filter(([, v]) => v !== void 0));
1897
+ const saved = parent._id ? await resource.update(String(parent._id), payload) : await resource.create(payload);
1898
+ onSaved(saved);
1899
+ } catch (err) {
1900
+ setError(err);
1901
+ } finally {
1902
+ setSaving(false);
1903
+ }
1904
+ }, children: /* @__PURE__ */ jsxs10(Stack3, { gap: 4, children: [
1905
+ error ? /* @__PURE__ */ jsx14(Text9, { color: "#B42318", fontSize: "11px", children: "N\xE3o foi poss\xEDvel salvar." }) : null,
1906
+ /* @__PURE__ */ jsx14(SimpleGrid3, { columns: { base: 1, md: 2 }, gap: 3, children: fields.map((field) => /* @__PURE__ */ jsxs10(Box7, { children: [
1907
+ /* @__PURE__ */ jsx14(Text9, { as: "label", display: "block", mb: "5px", fontSize: "11px", fontWeight: "600", children: fieldLabel({ name: field.field, label: field.label }) }),
1908
+ field.kind === "boolean" ? /* @__PURE__ */ jsxs10(NativeSelect4.Root, { size: "sm", children: [
1909
+ /* @__PURE__ */ jsxs10(NativeSelect4.Field, { value: values[field.field] ?? "", onChange: (e) => setValues((v) => ({ ...v, [field.field]: e.currentTarget.value })), children: [
1910
+ /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
1911
+ /* @__PURE__ */ jsx14("option", { value: "true", children: "Sim" }),
1912
+ /* @__PURE__ */ jsx14("option", { value: "false", children: "N\xE3o" })
1913
+ ] }),
1914
+ /* @__PURE__ */ jsx14(NativeSelect4.Indicator, {})
1915
+ ] }) : /* @__PURE__ */ jsx14(Input5, { size: "sm", type: field.kind === "date" ? "date" : ["number", "currency"].includes(field.kind ?? "") ? "number" : "text", value: values[field.field] ?? "", onChange: (e) => setValues((v) => ({ ...v, [field.field]: e.currentTarget.value })) })
1916
+ ] }, field.field)) }),
1917
+ /* @__PURE__ */ jsx14(Flex6, { justify: "flex-end", children: /* @__PURE__ */ jsx14(Button7, { type: "submit", colorPalette: "brand", loading: saving, children: "Salvar dados principais" }) })
1918
+ ] }) });
1919
+ }
1920
+ function CoreTabbedDetail({ tabs, activeTab, onTabChange, parent, formFields, resource, relations, refreshTokens, onRefresh, onParentSaved }) {
1921
+ const active = tabs.find((tab) => tab.id === activeTab) ?? tabs[0];
1922
+ return /* @__PURE__ */ jsxs10(Stack3, { gap: 4, children: [
1923
+ /* @__PURE__ */ jsx14(Flex6, { gap: 2, borderBottomWidth: "1px", borderColor: "#E5E9ED", overflowX: "auto", children: tabs.map((tab) => {
1924
+ const disabled = !parent?._id && (tab.type === "relatedGrid" || tab.type === "readonlyGrid" || tab.type === "summary");
1925
+ return /* @__PURE__ */ jsx14(Button7, { type: "button", variant: active?.id === tab.id ? "solid" : "ghost", colorPalette: active?.id === tab.id ? "brand" : void 0, disabled, onClick: () => onTabChange(tab.id), children: tab.label }, tab.id);
1926
+ }) }),
1927
+ /* @__PURE__ */ jsx14(Box7, { children: !active ? null : active.type === "summary" && parent ? /* @__PURE__ */ jsx14(CoreSummaryCards, { cards: active.cards, parent, relations }) : active.type === "form" ? /* @__PURE__ */ jsx14(InlineParentForm, { fields: fieldsForTab(formFields, active.fields ?? active.groups?.flatMap((g) => g.fields)), parent: parent ?? {}, resource, onSaved: onParentSaved }) : (active.type === "relatedGrid" || active.type === "readonlyGrid") && parent ? /* @__PURE__ */ jsx14(CoreRelatedGrid, { tab: active, parent, relations, refreshToken: refreshTokens[active.id], onRefresh }) : active.type === "customComponent" ? /* @__PURE__ */ jsxs10(Text9, { color: "#667085", children: [
1928
+ "Componente customizado: ",
1929
+ active.component
1930
+ ] }) : /* @__PURE__ */ jsx14(Text9, { color: "#667085", children: "Salve o registro principal para liberar esta aba." }) })
1931
+ ] });
1932
+ }
1933
+
1934
+ // src/components/internal/CoreDetailModal.tsx
1935
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
1936
+ function CoreDetailModal({ model, title, config, recordId, initialRecord, initialTab, relations, onClose, onSaved }) {
1937
+ const schemaQuery = useModelSchema(model);
1938
+ const schema = schemaQuery.data;
1939
+ const resource = useOonResource(schema?.basePath ?? `/${model.toLowerCase()}s`);
1940
+ const queryClient = useQueryClient2();
1941
+ const [parent, setParent] = useState9(initialRecord);
1942
+ const [activeTab, setActiveTab] = useState9(initialTab ?? config.defaultTab ?? config.tabs[0]?.id ?? "dados");
1943
+ const [refreshTokens, setRefreshTokens] = useState9({});
1944
+ const parentQuery = useQuery6({ queryKey: ["oon", "detail", model, recordId], enabled: !!recordId, queryFn: () => resource.get(recordId) });
1945
+ useEffect6(() => {
1946
+ if (parentQuery.data) setParent(parentQuery.data);
1947
+ }, [parentQuery.data]);
1948
+ const formFields = useMemo6(() => schema ? formFieldsFromMeta(schema.fields) : [], [schema]);
1949
+ const refresh = (targets) => {
1950
+ const list = targets?.length ? targets : ["self"];
1951
+ if (list.includes("parent") || list.includes("all")) {
1952
+ if (recordId) queryClient.invalidateQueries({ queryKey: ["oon", "detail", model, recordId] });
1953
+ onSaved?.();
1954
+ }
1955
+ setRefreshTokens((current) => {
1956
+ const next = { ...current };
1957
+ for (const target of list) {
1958
+ if (target === "all") config.tabs.forEach((tab) => next[tab.id] = (next[tab.id] ?? 0) + 1);
1959
+ else if (target !== "parent") next[target === "self" ? activeTab : target] = (next[target === "self" ? activeTab : target] ?? 0) + 1;
1960
+ }
1961
+ return next;
1962
+ });
1963
+ };
1964
+ const width = config.size === "full" ? "98vw" : config.size === "md" ? "760px" : config.size === "lg" ? "980px" : "1180px";
1965
+ const displayTitle = parent?.[config.titleField ?? ""] ? String(parent[config.titleField ?? ""]) : title;
1966
+ return /* @__PURE__ */ jsx15(Flex7, { position: "fixed", inset: 0, zIndex: 1e3, align: "center", justify: "center", p: 4, bg: "rgba(15,23,42,.48)", children: /* @__PURE__ */ jsxs11(Box8, { role: "dialog", "aria-modal": "true", w: `min(${width}, 98vw)`, maxH: "94vh", overflow: "hidden", bg: "white", borderRadius: "14px", boxShadow: "0 24px 70px rgba(15,23,42,.24)", children: [
1967
+ /* @__PURE__ */ jsxs11(Flex7, { minH: "72px", px: "20px", align: "center", justify: "space-between", borderBottomWidth: "1px", borderColor: "#E5E9ED", children: [
1968
+ /* @__PURE__ */ jsxs11(Box8, { children: [
1969
+ /* @__PURE__ */ jsx15(Text10, { color: "#0474AF", fontSize: "10px", fontWeight: "700", textTransform: "uppercase", children: "Detalhe" }),
1970
+ /* @__PURE__ */ jsx15(Heading3, { size: "md", children: recordId ? displayTitle : `Novo ${title}` })
1971
+ ] }),
1972
+ /* @__PURE__ */ jsx15(Button8, { onClick: onClose, children: "Fechar" })
1973
+ ] }),
1974
+ /* @__PURE__ */ jsx15(Box8, { maxH: "calc(94vh - 73px)", p: "20px", overflowY: "auto", children: schemaQuery.isLoading || parentQuery.isLoading ? /* @__PURE__ */ jsx15(Text10, { children: "Carregando..." }) : /* @__PURE__ */ jsx15(CoreTabbedDetail, { tabs: config.tabs, activeTab, onTabChange: setActiveTab, parent, formFields, resource, relations, refreshTokens, onRefresh: refresh, onParentSaved: (saved) => {
1975
+ setParent(saved);
1976
+ onSaved?.();
1977
+ refresh(["parent"]);
1978
+ } }) })
1979
+ ] }) });
1980
+ }
1981
+
1557
1982
  // src/components/CoreCollection.tsx
1558
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1559
- function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynamic", endpoint, columns, form, importExport }) {
1983
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
1984
+ function mergeFormFields(metadataFields, overrides) {
1985
+ if (!overrides?.length) return metadataFields;
1986
+ const byField = new Map(overrides.map((field) => [field.field, field]));
1987
+ const merged = metadataFields.map((field) => ({ ...field, ...byField.get(field.field) }));
1988
+ const known = new Set(metadataFields.map((field) => field.field));
1989
+ overrides.forEach((field) => {
1990
+ if (!known.has(field.field)) merged.push(field);
1991
+ });
1992
+ return merged;
1993
+ }
1994
+ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynamic", endpoint, columns, form, importExport, list, relations, detailModal }) {
1560
1995
  const needsSchema = mode !== "full" || !columns || !form || !endpoint;
1561
1996
  const schemaQuery = useModelSchema(needsSchema ? model : "");
1562
1997
  const schema = schemaQuery.data;
1563
1998
  const basePath = endpoint ?? schema?.basePath ?? `/${model.toLowerCase()}s`;
1564
- const resolvedColumns = columns ?? (schema ? columnsFromMeta(schema.fields) : []);
1565
- const resolvedForm = form ?? (schema ? formFieldsFromMeta(schema.fields) : []);
1999
+ const resolvedColumns = (list?.columns?.length ? list.columns.map((column) => normalizeColumn(column, schema)) : columns) ?? (schema ? columnsFromMeta(schema.fields) : []);
2000
+ const metadataForm = schema ? formFieldsFromMeta(schema.fields) : [];
2001
+ const resolvedForm = mode === "full" && form?.length ? form : mergeFormFields(metadataForm, form);
1566
2002
  const resource = useOonResource(basePath);
1567
- const queryClient = useQueryClient();
1568
- const [formState, setFormState] = useState6({ open: false });
1569
- const [formError, setFormError] = useState6(null);
2003
+ const queryClient = useQueryClient3();
2004
+ const [formState, setFormState] = useState10({ open: false });
2005
+ const [detailState, setDetailState] = useState10({ open: false });
2006
+ const [formError, setFormError] = useState10(null);
1570
2007
  const invalidate = () => queryClient.invalidateQueries({ queryKey: ["oon", "list", basePath] });
1571
- const saveMutation = useMutation({
2008
+ const saveMutation = useMutation2({
1572
2009
  mutationFn: (values) => {
1573
2010
  const editingRow = formState.open ? formState.row : void 0;
1574
2011
  const id = editingRow?._id;
@@ -1581,39 +2018,52 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
1581
2018
  },
1582
2019
  onError: (error) => setFormError(error)
1583
2020
  });
1584
- const deleteMutation = useMutation({
2021
+ const deleteMutation = useMutation2({
1585
2022
  mutationFn: (row) => resource.delete(row._id),
1586
2023
  onSuccess: invalidate
1587
2024
  });
1588
- if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx10(LoadingScreen, {});
1589
- if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx10(ErrorState, { error: schemaQuery.error });
2025
+ if (needsSchema && schemaQuery.isLoading) return /* @__PURE__ */ jsx16(LoadingScreen, {});
2026
+ if (needsSchema && schemaQuery.isError) return /* @__PURE__ */ jsx16(ErrorState, { error: schemaQuery.error });
1590
2027
  const title = label ?? schema?.name ?? model;
1591
- return /* @__PURE__ */ jsxs6(Stack3, { gap: 5, children: [
1592
- /* @__PURE__ */ jsxs6(Box5, { children: [
1593
- /* @__PURE__ */ jsx10(Text6, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
1594
- /* @__PURE__ */ jsx10(Heading3, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
1595
- /* @__PURE__ */ jsx10(Text6, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
2028
+ return /* @__PURE__ */ jsxs12(Stack4, { gap: 5, children: [
2029
+ /* @__PURE__ */ jsxs12(Box9, { children: [
2030
+ /* @__PURE__ */ jsx16(Text11, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: section }),
2031
+ /* @__PURE__ */ jsx16(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: title }),
2032
+ /* @__PURE__ */ jsx16(Text11, { mt: 1, fontSize: "13px", color: "gray.500", children: "Consulte, filtre e mantenha os registros desta opera\xE7\xE3o." })
1596
2033
  ] }),
1597
- /* @__PURE__ */ jsx10(
2034
+ /* @__PURE__ */ jsx16(
1598
2035
  DataGrid,
1599
2036
  {
1600
2037
  resource,
1601
2038
  resourceKey: basePath,
1602
2039
  columns: resolvedColumns,
2040
+ filters: list?.filters,
1603
2041
  onCreate: () => {
1604
2042
  setFormError(null);
1605
- setFormState({ open: true });
2043
+ if (detailModal?.enabled) setDetailState({ open: true });
2044
+ else setFormState({ open: true });
1606
2045
  },
1607
2046
  onEdit: (row) => {
1608
2047
  setFormError(null);
1609
- setFormState({ open: true, row });
2048
+ if (detailModal?.enabled) setDetailState({ open: true, row });
2049
+ else setFormState({ open: true, row });
1610
2050
  },
1611
2051
  onDelete: (row) => {
1612
2052
  if (window.confirm("Excluir este registro?")) deleteMutation.mutate(row);
1613
- }
2053
+ },
2054
+ renderRowActions: list?.rowActions?.length ? (row) => list.rowActions?.map((action) => /* @__PURE__ */ jsx16(
2055
+ CoreRowAction,
2056
+ {
2057
+ action,
2058
+ row,
2059
+ onOpenDetail: (selected, initialTab) => setDetailState({ open: true, row: selected, initialTab }),
2060
+ onRefresh: invalidate
2061
+ },
2062
+ action.id ?? action.label
2063
+ )) : void 0
1614
2064
  }
1615
2065
  ),
1616
- formState.open ? /* @__PURE__ */ jsx10(
2066
+ formState.open ? /* @__PURE__ */ jsx16(
1617
2067
  DynamicForm,
1618
2068
  {
1619
2069
  title: formState.row ? `Editar ${title}` : `Novo ${title}`,
@@ -1633,14 +2083,28 @@ function CoreCollection({ model, label, section = "Cole\xE7\xE3o", mode = "dynam
1633
2083
  }
1634
2084
  }
1635
2085
  ) : null,
1636
- importExport ? null : null
2086
+ importExport ? null : null,
2087
+ detailState.open && detailModal?.enabled ? /* @__PURE__ */ jsx16(
2088
+ CoreDetailModal,
2089
+ {
2090
+ model,
2091
+ title,
2092
+ config: detailModal,
2093
+ recordId: detailState.row?._id,
2094
+ initialRecord: detailState.row,
2095
+ initialTab: detailState.initialTab,
2096
+ relations,
2097
+ onClose: () => setDetailState({ open: false }),
2098
+ onSaved: invalidate
2099
+ }
2100
+ ) : null
1637
2101
  ] });
1638
2102
  }
1639
2103
 
1640
2104
  // src/components/CoreDocument.tsx
1641
- import { jsx as jsx11 } from "react/jsx-runtime";
2105
+ import { jsx as jsx17 } from "react/jsx-runtime";
1642
2106
  function CoreDocument({ model, label, endpoint, columns, form }) {
1643
- return /* @__PURE__ */ jsx11(
2107
+ return /* @__PURE__ */ jsx17(
1644
2108
  CoreCollection,
1645
2109
  {
1646
2110
  model,
@@ -1654,10 +2118,10 @@ function CoreDocument({ model, label, endpoint, columns, form }) {
1654
2118
  }
1655
2119
 
1656
2120
  // src/components/CorePipeline.tsx
1657
- import { useState as useState7 } from "react";
1658
- import { Badge as Badge2, Box as Box6, Button as Button5, Flex as Flex5, Heading as Heading4, Stack as Stack4, Text as Text7 } from "@chakra-ui/react";
1659
- import { useMutation as useMutation2, useQuery as useQuery4, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
1660
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
2121
+ import { useState as useState11 } from "react";
2122
+ import { Badge as Badge4, Box as Box10, Button as Button9, Flex as Flex8, Heading as Heading5, Stack as Stack5, Text as Text12 } from "@chakra-ui/react";
2123
+ import { useMutation as useMutation3, useQuery as useQuery7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
2124
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
1661
2125
  function ticketId(row) {
1662
2126
  const id = row._id ?? row.id;
1663
2127
  return id == null ? void 0 : String(id);
@@ -1667,15 +2131,15 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1667
2131
  const schema = schemaQuery.data;
1668
2132
  const basePath = endpoint ?? schema?.basePath ?? `/${model.toLowerCase()}s`;
1669
2133
  const resource = useOonResource(basePath);
1670
- const queryClient = useQueryClient2();
1671
- const [selectedTicket, setSelectedTicket] = useState7(null);
1672
- const [formError, setFormError] = useState7(null);
1673
- const listQuery = useQuery4({
2134
+ const queryClient = useQueryClient4();
2135
+ const [selectedTicket, setSelectedTicket] = useState11(null);
2136
+ const [formError, setFormError] = useState11(null);
2137
+ const listQuery = useQuery7({
1674
2138
  queryKey: ["oon", "pipeline", basePath],
1675
2139
  queryFn: () => resource.list({ pageSize: 200 }),
1676
2140
  enabled: !!schema
1677
2141
  });
1678
- const saveMutation = useMutation2({
2142
+ const saveMutation = useMutation3({
1679
2143
  mutationFn: (values) => {
1680
2144
  const id = selectedTicket ? ticketId(selectedTicket) : void 0;
1681
2145
  if (!id) throw new Error("N\xE3o foi poss\xEDvel identificar o ticket selecionado.");
@@ -1688,9 +2152,9 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1688
2152
  },
1689
2153
  onError: (error) => setFormError(error)
1690
2154
  });
1691
- if (schemaQuery.isLoading || listQuery.isLoading) return /* @__PURE__ */ jsx12(LoadingScreen, {});
1692
- if (schemaQuery.isError) return /* @__PURE__ */ jsx12(ErrorState, { error: schemaQuery.error });
1693
- if (listQuery.isError) return /* @__PURE__ */ jsx12(ErrorState, { error: listQuery.error });
2155
+ if (schemaQuery.isLoading || listQuery.isLoading) return /* @__PURE__ */ jsx18(LoadingScreen, {});
2156
+ if (schemaQuery.isError) return /* @__PURE__ */ jsx18(ErrorState, { error: schemaQuery.error });
2157
+ if (listQuery.isError) return /* @__PURE__ */ jsx18(ErrorState, { error: listQuery.error });
1694
2158
  const stageFieldMeta = schema?.fields.find((field) => field.name === stageField);
1695
2159
  const resolvedStages = stages ?? (stageFieldMeta?.options ?? []).map((option) => ({ id: option, label: option }));
1696
2160
  const title = titleField ?? schema?.fields.find((field) => field.kind === "string")?.name ?? schema?.searchable[0] ?? "_id";
@@ -1704,16 +2168,16 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1704
2168
  if (!byStage.has(key)) byStage.set(key, []);
1705
2169
  byStage.get(key).push(row);
1706
2170
  }
1707
- return /* @__PURE__ */ jsxs7(Stack4, { gap: 5, children: [
1708
- /* @__PURE__ */ jsxs7(Box6, { children: [
1709
- /* @__PURE__ */ jsx12(Text7, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
1710
- /* @__PURE__ */ jsx12(Heading4, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
1711
- /* @__PURE__ */ jsx12(Text7, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
2171
+ return /* @__PURE__ */ jsxs13(Stack5, { gap: 5, children: [
2172
+ /* @__PURE__ */ jsxs13(Box10, { children: [
2173
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "11px", fontWeight: "700", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", mb: 1, children: "Esteira de processo" }),
2174
+ /* @__PURE__ */ jsx18(Heading5, { size: "lg", color: "#24323A", letterSpacing: "-0.02em", children: label ?? schema?.name ?? model }),
2175
+ /* @__PURE__ */ jsx18(Text12, { mt: 1, fontSize: "13px", color: "gray.500", children: "Acompanhe os tickets por etapa e visualize os principais dados de cada item." })
1712
2176
  ] }),
1713
- /* @__PURE__ */ jsx12(Flex5, { gap: 4, align: "stretch", overflowX: "auto", pb: 3, minH: "420px", children: Array.from(byStage.entries()).map(([stageId, items]) => {
2177
+ /* @__PURE__ */ jsx18(Flex8, { gap: 4, align: "stretch", overflowX: "auto", pb: 3, minH: "420px", children: Array.from(byStage.entries()).map(([stageId, items]) => {
1714
2178
  const stageLabel = resolvedStages.find((stage) => stage.id === stageId)?.label ?? (stageId || "Sem etapa");
1715
- return /* @__PURE__ */ jsxs7(
1716
- Box6,
2179
+ return /* @__PURE__ */ jsxs13(
2180
+ Box10,
1717
2181
  {
1718
2182
  minW: "300px",
1719
2183
  maxW: "340px",
@@ -1724,14 +2188,14 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1724
2188
  borderWidth: "1px",
1725
2189
  borderColor: "#DDE3E7",
1726
2190
  children: [
1727
- /* @__PURE__ */ jsxs7(Flex5, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
1728
- /* @__PURE__ */ jsx12(Text7, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
1729
- /* @__PURE__ */ jsx12(Badge2, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
2191
+ /* @__PURE__ */ jsxs13(Flex8, { align: "center", justify: "space-between", mb: 3, px: 1, children: [
2192
+ /* @__PURE__ */ jsx18(Text12, { fontWeight: "700", fontSize: "12px", color: "#33434C", textTransform: "uppercase", letterSpacing: "0.03em", children: stageLabel }),
2193
+ /* @__PURE__ */ jsx18(Badge4, { colorPalette: "brand", variant: "solid", borderRadius: "full", minW: "24px", justifyContent: "center", children: items.length })
1730
2194
  ] }),
1731
- /* @__PURE__ */ jsx12(Stack4, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx12(Box6, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx12(Text7, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
2195
+ /* @__PURE__ */ jsx18(Stack5, { gap: 2, children: items.length === 0 ? /* @__PURE__ */ jsx18(Box10, { borderWidth: "1px", borderStyle: "dashed", borderColor: "#C8D0D5", borderRadius: "10px", p: 5, textAlign: "center", children: /* @__PURE__ */ jsx18(Text12, { fontSize: "12px", color: "gray.500", children: "Nenhum ticket nesta etapa." }) }) : items.map((row, index) => {
1732
2196
  const ticketTitle = formatCell(row[title], "string");
1733
- return /* @__PURE__ */ jsxs7(
1734
- Button5,
2197
+ return /* @__PURE__ */ jsxs13(
2198
+ Button9,
1735
2199
  {
1736
2200
  type: "button",
1737
2201
  variant: "plain",
@@ -1756,10 +2220,10 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1756
2220
  _hover: { borderColor: "brand.300", transform: "translateY(-1px)", boxShadow: "0 7px 18px rgba(7, 38, 46, 0.09)" },
1757
2221
  _focusVisible: { borderColor: "brand.500", boxShadow: "0 0 0 3px rgba(4, 116, 175, 0.16)" },
1758
2222
  children: [
1759
- /* @__PURE__ */ jsx12(Text7, { fontSize: "13px", fontWeight: "700", color: "#24323A", mb: 2, lineClamp: 2, children: ticketTitle }),
1760
- /* @__PURE__ */ jsx12(Stack4, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs7(Flex5, { gap: 2, align: "baseline", justify: "space-between", children: [
1761
- /* @__PURE__ */ jsx12(Text7, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
1762
- /* @__PURE__ */ jsx12(Text7, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
2223
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "13px", fontWeight: "700", color: "#24323A", mb: 2, lineClamp: 2, children: ticketTitle }),
2224
+ /* @__PURE__ */ jsx18(Stack5, { gap: 1, children: detailFields.map((field) => /* @__PURE__ */ jsxs13(Flex8, { gap: 2, align: "baseline", justify: "space-between", children: [
2225
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.03em", children: fieldLabel(field) }),
2226
+ /* @__PURE__ */ jsx18(Text12, { fontSize: "11px", color: "#46545C", fontWeight: "500", textAlign: "right", lineClamp: 1, children: formatCell(row[field.name], field.kind) })
1763
2227
  ] }, field.name)) })
1764
2228
  ]
1765
2229
  },
@@ -1771,7 +2235,7 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1771
2235
  stageId
1772
2236
  );
1773
2237
  }) }),
1774
- selectedTicket ? /* @__PURE__ */ jsx12(
2238
+ selectedTicket ? /* @__PURE__ */ jsx18(
1775
2239
  DynamicForm,
1776
2240
  {
1777
2241
  title: `Editar ${schema?.singular ?? label ?? model}`,
@@ -1796,9 +2260,9 @@ function CorePipeline({ model, label, endpoint, stageField = "status", stages, t
1796
2260
  }
1797
2261
 
1798
2262
  // src/components/CoreDashboard.tsx
1799
- import { Box as Box7, Heading as Heading5, SimpleGrid as SimpleGrid2, Stack as Stack5, Text as Text8 } from "@chakra-ui/react";
2263
+ import { Box as Box11, Heading as Heading6, SimpleGrid as SimpleGrid4, Stack as Stack6, Text as Text13 } from "@chakra-ui/react";
1800
2264
  import { useQueries } from "@tanstack/react-query";
1801
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2265
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1802
2266
  function CoreDashboard({ label = "Dashboard", widgets = [] }) {
1803
2267
  const { resource } = useOonApi();
1804
2268
  const queries = useQueries({
@@ -1815,17 +2279,17 @@ function CoreDashboard({ label = "Dashboard", widgets = [] }) {
1815
2279
  }))
1816
2280
  });
1817
2281
  let queryIdx = 0;
1818
- return /* @__PURE__ */ jsxs8(Stack5, { gap: 6, children: [
1819
- /* @__PURE__ */ jsx13(Heading5, { size: "lg", children: label }),
1820
- /* @__PURE__ */ jsx13(SimpleGrid2, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
2282
+ return /* @__PURE__ */ jsxs14(Stack6, { gap: 6, children: [
2283
+ /* @__PURE__ */ jsx19(Heading6, { size: "lg", children: label }),
2284
+ /* @__PURE__ */ jsx19(SimpleGrid4, { columns: { base: 1, md: 2, lg: 3 }, gap: 4, children: widgets.map((w) => {
1821
2285
  if (w.kind === "custom" && w.render) {
1822
- return /* @__PURE__ */ jsx13(Box7, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
2286
+ return /* @__PURE__ */ jsx19(Box11, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: w.render() }, w.id);
1823
2287
  }
1824
2288
  const q = queries[queryIdx++];
1825
2289
  const value = q?.isLoading ? "\u2026" : q?.isError ? "\u2014" : formatWidget(q?.data, w.kind, w.field);
1826
- return /* @__PURE__ */ jsxs8(Box7, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
1827
- /* @__PURE__ */ jsx13(Text8, { fontSize: "sm", color: "gray.500", children: w.label }),
1828
- /* @__PURE__ */ jsx13(Heading5, { size: "xl", mt: 1, children: value })
2290
+ return /* @__PURE__ */ jsxs14(Box11, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 5, children: [
2291
+ /* @__PURE__ */ jsx19(Text13, { fontSize: "sm", color: "gray.500", children: w.label }),
2292
+ /* @__PURE__ */ jsx19(Heading6, { size: "xl", mt: 1, children: value })
1829
2293
  ] }, w.id);
1830
2294
  }) })
1831
2295
  ] });
@@ -1839,22 +2303,22 @@ function formatWidget(value, kind, field) {
1839
2303
  }
1840
2304
 
1841
2305
  // src/components/ui-v2/CorePage.tsx
1842
- import { Box as Box10, Heading as Heading7, Stack as Stack6, Text as Text11 } from "@chakra-ui/react";
2306
+ import { Box as Box14, Heading as Heading8, Stack as Stack7, Text as Text16 } from "@chakra-ui/react";
1843
2307
 
1844
2308
  // src/security/PermissionGate.tsx
1845
- import { Fragment, jsx as jsx14 } from "react/jsx-runtime";
2309
+ import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
1846
2310
  function PermissionGate({
1847
2311
  permission,
1848
2312
  fallback = null,
1849
2313
  children
1850
2314
  }) {
1851
2315
  const { hasPermission } = useOonAuth();
1852
- return /* @__PURE__ */ jsx14(Fragment, { children: hasPermission(permission) ? children : fallback });
2316
+ return /* @__PURE__ */ jsx20(Fragment3, { children: hasPermission(permission) ? children : fallback });
1853
2317
  }
1854
2318
 
1855
2319
  // src/app/componentRegistry.tsx
1856
- import { Box as Box8, Text as Text9 } from "@chakra-ui/react";
1857
- import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
2320
+ import { Box as Box12, Text as Text14 } from "@chakra-ui/react";
2321
+ import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
1858
2322
  var PREFIX_BUCKETS = {
1859
2323
  "custom": "pageComponents",
1860
2324
  "fields": "fieldRenderers",
@@ -1874,12 +2338,12 @@ function resolveComponent(registry, key, bucket) {
1874
2338
  return registry?.[targetBucket]?.[normalized] ?? registry?.[targetBucket]?.[key] ?? null;
1875
2339
  }
1876
2340
  function MissingRenderer({ renderer, children }) {
1877
- if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx15(Fragment2, { children: children ?? null });
1878
- return /* @__PURE__ */ jsxs9(Box8, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
1879
- /* @__PURE__ */ jsx15(Text9, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
1880
- /* @__PURE__ */ jsxs9(Text9, { fontSize: "xs", children: [
2341
+ if (import.meta.env?.MODE === "production") return /* @__PURE__ */ jsx21(Fragment4, { children: children ?? null });
2342
+ return /* @__PURE__ */ jsxs15(Box12, { borderWidth: "1px", borderStyle: "dashed", borderColor: "orange.300", bg: "orange.50", color: "orange.900", borderRadius: "md", p: 3, children: [
2343
+ /* @__PURE__ */ jsx21(Text14, { fontSize: "sm", fontWeight: "600", children: "Renderer n\xE3o encontrado" }),
2344
+ /* @__PURE__ */ jsxs15(Text14, { fontSize: "xs", children: [
1881
2345
  "Registre a chave ",
1882
- renderer ? /* @__PURE__ */ jsx15("code", { children: renderer }) : "solicitada",
2346
+ renderer ? /* @__PURE__ */ jsx21("code", { children: renderer }) : "solicitada",
1883
2347
  " no registry da UI."
1884
2348
  ] }),
1885
2349
  children
@@ -1887,61 +2351,61 @@ function MissingRenderer({ renderer, children }) {
1887
2351
  }
1888
2352
 
1889
2353
  // src/components/ui-v2/CorePrimitives.tsx
1890
- import { Box as Box9, Button as Button6, Flex as Flex6, Heading as Heading6, Spinner as Spinner3, Text as Text10 } from "@chakra-ui/react";
1891
- import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
2354
+ import { Box as Box13, Button as Button10, Flex as Flex9, Heading as Heading7, Spinner as Spinner3, Text as Text15 } from "@chakra-ui/react";
2355
+ import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
1892
2356
  function CorePage({ children }) {
1893
- return /* @__PURE__ */ jsx16(Box9, { children });
2357
+ return /* @__PURE__ */ jsx22(Box13, { children });
1894
2358
  }
1895
2359
  function CorePageHeader({ title, description, actions }) {
1896
- return /* @__PURE__ */ jsxs10(Flex6, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
1897
- /* @__PURE__ */ jsxs10(Box9, { children: [
1898
- title ? /* @__PURE__ */ jsx16(Heading6, { size: "lg", children: title }) : null,
1899
- description ? /* @__PURE__ */ jsx16(Text10, { color: "gray.600", mt: 1, children: description }) : null
2360
+ return /* @__PURE__ */ jsxs16(Flex9, { align: "start", justify: "space-between", gap: 4, mb: 6, children: [
2361
+ /* @__PURE__ */ jsxs16(Box13, { children: [
2362
+ title ? /* @__PURE__ */ jsx22(Heading7, { size: "lg", children: title }) : null,
2363
+ description ? /* @__PURE__ */ jsx22(Text15, { color: "gray.600", mt: 1, children: description }) : null
1900
2364
  ] }),
1901
2365
  actions
1902
2366
  ] });
1903
2367
  }
1904
2368
  function CoreToolbar({ children }) {
1905
- return /* @__PURE__ */ jsx16(Flex6, { align: "center", gap: 2, mb: 4, children });
2369
+ return /* @__PURE__ */ jsx22(Flex9, { align: "center", gap: 2, mb: 4, children });
1906
2370
  }
1907
2371
  function CoreDataGrid(props) {
1908
- return /* @__PURE__ */ jsx16(CoreCollection, { ...props });
2372
+ return /* @__PURE__ */ jsx22(CoreCollection, { ...props });
1909
2373
  }
1910
2374
  function CoreCards(props) {
1911
- return /* @__PURE__ */ jsx16(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
2375
+ return /* @__PURE__ */ jsx22(CoreCollection, { model: props.model, mode: "minimal", label: props.model });
1912
2376
  }
1913
2377
  function CoreForm(props) {
1914
- return /* @__PURE__ */ jsx16(Box9, { children: props.children });
2378
+ return /* @__PURE__ */ jsx22(Box13, { children: props.children });
1915
2379
  }
1916
2380
  function CoreField({ label, children }) {
1917
- return /* @__PURE__ */ jsxs10(Box9, { children: [
1918
- /* @__PURE__ */ jsx16(Text10, { fontSize: "sm", fontWeight: "600", children: label }),
2381
+ return /* @__PURE__ */ jsxs16(Box13, { children: [
2382
+ /* @__PURE__ */ jsx22(Text15, { fontSize: "sm", fontWeight: "600", children: label }),
1919
2383
  children
1920
2384
  ] });
1921
2385
  }
1922
2386
  function CoreRelationField(props) {
1923
- return /* @__PURE__ */ jsx16(CoreField, { ...props });
2387
+ return /* @__PURE__ */ jsx22(CoreField, { ...props });
1924
2388
  }
1925
2389
  function CoreActions({ children }) {
1926
- return /* @__PURE__ */ jsx16(Flex6, { gap: 2, children });
2390
+ return /* @__PURE__ */ jsx22(Flex9, { gap: 2, children });
1927
2391
  }
1928
2392
  function CoreEmptyState({ title = "Nenhum dado encontrado", actionLabel, onAction }) {
1929
- return /* @__PURE__ */ jsxs10(Box9, { textAlign: "center", py: 10, children: [
1930
- /* @__PURE__ */ jsx16(Text10, { children: title }),
1931
- actionLabel ? /* @__PURE__ */ jsx16(Button6, { mt: 3, onClick: onAction, children: actionLabel }) : null
2393
+ return /* @__PURE__ */ jsxs16(Box13, { textAlign: "center", py: 10, children: [
2394
+ /* @__PURE__ */ jsx22(Text15, { children: title }),
2395
+ actionLabel ? /* @__PURE__ */ jsx22(Button10, { mt: 3, onClick: onAction, children: actionLabel }) : null
1932
2396
  ] });
1933
2397
  }
1934
2398
  function CoreLoadingState({ label = "Carregando..." }) {
1935
- return /* @__PURE__ */ jsxs10(Flex6, { align: "center", gap: 3, children: [
1936
- /* @__PURE__ */ jsx16(Spinner3, { size: "sm" }),
1937
- /* @__PURE__ */ jsx16(Text10, { children: label })
2399
+ return /* @__PURE__ */ jsxs16(Flex9, { align: "center", gap: 3, children: [
2400
+ /* @__PURE__ */ jsx22(Spinner3, { size: "sm" }),
2401
+ /* @__PURE__ */ jsx22(Text15, { children: label })
1938
2402
  ] });
1939
2403
  }
1940
2404
 
1941
2405
  // src/components/ui-v2/CorePage.tsx
1942
- import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
2406
+ import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
1943
2407
  function renderMarkdown(content) {
1944
- return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx17(Text11, { whiteSpace: "pre-wrap", children: paragraph }, index));
2408
+ return content.split(/\n{2,}/).map((paragraph, index) => /* @__PURE__ */ jsx23(Text16, { whiteSpace: "pre-wrap", children: paragraph }, index));
1945
2409
  }
1946
2410
  function requiredAccess(source) {
1947
2411
  const values = [...source.permissions ?? [], ...source.capabilities ?? []].filter(Boolean);
@@ -1953,38 +2417,38 @@ function CoreBlock({ block, registry }) {
1953
2417
  switch (block.type) {
1954
2418
  case "custom": {
1955
2419
  const Component = resolveComponent(registry, block.component, "pageComponents");
1956
- return Component ? /* @__PURE__ */ jsx17(Component, { block, ...block.props }) : /* @__PURE__ */ jsx17(MissingRenderer, { renderer: block.component });
2420
+ return Component ? /* @__PURE__ */ jsx23(Component, { block, ...block.props }) : /* @__PURE__ */ jsx23(MissingRenderer, { renderer: block.component });
1957
2421
  }
1958
2422
  case "collection.datagrid":
1959
- return /* @__PURE__ */ jsx17(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
2423
+ return /* @__PURE__ */ jsx23(CoreDataGrid, { model: block.model, mode: block.mode, columns: block.columns, form: block.form, label: block.title ?? block.model });
1960
2424
  case "collection.cards": {
1961
2425
  const Component = resolveComponent(registry, block.renderer, "cardRenderers");
1962
- return Component ? /* @__PURE__ */ jsx17(Component, { block, model: block.model }) : /* @__PURE__ */ jsx17(CoreCards, { model: block.model, renderer: block.renderer });
2426
+ return Component ? /* @__PURE__ */ jsx23(Component, { block, model: block.model }) : /* @__PURE__ */ jsx23(CoreCards, { model: block.model, renderer: block.renderer });
1963
2427
  }
1964
2428
  case "section":
1965
- return /* @__PURE__ */ jsxs11(Box10, { children: [
1966
- /* @__PURE__ */ jsx17(Heading7, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
1967
- block.description ? /* @__PURE__ */ jsx17(Text11, { color: "gray.600", mb: 4, children: block.description }) : null,
1968
- /* @__PURE__ */ jsx17(Stack6, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx17(CoreBlock, { block: child, registry }, child.id ?? index)) })
2429
+ return /* @__PURE__ */ jsxs17(Box14, { children: [
2430
+ /* @__PURE__ */ jsx23(Heading8, { size: "md", mb: block.description ? 1 : 4, children: block.title }),
2431
+ block.description ? /* @__PURE__ */ jsx23(Text16, { color: "gray.600", mb: 4, children: block.description }) : null,
2432
+ /* @__PURE__ */ jsx23(Stack7, { gap: 4, children: block.blocks?.map((child, index) => /* @__PURE__ */ jsx23(CoreBlock, { block: child, registry }, child.id ?? index)) })
1969
2433
  ] });
1970
2434
  case "markdown":
1971
- return /* @__PURE__ */ jsx17(Stack6, { gap: 2, children: renderMarkdown(block.content) });
2435
+ return /* @__PURE__ */ jsx23(Stack7, { gap: 2, children: renderMarkdown(block.content) });
1972
2436
  default:
1973
- return /* @__PURE__ */ jsx17(MissingRenderer, { renderer: block.type });
2437
+ return /* @__PURE__ */ jsx23(MissingRenderer, { renderer: block.type });
1974
2438
  }
1975
2439
  })();
1976
- return /* @__PURE__ */ jsx17(PermissionGate, { permission: requiredAccess(block), children: content });
2440
+ return /* @__PURE__ */ jsx23(PermissionGate, { permission: requiredAccess(block), children: content });
1977
2441
  }
1978
2442
  function CorePage2({ page, registry }) {
1979
2443
  const Component = resolveComponent(registry, page.component, "pageComponents");
1980
- return /* @__PURE__ */ jsx17(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx17(Component, { page }) : /* @__PURE__ */ jsxs11(CorePage, { children: [
1981
- /* @__PURE__ */ jsx17(CorePageHeader, { title: page.title ?? page.label }),
1982
- /* @__PURE__ */ jsx17(Stack6, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx17(CoreBlock, { block, registry }, block.id ?? index)) })
2444
+ return /* @__PURE__ */ jsx23(PermissionGate, { permission: requiredAccess(page), children: Component ? /* @__PURE__ */ jsx23(Component, { page }) : /* @__PURE__ */ jsxs17(CorePage, { children: [
2445
+ /* @__PURE__ */ jsx23(CorePageHeader, { title: page.title ?? page.label }),
2446
+ /* @__PURE__ */ jsx23(Stack7, { gap: 6, children: page.blocks?.map((block, index) => /* @__PURE__ */ jsx23(CoreBlock, { block, registry }, block.id ?? index)) })
1983
2447
  ] }) });
1984
2448
  }
1985
2449
 
1986
2450
  // src/app/moduleRegistry.tsx
1987
- import { jsx as jsx18 } from "react/jsx-runtime";
2451
+ import { jsx as jsx24 } from "react/jsx-runtime";
1988
2452
  function slug(value) {
1989
2453
  return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
1990
2454
  }
@@ -2011,7 +2475,7 @@ function renderView(view) {
2011
2475
  switch (view.type) {
2012
2476
  case "collection": {
2013
2477
  const v = view;
2014
- return /* @__PURE__ */ jsx18(
2478
+ return /* @__PURE__ */ jsx24(
2015
2479
  CoreCollection,
2016
2480
  {
2017
2481
  model: v.model,
@@ -2019,17 +2483,21 @@ function renderView(view) {
2019
2483
  columns: v.columns,
2020
2484
  form: v.form,
2021
2485
  label: viewLabel(v),
2022
- importExport: v.importExport
2486
+ section: v.section,
2487
+ importExport: v.importExport,
2488
+ list: v.list,
2489
+ relations: v.relations,
2490
+ detailModal: v.detailModal
2023
2491
  }
2024
2492
  );
2025
2493
  }
2026
2494
  case "document": {
2027
2495
  const v = view;
2028
- return /* @__PURE__ */ jsx18(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
2496
+ return /* @__PURE__ */ jsx24(CoreDocument, { model: v.model, label: viewLabel(v), approval: v.approval, attachments: v.attachments });
2029
2497
  }
2030
2498
  case "pipeline": {
2031
2499
  const v = view;
2032
- return /* @__PURE__ */ jsx18(
2500
+ return /* @__PURE__ */ jsx24(
2033
2501
  CorePipeline,
2034
2502
  {
2035
2503
  model: v.model,
@@ -2041,7 +2509,7 @@ function renderView(view) {
2041
2509
  }
2042
2510
  case "dashboard": {
2043
2511
  const v = view;
2044
- return /* @__PURE__ */ jsx18(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
2512
+ return /* @__PURE__ */ jsx24(CoreDashboard, { label: viewLabel(v), widgets: v.widgets });
2045
2513
  }
2046
2514
  default:
2047
2515
  return null;
@@ -2055,7 +2523,7 @@ function viewToRoute(view) {
2055
2523
  };
2056
2524
  }
2057
2525
  function pageToRoute(page, registry) {
2058
- return { path: page.path, element: /* @__PURE__ */ jsx18(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
2526
+ return { path: page.path, element: /* @__PURE__ */ jsx24(CorePage2, { page, registry }), permissions: requiredAccess2(page) };
2059
2527
  }
2060
2528
  function pageToMenu(page) {
2061
2529
  if (page.hidden || !page.label) return null;
@@ -2116,13 +2584,13 @@ import {
2116
2584
  } from "react-router-dom";
2117
2585
 
2118
2586
  // src/shell/DefaultShell.tsx
2119
- import { Box as Box12, Button as Button7, Flex as Flex8, Spacer as Spacer2, Text as Text13 } from "@chakra-ui/react";
2587
+ import { Box as Box16, Button as Button11, Flex as Flex11, Spacer as Spacer2, Text as Text18 } from "@chakra-ui/react";
2120
2588
  import { Outlet } from "react-router-dom";
2121
2589
 
2122
2590
  // src/shell/Sidebar.tsx
2123
- import { Box as Box11, Flex as Flex7, Image, Stack as Stack7, Text as Text12 } from "@chakra-ui/react";
2591
+ import { Box as Box15, Flex as Flex10, Image, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
2124
2592
  import { NavLink } from "react-router-dom";
2125
- import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
2593
+ import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
2126
2594
  function groupBySection(items) {
2127
2595
  const groups = /* @__PURE__ */ new Map();
2128
2596
  for (const item of items) {
@@ -2135,8 +2603,8 @@ function groupBySection(items) {
2135
2603
  function Sidebar({ app, menu, registry }) {
2136
2604
  const { hasPermission } = useOonAuth();
2137
2605
  const visible = menu.filter((item) => !item.hidden && hasPermission(item.permissions));
2138
- return /* @__PURE__ */ jsxs12(
2139
- Box11,
2606
+ return /* @__PURE__ */ jsxs18(
2607
+ Box15,
2140
2608
  {
2141
2609
  as: "nav",
2142
2610
  w: { base: "76px", lg: "248px" },
@@ -2151,9 +2619,9 @@ function Sidebar({ app, menu, registry }) {
2151
2619
  alignSelf: "flex-start",
2152
2620
  overflowY: "auto",
2153
2621
  children: [
2154
- /* @__PURE__ */ jsxs12(Flex7, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
2155
- app.logo ? /* @__PURE__ */ jsx19(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx19(
2156
- Flex7,
2622
+ /* @__PURE__ */ jsxs18(Flex10, { align: "center", gap: 3, mb: 6, px: { base: 1, lg: 2 }, minH: "42px", children: [
2623
+ app.logo ? /* @__PURE__ */ jsx25(Image, { src: app.logo, alt: app.name, maxH: "36px", maxW: { base: "44px", lg: "150px" }, objectFit: "contain" }) : /* @__PURE__ */ jsx25(
2624
+ Flex10,
2157
2625
  {
2158
2626
  w: "38px",
2159
2627
  h: "38px",
@@ -2168,14 +2636,14 @@ function Sidebar({ app, menu, registry }) {
2168
2636
  children: "O"
2169
2637
  }
2170
2638
  ),
2171
- /* @__PURE__ */ jsxs12(Box11, { display: { base: "none", lg: "block" }, minW: 0, children: [
2172
- /* @__PURE__ */ jsx19(Text12, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
2173
- /* @__PURE__ */ jsx19(Text12, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
2639
+ /* @__PURE__ */ jsxs18(Box15, { display: { base: "none", lg: "block" }, minW: 0, children: [
2640
+ /* @__PURE__ */ jsx25(Text17, { fontWeight: "700", fontSize: "sm", color: "#07262E", lineClamp: 1, children: app.name }),
2641
+ /* @__PURE__ */ jsx25(Text17, { fontSize: "10px", color: "gray.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Opera\xE7\xE3o digital" })
2174
2642
  ] })
2175
2643
  ] }),
2176
- /* @__PURE__ */ jsx19(Stack7, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs12(Stack7, { gap: 1, children: [
2177
- /* @__PURE__ */ jsx19(
2178
- Text12,
2644
+ /* @__PURE__ */ jsx25(Stack8, { gap: 5, children: groupBySection(visible).map(([section, items]) => /* @__PURE__ */ jsxs18(Stack8, { gap: 1, children: [
2645
+ /* @__PURE__ */ jsx25(
2646
+ Text17,
2179
2647
  {
2180
2648
  display: { base: "none", lg: "block" },
2181
2649
  fontSize: "10px",
@@ -2190,9 +2658,9 @@ function Sidebar({ app, menu, registry }) {
2190
2658
  ),
2191
2659
  items.map((item) => {
2192
2660
  const CustomMenuItem = resolveComponent(registry, item.renderer, "menuRenderers");
2193
- if (CustomMenuItem) return /* @__PURE__ */ jsx19(CustomMenuItem, { item }, item.href);
2194
- return /* @__PURE__ */ jsx19(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs12(
2195
- Flex7,
2661
+ if (CustomMenuItem) return /* @__PURE__ */ jsx25(CustomMenuItem, { item }, item.href);
2662
+ return /* @__PURE__ */ jsx25(NavLink, { to: item.href, end: item.href === "/", title: item.label, children: ({ isActive }) => /* @__PURE__ */ jsxs18(
2663
+ Flex10,
2196
2664
  {
2197
2665
  align: "center",
2198
2666
  justify: { base: "center", lg: "flex-start" },
@@ -2209,8 +2677,8 @@ function Sidebar({ app, menu, registry }) {
2209
2677
  transition: "all 0.15s ease",
2210
2678
  _hover: { bg: isActive ? "brand.50" : "#F8F9FA", color: "brand.700" },
2211
2679
  children: [
2212
- item.icon ? /* @__PURE__ */ jsx19(Box11, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx19(Box11, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
2213
- /* @__PURE__ */ jsx19(Text12, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
2680
+ item.icon ? /* @__PURE__ */ jsx25(Box15, { flex: "0 0 auto", children: item.icon }) : /* @__PURE__ */ jsx25(Box15, { w: "7px", h: "7px", borderRadius: "full", bg: isActive ? "brand.500" : "gray.300" }),
2681
+ /* @__PURE__ */ jsx25(Text17, { display: { base: "none", lg: "block" }, lineClamp: 1, children: item.label })
2214
2682
  ]
2215
2683
  }
2216
2684
  ) }, item.href);
@@ -2222,21 +2690,21 @@ function Sidebar({ app, menu, registry }) {
2222
2690
  }
2223
2691
 
2224
2692
  // src/shell/DefaultShell.tsx
2225
- import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
2693
+ import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
2226
2694
  function CoreTopbar({ app }) {
2227
2695
  const { user, logout } = useOonAuth();
2228
- return /* @__PURE__ */ jsxs13(Flex8, { as: "header", align: "center", minH: "64px", px: { base: 4, lg: 6 }, py: 3, borderBottomWidth: "1px", borderColor: "#E8ECEF", bg: "rgba(255, 255, 255, 0.96)", backdropFilter: "blur(10px)", position: "sticky", top: 0, zIndex: 10, children: [
2229
- /* @__PURE__ */ jsxs13(Box12, { children: [
2230
- /* @__PURE__ */ jsx20(Text13, { fontSize: "xs", fontWeight: "600", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Central Oon" }),
2231
- /* @__PURE__ */ jsx20(Text13, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name })
2696
+ return /* @__PURE__ */ jsxs19(Flex11, { as: "header", align: "center", minH: "64px", px: { base: 4, lg: 6 }, py: 3, borderBottomWidth: "1px", borderColor: "#E8ECEF", bg: "rgba(255, 255, 255, 0.96)", backdropFilter: "blur(10px)", position: "sticky", top: 0, zIndex: 10, children: [
2697
+ /* @__PURE__ */ jsxs19(Box16, { children: [
2698
+ /* @__PURE__ */ jsx26(Text18, { fontSize: "xs", fontWeight: "600", color: "brand.500", textTransform: "uppercase", letterSpacing: "0.08em", children: "Central Oon" }),
2699
+ /* @__PURE__ */ jsx26(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: app.title ?? app.name })
2232
2700
  ] }),
2233
- /* @__PURE__ */ jsx20(Spacer2, {}),
2234
- user ? /* @__PURE__ */ jsxs13(Flex8, { align: "center", gap: 3, children: [
2235
- /* @__PURE__ */ jsxs13(Box12, { textAlign: "right", display: { base: "none", md: "block" }, children: [
2236
- /* @__PURE__ */ jsx20(Text13, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
2237
- user.email ? /* @__PURE__ */ jsx20(Text13, { fontSize: "xs", color: "gray.500", children: user.email }) : null
2701
+ /* @__PURE__ */ jsx26(Spacer2, {}),
2702
+ user ? /* @__PURE__ */ jsxs19(Flex11, { align: "center", gap: 3, children: [
2703
+ /* @__PURE__ */ jsxs19(Box16, { textAlign: "right", display: { base: "none", md: "block" }, children: [
2704
+ /* @__PURE__ */ jsx26(Text18, { fontSize: "sm", fontWeight: "600", color: "#24323A", children: user.nome }),
2705
+ user.email ? /* @__PURE__ */ jsx26(Text18, { fontSize: "xs", color: "gray.500", children: user.email }) : null
2238
2706
  ] }),
2239
- /* @__PURE__ */ jsx20(Button7, { size: "sm", variant: "outline", colorPalette: "brand", borderRadius: "8px", onClick: logout, children: "Sair" })
2707
+ /* @__PURE__ */ jsx26(Button11, { size: "sm", variant: "outline", colorPalette: "brand", borderRadius: "8px", onClick: logout, children: "Sair" })
2240
2708
  ] }) : null
2241
2709
  ] });
2242
2710
  }
@@ -2244,45 +2712,45 @@ function Slot({ name, slot, registry, app, menu }) {
2244
2712
  if (slot === "none") return null;
2245
2713
  if (slot?.startsWith("custom:")) {
2246
2714
  const C = resolveComponent(registry, slot, "layoutSlots");
2247
- return C ? /* @__PURE__ */ jsx20(C, { app, menu }) : /* @__PURE__ */ jsx20(MissingRenderer, { renderer: slot });
2715
+ return C ? /* @__PURE__ */ jsx26(C, { app, menu }) : /* @__PURE__ */ jsx26(MissingRenderer, { renderer: slot });
2248
2716
  }
2249
- if (name === "sidebar") return /* @__PURE__ */ jsx20(Sidebar, { app, menu, registry });
2250
- if (name === "topbar") return /* @__PURE__ */ jsx20(CoreTopbar, { app });
2251
- if (name === "footer" && slot === "core") return /* @__PURE__ */ jsx20(Box12, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
2717
+ if (name === "sidebar") return /* @__PURE__ */ jsx26(Sidebar, { app, menu, registry });
2718
+ if (name === "topbar") return /* @__PURE__ */ jsx26(CoreTopbar, { app });
2719
+ if (name === "footer" && slot === "core") return /* @__PURE__ */ jsx26(Box16, { as: "footer", px: 6, py: 4, color: "gray.500", fontSize: "xs", borderTopWidth: "1px", children: "OonCore" });
2252
2720
  return null;
2253
2721
  }
2254
2722
  function DefaultShell({ app, menu, layout, registry }) {
2255
2723
  const portal = layout?.shell === "portal" || layout?.shell === "content-only";
2256
2724
  const mainPadding = portal ? { base: 4, lg: 10 } : { base: 4, lg: 6 };
2257
- return /* @__PURE__ */ jsxs13(Flex8, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
2258
- /* @__PURE__ */ jsx20(Slot, { name: "sidebar", slot: layout?.sidebar ?? "core", registry, app, menu }),
2259
- /* @__PURE__ */ jsxs13(Flex8, { direction: "column", flex: "1", minW: 0, children: [
2260
- /* @__PURE__ */ jsx20(Slot, { name: "topbar", slot: layout?.topbar ?? "core", registry, app, menu }),
2261
- /* @__PURE__ */ jsx20(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
2262
- /* @__PURE__ */ jsx20(Box12, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx20(Box12, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx20(Outlet, {}) }) }),
2263
- /* @__PURE__ */ jsx20(Slot, { name: "footer", slot: layout?.footer ?? "none", registry, app, menu })
2725
+ return /* @__PURE__ */ jsxs19(Flex11, { align: "stretch", minH: "100vh", bg: portal ? "white" : "#F8F9FA", children: [
2726
+ /* @__PURE__ */ jsx26(Slot, { name: "sidebar", slot: layout?.sidebar ?? "core", registry, app, menu }),
2727
+ /* @__PURE__ */ jsxs19(Flex11, { direction: "column", flex: "1", minW: 0, children: [
2728
+ /* @__PURE__ */ jsx26(Slot, { name: "topbar", slot: layout?.topbar ?? "core", registry, app, menu }),
2729
+ /* @__PURE__ */ jsx26(Slot, { name: "header", slot: layout?.header, registry, app, menu }),
2730
+ /* @__PURE__ */ jsx26(Box16, { as: "main", flex: "1", p: mainPadding, minW: 0, children: /* @__PURE__ */ jsx26(Box16, { maxW: portal ? "1180px" : "1680px", mx: "auto", children: /* @__PURE__ */ jsx26(Outlet, {}) }) }),
2731
+ /* @__PURE__ */ jsx26(Slot, { name: "footer", slot: layout?.footer ?? "none", registry, app, menu })
2264
2732
  ] })
2265
2733
  ] });
2266
2734
  }
2267
2735
  function PortalShell(props) {
2268
- return /* @__PURE__ */ jsx20(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
2736
+ return /* @__PURE__ */ jsx26(DefaultShell, { ...props, layout: { ...props.layout, shell: "portal" } });
2269
2737
  }
2270
2738
 
2271
2739
  // src/shell/AuthenticatedLayout.tsx
2272
- import { jsx as jsx21 } from "react/jsx-runtime";
2740
+ import { jsx as jsx27 } from "react/jsx-runtime";
2273
2741
  function AuthenticatedLayout({ app, menu, layout, registry }) {
2274
2742
  if (layout?.shell?.startsWith("custom:")) {
2275
2743
  const CustomShell = resolveComponent(registry, layout.shell, "layoutSlots");
2276
- return CustomShell ? /* @__PURE__ */ jsx21(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx21(MissingRenderer, { renderer: layout.shell });
2744
+ return CustomShell ? /* @__PURE__ */ jsx27(CustomShell, { app, menu, layout }) : /* @__PURE__ */ jsx27(MissingRenderer, { renderer: layout.shell });
2277
2745
  }
2278
- if (layout?.shell === "portal") return /* @__PURE__ */ jsx21(PortalShell, { app, menu, layout, registry });
2279
- return /* @__PURE__ */ jsx21(DefaultShell, { app, menu, layout, registry });
2746
+ if (layout?.shell === "portal") return /* @__PURE__ */ jsx27(PortalShell, { app, menu, layout, registry });
2747
+ return /* @__PURE__ */ jsx27(DefaultShell, { app, menu, layout, registry });
2280
2748
  }
2281
2749
 
2282
2750
  // src/security/AccessDeniedPage.tsx
2283
- import { Box as Box13, Button as Button8, Flex as Flex9, Heading as Heading8, Text as Text14, VStack } from "@chakra-ui/react";
2751
+ import { Box as Box17, Button as Button12, Flex as Flex12, Heading as Heading9, Text as Text19, VStack } from "@chakra-ui/react";
2284
2752
  import { useNavigate } from "react-router-dom";
2285
- import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
2753
+ import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
2286
2754
  function AccessDeniedPage({ app }) {
2287
2755
  const { logout } = useOonAuth();
2288
2756
  const navigate = useNavigate();
@@ -2290,8 +2758,8 @@ function AccessDeniedPage({ app }) {
2290
2758
  logout();
2291
2759
  navigate("/login", { replace: true });
2292
2760
  }
2293
- return /* @__PURE__ */ jsx22(Flex9, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx22(
2294
- Box13,
2761
+ return /* @__PURE__ */ jsx28(Flex12, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx28(
2762
+ Box17,
2295
2763
  {
2296
2764
  width: "100%",
2297
2765
  maxW: "560px",
@@ -2301,9 +2769,9 @@ function AccessDeniedPage({ app }) {
2301
2769
  borderRadius: "18px",
2302
2770
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
2303
2771
  p: { base: 6, md: 10 },
2304
- children: /* @__PURE__ */ jsxs14(VStack, { align: "stretch", gap: 6, children: [
2305
- /* @__PURE__ */ jsx22(
2306
- Box13,
2772
+ children: /* @__PURE__ */ jsxs20(VStack, { align: "stretch", gap: 6, children: [
2773
+ /* @__PURE__ */ jsx28(
2774
+ Box17,
2307
2775
  {
2308
2776
  width: "56px",
2309
2777
  height: "56px",
@@ -2319,9 +2787,9 @@ function AccessDeniedPage({ app }) {
2319
2787
  children: "!"
2320
2788
  }
2321
2789
  ),
2322
- /* @__PURE__ */ jsxs14(Box13, { children: [
2323
- /* @__PURE__ */ jsx22(
2324
- Text14,
2790
+ /* @__PURE__ */ jsxs20(Box17, { children: [
2791
+ /* @__PURE__ */ jsx28(
2792
+ Text19,
2325
2793
  {
2326
2794
  color: "#39BFED",
2327
2795
  fontSize: "xs",
@@ -2331,15 +2799,15 @@ function AccessDeniedPage({ app }) {
2331
2799
  children: "Acesso negado"
2332
2800
  }
2333
2801
  ),
2334
- /* @__PURE__ */ jsx22(Heading8, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
2335
- /* @__PURE__ */ jsxs14(Text14, { mt: 3, color: "gray.600", children: [
2802
+ /* @__PURE__ */ jsx28(Heading9, { mt: 2, size: "lg", color: "#07262E", children: "Voc\xEA n\xE3o possui permiss\xE3o para este aplicativo" }),
2803
+ /* @__PURE__ */ jsxs20(Text19, { mt: 3, color: "gray.600", children: [
2336
2804
  "Seu usu\xE1rio foi autenticado, mas n\xE3o existe uma permiss\xE3o ativa para acessar ",
2337
2805
  app.title ?? app.name,
2338
2806
  ". Solicite o acesso ao administrador da sua organiza\xE7\xE3o."
2339
2807
  ] })
2340
2808
  ] }),
2341
- /* @__PURE__ */ jsx22(
2342
- Button8,
2809
+ /* @__PURE__ */ jsx28(
2810
+ Button12,
2343
2811
  {
2344
2812
  alignSelf: "flex-start",
2345
2813
  bg: "#07262E",
@@ -2356,7 +2824,7 @@ function AccessDeniedPage({ app }) {
2356
2824
 
2357
2825
  // src/security/AppAccessGuard.tsx
2358
2826
  import { Navigate, useLocation } from "react-router-dom";
2359
- import { Fragment as Fragment3, jsx as jsx23 } from "react/jsx-runtime";
2827
+ import { Fragment as Fragment5, jsx as jsx29 } from "react/jsx-runtime";
2360
2828
  function loginRedirect(pathname, search) {
2361
2829
  const destination = `${pathname}${search}`;
2362
2830
  return `/login?redirect=${encodeURIComponent(destination)}`;
@@ -2364,9 +2832,9 @@ function loginRedirect(pathname, search) {
2364
2832
  function AppAccessGuard({ children }) {
2365
2833
  const { status, retry } = useOonAuth();
2366
2834
  const location = useLocation();
2367
- if (status === "loading") return /* @__PURE__ */ jsx23(LoadingScreen, {});
2835
+ if (status === "loading") return /* @__PURE__ */ jsx29(LoadingScreen, {});
2368
2836
  if (status === "unauthenticated") {
2369
- return /* @__PURE__ */ jsx23(
2837
+ return /* @__PURE__ */ jsx29(
2370
2838
  Navigate,
2371
2839
  {
2372
2840
  to: loginRedirect(location.pathname, location.search),
@@ -2375,10 +2843,10 @@ function AppAccessGuard({ children }) {
2375
2843
  );
2376
2844
  }
2377
2845
  if (status === "forbidden") {
2378
- return /* @__PURE__ */ jsx23(Navigate, { to: "/acesso-negado", replace: true });
2846
+ return /* @__PURE__ */ jsx29(Navigate, { to: "/acesso-negado", replace: true });
2379
2847
  }
2380
2848
  if (status === "error") {
2381
- return /* @__PURE__ */ jsx23(
2849
+ return /* @__PURE__ */ jsx29(
2382
2850
  LoadingScreen,
2383
2851
  {
2384
2852
  message: "N\xE3o foi poss\xEDvel validar seu acesso. Tente novamente.",
@@ -2389,22 +2857,22 @@ function AppAccessGuard({ children }) {
2389
2857
  }
2390
2858
  );
2391
2859
  }
2392
- return /* @__PURE__ */ jsx23(Fragment3, { children });
2860
+ return /* @__PURE__ */ jsx29(Fragment5, { children });
2393
2861
  }
2394
2862
 
2395
2863
  // src/security/LoginPage.tsx
2396
- import { useState as useState8 } from "react";
2864
+ import { useState as useState12 } from "react";
2397
2865
  import {
2398
- Box as Box14,
2399
- Button as Button9,
2400
- Flex as Flex10,
2401
- Heading as Heading9,
2402
- Input as Input4,
2403
- Text as Text15,
2866
+ Box as Box18,
2867
+ Button as Button13,
2868
+ Flex as Flex13,
2869
+ Heading as Heading10,
2870
+ Input as Input6,
2871
+ Text as Text20,
2404
2872
  VStack as VStack2
2405
2873
  } from "@chakra-ui/react";
2406
2874
  import { Navigate as Navigate2, useLocation as useLocation2 } from "react-router-dom";
2407
- import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
2875
+ import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
2408
2876
  function safeRedirect(search) {
2409
2877
  const value = new URLSearchParams(search).get("redirect") || "/";
2410
2878
  if (!value.startsWith("/") || value.startsWith("//")) return "/";
@@ -2416,16 +2884,16 @@ function safeRedirect(search) {
2416
2884
  function LoginPage({ app }) {
2417
2885
  const { status, login } = useOonAuth();
2418
2886
  const location = useLocation2();
2419
- const [email, setEmail] = useState8("");
2420
- const [password, setPassword] = useState8("");
2421
- const [submitting, setSubmitting] = useState8(false);
2422
- const [message, setMessage] = useState8(null);
2887
+ const [email, setEmail] = useState12("");
2888
+ const [password, setPassword] = useState12("");
2889
+ const [submitting, setSubmitting] = useState12(false);
2890
+ const [message, setMessage] = useState12(null);
2423
2891
  const redirect = safeRedirect(location.search);
2424
2892
  if (status === "authenticated") {
2425
- return /* @__PURE__ */ jsx24(Navigate2, { to: redirect, replace: true });
2893
+ return /* @__PURE__ */ jsx30(Navigate2, { to: redirect, replace: true });
2426
2894
  }
2427
2895
  if (status === "forbidden") {
2428
- return /* @__PURE__ */ jsx24(Navigate2, { to: "/acesso-negado", replace: true });
2896
+ return /* @__PURE__ */ jsx30(Navigate2, { to: "/acesso-negado", replace: true });
2429
2897
  }
2430
2898
  async function handleSubmit(event) {
2431
2899
  event.preventDefault();
@@ -2443,8 +2911,8 @@ function LoginPage({ app }) {
2443
2911
  setSubmitting(false);
2444
2912
  }
2445
2913
  }
2446
- return /* @__PURE__ */ jsx24(Flex10, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx24(
2447
- Box14,
2914
+ return /* @__PURE__ */ jsx30(Flex13, { minH: "100vh", align: "center", justify: "center", bg: "#F5F8FA", px: 4, children: /* @__PURE__ */ jsx30(
2915
+ Box18,
2448
2916
  {
2449
2917
  width: "100%",
2450
2918
  maxW: "440px",
@@ -2454,10 +2922,10 @@ function LoginPage({ app }) {
2454
2922
  borderRadius: "18px",
2455
2923
  boxShadow: "0 24px 70px rgba(7, 38, 46, 0.10)",
2456
2924
  p: { base: 6, md: 9 },
2457
- children: /* @__PURE__ */ jsx24("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs15(VStack2, { align: "stretch", gap: 6, children: [
2458
- /* @__PURE__ */ jsxs15(Box14, { children: [
2459
- /* @__PURE__ */ jsx24(
2460
- Text15,
2925
+ children: /* @__PURE__ */ jsx30("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 6, children: [
2926
+ /* @__PURE__ */ jsxs21(Box18, { children: [
2927
+ /* @__PURE__ */ jsx30(
2928
+ Text20,
2461
2929
  {
2462
2930
  color: "#39BFED",
2463
2931
  fontSize: "xs",
@@ -2467,14 +2935,14 @@ function LoginPage({ app }) {
2467
2935
  children: "Central Oon"
2468
2936
  }
2469
2937
  ),
2470
- /* @__PURE__ */ jsx24(Heading9, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
2471
- /* @__PURE__ */ jsx24(Text15, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
2938
+ /* @__PURE__ */ jsx30(Heading10, { mt: 2, size: "lg", color: "#07262E", children: app.title ?? app.name }),
2939
+ /* @__PURE__ */ jsx30(Text20, { mt: 2, color: "gray.600", fontSize: "sm", children: "Entre com seu usu\xE1rio autorizado para acessar este aplicativo." })
2472
2940
  ] }),
2473
- /* @__PURE__ */ jsxs15(VStack2, { align: "stretch", gap: 4, children: [
2474
- /* @__PURE__ */ jsxs15(Box14, { children: [
2475
- /* @__PURE__ */ jsx24(Text15, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
2476
- /* @__PURE__ */ jsx24(
2477
- Input4,
2941
+ /* @__PURE__ */ jsxs21(VStack2, { align: "stretch", gap: 4, children: [
2942
+ /* @__PURE__ */ jsxs21(Box18, { children: [
2943
+ /* @__PURE__ */ jsx30(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "E-mail" }),
2944
+ /* @__PURE__ */ jsx30(
2945
+ Input6,
2478
2946
  {
2479
2947
  type: "email",
2480
2948
  value: email,
@@ -2485,10 +2953,10 @@ function LoginPage({ app }) {
2485
2953
  }
2486
2954
  )
2487
2955
  ] }),
2488
- /* @__PURE__ */ jsxs15(Box14, { children: [
2489
- /* @__PURE__ */ jsx24(Text15, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
2490
- /* @__PURE__ */ jsx24(
2491
- Input4,
2956
+ /* @__PURE__ */ jsxs21(Box18, { children: [
2957
+ /* @__PURE__ */ jsx30(Text20, { mb: 2, fontSize: "sm", fontWeight: "600", color: "#24323A", children: "Senha" }),
2958
+ /* @__PURE__ */ jsx30(
2959
+ Input6,
2492
2960
  {
2493
2961
  type: "password",
2494
2962
  value: password,
@@ -2500,8 +2968,8 @@ function LoginPage({ app }) {
2500
2968
  )
2501
2969
  ] })
2502
2970
  ] }),
2503
- message ? /* @__PURE__ */ jsx24(
2504
- Box14,
2971
+ message ? /* @__PURE__ */ jsx30(
2972
+ Box18,
2505
2973
  {
2506
2974
  role: "alert",
2507
2975
  borderRadius: "10px",
@@ -2513,8 +2981,8 @@ function LoginPage({ app }) {
2513
2981
  children: message
2514
2982
  }
2515
2983
  ) : null,
2516
- /* @__PURE__ */ jsx24(
2517
- Button9,
2984
+ /* @__PURE__ */ jsx30(
2985
+ Button13,
2518
2986
  {
2519
2987
  type: "submit",
2520
2988
  bg: "#07262E",
@@ -2530,9 +2998,9 @@ function LoginPage({ app }) {
2530
2998
  }
2531
2999
 
2532
3000
  // src/security/ActivationPage.tsx
2533
- import { useEffect as useEffect5, useState as useState9 } from "react";
2534
- import { Box as Box15, Button as Button10, Heading as Heading10, Input as Input5, Text as Text16, VStack as VStack3 } from "@chakra-ui/react";
2535
- import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
3001
+ import { useEffect as useEffect7, useState as useState13 } from "react";
3002
+ import { Box as Box19, Button as Button14, Heading as Heading11, Input as Input7, Text as Text21, VStack as VStack3 } from "@chakra-ui/react";
3003
+ import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
2536
3004
  function encodeBasicCredentials2(email, password) {
2537
3005
  const bytes = new TextEncoder().encode(`${email}:${password}`);
2538
3006
  let binary = "";
@@ -2542,22 +3010,22 @@ function encodeBasicCredentials2(email, password) {
2542
3010
  function ActivationPage() {
2543
3011
  const { http } = useOonApi();
2544
3012
  const activation = useActivation();
2545
- const [step, setStep] = useState9(1);
2546
- const [config, setConfig] = useState9(null);
2547
- const [code, setCode] = useState9("");
2548
- const [preview, setPreview] = useState9(null);
2549
- const [global, setGlobal] = useState9({});
2550
- const [app, setApp] = useState9({});
2551
- const [rootEmail, setRootEmail] = useState9("");
2552
- const [rootPassword, setRootPassword] = useState9("");
2553
- const [devName, setDevName] = useState9("");
2554
- const [devEmail, setDevEmail] = useState9("");
2555
- const [devPassword, setDevPassword] = useState9("");
2556
- const [showCodeFlow, setShowCodeFlow] = useState9(false);
2557
- const [devResult, setDevResult] = useState9(null);
2558
- const [error, setError] = useState9(null);
2559
- const [submitting, setSubmitting] = useState9(false);
2560
- useEffect5(() => {
3013
+ const [step, setStep] = useState13(1);
3014
+ const [config, setConfig] = useState13(null);
3015
+ const [code, setCode] = useState13("");
3016
+ const [preview, setPreview] = useState13(null);
3017
+ const [global, setGlobal] = useState13({});
3018
+ const [app, setApp] = useState13({});
3019
+ const [rootEmail, setRootEmail] = useState13("");
3020
+ const [rootPassword, setRootPassword] = useState13("");
3021
+ const [devName, setDevName] = useState13("");
3022
+ const [devEmail, setDevEmail] = useState13("");
3023
+ const [devPassword, setDevPassword] = useState13("");
3024
+ const [showCodeFlow, setShowCodeFlow] = useState13(false);
3025
+ const [devResult, setDevResult] = useState13(null);
3026
+ const [error, setError] = useState13(null);
3027
+ const [submitting, setSubmitting] = useState13(false);
3028
+ useEffect7(() => {
2561
3029
  http.get("/ativacao/configuracao").then((response) => {
2562
3030
  setConfig(response.data);
2563
3031
  setGlobal(response.data.defaults || {});
@@ -2565,7 +3033,7 @@ function ActivationPage() {
2565
3033
  () => setError("N\xE3o foi poss\xEDvel carregar a configura\xE7\xE3o de ativa\xE7\xE3o.")
2566
3034
  );
2567
3035
  }, [http]);
2568
- useEffect5(() => {
3036
+ useEffect7(() => {
2569
3037
  if (activation.status === "active") {
2570
3038
  window.location.replace("/login");
2571
3039
  }
@@ -2666,13 +3134,13 @@ function ActivationPage() {
2666
3134
  }
2667
3135
  }
2668
3136
  function renderField(field, values, setValues) {
2669
- return /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2670
- /* @__PURE__ */ jsxs16(Text16, { fontWeight: "medium", children: [
3137
+ return /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3138
+ /* @__PURE__ */ jsxs22(Text21, { fontWeight: "medium", children: [
2671
3139
  field.label,
2672
3140
  field.required ? " *" : ""
2673
3141
  ] }),
2674
- /* @__PURE__ */ jsx25(
2675
- Input5,
3142
+ /* @__PURE__ */ jsx31(
3143
+ Input7,
2676
3144
  {
2677
3145
  type: field.type === "password" || field.type === "secret" ? "password" : field.type === "email" ? "email" : field.type === "url" ? "url" : field.type === "number" || field.type === "integer" ? "number" : "text",
2678
3146
  value: String(values[field.name] ?? field.defaultValue ?? ""),
@@ -2683,16 +3151,16 @@ function ActivationPage() {
2683
3151
  onChange: (event) => setValues({ ...values, [field.name]: event.target.value })
2684
3152
  }
2685
3153
  ),
2686
- field.helpText ? /* @__PURE__ */ jsx25(Text16, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
3154
+ field.helpText ? /* @__PURE__ */ jsx31(Text21, { fontSize: "sm", color: "gray.500", children: field.helpText }) : null
2687
3155
  ] }, field.name);
2688
3156
  }
2689
3157
  function renderDevLocalActivation() {
2690
- return /* @__PURE__ */ jsxs16(Fragment4, { children: [
2691
- /* @__PURE__ */ jsx25(Text16, { color: "gray.700", children: "Entre com seu e-mail e senha para ativar esta Central em ambiente de desenvolvimento. Se o e-mail ainda n\xE3o existir na Central de Ativa\xE7\xF5es, o usu\xE1rio ser\xE1 criado automaticamente com perfil de desenvolvedor." }),
2692
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2693
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
2694
- /* @__PURE__ */ jsx25(
2695
- Input5,
3158
+ return /* @__PURE__ */ jsxs22(Fragment6, { children: [
3159
+ /* @__PURE__ */ jsx31(Text21, { color: "gray.700", children: "Entre com seu e-mail e senha para ativar esta Central em ambiente de desenvolvimento. Se o e-mail ainda n\xE3o existir na Central de Ativa\xE7\xF5es, o usu\xE1rio ser\xE1 criado automaticamente com perfil de desenvolvedor." }),
3160
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3161
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Nome do usu\xE1rio" }),
3162
+ /* @__PURE__ */ jsx31(
3163
+ Input7,
2696
3164
  {
2697
3165
  value: devName,
2698
3166
  onChange: (event) => setDevName(event.target.value),
@@ -2701,10 +3169,10 @@ function ActivationPage() {
2701
3169
  }
2702
3170
  )
2703
3171
  ] }),
2704
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2705
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "E-mail *" }),
2706
- /* @__PURE__ */ jsx25(
2707
- Input5,
3172
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3173
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "E-mail *" }),
3174
+ /* @__PURE__ */ jsx31(
3175
+ Input7,
2708
3176
  {
2709
3177
  type: "email",
2710
3178
  value: devEmail,
@@ -2714,10 +3182,10 @@ function ActivationPage() {
2714
3182
  }
2715
3183
  )
2716
3184
  ] }),
2717
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2718
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "Senha *" }),
2719
- /* @__PURE__ */ jsx25(
2720
- Input5,
3185
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3186
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Senha *" }),
3187
+ /* @__PURE__ */ jsx31(
3188
+ Input7,
2721
3189
  {
2722
3190
  type: "password",
2723
3191
  value: devPassword,
@@ -2728,8 +3196,8 @@ function ActivationPage() {
2728
3196
  }
2729
3197
  )
2730
3198
  ] }),
2731
- /* @__PURE__ */ jsx25(
2732
- Button10,
3199
+ /* @__PURE__ */ jsx31(
3200
+ Button14,
2733
3201
  {
2734
3202
  colorPalette: "blue",
2735
3203
  onClick: activateDevLocal,
@@ -2738,8 +3206,8 @@ function ActivationPage() {
2738
3206
  children: "Ativar ambiente de desenvolvimento"
2739
3207
  }
2740
3208
  ),
2741
- /* @__PURE__ */ jsx25(
2742
- Button10,
3209
+ /* @__PURE__ */ jsx31(
3210
+ Button14,
2743
3211
  {
2744
3212
  variant: "outline",
2745
3213
  onClick: () => setShowCodeFlow(true),
@@ -2752,7 +3220,7 @@ function ActivationPage() {
2752
3220
  const rootMode = config?.mode === "root-bootstrap" || activation.details?.role === "root";
2753
3221
  const isDevelopmentMember = !rootMode && config?.technical?.ambiente === "desenvolvimento";
2754
3222
  if (activation.status === "loading" || !config) {
2755
- return /* @__PURE__ */ jsx25(Box15, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs16(
3223
+ return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
2756
3224
  VStack3,
2757
3225
  {
2758
3226
  maxW: "760px",
@@ -2763,14 +3231,14 @@ function ActivationPage() {
2763
3231
  align: "stretch",
2764
3232
  gap: 5,
2765
3233
  children: [
2766
- /* @__PURE__ */ jsx25(Heading10, { children: "Preparando ativa\xE7\xE3o..." }),
2767
- error ? /* @__PURE__ */ jsx25(Text16, { color: "red.600", children: error }) : null
3234
+ /* @__PURE__ */ jsx31(Heading11, { children: "Preparando ativa\xE7\xE3o..." }),
3235
+ error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null
2768
3236
  ]
2769
3237
  }
2770
3238
  ) });
2771
3239
  }
2772
3240
  if (rootMode) {
2773
- return /* @__PURE__ */ jsx25(Box15, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs16(
3241
+ return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
2774
3242
  VStack3,
2775
3243
  {
2776
3244
  maxW: "560px",
@@ -2781,21 +3249,21 @@ function ActivationPage() {
2781
3249
  align: "stretch",
2782
3250
  gap: 5,
2783
3251
  children: [
2784
- /* @__PURE__ */ jsx25(Heading10, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
2785
- /* @__PURE__ */ jsx25(Text16, { color: "gray.600", children: "Esta \xE9 a aplica\xE7\xE3o root do ecossistema. Informe somente o e-mail e a senha do primeiro administrador. O Core criar\xE1 a estrutura m\xEDnima necess\xE1ria para liberar o primeiro login." }),
2786
- /* @__PURE__ */ jsxs16(Text16, { fontSize: "sm", color: "gray.500", children: [
3252
+ /* @__PURE__ */ jsx31(Heading11, { children: "Ativa\xE7\xE3o inicial do Ecossistema Oon" }),
3253
+ /* @__PURE__ */ jsx31(Text21, { color: "gray.600", children: "Esta \xE9 a aplica\xE7\xE3o root do ecossistema. Informe somente o e-mail e a senha do primeiro administrador. O Core criar\xE1 a estrutura m\xEDnima necess\xE1ria para liberar o primeiro login." }),
3254
+ /* @__PURE__ */ jsxs22(Text21, { fontSize: "sm", color: "gray.500", children: [
2787
3255
  "App: ",
2788
3256
  config.technical.appCode,
2789
3257
  " \xB7 Ambiente:",
2790
3258
  " ",
2791
3259
  config.technical.ambiente
2792
3260
  ] }),
2793
- error ? /* @__PURE__ */ jsx25(Text16, { color: "red.600", children: error }) : null,
2794
- step !== 6 ? /* @__PURE__ */ jsxs16(Fragment4, { children: [
2795
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2796
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "E-mail do administrador *" }),
2797
- /* @__PURE__ */ jsx25(
2798
- Input5,
3261
+ error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null,
3262
+ step !== 6 ? /* @__PURE__ */ jsxs22(Fragment6, { children: [
3263
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3264
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "E-mail do administrador *" }),
3265
+ /* @__PURE__ */ jsx31(
3266
+ Input7,
2799
3267
  {
2800
3268
  type: "email",
2801
3269
  autoComplete: "email",
@@ -2805,10 +3273,10 @@ function ActivationPage() {
2805
3273
  }
2806
3274
  )
2807
3275
  ] }),
2808
- /* @__PURE__ */ jsxs16(Box15, { w: "100%", children: [
2809
- /* @__PURE__ */ jsx25(Text16, { fontWeight: "medium", children: "Senha *" }),
2810
- /* @__PURE__ */ jsx25(
2811
- Input5,
3276
+ /* @__PURE__ */ jsxs22(Box19, { w: "100%", children: [
3277
+ /* @__PURE__ */ jsx31(Text21, { fontWeight: "medium", children: "Senha *" }),
3278
+ /* @__PURE__ */ jsx31(
3279
+ Input7,
2812
3280
  {
2813
3281
  type: "password",
2814
3282
  minLength: 8,
@@ -2819,8 +3287,8 @@ function ActivationPage() {
2819
3287
  }
2820
3288
  )
2821
3289
  ] }),
2822
- /* @__PURE__ */ jsx25(
2823
- Button10,
3290
+ /* @__PURE__ */ jsx31(
3291
+ Button14,
2824
3292
  {
2825
3293
  colorPalette: "blue",
2826
3294
  onClick: activateRoot,
@@ -2829,15 +3297,15 @@ function ActivationPage() {
2829
3297
  children: "Criar ecossistema e ativar"
2830
3298
  }
2831
3299
  )
2832
- ] }) : /* @__PURE__ */ jsxs16(Fragment4, { children: [
2833
- /* @__PURE__ */ jsx25(Heading10, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
2834
- /* @__PURE__ */ jsx25(Text16, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
3300
+ ] }) : /* @__PURE__ */ jsxs22(Fragment6, { children: [
3301
+ /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
3302
+ /* @__PURE__ */ jsx31(Text21, { children: "Usu\xE1rio, tenant, aplicativo, licen\xE7a e permiss\xF5es foram preparados. Redirecionando para o primeiro login..." })
2835
3303
  ] })
2836
3304
  ]
2837
3305
  }
2838
3306
  ) });
2839
3307
  }
2840
- return /* @__PURE__ */ jsx25(Box15, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs16(
3308
+ return /* @__PURE__ */ jsx31(Box19, { minH: "100vh", bg: "gray.50", p: 8, children: /* @__PURE__ */ jsxs22(
2841
3309
  VStack3,
2842
3310
  {
2843
3311
  maxW: "760px",
@@ -2848,8 +3316,8 @@ function ActivationPage() {
2848
3316
  align: "stretch",
2849
3317
  gap: 5,
2850
3318
  children: [
2851
- /* @__PURE__ */ jsx25(Heading10, { children: "Ativa\xE7\xE3o da Central Oon" }),
2852
- /* @__PURE__ */ jsxs16(Text16, { children: [
3319
+ /* @__PURE__ */ jsx31(Heading11, { children: "Ativa\xE7\xE3o da Central Oon" }),
3320
+ /* @__PURE__ */ jsxs22(Text21, { children: [
2853
3321
  "App: ",
2854
3322
  config.technical.appCode,
2855
3323
  " \xB7 Ambiente:",
@@ -2859,12 +3327,12 @@ function ActivationPage() {
2859
3327
  " ",
2860
3328
  config.technical.centralAtivacaoUrl || config.technical.centralAtivacaoHost
2861
3329
  ] }),
2862
- error ? /* @__PURE__ */ jsx25(Text16, { color: "red.600", children: error }) : null,
3330
+ error ? /* @__PURE__ */ jsx31(Text21, { color: "red.600", children: error }) : null,
2863
3331
  step === 1 && isDevelopmentMember && !showCodeFlow ? renderDevLocalActivation() : null,
2864
- step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2865
- /* @__PURE__ */ jsx25(Text16, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
2866
- /* @__PURE__ */ jsx25(
2867
- Input5,
3332
+ step === 1 && (!isDevelopmentMember || showCodeFlow) && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3333
+ /* @__PURE__ */ jsx31(Text21, { children: "Informe o c\xF3digo de ativa\xE7\xE3o para validar tenant, aplicativo e licen\xE7a antes de consumir o c\xF3digo." }),
3334
+ /* @__PURE__ */ jsx31(
3335
+ Input7,
2868
3336
  {
2869
3337
  "aria-label": "C\xF3digo de ativa\xE7\xE3o",
2870
3338
  value: code,
@@ -2872,8 +3340,8 @@ function ActivationPage() {
2872
3340
  placeholder: "OON-XXXX"
2873
3341
  }
2874
3342
  ),
2875
- /* @__PURE__ */ jsx25(
2876
- Button10,
3343
+ /* @__PURE__ */ jsx31(
3344
+ Button14,
2877
3345
  {
2878
3346
  onClick: validateCode,
2879
3347
  loading: submitting,
@@ -2881,8 +3349,8 @@ function ActivationPage() {
2881
3349
  children: "Validar c\xF3digo"
2882
3350
  }
2883
3351
  ),
2884
- isDevelopmentMember ? /* @__PURE__ */ jsx25(
2885
- Button10,
3352
+ isDevelopmentMember ? /* @__PURE__ */ jsx31(
3353
+ Button14,
2886
3354
  {
2887
3355
  variant: "outline",
2888
3356
  onClick: () => setShowCodeFlow(false),
@@ -2891,25 +3359,25 @@ function ActivationPage() {
2891
3359
  }
2892
3360
  ) : null
2893
3361
  ] }),
2894
- step === 2 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2895
- /* @__PURE__ */ jsx25(Heading10, { size: "md", children: "Confirma\xE7\xE3o" }),
2896
- /* @__PURE__ */ jsx25("pre", { children: JSON.stringify(preview, null, 2) }),
2897
- /* @__PURE__ */ jsx25(Button10, { onClick: () => setStep(3), children: "Continuar" })
3362
+ step === 2 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3363
+ /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Confirma\xE7\xE3o" }),
3364
+ /* @__PURE__ */ jsx31("pre", { children: JSON.stringify(preview, null, 2) }),
3365
+ /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(3), children: "Continuar" })
2898
3366
  ] }),
2899
- step === 3 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
3367
+ step === 3 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
2900
3368
  config.globalFields.map(
2901
3369
  (field) => renderField(field, global, setGlobal)
2902
3370
  ),
2903
- /* @__PURE__ */ jsx25(Button10, { onClick: () => setStep(4), children: "Continuar" })
3371
+ /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(4), children: "Continuar" })
2904
3372
  ] }),
2905
- step === 4 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2906
- config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx25(Text16, { children: "Nenhum par\xE2metro adicional declarado." }),
2907
- /* @__PURE__ */ jsx25(Button10, { onClick: () => setStep(5), children: "Revisar" })
3373
+ step === 4 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3374
+ config.appFields.length ? config.appFields.map((field) => renderField(field, app, setApp)) : /* @__PURE__ */ jsx31(Text21, { children: "Nenhum par\xE2metro adicional declarado." }),
3375
+ /* @__PURE__ */ jsx31(Button14, { onClick: () => setStep(5), children: "Revisar" })
2908
3376
  ] }),
2909
- step === 5 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2910
- /* @__PURE__ */ jsx25(Text16, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
2911
- /* @__PURE__ */ jsx25(
2912
- Button10,
3377
+ step === 5 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3378
+ /* @__PURE__ */ jsx31(Text21, { children: "Ao confirmar, o c\xF3digo ser\xE1 consumido e a inst\xE2ncia ser\xE1 registrada no Ecossistema Oon." }),
3379
+ /* @__PURE__ */ jsx31(
3380
+ Button14,
2913
3381
  {
2914
3382
  colorPalette: "blue",
2915
3383
  onClick: completeMemberActivation,
@@ -2919,14 +3387,14 @@ function ActivationPage() {
2919
3387
  }
2920
3388
  )
2921
3389
  ] }),
2922
- step === 6 && /* @__PURE__ */ jsxs16(Fragment4, { children: [
2923
- /* @__PURE__ */ jsx25(Heading10, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
2924
- devResult?.appCode ? /* @__PURE__ */ jsxs16(Text16, { children: [
3390
+ step === 6 && /* @__PURE__ */ jsxs22(Fragment6, { children: [
3391
+ /* @__PURE__ */ jsx31(Heading11, { size: "md", children: "Ativa\xE7\xE3o conclu\xEDda" }),
3392
+ devResult?.appCode ? /* @__PURE__ */ jsxs22(Text21, { children: [
2925
3393
  "C\xF3digo do app: ",
2926
3394
  devResult.appCode,
2927
3395
  ". Redirecionando para a Central em desenvolvimento..."
2928
- ] }) : /* @__PURE__ */ jsx25(Text16, { children: "Redirecionando para o login..." }),
2929
- devResult?.instrucoes?.env ? /* @__PURE__ */ jsx25(Text16, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
3396
+ ] }) : /* @__PURE__ */ jsx31(Text21, { children: "Redirecionando para o login..." }),
3397
+ devResult?.instrucoes?.env ? /* @__PURE__ */ jsx31(Text21, { fontSize: "sm", color: "gray.500", children: devResult.instrucoes.env }) : null
2930
3398
  ] })
2931
3399
  ]
2932
3400
  }
@@ -2936,47 +3404,47 @@ function InstanceBlockedPage({
2936
3404
  title,
2937
3405
  message
2938
3406
  }) {
2939
- return /* @__PURE__ */ jsxs16(Box15, { p: 8, children: [
2940
- /* @__PURE__ */ jsx25(Heading10, { children: title }),
2941
- /* @__PURE__ */ jsx25(Text16, { children: message })
3407
+ return /* @__PURE__ */ jsxs22(Box19, { p: 8, children: [
3408
+ /* @__PURE__ */ jsx31(Heading11, { children: title }),
3409
+ /* @__PURE__ */ jsx31(Text21, { children: message })
2942
3410
  ] });
2943
3411
  }
2944
3412
 
2945
3413
  // src/security/RouteGuard.tsx
2946
- import { Fragment as Fragment5, jsx as jsx26 } from "react/jsx-runtime";
3414
+ import { Fragment as Fragment7, jsx as jsx32 } from "react/jsx-runtime";
2947
3415
  function RouteGuard({
2948
3416
  permission,
2949
3417
  children
2950
3418
  }) {
2951
3419
  const { status, hasPermission } = useOonAuth();
2952
- if (status === "loading") return /* @__PURE__ */ jsx26(LoadingScreen, {});
2953
- if (status === "unauthenticated") return /* @__PURE__ */ jsx26(LoadingScreen, { message: "Redirecionando para o login..." });
3420
+ if (status === "loading") return /* @__PURE__ */ jsx32(LoadingScreen, {});
3421
+ if (status === "unauthenticated") return /* @__PURE__ */ jsx32(LoadingScreen, { message: "Redirecionando para o login..." });
2954
3422
  if (!hasPermission(permission)) {
2955
- return /* @__PURE__ */ jsx26(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
3423
+ return /* @__PURE__ */ jsx32(LoadingScreen, { message: "Voc\xEA n\xE3o tem acesso a esta tela." });
2956
3424
  }
2957
- return /* @__PURE__ */ jsx26(Fragment5, { children });
3425
+ return /* @__PURE__ */ jsx32(Fragment7, { children });
2958
3426
  }
2959
3427
 
2960
3428
  // src/security/ActivationGuard.tsx
2961
3429
  import { Navigate as Navigate3 } from "react-router-dom";
2962
- import { jsx as jsx27 } from "react/jsx-runtime";
3430
+ import { jsx as jsx33 } from "react/jsx-runtime";
2963
3431
  function ActivationGuard({ children }) {
2964
3432
  const { status } = useActivation();
2965
3433
  if (status === "loading") return null;
2966
- if (status === "suspended") return /* @__PURE__ */ jsx27(Navigate3, { to: "/instancia-suspensa", replace: true });
2967
- if (status === "revoked") return /* @__PURE__ */ jsx27(Navigate3, { to: "/instancia-revogada", replace: true });
2968
- if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx27(Navigate3, { to: "/ativacao", replace: true });
3434
+ if (status === "suspended") return /* @__PURE__ */ jsx33(Navigate3, { to: "/instancia-suspensa", replace: true });
3435
+ if (status === "revoked") return /* @__PURE__ */ jsx33(Navigate3, { to: "/instancia-revogada", replace: true });
3436
+ if (status !== "active" && window.location.pathname !== "/ativacao") return /* @__PURE__ */ jsx33(Navigate3, { to: "/ativacao", replace: true });
2969
3437
  return children;
2970
3438
  }
2971
3439
 
2972
3440
  // src/app/createOonRouter.tsx
2973
- import { jsx as jsx28 } from "react/jsx-runtime";
3441
+ import { jsx as jsx34 } from "react/jsx-runtime";
2974
3442
  function createOonRouter({ app, menu, routes, security, layout, registry }) {
2975
3443
  const guardEnabled = security?.enableRouteGuard !== false;
2976
3444
  const publicRoutes = routes.filter((route) => route.public).map((route) => ({ path: route.path, element: route.element }));
2977
3445
  const privateSource = routes.filter((route) => !route.public);
2978
3446
  const privateRoutes = privateSource.map((route) => {
2979
- const element = guardEnabled ? /* @__PURE__ */ jsx28(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
3447
+ const element = guardEnabled ? /* @__PURE__ */ jsx34(RouteGuard, { permission: route.permissions, children: route.element }) : route.element;
2980
3448
  return route.path === "/" ? { index: true, element } : { path: route.path.replace(/^\//, ""), element };
2981
3449
  });
2982
3450
  const hasIndexRoute = privateSource.some((route) => route.path === "/");
@@ -2984,7 +3452,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
2984
3452
  if (!hasIndexRoute && firstRoute) {
2985
3453
  privateRoutes.unshift({
2986
3454
  index: true,
2987
- element: /* @__PURE__ */ jsx28(Navigate4, { to: firstRoute.path, replace: true })
3455
+ element: /* @__PURE__ */ jsx34(Navigate4, { to: firstRoute.path, replace: true })
2988
3456
  });
2989
3457
  }
2990
3458
  const customPaths = new Set(publicRoutes.map((route) => route.path));
@@ -2992,19 +3460,19 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
2992
3460
  if (!customPaths.has("/login")) {
2993
3461
  builtInPublicRoutes.push({
2994
3462
  path: "/login",
2995
- element: /* @__PURE__ */ jsx28(ActivationGuard, { children: /* @__PURE__ */ jsx28(LoginPage, { app }) })
3463
+ element: /* @__PURE__ */ jsx34(ActivationGuard, { children: /* @__PURE__ */ jsx34(LoginPage, { app }) })
2996
3464
  });
2997
3465
  }
2998
3466
  if (!customPaths.has("/ativacao")) {
2999
3467
  builtInPublicRoutes.push({
3000
3468
  path: "/ativacao",
3001
- element: /* @__PURE__ */ jsx28(ActivationPage, {})
3469
+ element: /* @__PURE__ */ jsx34(ActivationPage, {})
3002
3470
  });
3003
3471
  }
3004
3472
  if (!customPaths.has("/instancia-suspensa")) {
3005
3473
  builtInPublicRoutes.push({
3006
3474
  path: "/instancia-suspensa",
3007
- element: /* @__PURE__ */ jsx28(
3475
+ element: /* @__PURE__ */ jsx34(
3008
3476
  InstanceBlockedPage,
3009
3477
  {
3010
3478
  title: "Inst\xE2ncia suspensa",
@@ -3016,7 +3484,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3016
3484
  if (!customPaths.has("/instancia-revogada")) {
3017
3485
  builtInPublicRoutes.push({
3018
3486
  path: "/instancia-revogada",
3019
- element: /* @__PURE__ */ jsx28(
3487
+ element: /* @__PURE__ */ jsx34(
3020
3488
  InstanceBlockedPage,
3021
3489
  {
3022
3490
  title: "Inst\xE2ncia revogada",
@@ -3028,7 +3496,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3028
3496
  if (!customPaths.has("/acesso-negado")) {
3029
3497
  builtInPublicRoutes.push({
3030
3498
  path: "/acesso-negado",
3031
- element: /* @__PURE__ */ jsx28(AccessDeniedPage, { app })
3499
+ element: /* @__PURE__ */ jsx34(AccessDeniedPage, { app })
3032
3500
  });
3033
3501
  }
3034
3502
  const tree = [
@@ -3036,7 +3504,7 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3036
3504
  ...publicRoutes,
3037
3505
  {
3038
3506
  path: "/",
3039
- element: /* @__PURE__ */ jsx28(ActivationGuard, { children: /* @__PURE__ */ jsx28(AppAccessGuard, { children: /* @__PURE__ */ jsx28(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
3507
+ element: /* @__PURE__ */ jsx34(ActivationGuard, { children: /* @__PURE__ */ jsx34(AppAccessGuard, { children: /* @__PURE__ */ jsx34(AuthenticatedLayout, { app, menu, layout, registry }) }) }),
3040
3508
  children: privateRoutes
3041
3509
  }
3042
3510
  ];
@@ -3044,13 +3512,13 @@ function createOonRouter({ app, menu, routes, security, layout, registry }) {
3044
3512
  }
3045
3513
 
3046
3514
  // src/app/OonApp.tsx
3047
- import { jsx as jsx29 } from "react/jsx-runtime";
3515
+ import { jsx as jsx35 } from "react/jsx-runtime";
3048
3516
  function localLoginUrl() {
3049
3517
  const current = `${window.location.pathname}${window.location.search}`;
3050
3518
  return `/login?redirect=${encodeURIComponent(current)}`;
3051
3519
  }
3052
3520
  function OonApp({ config }) {
3053
- const { http, storage, router } = useMemo4(() => {
3521
+ const { http, storage, router } = useMemo7(() => {
3054
3522
  const storage2 = createTokenStorage(config.app.id);
3055
3523
  const externalLoginUrl = config.auth?.loginUrl ?? config.api.meusAppsUrl;
3056
3524
  const http2 = createRestClient({
@@ -3079,11 +3547,11 @@ function OonApp({ config }) {
3079
3547
  });
3080
3548
  return { http: http2, storage: storage2, router: router2 };
3081
3549
  }, [config]);
3082
- return /* @__PURE__ */ jsx29(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx29(RouterProvider, { router }) });
3550
+ return /* @__PURE__ */ jsx35(OonProviders, { config, http, storage, children: /* @__PURE__ */ jsx35(RouterProvider, { router }) });
3083
3551
  }
3084
3552
 
3085
3553
  // src/start.tsx
3086
- import { jsx as jsx30 } from "react/jsx-runtime";
3554
+ import { jsx as jsx36 } from "react/jsx-runtime";
3087
3555
  function validateConfig(config) {
3088
3556
  if (!config?.app?.id) throw new Error("oonCoreFront.start: config.app.id \xE9 obrigat\xF3rio.");
3089
3557
  if (!config?.api?.baseUrl) throw new Error("oonCoreFront.start: config.api.baseUrl \xE9 obrigat\xF3rio.");
@@ -3117,7 +3585,7 @@ function start(config) {
3117
3585
  const el = document.getElementById(rootId);
3118
3586
  if (!el) throw new Error(`oonCoreFront.start: elemento #${rootId} n\xE3o encontrado no DOM.`);
3119
3587
  createRoot(el).render(
3120
- /* @__PURE__ */ jsx30(StrictMode, { children: /* @__PURE__ */ jsx30(OonApp, { config }) })
3588
+ /* @__PURE__ */ jsx36(StrictMode, { children: /* @__PURE__ */ jsx36(OonApp, { config }) })
3121
3589
  );
3122
3590
  }
3123
3591
  var oonCoreFront = { start };
@@ -3144,7 +3612,11 @@ function manifestToConfig(manifest, runtime) {
3144
3612
  mode: c.mode ?? "dynamic",
3145
3613
  path: c.path,
3146
3614
  label: c.label,
3147
- section: c.section
3615
+ section: c.section,
3616
+ form: c.form,
3617
+ list: c.list,
3618
+ relations: c.relations,
3619
+ detailModal: c.detailModal
3148
3620
  };
3149
3621
  views.push(view);
3150
3622
  }
@@ -3234,34 +3706,34 @@ function defineOonModule(mod) {
3234
3706
  }
3235
3707
 
3236
3708
  // src/components/CoreIntegration.tsx
3237
- import { Badge as Badge3, Box as Box16, Button as Button11, Flex as Flex11, Heading as Heading11, Stack as Stack8, Text as Text17 } from "@chakra-ui/react";
3238
- import { useMutation as useMutation3 } from "@tanstack/react-query";
3239
- import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
3709
+ import { Badge as Badge5, Box as Box20, Button as Button15, Flex as Flex14, Heading as Heading12, Stack as Stack9, Text as Text22 } from "@chakra-ui/react";
3710
+ import { useMutation as useMutation4 } from "@tanstack/react-query";
3711
+ import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
3240
3712
  function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
3241
3713
  const { http } = useOonApi();
3242
3714
  const metadata = useCoreMetadata();
3243
- const reprocess = useMutation3({
3715
+ const reprocess = useMutation4({
3244
3716
  mutationFn: () => http.post("/integrations/actions/process-active", {}, { headers: { "x-oon-origin": "integration" } })
3245
3717
  });
3246
- if (metadata.isLoading) return /* @__PURE__ */ jsx31(LoadingScreen, {});
3247
- if (metadata.isError) return /* @__PURE__ */ jsx31(ErrorState, { error: metadata.error });
3718
+ if (metadata.isLoading) return /* @__PURE__ */ jsx37(LoadingScreen, {});
3719
+ if (metadata.isError) return /* @__PURE__ */ jsx37(ErrorState, { error: metadata.error });
3248
3720
  const integrations = metadata.data?.integrations ?? [];
3249
- return /* @__PURE__ */ jsxs17(Stack8, { gap: 6, children: [
3250
- /* @__PURE__ */ jsxs17(Flex11, { align: "center", justify: "space-between", children: [
3251
- /* @__PURE__ */ jsx31(Heading11, { size: "lg", children: label }),
3252
- /* @__PURE__ */ jsx31(Button11, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
3721
+ return /* @__PURE__ */ jsxs23(Stack9, { gap: 6, children: [
3722
+ /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
3723
+ /* @__PURE__ */ jsx37(Heading12, { size: "lg", children: label }),
3724
+ /* @__PURE__ */ jsx37(Button15, { size: "sm", variant: "outline", loading: reprocess.isPending, onClick: () => reprocess.mutate(), children: "Reprocessar ativos" })
3253
3725
  ] }),
3254
- /* @__PURE__ */ jsx31(Stack8, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx31(Text17, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx31(
3255
- Box16,
3726
+ /* @__PURE__ */ jsx37(Stack9, { gap: 3, children: integrations.length === 0 ? /* @__PURE__ */ jsx37(Text22, { color: "gray.400", children: "Nenhuma integra\xE7\xE3o declarada." }) : integrations.map((it, idx) => /* @__PURE__ */ jsx37(
3727
+ Box20,
3256
3728
  {
3257
3729
  borderWidth: "1px",
3258
3730
  borderColor: "gray.200",
3259
3731
  borderRadius: "md",
3260
3732
  bg: "white",
3261
3733
  p: 4,
3262
- children: /* @__PURE__ */ jsxs17(Flex11, { align: "center", justify: "space-between", children: [
3263
- /* @__PURE__ */ jsx31(Text17, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
3264
- /* @__PURE__ */ jsx31(Badge3, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
3734
+ children: /* @__PURE__ */ jsxs23(Flex14, { align: "center", justify: "space-between", children: [
3735
+ /* @__PURE__ */ jsx37(Text22, { fontWeight: "medium", children: it.label ?? it.name ?? "Integra\xE7\xE3o" }),
3736
+ /* @__PURE__ */ jsx37(Badge5, { colorPalette: it.status === "erro" ? "red" : it.status === "ativo" ? "green" : "gray", children: it.status ?? "\u2014" })
3265
3737
  ] })
3266
3738
  },
3267
3739
  it.id ?? it.name ?? idx
@@ -3270,36 +3742,36 @@ function CoreIntegration({ label = "Integra\xE7\xF5es" }) {
3270
3742
  }
3271
3743
 
3272
3744
  // src/components/CoreCurrency.tsx
3273
- import { Button as Button12, Flex as Flex12, Heading as Heading12, Stack as Stack9, Text as Text18 } from "@chakra-ui/react";
3274
- import { useMutation as useMutation4, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
3275
- import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
3745
+ import { Button as Button16, Flex as Flex15, Heading as Heading13, Stack as Stack10, Text as Text23 } from "@chakra-ui/react";
3746
+ import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
3747
+ import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
3276
3748
  function CoreCurrency({ model = "Moeda", label = "Multi-moedas", endpoint = "/moedas", columns }) {
3277
3749
  const { http } = useOonApi();
3278
- const queryClient = useQueryClient3();
3279
- const updateRates = useMutation4({
3750
+ const queryClient = useQueryClient5();
3751
+ const updateRates = useMutation5({
3280
3752
  mutationFn: () => http.post(`${endpoint}/actions/update-rates`, {}, { headers: { "x-oon-origin": "integration" } }),
3281
3753
  onSuccess: () => queryClient.invalidateQueries({ queryKey: ["oon", "list", endpoint] })
3282
3754
  });
3283
- return /* @__PURE__ */ jsxs18(Stack9, { gap: 6, children: [
3284
- /* @__PURE__ */ jsxs18(Flex12, { align: "center", justify: "space-between", children: [
3285
- /* @__PURE__ */ jsx32(Heading12, { size: "lg", children: label }),
3286
- /* @__PURE__ */ jsx32(Button12, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
3755
+ return /* @__PURE__ */ jsxs24(Stack10, { gap: 6, children: [
3756
+ /* @__PURE__ */ jsxs24(Flex15, { align: "center", justify: "space-between", children: [
3757
+ /* @__PURE__ */ jsx38(Heading13, { size: "lg", children: label }),
3758
+ /* @__PURE__ */ jsx38(Button16, { size: "sm", colorPalette: "blue", loading: updateRates.isPending, onClick: () => updateRates.mutate(), children: "Atualizar cota\xE7\xF5es" })
3287
3759
  ] }),
3288
- updateRates.isError ? /* @__PURE__ */ jsx32(Text18, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
3289
- /* @__PURE__ */ jsx32(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
3760
+ updateRates.isError ? /* @__PURE__ */ jsx38(Text23, { fontSize: "sm", color: "red.600", children: updateRates.error?.message }) : null,
3761
+ /* @__PURE__ */ jsx38(CoreCollection, { model, label: "", mode: columns ? "full" : "dynamic", endpoint, columns })
3290
3762
  ] });
3291
3763
  }
3292
3764
 
3293
3765
  // src/components/CoreAssistant.tsx
3294
- import { useState as useState10 } from "react";
3295
- import { Box as Box17, Button as Button13, Flex as Flex13, Heading as Heading13, Input as Input6, Stack as Stack10, Text as Text19 } from "@chakra-ui/react";
3296
- import { useMutation as useMutation5 } from "@tanstack/react-query";
3297
- import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
3766
+ import { useState as useState14 } from "react";
3767
+ import { Box as Box21, Button as Button17, Flex as Flex16, Heading as Heading14, Input as Input8, Stack as Stack11, Text as Text24 } from "@chakra-ui/react";
3768
+ import { useMutation as useMutation6 } from "@tanstack/react-query";
3769
+ import { jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
3298
3770
  function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint = "/assistant-runs" }) {
3299
3771
  const { http } = useOonApi();
3300
- const [messages, setMessages] = useState10([]);
3301
- const [input, setInput] = useState10("");
3302
- const ask = useMutation5({
3772
+ const [messages, setMessages] = useState14([]);
3773
+ const [input, setInput] = useState14("");
3774
+ const ask = useMutation6({
3303
3775
  mutationFn: async (message) => {
3304
3776
  const { data } = await http.post(
3305
3777
  endpoint,
@@ -3323,11 +3795,11 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
3323
3795
  setInput("");
3324
3796
  ask.mutate(text);
3325
3797
  };
3326
- return /* @__PURE__ */ jsxs19(Stack10, { gap: 4, maxW: "560px", children: [
3327
- /* @__PURE__ */ jsx33(Heading13, { size: "md", children: label }),
3328
- /* @__PURE__ */ jsx33(Box17, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs19(Stack10, { gap: 3, children: [
3329
- messages.length === 0 ? /* @__PURE__ */ jsx33(Text19, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx33(Flex13, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx33(
3330
- Box17,
3798
+ return /* @__PURE__ */ jsxs25(Stack11, { gap: 4, maxW: "560px", children: [
3799
+ /* @__PURE__ */ jsx39(Heading14, { size: "md", children: label }),
3800
+ /* @__PURE__ */ jsx39(Box21, { borderWidth: "1px", borderColor: "gray.200", borderRadius: "md", bg: "white", p: 4, minH: "240px", children: /* @__PURE__ */ jsxs25(Stack11, { gap: 3, children: [
3801
+ messages.length === 0 ? /* @__PURE__ */ jsx39(Text24, { color: "gray.400", fontSize: "sm", children: "Fa\xE7a uma pergunta ao assistente." }) : messages.map((m, idx) => /* @__PURE__ */ jsx39(Flex16, { justify: m.role === "user" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsx39(
3802
+ Box21,
3331
3803
  {
3332
3804
  bg: m.role === "user" ? "brand.500" : "gray.100",
3333
3805
  color: m.role === "user" ? "white" : "gray.800",
@@ -3339,12 +3811,12 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
3339
3811
  children: m.content
3340
3812
  }
3341
3813
  ) }, idx)),
3342
- ask.isPending ? /* @__PURE__ */ jsx33(Text19, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
3343
- ask.isError ? /* @__PURE__ */ jsx33(Text19, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
3814
+ ask.isPending ? /* @__PURE__ */ jsx39(Text24, { color: "gray.400", fontSize: "sm", children: "Pensando\u2026" }) : null,
3815
+ ask.isError ? /* @__PURE__ */ jsx39(Text24, { color: "red.600", fontSize: "sm", children: ask.error?.message }) : null
3344
3816
  ] }) }),
3345
- /* @__PURE__ */ jsxs19(Flex13, { gap: 2, children: [
3346
- /* @__PURE__ */ jsx33(
3347
- Input6,
3817
+ /* @__PURE__ */ jsxs25(Flex16, { gap: 2, children: [
3818
+ /* @__PURE__ */ jsx39(
3819
+ Input8,
3348
3820
  {
3349
3821
  size: "sm",
3350
3822
  value: input,
@@ -3355,7 +3827,7 @@ function CoreAssistant({ assistantCode, label = "Assistente", entity, endpoint =
3355
3827
  }
3356
3828
  }
3357
3829
  ),
3358
- /* @__PURE__ */ jsx33(Button13, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
3830
+ /* @__PURE__ */ jsx39(Button17, { size: "sm", colorPalette: "blue", onClick: send, loading: ask.isPending, children: "Enviar" })
3359
3831
  ] })
3360
3832
  ] });
3361
3833
  }