dp-widgets-framework 1.7.7 → 1.7.8

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.
Files changed (3) hide show
  1. package/dist/index.esm.js +1717 -727
  2. package/dist/index.js +1718 -727
  3. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -19,6 +19,7 @@ import { TextMessage, Role } from '@copilotkit/runtime-client-gql';
19
19
  import { CopilotKit, useCopilotContext, useCoAgent, useCopilotChat } from '@copilotkit/react-core';
20
20
  import jsPDF from 'jspdf';
21
21
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
22
+ import * as SliderPrimitive from '@radix-ui/react-slider';
22
23
  import * as DialogPrimitive from '@radix-ui/react-dialog';
23
24
  import { format } from 'date-fns';
24
25
 
@@ -1429,40 +1430,40 @@ const KEYS = {
1429
1430
  ESCAPE: "Escape",
1430
1431
  TAB: "Tab"};
1431
1432
 
1432
- var __defProp$q = Object.defineProperty;
1433
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
1434
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
1435
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
1436
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1437
- var __spreadValues$q = (a, b) => {
1433
+ var __defProp$u = Object.defineProperty;
1434
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
1435
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
1436
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
1437
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1438
+ var __spreadValues$u = (a, b) => {
1438
1439
  for (var prop in b || (b = {}))
1439
- if (__hasOwnProp$q.call(b, prop))
1440
- __defNormalProp$q(a, prop, b[prop]);
1441
- if (__getOwnPropSymbols$q)
1442
- for (var prop of __getOwnPropSymbols$q(b)) {
1443
- if (__propIsEnum$q.call(b, prop))
1444
- __defNormalProp$q(a, prop, b[prop]);
1440
+ if (__hasOwnProp$u.call(b, prop))
1441
+ __defNormalProp$u(a, prop, b[prop]);
1442
+ if (__getOwnPropSymbols$u)
1443
+ for (var prop of __getOwnPropSymbols$u(b)) {
1444
+ if (__propIsEnum$u.call(b, prop))
1445
+ __defNormalProp$u(a, prop, b[prop]);
1445
1446
  }
1446
1447
  return a;
1447
1448
  };
1448
- var __objRest$d = (source, exclude) => {
1449
+ var __objRest$e = (source, exclude) => {
1449
1450
  var target = {};
1450
1451
  for (var prop in source)
1451
- if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
1452
+ if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
1452
1453
  target[prop] = source[prop];
1453
- if (source != null && __getOwnPropSymbols$q)
1454
- for (var prop of __getOwnPropSymbols$q(source)) {
1455
- if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
1454
+ if (source != null && __getOwnPropSymbols$u)
1455
+ for (var prop of __getOwnPropSymbols$u(source)) {
1456
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
1456
1457
  target[prop] = source[prop];
1457
1458
  }
1458
1459
  return target;
1459
1460
  };
1460
1461
  const Tabs = TabsPrimitive.Root;
1461
1462
  const TabsList = React.forwardRef((_a, ref) => {
1462
- var _b = _a, { className } = _b, props = __objRest$d(_b, ["className"]);
1463
+ var _b = _a, { className } = _b, props = __objRest$e(_b, ["className"]);
1463
1464
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1464
1465
  TabsPrimitive.List,
1465
- __spreadValues$q({
1466
+ __spreadValues$u({
1466
1467
  ref,
1467
1468
  className: cn(
1468
1469
  "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
@@ -1473,10 +1474,10 @@ const TabsList = React.forwardRef((_a, ref) => {
1473
1474
  });
1474
1475
  TabsList.displayName = TabsPrimitive.List.displayName;
1475
1476
  const TabsTrigger = React.forwardRef((_c, ref) => {
1476
- var _d = _c, { className } = _d, props = __objRest$d(_d, ["className"]);
1477
+ var _d = _c, { className } = _d, props = __objRest$e(_d, ["className"]);
1477
1478
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1478
1479
  TabsPrimitive.Trigger,
1479
- __spreadValues$q({
1480
+ __spreadValues$u({
1480
1481
  ref,
1481
1482
  className: cn(
1482
1483
  "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
@@ -1487,10 +1488,10 @@ const TabsTrigger = React.forwardRef((_c, ref) => {
1487
1488
  });
1488
1489
  TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
1489
1490
  const TabsContent = React.forwardRef((_e, ref) => {
1490
- var _f = _e, { className } = _f, props = __objRest$d(_f, ["className"]);
1491
+ var _f = _e, { className } = _f, props = __objRest$e(_f, ["className"]);
1491
1492
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1492
1493
  TabsPrimitive.Content,
1493
- __spreadValues$q({
1494
+ __spreadValues$u({
1494
1495
  ref,
1495
1496
  className: cn(
1496
1497
  "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
@@ -1501,40 +1502,40 @@ const TabsContent = React.forwardRef((_e, ref) => {
1501
1502
  });
1502
1503
  TabsContent.displayName = TabsPrimitive.Content.displayName;
1503
1504
 
1504
- var __defProp$p = Object.defineProperty;
1505
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
1506
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
1507
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
1508
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1509
- var __spreadValues$p = (a, b) => {
1505
+ var __defProp$t = Object.defineProperty;
1506
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
1507
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
1508
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
1509
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1510
+ var __spreadValues$t = (a, b) => {
1510
1511
  for (var prop in b || (b = {}))
1511
- if (__hasOwnProp$p.call(b, prop))
1512
- __defNormalProp$p(a, prop, b[prop]);
1513
- if (__getOwnPropSymbols$p)
1514
- for (var prop of __getOwnPropSymbols$p(b)) {
1515
- if (__propIsEnum$p.call(b, prop))
1516
- __defNormalProp$p(a, prop, b[prop]);
1512
+ if (__hasOwnProp$t.call(b, prop))
1513
+ __defNormalProp$t(a, prop, b[prop]);
1514
+ if (__getOwnPropSymbols$t)
1515
+ for (var prop of __getOwnPropSymbols$t(b)) {
1516
+ if (__propIsEnum$t.call(b, prop))
1517
+ __defNormalProp$t(a, prop, b[prop]);
1517
1518
  }
1518
1519
  return a;
1519
1520
  };
1520
- var __objRest$c = (source, exclude) => {
1521
+ var __objRest$d = (source, exclude) => {
1521
1522
  var target = {};
1522
1523
  for (var prop in source)
1523
- if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
1524
+ if (__hasOwnProp$t.call(source, prop) && exclude.indexOf(prop) < 0)
1524
1525
  target[prop] = source[prop];
1525
- if (source != null && __getOwnPropSymbols$p)
1526
- for (var prop of __getOwnPropSymbols$p(source)) {
1527
- if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
1526
+ if (source != null && __getOwnPropSymbols$t)
1527
+ for (var prop of __getOwnPropSymbols$t(source)) {
1528
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$t.call(source, prop))
1528
1529
  target[prop] = source[prop];
1529
1530
  }
1530
1531
  return target;
1531
1532
  };
1532
1533
  const Input = React.forwardRef(
1533
1534
  (_a, ref) => {
1534
- var _b = _a, { className, type } = _b, props = __objRest$c(_b, ["className", "type"]);
1535
+ var _b = _a, { className, type } = _b, props = __objRest$d(_b, ["className", "type"]);
1535
1536
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1536
1537
  "input",
1537
- __spreadValues$p({
1538
+ __spreadValues$t({
1538
1539
  type,
1539
1540
  className: cn(
1540
1541
  "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
@@ -1547,30 +1548,30 @@ const Input = React.forwardRef(
1547
1548
  );
1548
1549
  Input.displayName = "Input";
1549
1550
 
1550
- var __defProp$o = Object.defineProperty;
1551
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
1552
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
1553
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
1554
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1555
- var __spreadValues$o = (a, b) => {
1551
+ var __defProp$s = Object.defineProperty;
1552
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
1553
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
1554
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
1555
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1556
+ var __spreadValues$s = (a, b) => {
1556
1557
  for (var prop in b || (b = {}))
1557
- if (__hasOwnProp$o.call(b, prop))
1558
- __defNormalProp$o(a, prop, b[prop]);
1559
- if (__getOwnPropSymbols$o)
1560
- for (var prop of __getOwnPropSymbols$o(b)) {
1561
- if (__propIsEnum$o.call(b, prop))
1562
- __defNormalProp$o(a, prop, b[prop]);
1558
+ if (__hasOwnProp$s.call(b, prop))
1559
+ __defNormalProp$s(a, prop, b[prop]);
1560
+ if (__getOwnPropSymbols$s)
1561
+ for (var prop of __getOwnPropSymbols$s(b)) {
1562
+ if (__propIsEnum$s.call(b, prop))
1563
+ __defNormalProp$s(a, prop, b[prop]);
1563
1564
  }
1564
1565
  return a;
1565
1566
  };
1566
- var __objRest$b = (source, exclude) => {
1567
+ var __objRest$c = (source, exclude) => {
1567
1568
  var target = {};
1568
1569
  for (var prop in source)
1569
- if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
1570
+ if (__hasOwnProp$s.call(source, prop) && exclude.indexOf(prop) < 0)
1570
1571
  target[prop] = source[prop];
1571
- if (source != null && __getOwnPropSymbols$o)
1572
- for (var prop of __getOwnPropSymbols$o(source)) {
1573
- if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
1572
+ if (source != null && __getOwnPropSymbols$s)
1573
+ for (var prop of __getOwnPropSymbols$s(source)) {
1574
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$s.call(source, prop))
1574
1575
  target[prop] = source[prop];
1575
1576
  }
1576
1577
  return target;
@@ -1579,10 +1580,10 @@ const labelVariants = cva(
1579
1580
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1580
1581
  );
1581
1582
  const Label$1 = React.forwardRef((_a, ref) => {
1582
- var _b = _a, { className } = _b, props = __objRest$b(_b, ["className"]);
1583
+ var _b = _a, { className } = _b, props = __objRest$c(_b, ["className"]);
1583
1584
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1584
1585
  LabelPrimitive.Root,
1585
- __spreadValues$o({
1586
+ __spreadValues$s({
1586
1587
  ref,
1587
1588
  className: cn(labelVariants(), className)
1588
1589
  }, props)
@@ -1590,42 +1591,42 @@ const Label$1 = React.forwardRef((_a, ref) => {
1590
1591
  });
1591
1592
  Label$1.displayName = LabelPrimitive.Root.displayName;
1592
1593
 
1593
- var __defProp$n = Object.defineProperty;
1594
- var __defProps$g = Object.defineProperties;
1595
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
1596
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
1597
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
1598
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
1599
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1600
- var __spreadValues$n = (a, b) => {
1594
+ var __defProp$r = Object.defineProperty;
1595
+ var __defProps$k = Object.defineProperties;
1596
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
1597
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
1598
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
1599
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
1600
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1601
+ var __spreadValues$r = (a, b) => {
1601
1602
  for (var prop in b || (b = {}))
1602
- if (__hasOwnProp$n.call(b, prop))
1603
- __defNormalProp$n(a, prop, b[prop]);
1604
- if (__getOwnPropSymbols$n)
1605
- for (var prop of __getOwnPropSymbols$n(b)) {
1606
- if (__propIsEnum$n.call(b, prop))
1607
- __defNormalProp$n(a, prop, b[prop]);
1603
+ if (__hasOwnProp$r.call(b, prop))
1604
+ __defNormalProp$r(a, prop, b[prop]);
1605
+ if (__getOwnPropSymbols$r)
1606
+ for (var prop of __getOwnPropSymbols$r(b)) {
1607
+ if (__propIsEnum$r.call(b, prop))
1608
+ __defNormalProp$r(a, prop, b[prop]);
1608
1609
  }
1609
1610
  return a;
1610
1611
  };
1611
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
1612
- var __objRest$a = (source, exclude) => {
1612
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
1613
+ var __objRest$b = (source, exclude) => {
1613
1614
  var target = {};
1614
1615
  for (var prop in source)
1615
- if (__hasOwnProp$n.call(source, prop) && exclude.indexOf(prop) < 0)
1616
+ if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
1616
1617
  target[prop] = source[prop];
1617
- if (source != null && __getOwnPropSymbols$n)
1618
- for (var prop of __getOwnPropSymbols$n(source)) {
1619
- if (exclude.indexOf(prop) < 0 && __propIsEnum$n.call(source, prop))
1618
+ if (source != null && __getOwnPropSymbols$r)
1619
+ for (var prop of __getOwnPropSymbols$r(source)) {
1620
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
1620
1621
  target[prop] = source[prop];
1621
1622
  }
1622
1623
  return target;
1623
1624
  };
1624
1625
  const Switch = React.forwardRef((_a, ref) => {
1625
- var _b = _a, { className } = _b, props = __objRest$a(_b, ["className"]);
1626
+ var _b = _a, { className } = _b, props = __objRest$b(_b, ["className"]);
1626
1627
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1627
1628
  SwitchPrimitives.Root,
1628
- __spreadProps$g(__spreadValues$n({
1629
+ __spreadProps$k(__spreadValues$r({
1629
1630
  className: cn(
1630
1631
  "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
1631
1632
  className
@@ -1645,33 +1646,33 @@ const Switch = React.forwardRef((_a, ref) => {
1645
1646
  });
1646
1647
  Switch.displayName = SwitchPrimitives.Root.displayName;
1647
1648
 
1648
- var __defProp$m = Object.defineProperty;
1649
- var __defProps$f = Object.defineProperties;
1650
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
1651
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
1652
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
1653
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
1654
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1655
- var __spreadValues$m = (a, b) => {
1649
+ var __defProp$q = Object.defineProperty;
1650
+ var __defProps$j = Object.defineProperties;
1651
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
1652
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
1653
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
1654
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
1655
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1656
+ var __spreadValues$q = (a, b) => {
1656
1657
  for (var prop in b || (b = {}))
1657
- if (__hasOwnProp$m.call(b, prop))
1658
- __defNormalProp$m(a, prop, b[prop]);
1659
- if (__getOwnPropSymbols$m)
1660
- for (var prop of __getOwnPropSymbols$m(b)) {
1661
- if (__propIsEnum$m.call(b, prop))
1662
- __defNormalProp$m(a, prop, b[prop]);
1658
+ if (__hasOwnProp$q.call(b, prop))
1659
+ __defNormalProp$q(a, prop, b[prop]);
1660
+ if (__getOwnPropSymbols$q)
1661
+ for (var prop of __getOwnPropSymbols$q(b)) {
1662
+ if (__propIsEnum$q.call(b, prop))
1663
+ __defNormalProp$q(a, prop, b[prop]);
1663
1664
  }
1664
1665
  return a;
1665
1666
  };
1666
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
1667
- var __objRest$9 = (source, exclude) => {
1667
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
1668
+ var __objRest$a = (source, exclude) => {
1668
1669
  var target = {};
1669
1670
  for (var prop in source)
1670
- if (__hasOwnProp$m.call(source, prop) && exclude.indexOf(prop) < 0)
1671
+ if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
1671
1672
  target[prop] = source[prop];
1672
- if (source != null && __getOwnPropSymbols$m)
1673
- for (var prop of __getOwnPropSymbols$m(source)) {
1674
- if (exclude.indexOf(prop) < 0 && __propIsEnum$m.call(source, prop))
1673
+ if (source != null && __getOwnPropSymbols$q)
1674
+ for (var prop of __getOwnPropSymbols$q(source)) {
1675
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
1675
1676
  target[prop] = source[prop];
1676
1677
  }
1677
1678
  return target;
@@ -1679,10 +1680,10 @@ var __objRest$9 = (source, exclude) => {
1679
1680
  const Select = SelectPrimitive.Root;
1680
1681
  const SelectValue = SelectPrimitive.Value;
1681
1682
  const SelectTrigger = React.forwardRef((_a, ref) => {
1682
- var _b = _a, { className, children } = _b, props = __objRest$9(_b, ["className", "children"]);
1683
+ var _b = _a, { className, children } = _b, props = __objRest$a(_b, ["className", "children"]);
1683
1684
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1684
1685
  SelectPrimitive.Trigger,
1685
- __spreadProps$f(__spreadValues$m({
1686
+ __spreadProps$j(__spreadValues$q({
1686
1687
  ref,
1687
1688
  className: cn(
1688
1689
  "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
@@ -1698,10 +1699,10 @@ const SelectTrigger = React.forwardRef((_a, ref) => {
1698
1699
  });
1699
1700
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
1700
1701
  const SelectScrollUpButton = React.forwardRef((_c, ref) => {
1701
- var _d = _c, { className } = _d, props = __objRest$9(_d, ["className"]);
1702
+ var _d = _c, { className } = _d, props = __objRest$a(_d, ["className"]);
1702
1703
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1703
1704
  SelectPrimitive.ScrollUpButton,
1704
- __spreadProps$f(__spreadValues$m({
1705
+ __spreadProps$j(__spreadValues$q({
1705
1706
  ref,
1706
1707
  className: cn(
1707
1708
  "flex cursor-default items-center justify-center py-1",
@@ -1714,10 +1715,10 @@ const SelectScrollUpButton = React.forwardRef((_c, ref) => {
1714
1715
  });
1715
1716
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
1716
1717
  const SelectScrollDownButton = React.forwardRef((_e, ref) => {
1717
- var _f = _e, { className } = _f, props = __objRest$9(_f, ["className"]);
1718
+ var _f = _e, { className } = _f, props = __objRest$a(_f, ["className"]);
1718
1719
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1719
1720
  SelectPrimitive.ScrollDownButton,
1720
- __spreadProps$f(__spreadValues$m({
1721
+ __spreadProps$j(__spreadValues$q({
1721
1722
  ref,
1722
1723
  className: cn(
1723
1724
  "flex cursor-default items-center justify-center py-1",
@@ -1730,10 +1731,10 @@ const SelectScrollDownButton = React.forwardRef((_e, ref) => {
1730
1731
  });
1731
1732
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
1732
1733
  const SelectContent = React.forwardRef((_g, ref) => {
1733
- var _h = _g, { className, children, position = "popper" } = _h, props = __objRest$9(_h, ["className", "children", "position"]);
1734
+ var _h = _g, { className, children, position = "popper" } = _h, props = __objRest$a(_h, ["className", "children", "position"]);
1734
1735
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1735
1736
  SelectPrimitive.Content,
1736
- __spreadProps$f(__spreadValues$m({
1737
+ __spreadProps$j(__spreadValues$q({
1737
1738
  ref,
1738
1739
  className: cn(
1739
1740
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
@@ -1761,10 +1762,10 @@ const SelectContent = React.forwardRef((_g, ref) => {
1761
1762
  });
1762
1763
  SelectContent.displayName = SelectPrimitive.Content.displayName;
1763
1764
  const SelectLabel = React.forwardRef((_i, ref) => {
1764
- var _j = _i, { className } = _j, props = __objRest$9(_j, ["className"]);
1765
+ var _j = _i, { className } = _j, props = __objRest$a(_j, ["className"]);
1765
1766
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1766
1767
  SelectPrimitive.Label,
1767
- __spreadValues$m({
1768
+ __spreadValues$q({
1768
1769
  ref,
1769
1770
  className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)
1770
1771
  }, props)
@@ -1772,10 +1773,10 @@ const SelectLabel = React.forwardRef((_i, ref) => {
1772
1773
  });
1773
1774
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
1774
1775
  const SelectItem = React.forwardRef((_k, ref) => {
1775
- var _l = _k, { className, children } = _l, props = __objRest$9(_l, ["className", "children"]);
1776
+ var _l = _k, { className, children } = _l, props = __objRest$a(_l, ["className", "children"]);
1776
1777
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1777
1778
  SelectPrimitive.Item,
1778
- __spreadProps$f(__spreadValues$m({
1779
+ __spreadProps$j(__spreadValues$q({
1779
1780
  ref,
1780
1781
  className: cn(
1781
1782
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -1791,10 +1792,10 @@ const SelectItem = React.forwardRef((_k, ref) => {
1791
1792
  });
1792
1793
  SelectItem.displayName = SelectPrimitive.Item.displayName;
1793
1794
  const SelectSeparator = React.forwardRef((_m, ref) => {
1794
- var _n = _m, { className } = _n, props = __objRest$9(_n, ["className"]);
1795
+ var _n = _m, { className } = _n, props = __objRest$a(_n, ["className"]);
1795
1796
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1796
1797
  SelectPrimitive.Separator,
1797
- __spreadValues$m({
1798
+ __spreadValues$q({
1798
1799
  ref,
1799
1800
  className: cn("-mx-1 my-1 h-px bg-muted", className)
1800
1801
  }, props)
@@ -1802,42 +1803,42 @@ const SelectSeparator = React.forwardRef((_m, ref) => {
1802
1803
  });
1803
1804
  SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
1804
1805
 
1805
- var __defProp$l = Object.defineProperty;
1806
- var __defProps$e = Object.defineProperties;
1807
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
1808
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
1809
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
1810
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
1811
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1812
- var __spreadValues$l = (a, b) => {
1806
+ var __defProp$p = Object.defineProperty;
1807
+ var __defProps$i = Object.defineProperties;
1808
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
1809
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
1810
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
1811
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
1812
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1813
+ var __spreadValues$p = (a, b) => {
1813
1814
  for (var prop in b || (b = {}))
1814
- if (__hasOwnProp$l.call(b, prop))
1815
- __defNormalProp$l(a, prop, b[prop]);
1816
- if (__getOwnPropSymbols$l)
1817
- for (var prop of __getOwnPropSymbols$l(b)) {
1818
- if (__propIsEnum$l.call(b, prop))
1819
- __defNormalProp$l(a, prop, b[prop]);
1815
+ if (__hasOwnProp$p.call(b, prop))
1816
+ __defNormalProp$p(a, prop, b[prop]);
1817
+ if (__getOwnPropSymbols$p)
1818
+ for (var prop of __getOwnPropSymbols$p(b)) {
1819
+ if (__propIsEnum$p.call(b, prop))
1820
+ __defNormalProp$p(a, prop, b[prop]);
1820
1821
  }
1821
1822
  return a;
1822
1823
  };
1823
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
1824
- var __objRest$8 = (source, exclude) => {
1824
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
1825
+ var __objRest$9 = (source, exclude) => {
1825
1826
  var target = {};
1826
1827
  for (var prop in source)
1827
- if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
1828
+ if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
1828
1829
  target[prop] = source[prop];
1829
- if (source != null && __getOwnPropSymbols$l)
1830
- for (var prop of __getOwnPropSymbols$l(source)) {
1831
- if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
1830
+ if (source != null && __getOwnPropSymbols$p)
1831
+ for (var prop of __getOwnPropSymbols$p(source)) {
1832
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
1832
1833
  target[prop] = source[prop];
1833
1834
  }
1834
1835
  return target;
1835
1836
  };
1836
1837
  const ScrollArea = React.forwardRef((_a, ref) => {
1837
- var _b = _a, { className, children } = _b, props = __objRest$8(_b, ["className", "children"]);
1838
+ var _b = _a, { className, children } = _b, props = __objRest$9(_b, ["className", "children"]);
1838
1839
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1839
1840
  ScrollAreaPrimitive.Root,
1840
- __spreadProps$e(__spreadValues$l({
1841
+ __spreadProps$i(__spreadValues$p({
1841
1842
  ref,
1842
1843
  className: cn("relative overflow-hidden", className)
1843
1844
  }, props), {
@@ -1851,10 +1852,10 @@ const ScrollArea = React.forwardRef((_a, ref) => {
1851
1852
  });
1852
1853
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
1853
1854
  const ScrollBar = React.forwardRef((_c, ref) => {
1854
- var _d = _c, { className, orientation = "vertical" } = _d, props = __objRest$8(_d, ["className", "orientation"]);
1855
+ var _d = _c, { className, orientation = "vertical" } = _d, props = __objRest$9(_d, ["className", "orientation"]);
1855
1856
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1856
1857
  ScrollAreaPrimitive.ScrollAreaScrollbar,
1857
- __spreadProps$e(__spreadValues$l({
1858
+ __spreadProps$i(__spreadValues$p({
1858
1859
  ref,
1859
1860
  orientation,
1860
1861
  className: cn(
@@ -1870,30 +1871,30 @@ const ScrollBar = React.forwardRef((_c, ref) => {
1870
1871
  });
1871
1872
  ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
1872
1873
 
1873
- var __defProp$k = Object.defineProperty;
1874
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
1875
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
1876
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
1877
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1878
- var __spreadValues$k = (a, b) => {
1874
+ var __defProp$o = Object.defineProperty;
1875
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
1876
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
1877
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
1878
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1879
+ var __spreadValues$o = (a, b) => {
1879
1880
  for (var prop in b || (b = {}))
1880
- if (__hasOwnProp$k.call(b, prop))
1881
- __defNormalProp$k(a, prop, b[prop]);
1882
- if (__getOwnPropSymbols$k)
1883
- for (var prop of __getOwnPropSymbols$k(b)) {
1884
- if (__propIsEnum$k.call(b, prop))
1885
- __defNormalProp$k(a, prop, b[prop]);
1881
+ if (__hasOwnProp$o.call(b, prop))
1882
+ __defNormalProp$o(a, prop, b[prop]);
1883
+ if (__getOwnPropSymbols$o)
1884
+ for (var prop of __getOwnPropSymbols$o(b)) {
1885
+ if (__propIsEnum$o.call(b, prop))
1886
+ __defNormalProp$o(a, prop, b[prop]);
1886
1887
  }
1887
1888
  return a;
1888
1889
  };
1889
- var __objRest$7 = (source, exclude) => {
1890
+ var __objRest$8 = (source, exclude) => {
1890
1891
  var target = {};
1891
1892
  for (var prop in source)
1892
- if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
1893
+ if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
1893
1894
  target[prop] = source[prop];
1894
- if (source != null && __getOwnPropSymbols$k)
1895
- for (var prop of __getOwnPropSymbols$k(source)) {
1896
- if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
1895
+ if (source != null && __getOwnPropSymbols$o)
1896
+ for (var prop of __getOwnPropSymbols$o(source)) {
1897
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
1897
1898
  target[prop] = source[prop];
1898
1899
  }
1899
1900
  return target;
@@ -1925,11 +1926,11 @@ const buttonVariants = cva(
1925
1926
  );
1926
1927
  const Button = React.forwardRef(
1927
1928
  (_a, ref) => {
1928
- var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest$7(_b, ["className", "variant", "size", "asChild"]);
1929
+ var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest$8(_b, ["className", "variant", "size", "asChild"]);
1929
1930
  const Comp = asChild ? Slot : "button";
1930
1931
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1931
1932
  Comp,
1932
- __spreadValues$k({
1933
+ __spreadValues$o({
1933
1934
  className: cn(buttonVariants({ variant, size, className })),
1934
1935
  ref
1935
1936
  }, props)
@@ -1938,30 +1939,30 @@ const Button = React.forwardRef(
1938
1939
  );
1939
1940
  Button.displayName = "Button";
1940
1941
 
1941
- var __defProp$j = Object.defineProperty;
1942
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
1943
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
1944
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
1945
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1946
- var __spreadValues$j = (a, b) => {
1942
+ var __defProp$n = Object.defineProperty;
1943
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
1944
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
1945
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
1946
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1947
+ var __spreadValues$n = (a, b) => {
1947
1948
  for (var prop in b || (b = {}))
1948
- if (__hasOwnProp$j.call(b, prop))
1949
- __defNormalProp$j(a, prop, b[prop]);
1950
- if (__getOwnPropSymbols$j)
1951
- for (var prop of __getOwnPropSymbols$j(b)) {
1952
- if (__propIsEnum$j.call(b, prop))
1953
- __defNormalProp$j(a, prop, b[prop]);
1949
+ if (__hasOwnProp$n.call(b, prop))
1950
+ __defNormalProp$n(a, prop, b[prop]);
1951
+ if (__getOwnPropSymbols$n)
1952
+ for (var prop of __getOwnPropSymbols$n(b)) {
1953
+ if (__propIsEnum$n.call(b, prop))
1954
+ __defNormalProp$n(a, prop, b[prop]);
1954
1955
  }
1955
1956
  return a;
1956
1957
  };
1957
- var __objRest$6 = (source, exclude) => {
1958
+ var __objRest$7 = (source, exclude) => {
1958
1959
  var target = {};
1959
1960
  for (var prop in source)
1960
- if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
1961
+ if (__hasOwnProp$n.call(source, prop) && exclude.indexOf(prop) < 0)
1961
1962
  target[prop] = source[prop];
1962
- if (source != null && __getOwnPropSymbols$j)
1963
- for (var prop of __getOwnPropSymbols$j(source)) {
1964
- if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
1963
+ if (source != null && __getOwnPropSymbols$n)
1964
+ for (var prop of __getOwnPropSymbols$n(source)) {
1965
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$n.call(source, prop))
1965
1966
  target[prop] = source[prop];
1966
1967
  }
1967
1968
  return target;
@@ -1981,10 +1982,10 @@ const alertVariants = cva(
1981
1982
  }
1982
1983
  );
1983
1984
  const Alert = React.forwardRef((_a, ref) => {
1984
- var _b = _a, { className, variant } = _b, props = __objRest$6(_b, ["className", "variant"]);
1985
+ var _b = _a, { className, variant } = _b, props = __objRest$7(_b, ["className", "variant"]);
1985
1986
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1986
1987
  "div",
1987
- __spreadValues$j({
1988
+ __spreadValues$n({
1988
1989
  ref,
1989
1990
  role: "alert",
1990
1991
  className: cn(alertVariants({ variant }), className)
@@ -1993,10 +1994,10 @@ const Alert = React.forwardRef((_a, ref) => {
1993
1994
  });
1994
1995
  Alert.displayName = "Alert";
1995
1996
  const AlertTitle = React.forwardRef((_c, ref) => {
1996
- var _d = _c, { className } = _d, props = __objRest$6(_d, ["className"]);
1997
+ var _d = _c, { className } = _d, props = __objRest$7(_d, ["className"]);
1997
1998
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1998
1999
  "h5",
1999
- __spreadValues$j({
2000
+ __spreadValues$n({
2000
2001
  ref,
2001
2002
  className: cn("mb-1 font-medium leading-none tracking-tight", className)
2002
2003
  }, props)
@@ -2004,10 +2005,10 @@ const AlertTitle = React.forwardRef((_c, ref) => {
2004
2005
  });
2005
2006
  AlertTitle.displayName = "AlertTitle";
2006
2007
  const AlertDescription = React.forwardRef((_e, ref) => {
2007
- var _f = _e, { className } = _f, props = __objRest$6(_f, ["className"]);
2008
+ var _f = _e, { className } = _f, props = __objRest$7(_f, ["className"]);
2008
2009
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2009
2010
  "div",
2010
- __spreadValues$j({
2011
+ __spreadValues$n({
2011
2012
  ref,
2012
2013
  className: cn("text-sm [&_p]:leading-relaxed", className)
2013
2014
  }, props)
@@ -2040,25 +2041,25 @@ function CodeEditor({
2040
2041
  );
2041
2042
  }
2042
2043
 
2043
- var __defProp$i = Object.defineProperty;
2044
- var __defProps$d = Object.defineProperties;
2045
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
2046
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
2047
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
2048
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
2049
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2050
- var __spreadValues$i = (a, b) => {
2044
+ var __defProp$m = Object.defineProperty;
2045
+ var __defProps$h = Object.defineProperties;
2046
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
2047
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
2048
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
2049
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
2050
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2051
+ var __spreadValues$m = (a, b) => {
2051
2052
  for (var prop in b || (b = {}))
2052
- if (__hasOwnProp$i.call(b, prop))
2053
- __defNormalProp$i(a, prop, b[prop]);
2054
- if (__getOwnPropSymbols$i)
2055
- for (var prop of __getOwnPropSymbols$i(b)) {
2056
- if (__propIsEnum$i.call(b, prop))
2057
- __defNormalProp$i(a, prop, b[prop]);
2053
+ if (__hasOwnProp$m.call(b, prop))
2054
+ __defNormalProp$m(a, prop, b[prop]);
2055
+ if (__getOwnPropSymbols$m)
2056
+ for (var prop of __getOwnPropSymbols$m(b)) {
2057
+ if (__propIsEnum$m.call(b, prop))
2058
+ __defNormalProp$m(a, prop, b[prop]);
2058
2059
  }
2059
2060
  return a;
2060
2061
  };
2061
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
2062
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
2062
2063
  function SearchWidgetFacetSettings({
2063
2064
  value = [],
2064
2065
  onChange,
@@ -2099,14 +2100,14 @@ function SearchWidgetFacetSettings({
2099
2100
  };
2100
2101
  const removeFacet = (index) => {
2101
2102
  const newFields = value.filter((_, i) => i !== index);
2102
- const reorderedFields = newFields.map((field, idx) => __spreadProps$d(__spreadValues$i({}, field), {
2103
+ const reorderedFields = newFields.map((field, idx) => __spreadProps$h(__spreadValues$m({}, field), {
2103
2104
  order: idx
2104
2105
  }));
2105
2106
  onChange(reorderedFields);
2106
2107
  };
2107
2108
  const updateFacet = (index, updates) => {
2108
2109
  const newFields = value.map(
2109
- (field, i) => i === index ? __spreadValues$i(__spreadValues$i({}, field), updates) : field
2110
+ (field, i) => i === index ? __spreadValues$m(__spreadValues$m({}, field), updates) : field
2110
2111
  );
2111
2112
  onChange(newFields);
2112
2113
  };
@@ -2117,8 +2118,8 @@ function SearchWidgetFacetSettings({
2117
2118
  const newFields = [...value];
2118
2119
  const newIndex = direction === "up" ? index - 1 : index + 1;
2119
2120
  [newFields[index], newFields[newIndex]] = [
2120
- __spreadProps$d(__spreadValues$i({}, newFields[newIndex]), { order: index }),
2121
- __spreadProps$d(__spreadValues$i({}, newFields[index]), { order: newIndex })
2121
+ __spreadProps$h(__spreadValues$m({}, newFields[newIndex]), { order: index }),
2122
+ __spreadProps$h(__spreadValues$m({}, newFields[index]), { order: newIndex })
2122
2123
  ];
2123
2124
  onChange(newFields);
2124
2125
  };
@@ -2204,25 +2205,25 @@ function SearchWidgetFacetSettings({
2204
2205
  ] });
2205
2206
  }
2206
2207
 
2207
- var __defProp$h = Object.defineProperty;
2208
- var __defProps$c = Object.defineProperties;
2209
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
2210
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
2211
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
2212
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
2213
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2214
- var __spreadValues$h = (a, b) => {
2208
+ var __defProp$l = Object.defineProperty;
2209
+ var __defProps$g = Object.defineProperties;
2210
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
2211
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
2212
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
2213
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
2214
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2215
+ var __spreadValues$l = (a, b) => {
2215
2216
  for (var prop in b || (b = {}))
2216
- if (__hasOwnProp$h.call(b, prop))
2217
- __defNormalProp$h(a, prop, b[prop]);
2218
- if (__getOwnPropSymbols$h)
2219
- for (var prop of __getOwnPropSymbols$h(b)) {
2220
- if (__propIsEnum$h.call(b, prop))
2221
- __defNormalProp$h(a, prop, b[prop]);
2217
+ if (__hasOwnProp$l.call(b, prop))
2218
+ __defNormalProp$l(a, prop, b[prop]);
2219
+ if (__getOwnPropSymbols$l)
2220
+ for (var prop of __getOwnPropSymbols$l(b)) {
2221
+ if (__propIsEnum$l.call(b, prop))
2222
+ __defNormalProp$l(a, prop, b[prop]);
2222
2223
  }
2223
2224
  return a;
2224
2225
  };
2225
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
2226
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
2226
2227
  function WidgetSettingsPanel({
2227
2228
  pageId,
2228
2229
  widget,
@@ -2248,14 +2249,14 @@ function WidgetSettingsPanel({
2248
2249
  }
2249
2250
  const pageData = await pageResponse.json();
2250
2251
  const updatedWidgets = pageData.widgets.map(
2251
- (w) => w.id === widgetId ? __spreadValues$h(__spreadValues$h({}, w), updates) : w
2252
+ (w) => w.id === widgetId ? __spreadValues$l(__spreadValues$l({}, w), updates) : w
2252
2253
  );
2253
2254
  const response = await fetch(getApiUrl(`/api/pages/${pageId}`), {
2254
2255
  method: "PUT",
2255
2256
  headers: {
2256
2257
  "Content-Type": "application/json"
2257
2258
  },
2258
- body: JSON.stringify(__spreadProps$c(__spreadValues$h({}, pageData), {
2259
+ body: JSON.stringify(__spreadProps$g(__spreadValues$l({}, pageData), {
2259
2260
  widgets: updatedWidgets
2260
2261
  }))
2261
2262
  });
@@ -2314,12 +2315,12 @@ function WidgetSettingsPanel({
2314
2315
  }
2315
2316
  };
2316
2317
  const updateWidget = (updates) => {
2317
- const updatedWidget = __spreadValues$h(__spreadValues$h({}, localWidget), updates);
2318
+ const updatedWidget = __spreadValues$l(__spreadValues$l({}, localWidget), updates);
2318
2319
  setLocalWidget(updatedWidget);
2319
2320
  };
2320
2321
  const updateConfig = (updates) => {
2321
2322
  console.log("Updating config with:", updates);
2322
- const newConfig = __spreadValues$h(__spreadValues$h({}, localWidget.config), updates);
2323
+ const newConfig = __spreadValues$l(__spreadValues$l({}, localWidget.config), updates);
2323
2324
  console.log("New config will be:", newConfig);
2324
2325
  updateWidget({
2325
2326
  config: newConfig
@@ -2328,8 +2329,8 @@ function WidgetSettingsPanel({
2328
2329
  const updateStyle = (updates) => {
2329
2330
  var _a;
2330
2331
  updateWidget({
2331
- config: __spreadProps$c(__spreadValues$h({}, localWidget.config), {
2332
- styles: __spreadValues$h(__spreadValues$h({}, ((_a = localWidget.config) == null ? void 0 : _a.styles) || {}), updates)
2332
+ config: __spreadProps$g(__spreadValues$l({}, localWidget.config), {
2333
+ styles: __spreadValues$l(__spreadValues$l({}, ((_a = localWidget.config) == null ? void 0 : _a.styles) || {}), updates)
2333
2334
  })
2334
2335
  });
2335
2336
  };
@@ -2596,8 +2597,8 @@ function WidgetSettingsPanel({
2596
2597
  checked: (_k = (_j = (_i = widget.config) == null ? void 0 : _i.facets) == null ? void 0 : _j.enabled) != null ? _k : false,
2597
2598
  onCheckedChange: (checked) => {
2598
2599
  var _a2, _b2, _c2;
2599
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2600
- facets: __spreadProps$c(__spreadValues$h({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2600
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2601
+ facets: __spreadProps$g(__spreadValues$l({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2601
2602
  enabled: checked,
2602
2603
  fields: ((_c2 = (_b2 = widget.config) == null ? void 0 : _b2.facets) == null ? void 0 : _c2.fields) || []
2603
2604
  })
@@ -2613,8 +2614,8 @@ function WidgetSettingsPanel({
2613
2614
  placeHolder: "Select facet field",
2614
2615
  value: widget.config.facets.fields || [],
2615
2616
  onChange: (fields) => {
2616
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2617
- facets: __spreadProps$c(__spreadValues$h({}, widget.config.facets), {
2617
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2618
+ facets: __spreadProps$g(__spreadValues$l({}, widget.config.facets), {
2618
2619
  fields
2619
2620
  })
2620
2621
  });
@@ -2638,7 +2639,7 @@ function WidgetSettingsPanel({
2638
2639
  onValueChange: (value) => {
2639
2640
  var _a2;
2640
2641
  return updateConfig({
2641
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), { type: value })
2642
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), { type: value })
2642
2643
  });
2643
2644
  },
2644
2645
  children: [
@@ -2661,7 +2662,7 @@ function WidgetSettingsPanel({
2661
2662
  onValueChange: (value) => {
2662
2663
  var _a2;
2663
2664
  return updateConfig({
2664
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2665
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2665
2666
  itemsPerPage: parseInt(value)
2666
2667
  })
2667
2668
  });
@@ -2685,7 +2686,7 @@ function WidgetSettingsPanel({
2685
2686
  onCheckedChange: (checked) => {
2686
2687
  var _a2;
2687
2688
  return updateConfig({
2688
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2689
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2689
2690
  infiniteScroll: checked
2690
2691
  })
2691
2692
  });
@@ -2737,8 +2738,8 @@ function WidgetSettingsPanel({
2737
2738
  placeHolder: "Select metadata field",
2738
2739
  value: ((_l = (_k = widget.config) == null ? void 0 : _k.metadata) == null ? void 0 : _l.fields) || [],
2739
2740
  onChange: (fields) => {
2740
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2741
- metadata: __spreadProps$c(__spreadValues$h({}, widget.config.metadata), {
2741
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2742
+ metadata: __spreadProps$g(__spreadValues$l({}, widget.config.metadata), {
2742
2743
  fields
2743
2744
  })
2744
2745
  });
@@ -2814,8 +2815,8 @@ function WidgetSettingsPanel({
2814
2815
  checked: (_f = (_e = (_d = widget.config) == null ? void 0 : _d.facets) == null ? void 0 : _e.enabled) != null ? _f : false,
2815
2816
  onCheckedChange: (checked) => {
2816
2817
  var _a2, _b2, _c2;
2817
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2818
- facets: __spreadProps$c(__spreadValues$h({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2818
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2819
+ facets: __spreadProps$g(__spreadValues$l({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2819
2820
  enabled: checked,
2820
2821
  fields: ((_c2 = (_b2 = widget.config) == null ? void 0 : _b2.facets) == null ? void 0 : _c2.fields) || []
2821
2822
  })
@@ -2832,8 +2833,8 @@ function WidgetSettingsPanel({
2832
2833
  placeHolder: "Select facet field",
2833
2834
  value: widget.config.facets.fields || [],
2834
2835
  onChange: (fields) => {
2835
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2836
- facets: __spreadProps$c(__spreadValues$h({}, widget.config.facets), {
2836
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2837
+ facets: __spreadProps$g(__spreadValues$l({}, widget.config.facets), {
2837
2838
  fields
2838
2839
  })
2839
2840
  });
@@ -2951,39 +2952,39 @@ function WidgetSettingsPanel({
2951
2952
  ] });
2952
2953
  }
2953
2954
 
2954
- var __defProp$g = Object.defineProperty;
2955
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
2956
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
2957
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
2958
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2959
- var __spreadValues$g = (a, b) => {
2955
+ var __defProp$k = Object.defineProperty;
2956
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
2957
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
2958
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
2959
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2960
+ var __spreadValues$k = (a, b) => {
2960
2961
  for (var prop in b || (b = {}))
2961
- if (__hasOwnProp$g.call(b, prop))
2962
- __defNormalProp$g(a, prop, b[prop]);
2963
- if (__getOwnPropSymbols$g)
2964
- for (var prop of __getOwnPropSymbols$g(b)) {
2965
- if (__propIsEnum$g.call(b, prop))
2966
- __defNormalProp$g(a, prop, b[prop]);
2962
+ if (__hasOwnProp$k.call(b, prop))
2963
+ __defNormalProp$k(a, prop, b[prop]);
2964
+ if (__getOwnPropSymbols$k)
2965
+ for (var prop of __getOwnPropSymbols$k(b)) {
2966
+ if (__propIsEnum$k.call(b, prop))
2967
+ __defNormalProp$k(a, prop, b[prop]);
2967
2968
  }
2968
2969
  return a;
2969
2970
  };
2970
- var __objRest$5 = (source, exclude) => {
2971
+ var __objRest$6 = (source, exclude) => {
2971
2972
  var target = {};
2972
2973
  for (var prop in source)
2973
- if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
2974
+ if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
2974
2975
  target[prop] = source[prop];
2975
- if (source != null && __getOwnPropSymbols$g)
2976
- for (var prop of __getOwnPropSymbols$g(source)) {
2977
- if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
2976
+ if (source != null && __getOwnPropSymbols$k)
2977
+ for (var prop of __getOwnPropSymbols$k(source)) {
2978
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
2978
2979
  target[prop] = source[prop];
2979
2980
  }
2980
2981
  return target;
2981
2982
  };
2982
2983
  const Card = React.forwardRef((_a, ref) => {
2983
- var _b = _a, { className } = _b, props = __objRest$5(_b, ["className"]);
2984
+ var _b = _a, { className } = _b, props = __objRest$6(_b, ["className"]);
2984
2985
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2985
2986
  "div",
2986
- __spreadValues$g({
2987
+ __spreadValues$k({
2987
2988
  ref,
2988
2989
  className: cn(
2989
2990
  "rounded-lg border bg-card text-card-foreground shadow-sm",
@@ -2994,10 +2995,10 @@ const Card = React.forwardRef((_a, ref) => {
2994
2995
  });
2995
2996
  Card.displayName = "Card";
2996
2997
  const CardHeader = React.forwardRef((_c, ref) => {
2997
- var _d = _c, { className } = _d, props = __objRest$5(_d, ["className"]);
2998
+ var _d = _c, { className } = _d, props = __objRest$6(_d, ["className"]);
2998
2999
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2999
3000
  "div",
3000
- __spreadValues$g({
3001
+ __spreadValues$k({
3001
3002
  ref,
3002
3003
  className: cn("flex flex-col space-y-1.5 p-6", className)
3003
3004
  }, props)
@@ -3005,10 +3006,10 @@ const CardHeader = React.forwardRef((_c, ref) => {
3005
3006
  });
3006
3007
  CardHeader.displayName = "CardHeader";
3007
3008
  const CardTitle = React.forwardRef((_e, ref) => {
3008
- var _f = _e, { className } = _f, props = __objRest$5(_f, ["className"]);
3009
+ var _f = _e, { className } = _f, props = __objRest$6(_f, ["className"]);
3009
3010
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3010
3011
  "div",
3011
- __spreadValues$g({
3012
+ __spreadValues$k({
3012
3013
  ref,
3013
3014
  className: cn(
3014
3015
  "text-2xl font-semibold leading-none tracking-tight",
@@ -3019,10 +3020,10 @@ const CardTitle = React.forwardRef((_e, ref) => {
3019
3020
  });
3020
3021
  CardTitle.displayName = "CardTitle";
3021
3022
  const CardDescription = React.forwardRef((_g, ref) => {
3022
- var _h = _g, { className } = _h, props = __objRest$5(_h, ["className"]);
3023
+ var _h = _g, { className } = _h, props = __objRest$6(_h, ["className"]);
3023
3024
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3024
3025
  "div",
3025
- __spreadValues$g({
3026
+ __spreadValues$k({
3026
3027
  ref,
3027
3028
  className: cn("text-sm text-muted-foreground", className)
3028
3029
  }, props)
@@ -3030,15 +3031,15 @@ const CardDescription = React.forwardRef((_g, ref) => {
3030
3031
  });
3031
3032
  CardDescription.displayName = "CardDescription";
3032
3033
  const CardContent = React.forwardRef((_i, ref) => {
3033
- var _j = _i, { className } = _j, props = __objRest$5(_j, ["className"]);
3034
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$g({ ref, className: cn("p-6 pt-0", className) }, props));
3034
+ var _j = _i, { className } = _j, props = __objRest$6(_j, ["className"]);
3035
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$k({ ref, className: cn("p-6 pt-0", className) }, props));
3035
3036
  });
3036
3037
  CardContent.displayName = "CardContent";
3037
3038
  const CardFooter = React.forwardRef((_k, ref) => {
3038
- var _l = _k, { className } = _l, props = __objRest$5(_l, ["className"]);
3039
+ var _l = _k, { className } = _l, props = __objRest$6(_l, ["className"]);
3039
3040
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3040
3041
  "div",
3041
- __spreadValues$g({
3042
+ __spreadValues$k({
3042
3043
  ref,
3043
3044
  className: cn("flex items-center p-6 pt-0", className)
3044
3045
  }, props)
@@ -3147,30 +3148,141 @@ function WidgetPalette({ widgetBackendUrl } = {}) {
3147
3148
  ] });
3148
3149
  }
3149
3150
 
3150
- var __defProp$f = Object.defineProperty;
3151
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
3152
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
3153
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
3154
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3155
- var __spreadValues$f = (a, b) => {
3151
+ class WidgetService {
3152
+ constructor() {
3153
+ this.baseUrl = "/api/widgets";
3154
+ }
3155
+ async getWidgetTypes() {
3156
+ try {
3157
+ const response = await fetch(`${this.baseUrl}/types`);
3158
+ if (!response.ok) {
3159
+ throw new Error(`Failed to fetch widget types: ${response.statusText}`);
3160
+ }
3161
+ const data = await response.json();
3162
+ return data;
3163
+ } catch (error) {
3164
+ console.error("Error fetching widget types:", error);
3165
+ throw error;
3166
+ }
3167
+ }
3168
+ async getWidgetTemplates() {
3169
+ try {
3170
+ const response = await fetch(`${this.baseUrl}/templates`);
3171
+ if (!response.ok) {
3172
+ throw new Error(
3173
+ `Failed to fetch widget templates: ${response.statusText}`
3174
+ );
3175
+ }
3176
+ return await response.json();
3177
+ } catch (error) {
3178
+ console.error("Error fetching widget templates:", error);
3179
+ throw error;
3180
+ }
3181
+ }
3182
+ async getWidgetCategories() {
3183
+ try {
3184
+ const response = await fetch(`${this.baseUrl}/categories`);
3185
+ if (!response.ok) {
3186
+ throw new Error(
3187
+ `Failed to fetch widget categories: ${response.statusText}`
3188
+ );
3189
+ }
3190
+ return await response.json();
3191
+ } catch (error) {
3192
+ console.error("Error fetching widget categories:", error);
3193
+ throw error;
3194
+ }
3195
+ }
3196
+ async getPageWidgets(pageId) {
3197
+ try {
3198
+ const response = await fetch(`${this.baseUrl}/page/${pageId}`);
3199
+ if (!response.ok) {
3200
+ throw new Error(`Failed to fetch page widgets: ${response.statusText}`);
3201
+ }
3202
+ return await response.json();
3203
+ } catch (error) {
3204
+ console.error("Error fetching page widgets:", error);
3205
+ throw error;
3206
+ }
3207
+ }
3208
+ async saveWidget(widget) {
3209
+ try {
3210
+ const response = await fetch(this.baseUrl, {
3211
+ method: widget.id ? "PUT" : "POST",
3212
+ headers: {
3213
+ "Content-Type": "application/json"
3214
+ },
3215
+ body: JSON.stringify(widget)
3216
+ });
3217
+ if (!response.ok) {
3218
+ throw new Error(`Failed to save widget: ${response.statusText}`);
3219
+ }
3220
+ return await response.json();
3221
+ } catch (error) {
3222
+ console.error("Error saving widget:", error);
3223
+ throw error;
3224
+ }
3225
+ }
3226
+ async deleteWidget(widgetId) {
3227
+ try {
3228
+ const response = await fetch(`${this.baseUrl}/${widgetId}`, {
3229
+ method: "DELETE"
3230
+ });
3231
+ if (!response.ok) {
3232
+ throw new Error(`Failed to delete widget: ${response.statusText}`);
3233
+ }
3234
+ return true;
3235
+ } catch (error) {
3236
+ console.error("Error deleting widget:", error);
3237
+ throw error;
3238
+ }
3239
+ }
3240
+ async updateWidgetPositions(widgets) {
3241
+ try {
3242
+ const response = await fetch(`${this.baseUrl}/positions`, {
3243
+ method: "PUT",
3244
+ headers: {
3245
+ "Content-Type": "application/json"
3246
+ },
3247
+ body: JSON.stringify(widgets)
3248
+ });
3249
+ if (!response.ok) {
3250
+ throw new Error(
3251
+ `Failed to update widget positions: ${response.statusText}`
3252
+ );
3253
+ }
3254
+ return await response.json();
3255
+ } catch (error) {
3256
+ console.error("Error updating widget positions:", error);
3257
+ throw error;
3258
+ }
3259
+ }
3260
+ }
3261
+
3262
+ var __defProp$j = Object.defineProperty;
3263
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
3264
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
3265
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
3266
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3267
+ var __spreadValues$j = (a, b) => {
3156
3268
  for (var prop in b || (b = {}))
3157
- if (__hasOwnProp$f.call(b, prop))
3158
- __defNormalProp$f(a, prop, b[prop]);
3159
- if (__getOwnPropSymbols$f)
3160
- for (var prop of __getOwnPropSymbols$f(b)) {
3161
- if (__propIsEnum$f.call(b, prop))
3162
- __defNormalProp$f(a, prop, b[prop]);
3269
+ if (__hasOwnProp$j.call(b, prop))
3270
+ __defNormalProp$j(a, prop, b[prop]);
3271
+ if (__getOwnPropSymbols$j)
3272
+ for (var prop of __getOwnPropSymbols$j(b)) {
3273
+ if (__propIsEnum$j.call(b, prop))
3274
+ __defNormalProp$j(a, prop, b[prop]);
3163
3275
  }
3164
3276
  return a;
3165
3277
  };
3166
- var __objRest$4 = (source, exclude) => {
3278
+ var __objRest$5 = (source, exclude) => {
3167
3279
  var target = {};
3168
3280
  for (var prop in source)
3169
- if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
3281
+ if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
3170
3282
  target[prop] = source[prop];
3171
- if (source != null && __getOwnPropSymbols$f)
3172
- for (var prop of __getOwnPropSymbols$f(source)) {
3173
- if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
3283
+ if (source != null && __getOwnPropSymbols$j)
3284
+ for (var prop of __getOwnPropSymbols$j(source)) {
3285
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
3174
3286
  target[prop] = source[prop];
3175
3287
  }
3176
3288
  return target;
@@ -3197,8 +3309,8 @@ const badgeVariants = cva(
3197
3309
  }
3198
3310
  );
3199
3311
  function Badge(_a) {
3200
- var _b = _a, { className, variant } = _b, props = __objRest$4(_b, ["className", "variant"]);
3201
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$f({ className: cn(badgeVariants({ variant }), className) }, props));
3312
+ var _b = _a, { className, variant } = _b, props = __objRest$5(_b, ["className", "variant"]);
3313
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$j({ className: cn(badgeVariants({ variant }), className) }, props));
3202
3314
  }
3203
3315
 
3204
3316
  // src/primitive.tsx
@@ -6834,30 +6946,30 @@ var Root3 = Tooltip$2;
6834
6946
  var Trigger = TooltipTrigger$1;
6835
6947
  var Content2 = TooltipContent$1;
6836
6948
 
6837
- var __defProp$e = Object.defineProperty;
6838
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
6839
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
6840
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
6841
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6842
- var __spreadValues$e = (a, b) => {
6949
+ var __defProp$i = Object.defineProperty;
6950
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6951
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6952
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6953
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6954
+ var __spreadValues$i = (a, b) => {
6843
6955
  for (var prop in b || (b = {}))
6844
- if (__hasOwnProp$e.call(b, prop))
6845
- __defNormalProp$e(a, prop, b[prop]);
6846
- if (__getOwnPropSymbols$e)
6847
- for (var prop of __getOwnPropSymbols$e(b)) {
6848
- if (__propIsEnum$e.call(b, prop))
6849
- __defNormalProp$e(a, prop, b[prop]);
6956
+ if (__hasOwnProp$i.call(b, prop))
6957
+ __defNormalProp$i(a, prop, b[prop]);
6958
+ if (__getOwnPropSymbols$i)
6959
+ for (var prop of __getOwnPropSymbols$i(b)) {
6960
+ if (__propIsEnum$i.call(b, prop))
6961
+ __defNormalProp$i(a, prop, b[prop]);
6850
6962
  }
6851
6963
  return a;
6852
6964
  };
6853
- var __objRest$3 = (source, exclude) => {
6965
+ var __objRest$4 = (source, exclude) => {
6854
6966
  var target = {};
6855
6967
  for (var prop in source)
6856
- if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
6968
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
6857
6969
  target[prop] = source[prop];
6858
- if (source != null && __getOwnPropSymbols$e)
6859
- for (var prop of __getOwnPropSymbols$e(source)) {
6860
- if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
6970
+ if (source != null && __getOwnPropSymbols$i)
6971
+ for (var prop of __getOwnPropSymbols$i(source)) {
6972
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
6861
6973
  target[prop] = source[prop];
6862
6974
  }
6863
6975
  return target;
@@ -6866,10 +6978,10 @@ const TooltipProvider = Provider;
6866
6978
  const Tooltip$1 = Root3;
6867
6979
  const TooltipTrigger = Trigger;
6868
6980
  const TooltipContent = React.forwardRef((_a, ref) => {
6869
- var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest$3(_b, ["className", "sideOffset"]);
6981
+ var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest$4(_b, ["className", "sideOffset"]);
6870
6982
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
6871
6983
  Content2,
6872
- __spreadValues$e({
6984
+ __spreadValues$i({
6873
6985
  ref,
6874
6986
  sideOffset,
6875
6987
  className: cn(
@@ -7031,11 +7143,16 @@ function getWidgetStyles(widget) {
7031
7143
  };
7032
7144
  }
7033
7145
  function shuffleColors(colors, count) {
7034
- const shuffled = [...colors].sort(() => Math.random() - 0.5);
7035
- while (shuffled.length < count) {
7036
- shuffled.push(...[...colors].sort(() => Math.random() - 0.5));
7146
+ const shuffled = [...colors];
7147
+ for (let i = shuffled.length - 1; i > 0; i--) {
7148
+ const j = Math.floor(Math.random() * (i + 1));
7149
+ [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
7037
7150
  }
7038
- return shuffled.slice(0, count);
7151
+ let result = [...shuffled];
7152
+ while (result.length < count) {
7153
+ result.push(...shuffled);
7154
+ }
7155
+ return result.slice(0, count);
7039
7156
  }
7040
7157
  function getBorderRadiusValue(value) {
7041
7158
  switch (value) {
@@ -7066,25 +7183,25 @@ function getPaddingValue(value) {
7066
7183
  }
7067
7184
  }
7068
7185
 
7069
- var __defProp$d = Object.defineProperty;
7070
- var __defProps$b = Object.defineProperties;
7071
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
7072
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7073
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7074
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7075
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7076
- var __spreadValues$d = (a, b) => {
7186
+ var __defProp$h = Object.defineProperty;
7187
+ var __defProps$f = Object.defineProperties;
7188
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
7189
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
7190
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
7191
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
7192
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7193
+ var __spreadValues$h = (a, b) => {
7077
7194
  for (var prop in b || (b = {}))
7078
- if (__hasOwnProp$d.call(b, prop))
7079
- __defNormalProp$d(a, prop, b[prop]);
7080
- if (__getOwnPropSymbols$d)
7081
- for (var prop of __getOwnPropSymbols$d(b)) {
7082
- if (__propIsEnum$d.call(b, prop))
7083
- __defNormalProp$d(a, prop, b[prop]);
7195
+ if (__hasOwnProp$h.call(b, prop))
7196
+ __defNormalProp$h(a, prop, b[prop]);
7197
+ if (__getOwnPropSymbols$h)
7198
+ for (var prop of __getOwnPropSymbols$h(b)) {
7199
+ if (__propIsEnum$h.call(b, prop))
7200
+ __defNormalProp$h(a, prop, b[prop]);
7084
7201
  }
7085
7202
  return a;
7086
7203
  };
7087
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
7204
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
7088
7205
  function FacetWidget({
7089
7206
  widget,
7090
7207
  showHeader = true,
@@ -7143,7 +7260,7 @@ function FacetWidget({
7143
7260
  };
7144
7261
  const updateConfig = (newFields) => {
7145
7262
  if (onConfigUpdate) {
7146
- onConfigUpdate(__spreadProps$b(__spreadValues$d({}, widget.config), {
7263
+ onConfigUpdate(__spreadProps$f(__spreadValues$h({}, widget.config), {
7147
7264
  fields: newFields
7148
7265
  }));
7149
7266
  }
@@ -20140,9 +20257,28 @@ function BarChart({ orientation, title, data, options, className, units, content
20140
20257
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : defaultOptions, plugins: [barValuePlugin] });
20141
20258
  }
20142
20259
 
20260
+ var __defProp$g = Object.defineProperty;
20261
+ var __defProps$e = Object.defineProperties;
20262
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
20263
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
20264
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
20265
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
20266
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20267
+ var __spreadValues$g = (a, b) => {
20268
+ for (var prop in b || (b = {}))
20269
+ if (__hasOwnProp$g.call(b, prop))
20270
+ __defNormalProp$g(a, prop, b[prop]);
20271
+ if (__getOwnPropSymbols$g)
20272
+ for (var prop of __getOwnPropSymbols$g(b)) {
20273
+ if (__propIsEnum$g.call(b, prop))
20274
+ __defNormalProp$g(a, prop, b[prop]);
20275
+ }
20276
+ return a;
20277
+ };
20278
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
20143
20279
  Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
20144
- function SeriesChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title }) {
20145
- var _a, _b;
20280
+ function SeriesChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title, chartSettings }) {
20281
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
20146
20282
  const formatValue = (value) => {
20147
20283
  const numValue = typeof value === "string" ? parseFloat(value) : value;
20148
20284
  if (!isNaN(numValue)) {
@@ -20212,16 +20348,6 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20212
20348
  datalabels: {
20213
20349
  display: false
20214
20350
  },
20215
- title: {
20216
- display: true,
20217
- text: title,
20218
- font: {
20219
- size: 16,
20220
- weight: "bold"
20221
- },
20222
- color: "#0F172A",
20223
- padding: 16
20224
- },
20225
20351
  tooltip: {
20226
20352
  mode: "index",
20227
20353
  intersect: false,
@@ -20282,7 +20408,53 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20282
20408
  }
20283
20409
  }
20284
20410
  };
20285
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : defaultOptions, plugins: [barValuePlugin] });
20411
+ const mergedOptions = chartSettings ? __spreadProps$e(__spreadValues$g({}, defaultOptions), {
20412
+ plugins: __spreadProps$e(__spreadValues$g({}, defaultOptions.plugins), {
20413
+ legend: __spreadProps$e(__spreadValues$g({}, (_c = defaultOptions.plugins) == null ? void 0 : _c.legend), {
20414
+ display: chartSettings.showLegend !== false,
20415
+ labels: __spreadProps$e(__spreadValues$g({}, (_e = (_d = defaultOptions.plugins) == null ? void 0 : _d.legend) == null ? void 0 : _e.labels), {
20416
+ boxWidth: (_f = chartSettings.legendBoxSize) != null ? _f : 16,
20417
+ boxHeight: (_g = chartSettings.legendBoxSize) != null ? _g : 16,
20418
+ font: { size: (_h = chartSettings.legendFontSize) != null ? _h : 13 }
20419
+ })
20420
+ }),
20421
+ tooltip: __spreadProps$e(__spreadValues$g({}, (_i = defaultOptions.plugins) == null ? void 0 : _i.tooltip), {
20422
+ bodyFont: { size: (_j = chartSettings.tooltipFontSize) != null ? _j : 12 },
20423
+ titleFont: { size: (_k = chartSettings.tooltipFontSize) != null ? _k : 12 }
20424
+ })
20425
+ }),
20426
+ scales: __spreadProps$e(__spreadValues$g({}, defaultOptions.scales), {
20427
+ x: __spreadProps$e(__spreadValues$g({}, (_l = defaultOptions.scales) == null ? void 0 : _l.x), {
20428
+ title: __spreadProps$e(__spreadValues$g({}, (_n = (_m = defaultOptions.scales) == null ? void 0 : _m.x) == null ? void 0 : _n.title), {
20429
+ font: { size: (_o = chartSettings.xAxisTitleFontSize) != null ? _o : 13, weight: "bold" }
20430
+ }),
20431
+ ticks: __spreadProps$e(__spreadValues$g({}, (_q = (_p = defaultOptions.scales) == null ? void 0 : _p.x) == null ? void 0 : _q.ticks), {
20432
+ font: { size: (_r = chartSettings.xAxisTickFontSize) != null ? _r : 12 }
20433
+ })
20434
+ }),
20435
+ y: __spreadProps$e(__spreadValues$g({}, (_s = defaultOptions.scales) == null ? void 0 : _s.y), {
20436
+ title: __spreadProps$e(__spreadValues$g({}, (_u = (_t = defaultOptions.scales) == null ? void 0 : _t.y) == null ? void 0 : _u.title), {
20437
+ font: { size: (_v = chartSettings.yAxisTitleFontSize) != null ? _v : 13, weight: "bold" }
20438
+ }),
20439
+ ticks: __spreadProps$e(__spreadValues$g({}, (_x = (_w = defaultOptions.scales) == null ? void 0 : _w.y) == null ? void 0 : _x.ticks), {
20440
+ font: { size: (_y = chartSettings.yAxisTickFontSize) != null ? _y : 12 }
20441
+ })
20442
+ })
20443
+ })
20444
+ }) : defaultOptions;
20445
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
20446
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
20447
+ "p",
20448
+ {
20449
+ style: {
20450
+ fontSize: `${(_z = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _z : 16}px`
20451
+ },
20452
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
20453
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
20454
+ }
20455
+ ),
20456
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : mergedOptions, plugins: [barValuePlugin] }) })
20457
+ ] });
20286
20458
  }
20287
20459
 
20288
20460
  /*!
@@ -21633,9 +21805,28 @@ var plugin$1 = {
21633
21805
  }
21634
21806
  };
21635
21807
 
21636
- Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
21637
- function SeriesLineChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title }) {
21638
- var _a, _b;
21808
+ var __defProp$f = Object.defineProperty;
21809
+ var __defProps$d = Object.defineProperties;
21810
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
21811
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
21812
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
21813
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
21814
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21815
+ var __spreadValues$f = (a, b) => {
21816
+ for (var prop in b || (b = {}))
21817
+ if (__hasOwnProp$f.call(b, prop))
21818
+ __defNormalProp$f(a, prop, b[prop]);
21819
+ if (__getOwnPropSymbols$f)
21820
+ for (var prop of __getOwnPropSymbols$f(b)) {
21821
+ if (__propIsEnum$f.call(b, prop))
21822
+ __defNormalProp$f(a, prop, b[prop]);
21823
+ }
21824
+ return a;
21825
+ };
21826
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
21827
+ Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_tooltip, plugin_legend);
21828
+ function SeriesLineChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title, chartSettings }) {
21829
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
21639
21830
  const formatValue = (value) => {
21640
21831
  const numValue = typeof value === "string" ? parseFloat(value) : value;
21641
21832
  if (!isNaN(numValue)) {
@@ -21696,16 +21887,6 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21696
21887
  },
21697
21888
  formatter: (value) => value
21698
21889
  },
21699
- title: {
21700
- display: true,
21701
- text: title,
21702
- font: {
21703
- size: 16,
21704
- weight: "bold"
21705
- },
21706
- color: "#0F172A",
21707
- padding: 16
21708
- },
21709
21890
  tooltip: {
21710
21891
  mode: "index",
21711
21892
  intersect: false,
@@ -21771,7 +21952,68 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21771
21952
  }
21772
21953
  }
21773
21954
  };
21774
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data, options: options != null ? options : defaultOptions, plugins: [plugin$1] });
21955
+ const mergedOptions = chartSettings ? __spreadProps$d(__spreadValues$f({}, defaultOptions), {
21956
+ plugins: __spreadProps$d(__spreadValues$f({}, defaultOptions.plugins), {
21957
+ legend: __spreadProps$d(__spreadValues$f({}, (_c = defaultOptions.plugins) == null ? void 0 : _c.legend), {
21958
+ display: chartSettings.showLegend !== false,
21959
+ labels: __spreadProps$d(__spreadValues$f({}, (_e = (_d = defaultOptions.plugins) == null ? void 0 : _d.legend) == null ? void 0 : _e.labels), {
21960
+ boxWidth: (_f = chartSettings.legendBoxSize) != null ? _f : 16,
21961
+ boxHeight: (_g = chartSettings.legendBoxSize) != null ? _g : 16,
21962
+ font: { size: (_h = chartSettings.legendFontSize) != null ? _h : 13 }
21963
+ })
21964
+ }),
21965
+ datalabels: __spreadProps$d(__spreadValues$f({}, (_i = defaultOptions.plugins) == null ? void 0 : _i.datalabels), {
21966
+ display: (context) => {
21967
+ var _a2;
21968
+ return context.dataset.data[context.dataIndex] !== null && ((_a2 = chartSettings.showLabels) != null ? _a2 : false);
21969
+ },
21970
+ font: { size: (_j = chartSettings.dataLabelsFontSize) != null ? _j : 12 }
21971
+ }),
21972
+ tooltip: __spreadProps$d(__spreadValues$f({}, (_k = defaultOptions.plugins) == null ? void 0 : _k.tooltip), {
21973
+ bodyFont: { size: (_l = chartSettings.tooltipFontSize) != null ? _l : 12 },
21974
+ titleFont: { size: (_m = chartSettings.tooltipFontSize) != null ? _m : 12 }
21975
+ })
21976
+ }),
21977
+ scales: __spreadProps$d(__spreadValues$f({}, defaultOptions.scales), {
21978
+ x: __spreadProps$d(__spreadValues$f({}, (_n = defaultOptions.scales) == null ? void 0 : _n.x), {
21979
+ title: __spreadProps$d(__spreadValues$f({}, (_p = (_o = defaultOptions.scales) == null ? void 0 : _o.x) == null ? void 0 : _p.title), {
21980
+ font: { size: (_q = chartSettings.xAxisTitleFontSize) != null ? _q : 13, weight: "bold" }
21981
+ }),
21982
+ ticks: __spreadProps$d(__spreadValues$f({}, (_s = (_r = defaultOptions.scales) == null ? void 0 : _r.x) == null ? void 0 : _s.ticks), {
21983
+ font: { size: (_t = chartSettings.xAxisTickFontSize) != null ? _t : 12 }
21984
+ })
21985
+ }),
21986
+ y: __spreadProps$d(__spreadValues$f({}, (_u = defaultOptions.scales) == null ? void 0 : _u.y), {
21987
+ title: __spreadProps$d(__spreadValues$f({}, (_w = (_v = defaultOptions.scales) == null ? void 0 : _v.y) == null ? void 0 : _w.title), {
21988
+ font: { size: (_x = chartSettings.yAxisTitleFontSize) != null ? _x : 13, weight: "bold" }
21989
+ }),
21990
+ ticks: __spreadProps$d(__spreadValues$f({}, (_z = (_y = defaultOptions.scales) == null ? void 0 : _y.y) == null ? void 0 : _z.ticks), {
21991
+ font: { size: (_A = chartSettings.yAxisTickFontSize) != null ? _A : 12 }
21992
+ })
21993
+ })
21994
+ }),
21995
+ elements: {
21996
+ line: {
21997
+ tension: (_B = chartSettings.lineTension) != null ? _B : 0.3
21998
+ },
21999
+ point: {
22000
+ radius: (_C = chartSettings.pointRadius) != null ? _C : 4
22001
+ }
22002
+ }
22003
+ }) : defaultOptions;
22004
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
22005
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
22006
+ "p",
22007
+ {
22008
+ style: {
22009
+ fontSize: `${(_D = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _D : 16}px`
22010
+ },
22011
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
22012
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
22013
+ }
22014
+ ),
22015
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data, options: options != null ? options : mergedOptions, plugins: [plugin$1] }) })
22016
+ ] });
21775
22017
  }
21776
22018
 
21777
22019
  /*!
@@ -22556,9 +22798,29 @@ var plugin = {
22556
22798
  },
22557
22799
  };
22558
22800
 
22801
+ var __defProp$e = Object.defineProperty;
22802
+ var __defProps$c = Object.defineProperties;
22803
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
22804
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
22805
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
22806
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
22807
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22808
+ var __spreadValues$e = (a, b) => {
22809
+ for (var prop in b || (b = {}))
22810
+ if (__hasOwnProp$e.call(b, prop))
22811
+ __defNormalProp$e(a, prop, b[prop]);
22812
+ if (__getOwnPropSymbols$e)
22813
+ for (var prop of __getOwnPropSymbols$e(b)) {
22814
+ if (__propIsEnum$e.call(b, prop))
22815
+ __defNormalProp$e(a, prop, b[prop]);
22816
+ }
22817
+ return a;
22818
+ };
22819
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
22559
22820
  Chart$1.register(ArcElement, plugin_tooltip, plugin_legend);
22560
22821
  const PieChart = (props) => {
22561
- const { data, title, options, units, content } = props;
22822
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
22823
+ const { data, title, options, units, content, chartSettings } = props;
22562
22824
  const formatValue = (value) => {
22563
22825
  const numValue = typeof value === "string" ? parseFloat(value) : value;
22564
22826
  if (units === "$" && !isNaN(numValue)) {
@@ -22583,16 +22845,16 @@ const PieChart = (props) => {
22583
22845
  },
22584
22846
  outlabels: {
22585
22847
  display: (context) => {
22586
- var _a;
22587
- return context.dataset.data[context.dataIndex] !== null && ((_a = content == null ? void 0 : content.showLabels) != null ? _a : false);
22848
+ var _a2;
22849
+ return context.dataset.data[context.dataIndex] !== null && ((_a2 = content == null ? void 0 : content.showLabels) != null ? _a2 : false);
22588
22850
  },
22589
22851
  text: (ctx) => {
22590
- var _a;
22852
+ var _a2;
22591
22853
  const dataset = ctx.dataset.data;
22592
22854
  const total = dataset.reduce((a, b) => a + b, 0);
22593
22855
  const value = dataset[ctx.dataIndex];
22594
22856
  const percent = value / total * 100;
22595
- return percent >= 5 ? `${(_a = ctx.chart.data.labels) == null ? void 0 : _a[ctx.dataIndex]} ${value}` : "";
22857
+ return percent >= 5 ? `${(_a2 = ctx.chart.data.labels) == null ? void 0 : _a2[ctx.dataIndex]} ${value}` : "";
22596
22858
  },
22597
22859
  color: "#0F172A",
22598
22860
  stretch: 25,
@@ -22614,19 +22876,6 @@ const PieChart = (props) => {
22614
22876
  datalabels: {
22615
22877
  display: false
22616
22878
  },
22617
- title: {
22618
- display: true,
22619
- text: title,
22620
- font: {
22621
- size: 16,
22622
- weight: "bold"
22623
- },
22624
- color: "#0F172A",
22625
- padding: {
22626
- bottom: 28,
22627
- top: 0
22628
- }
22629
- },
22630
22879
  tooltip: {
22631
22880
  backgroundColor: "rgba(0, 0, 0, 0.8)",
22632
22881
  titleFont: { size: 13, weight: "bold" },
@@ -22651,7 +22900,41 @@ const PieChart = (props) => {
22651
22900
  }
22652
22901
  }
22653
22902
  };
22654
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Pie, { data, options: options != null ? options : defaultOptions, plugins: [plugin] });
22903
+ const mergedOptions = chartSettings ? __spreadProps$c(__spreadValues$e({}, defaultOptions), {
22904
+ plugins: __spreadProps$c(__spreadValues$e({}, defaultOptions.plugins), {
22905
+ legend: __spreadProps$c(__spreadValues$e({}, (_a = defaultOptions.plugins) == null ? void 0 : _a.legend), {
22906
+ display: chartSettings.showLegend !== false,
22907
+ labels: __spreadProps$c(__spreadValues$e({}, (_c = (_b = defaultOptions.plugins) == null ? void 0 : _b.legend) == null ? void 0 : _c.labels), {
22908
+ boxWidth: (_d = chartSettings.legendBoxSize) != null ? _d : 16,
22909
+ boxHeight: (_e = chartSettings.legendBoxSize) != null ? _e : 16,
22910
+ font: { size: (_f = chartSettings.legendFontSize) != null ? _f : 13 }
22911
+ })
22912
+ }),
22913
+ outlabels: __spreadProps$c(__spreadValues$e({}, (_g = defaultOptions.plugins) == null ? void 0 : _g.outlabels), {
22914
+ font: __spreadProps$c(__spreadValues$e({}, (_i = (_h = defaultOptions.plugins) == null ? void 0 : _h.outlabels) == null ? void 0 : _i.font), {
22915
+ minSize: (_j = chartSettings.dataLabelsFontSize) != null ? _j : 11,
22916
+ maxSize: ((_k = chartSettings.dataLabelsFontSize) != null ? _k : 12) + 2
22917
+ })
22918
+ }),
22919
+ tooltip: __spreadProps$c(__spreadValues$e({}, (_l = defaultOptions.plugins) == null ? void 0 : _l.tooltip), {
22920
+ bodyFont: { size: (_m = chartSettings.tooltipFontSize) != null ? _m : 12 },
22921
+ titleFont: { size: (_n = chartSettings.tooltipFontSize) != null ? _n : 12 }
22922
+ })
22923
+ })
22924
+ }) : defaultOptions;
22925
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
22926
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
22927
+ "p",
22928
+ {
22929
+ style: {
22930
+ fontSize: `${(_o = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _o : 16}px`
22931
+ },
22932
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
22933
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
22934
+ }
22935
+ ),
22936
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Pie, { data, options: options != null ? options : mergedOptions, plugins: [plugin] }) })
22937
+ ] });
22655
22938
  };
22656
22939
 
22657
22940
  Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
@@ -43576,27 +43859,27 @@ function SummaryWidget({ title, data, metadata, className }) {
43576
43859
  ] });
43577
43860
  }
43578
43861
 
43579
- var __defProp$c = Object.defineProperty;
43580
- var __defProps$a = Object.defineProperties;
43581
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
43582
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
43583
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
43584
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
43585
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43586
- var __spreadValues$c = (a, b) => {
43862
+ var __defProp$d = Object.defineProperty;
43863
+ var __defProps$b = Object.defineProperties;
43864
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
43865
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
43866
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
43867
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
43868
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43869
+ var __spreadValues$d = (a, b) => {
43587
43870
  for (var prop in b || (b = {}))
43588
- if (__hasOwnProp$c.call(b, prop))
43589
- __defNormalProp$c(a, prop, b[prop]);
43590
- if (__getOwnPropSymbols$c)
43591
- for (var prop of __getOwnPropSymbols$c(b)) {
43592
- if (__propIsEnum$c.call(b, prop))
43593
- __defNormalProp$c(a, prop, b[prop]);
43871
+ if (__hasOwnProp$d.call(b, prop))
43872
+ __defNormalProp$d(a, prop, b[prop]);
43873
+ if (__getOwnPropSymbols$d)
43874
+ for (var prop of __getOwnPropSymbols$d(b)) {
43875
+ if (__propIsEnum$d.call(b, prop))
43876
+ __defNormalProp$d(a, prop, b[prop]);
43594
43877
  }
43595
43878
  return a;
43596
43879
  };
43597
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
43880
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
43598
43881
  const CHART_REFRESH_TIMEOUT$4 = 3e3;
43599
- const DEFAULT_COLORS$3 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
43882
+ const DEFAULT_COLORS$4 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
43600
43883
  const LINE_COLORS = ["#243D84", "#69238B", "#4A959F", "#D0A677", "#B31E47", "#396431"];
43601
43884
  const clearChat$5 = async (widgetBackendUrl, widgetId) => {
43602
43885
  if (!widgetBackendUrl || !widgetId) return;
@@ -43626,7 +43909,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43626
43909
  const baseState = { dataset_id: datasetId || "home_generation_dataset" };
43627
43910
  switch (agentType) {
43628
43911
  case "Pie Chart Agent":
43629
- return __spreadValues$c({
43912
+ return __spreadValues$d({
43630
43913
  pie_chart_data: {
43631
43914
  title: "",
43632
43915
  type: "pie",
@@ -43637,7 +43920,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43637
43920
  }, baseState);
43638
43921
  case "Line Chart Agent":
43639
43922
  case "Bar Chart Agent":
43640
- return __spreadValues$c({
43923
+ return __spreadValues$d({
43641
43924
  bar_chart_data: {
43642
43925
  title: "",
43643
43926
  type: agentType === "Line Chart Agent" ? "line" : "bar",
@@ -43649,7 +43932,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43649
43932
  }, baseState);
43650
43933
  case "Series Bar Chart Agent":
43651
43934
  case "Series Line Chart Agent":
43652
- return __spreadValues$c({
43935
+ return __spreadValues$d({
43653
43936
  series_bar_chart_data: {
43654
43937
  title: "",
43655
43938
  type: "series_bar",
@@ -43675,7 +43958,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43675
43958
  }
43676
43959
  }, baseState);
43677
43960
  case "Data Grid Agent":
43678
- return __spreadValues$c({
43961
+ return __spreadValues$d({
43679
43962
  matrix_grid_data: {
43680
43963
  title: "",
43681
43964
  type: "data_grid",
@@ -43686,7 +43969,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43686
43969
  }
43687
43970
  }, baseState);
43688
43971
  case "Summary Agent":
43689
- return __spreadValues$c({
43972
+ return __spreadValues$d({
43690
43973
  summary_data: {
43691
43974
  title: "",
43692
43975
  type: "summary",
@@ -43695,7 +43978,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43695
43978
  }
43696
43979
  }, baseState);
43697
43980
  default:
43698
- return __spreadValues$c({ widget_ids: widgetIds }, baseState);
43981
+ return __spreadValues$d({ widget_ids: widgetIds }, baseState);
43699
43982
  }
43700
43983
  };
43701
43984
  const loadAgentState$5 = async (widgetBackendUrl, threadId, agentName) => {
@@ -43735,7 +44018,7 @@ const parseAndUpdateChartState$4 = (apiResponse, setChartState) => {
43735
44018
  if (parsedState.state) {
43736
44019
  const chartData = parsedState.state;
43737
44020
  setChartState((prevState) => {
43738
- const newChartState = __spreadValues$c({}, prevState);
44021
+ const newChartState = __spreadValues$d({}, prevState);
43739
44022
  if (chartData.bar_chart_data) {
43740
44023
  newChartState.bar_chart_data = chartData.bar_chart_data;
43741
44024
  }
@@ -43834,7 +44117,7 @@ function BarChartComponent({
43834
44117
  }
43835
44118
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43836
44119
  const finalColors = useMemo(() => {
43837
- return shuffleColors(DEFAULT_COLORS$3, labels == null ? void 0 : labels.length);
44120
+ return shuffleColors(DEFAULT_COLORS$4, labels == null ? void 0 : labels.length);
43838
44121
  }, [labels.length]);
43839
44122
  if (isEmpty) {
43840
44123
  return createLoadingComponent$5();
@@ -43900,7 +44183,7 @@ function SeriesBarChartComponent$2({
43900
44183
  }
43901
44184
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43902
44185
  const finalColors = useMemo(() => {
43903
- return shuffleColors(DEFAULT_COLORS$3, series == null ? void 0 : series.length);
44186
+ return shuffleColors(DEFAULT_COLORS$4, series == null ? void 0 : series.length);
43904
44187
  }, [series.length]);
43905
44188
  if (isEmpty) {
43906
44189
  return createLoadingComponent$5();
@@ -43964,7 +44247,7 @@ function SeriesLineChartComponent({
43964
44247
  }
43965
44248
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43966
44249
  const finalColors = useMemo(() => {
43967
- return shuffleColors([...LINE_COLORS, ...DEFAULT_COLORS$3], series == null ? void 0 : series.length);
44250
+ return shuffleColors([...LINE_COLORS, ...DEFAULT_COLORS$4], series == null ? void 0 : series.length);
43968
44251
  }, [series.length]);
43969
44252
  if (isEmpty) {
43970
44253
  return createLoadingComponent$5();
@@ -44033,7 +44316,7 @@ function PieChartComponent$1({
44033
44316
  }
44034
44317
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
44035
44318
  const backgroundColors = useMemo(() => {
44036
- return shuffleColors(DEFAULT_COLORS$3, labels.length);
44319
+ return shuffleColors(DEFAULT_COLORS$4, labels.length);
44037
44320
  }, [labels.length]);
44038
44321
  if (isEmpty) {
44039
44322
  return createLoadingComponent$5();
@@ -44212,7 +44495,7 @@ function SummaryComponent({
44212
44495
  useEffect(() => {
44213
44496
  if (isEmpty && query && isFirstLoad && !(summaryState == null ? void 0 : summaryState.agent_message) && !hasCalledRef.current) {
44214
44497
  hasCalledRef.current = true;
44215
- setChartState(__spreadProps$a(__spreadValues$c({}, summaryState), {
44498
+ setChartState(__spreadProps$b(__spreadValues$d({}, summaryState), {
44216
44499
  widget_ids
44217
44500
  }));
44218
44501
  setTimeout(() => {
@@ -44289,7 +44572,7 @@ function CopilotKitAgent({
44289
44572
  if (apiCallCount >= 10) {
44290
44573
  console.log("API call limit reached for widget:", widget.id);
44291
44574
  setHasTimeoutError(true);
44292
- setChartState((prevState) => __spreadProps$a(__spreadValues$c({}, prevState), {
44575
+ setChartState((prevState) => __spreadProps$b(__spreadValues$d({}, prevState), {
44293
44576
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
44294
44577
  }));
44295
44578
  return;
@@ -44698,25 +44981,25 @@ function exportChatToPDF(options) {
44698
44981
  doc.save(filename);
44699
44982
  }
44700
44983
 
44701
- var __defProp$b = Object.defineProperty;
44702
- var __defProps$9 = Object.defineProperties;
44703
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
44704
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
44705
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
44706
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
44707
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44708
- var __spreadValues$b = (a, b) => {
44984
+ var __defProp$c = Object.defineProperty;
44985
+ var __defProps$a = Object.defineProperties;
44986
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
44987
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
44988
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
44989
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
44990
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44991
+ var __spreadValues$c = (a, b) => {
44709
44992
  for (var prop in b || (b = {}))
44710
- if (__hasOwnProp$b.call(b, prop))
44711
- __defNormalProp$b(a, prop, b[prop]);
44712
- if (__getOwnPropSymbols$b)
44713
- for (var prop of __getOwnPropSymbols$b(b)) {
44714
- if (__propIsEnum$b.call(b, prop))
44715
- __defNormalProp$b(a, prop, b[prop]);
44993
+ if (__hasOwnProp$c.call(b, prop))
44994
+ __defNormalProp$c(a, prop, b[prop]);
44995
+ if (__getOwnPropSymbols$c)
44996
+ for (var prop of __getOwnPropSymbols$c(b)) {
44997
+ if (__propIsEnum$c.call(b, prop))
44998
+ __defNormalProp$c(a, prop, b[prop]);
44716
44999
  }
44717
45000
  return a;
44718
45001
  };
44719
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
45002
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
44720
45003
  const getStyleValues$4 = (styles = {}) => {
44721
45004
  const borderRadiusMap = {
44722
45005
  none: "0px",
@@ -44836,7 +45119,7 @@ function CopilotKitChatbot({
44836
45119
  const handleSubmit = (e) => {
44837
45120
  e.preventDefault();
44838
45121
  if (!inputValue.trim()) return;
44839
- setChatbotState((prevState) => __spreadProps$9(__spreadValues$b({}, prevState), {
45122
+ setChatbotState((prevState) => __spreadProps$a(__spreadValues$c({}, prevState), {
44840
45123
  widget_ids: widgetIds,
44841
45124
  dataset_id: datasetId
44842
45125
  }));
@@ -45010,42 +45293,42 @@ function ChatbotWidget({
45010
45293
  );
45011
45294
  }
45012
45295
 
45013
- var __defProp$a = Object.defineProperty;
45014
- var __defProps$8 = Object.defineProperties;
45015
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
45016
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
45017
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
45018
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
45019
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45020
- var __spreadValues$a = (a, b) => {
45296
+ var __defProp$b = Object.defineProperty;
45297
+ var __defProps$9 = Object.defineProperties;
45298
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
45299
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
45300
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
45301
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
45302
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45303
+ var __spreadValues$b = (a, b) => {
45021
45304
  for (var prop in b || (b = {}))
45022
- if (__hasOwnProp$a.call(b, prop))
45023
- __defNormalProp$a(a, prop, b[prop]);
45024
- if (__getOwnPropSymbols$a)
45025
- for (var prop of __getOwnPropSymbols$a(b)) {
45026
- if (__propIsEnum$a.call(b, prop))
45027
- __defNormalProp$a(a, prop, b[prop]);
45305
+ if (__hasOwnProp$b.call(b, prop))
45306
+ __defNormalProp$b(a, prop, b[prop]);
45307
+ if (__getOwnPropSymbols$b)
45308
+ for (var prop of __getOwnPropSymbols$b(b)) {
45309
+ if (__propIsEnum$b.call(b, prop))
45310
+ __defNormalProp$b(a, prop, b[prop]);
45028
45311
  }
45029
45312
  return a;
45030
45313
  };
45031
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
45032
- var __objRest$2 = (source, exclude) => {
45314
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
45315
+ var __objRest$3 = (source, exclude) => {
45033
45316
  var target = {};
45034
45317
  for (var prop in source)
45035
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
45318
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
45036
45319
  target[prop] = source[prop];
45037
- if (source != null && __getOwnPropSymbols$a)
45038
- for (var prop of __getOwnPropSymbols$a(source)) {
45039
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
45320
+ if (source != null && __getOwnPropSymbols$b)
45321
+ for (var prop of __getOwnPropSymbols$b(source)) {
45322
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
45040
45323
  target[prop] = source[prop];
45041
45324
  }
45042
45325
  return target;
45043
45326
  };
45044
45327
  const Checkbox = React.forwardRef((_a, ref) => {
45045
- var _b = _a, { className } = _b, props = __objRest$2(_b, ["className"]);
45328
+ var _b = _a, { className } = _b, props = __objRest$3(_b, ["className"]);
45046
45329
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
45047
45330
  CheckboxPrimitive.Root,
45048
- __spreadProps$8(__spreadValues$a({
45331
+ __spreadProps$9(__spreadValues$b({
45049
45332
  ref,
45050
45333
  className: cn(
45051
45334
  "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
@@ -45064,25 +45347,25 @@ const Checkbox = React.forwardRef((_a, ref) => {
45064
45347
  });
45065
45348
  Checkbox.displayName = CheckboxPrimitive.Root.displayName;
45066
45349
 
45067
- var __defProp$9 = Object.defineProperty;
45068
- var __defProps$7 = Object.defineProperties;
45069
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
45070
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
45071
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
45072
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
45073
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45074
- var __spreadValues$9 = (a, b) => {
45350
+ var __defProp$a = Object.defineProperty;
45351
+ var __defProps$8 = Object.defineProperties;
45352
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
45353
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
45354
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
45355
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
45356
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45357
+ var __spreadValues$a = (a, b) => {
45075
45358
  for (var prop in b || (b = {}))
45076
- if (__hasOwnProp$9.call(b, prop))
45077
- __defNormalProp$9(a, prop, b[prop]);
45078
- if (__getOwnPropSymbols$9)
45079
- for (var prop of __getOwnPropSymbols$9(b)) {
45080
- if (__propIsEnum$9.call(b, prop))
45081
- __defNormalProp$9(a, prop, b[prop]);
45359
+ if (__hasOwnProp$a.call(b, prop))
45360
+ __defNormalProp$a(a, prop, b[prop]);
45361
+ if (__getOwnPropSymbols$a)
45362
+ for (var prop of __getOwnPropSymbols$a(b)) {
45363
+ if (__propIsEnum$a.call(b, prop))
45364
+ __defNormalProp$a(a, prop, b[prop]);
45082
45365
  }
45083
45366
  return a;
45084
45367
  };
45085
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
45368
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
45086
45369
  const FILTER_REFRESH_TIMEOUT = 3e3;
45087
45370
  const clearChat$4 = async (widgetBackendUrl, widgetId) => {
45088
45371
  if (!widgetBackendUrl || !widgetId) return;
@@ -45151,7 +45434,7 @@ const parseAndUpdateFilterState = (apiResponse, setFilterState) => {
45151
45434
  if (parsedState.state) {
45152
45435
  const filterData = parsedState.state;
45153
45436
  setFilterState((prevState) => {
45154
- const newFilterState = __spreadValues$9({}, prevState);
45437
+ const newFilterState = __spreadValues$a({}, prevState);
45155
45438
  if (filterData.column_values) {
45156
45439
  newFilterState.column_values = filterData.column_values;
45157
45440
  }
@@ -45240,7 +45523,7 @@ function TableSelectionConfirmation({
45240
45523
  {
45241
45524
  value: selectedTables[col.column] || "",
45242
45525
  onChange: (e) => {
45243
- setSelectedTables((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45526
+ setSelectedTables((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45244
45527
  [col.column]: e.target.value
45245
45528
  }));
45246
45529
  },
@@ -45356,7 +45639,7 @@ function FiltersContent({
45356
45639
  }
45357
45640
  }, [(_a = widget.config) == null ? void 0 : _a.filters, filterGroups]);
45358
45641
  const toggleGroup = (groupId) => {
45359
- setExpandedGroups((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45642
+ setExpandedGroups((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45360
45643
  [groupId]: !prev[groupId]
45361
45644
  }));
45362
45645
  };
@@ -45369,7 +45652,7 @@ function FiltersContent({
45369
45652
  } else {
45370
45653
  newGroupFilters = groupFilters.filter((id) => id !== optionId);
45371
45654
  }
45372
- const newFilters = __spreadProps$7(__spreadValues$9({}, prev), {
45655
+ const newFilters = __spreadProps$8(__spreadValues$a({}, prev), {
45373
45656
  [groupId]: newGroupFilters
45374
45657
  });
45375
45658
  if (onFilterChange) {
@@ -45379,7 +45662,7 @@ function FiltersContent({
45379
45662
  });
45380
45663
  };
45381
45664
  const handleSearchChange = (groupId, query2) => {
45382
- setSearchQueries((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45665
+ setSearchQueries((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45383
45666
  [groupId]: query2
45384
45667
  }));
45385
45668
  };
@@ -45397,7 +45680,7 @@ function FiltersContent({
45397
45680
  };
45398
45681
  const clearGroupFilters = (groupId) => {
45399
45682
  setSelectedFilters((prev) => {
45400
- const newFilters = __spreadProps$7(__spreadValues$9({}, prev), { [groupId]: [] });
45683
+ const newFilters = __spreadProps$8(__spreadValues$a({}, prev), { [groupId]: [] });
45401
45684
  if (onFilterChange) {
45402
45685
  onFilterChange(newFilters);
45403
45686
  }
@@ -45559,7 +45842,7 @@ function FiltersContent({
45559
45842
  "Content-Type": "application/json"
45560
45843
  },
45561
45844
  body: JSON.stringify({
45562
- config: __spreadProps$7(__spreadValues$9({}, widget.config), {
45845
+ config: __spreadProps$8(__spreadValues$a({}, widget.config), {
45563
45846
  filters: filtersWithLabels
45564
45847
  })
45565
45848
  })
@@ -45639,7 +45922,7 @@ function CopilotKitFilters({
45639
45922
  if (apiCallCount >= 30) {
45640
45923
  console.log("API call limit reached for widget:", widget.id);
45641
45924
  setHasTimeoutError(true);
45642
- setFilterState((prevState) => __spreadProps$7(__spreadValues$9({}, prevState), {
45925
+ setFilterState((prevState) => __spreadProps$8(__spreadValues$a({}, prevState), {
45643
45926
  agent_message: "Timeout: Unable to load filter data after multiple attempts. Please try refreshing the widget."
45644
45927
  }));
45645
45928
  return;
@@ -45780,7 +46063,7 @@ function CopilotKitFilters({
45780
46063
  startLoadingTimeout();
45781
46064
  }, [filterState.filter_columns, filterState.ambiguous_columns, (_f = widget.config) == null ? void 0 : _f.query, datasetId, appendMessage, setFilterState, setAgentState, startLoadingTimeout, setApiCallCount, setHasTimeoutError]);
45782
46065
  const handleCancelConfirmation = useCallback(() => {
45783
- setFilterState((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
46066
+ setFilterState((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45784
46067
  status: void 0,
45785
46068
  ambiguous_columns: void 0,
45786
46069
  message: void 0
@@ -45874,27 +46157,27 @@ function FiltersWidget({
45874
46157
  );
45875
46158
  }
45876
46159
 
45877
- var __defProp$8 = Object.defineProperty;
45878
- var __defProps$6 = Object.defineProperties;
45879
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
45880
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
45881
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
45882
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
45883
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45884
- var __spreadValues$8 = (a, b) => {
46160
+ var __defProp$9 = Object.defineProperty;
46161
+ var __defProps$7 = Object.defineProperties;
46162
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
46163
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
46164
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
46165
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
46166
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46167
+ var __spreadValues$9 = (a, b) => {
45885
46168
  for (var prop in b || (b = {}))
45886
- if (__hasOwnProp$8.call(b, prop))
45887
- __defNormalProp$8(a, prop, b[prop]);
45888
- if (__getOwnPropSymbols$8)
45889
- for (var prop of __getOwnPropSymbols$8(b)) {
45890
- if (__propIsEnum$8.call(b, prop))
45891
- __defNormalProp$8(a, prop, b[prop]);
46169
+ if (__hasOwnProp$9.call(b, prop))
46170
+ __defNormalProp$9(a, prop, b[prop]);
46171
+ if (__getOwnPropSymbols$9)
46172
+ for (var prop of __getOwnPropSymbols$9(b)) {
46173
+ if (__propIsEnum$9.call(b, prop))
46174
+ __defNormalProp$9(a, prop, b[prop]);
45892
46175
  }
45893
46176
  return a;
45894
46177
  };
45895
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
46178
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
45896
46179
  const CHART_REFRESH_TIMEOUT$3 = 3e3;
45897
- const DEFAULT_COLORS$2 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46180
+ const DEFAULT_COLORS$3 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
45898
46181
  const clearChat$3 = async (widgetBackendUrl, widgetId) => {
45899
46182
  if (!widgetBackendUrl || !widgetId) return;
45900
46183
  console.log("clearChat called for widgetId:", widgetId);
@@ -45968,7 +46251,7 @@ const parseAndUpdateChartState$3 = (apiResponse, setChartState) => {
45968
46251
  if (parsedState.state) {
45969
46252
  const chartData = parsedState.state;
45970
46253
  setChartState((prevState) => {
45971
- const newChartState = __spreadValues$8({}, prevState);
46254
+ const newChartState = __spreadValues$9({}, prevState);
45972
46255
  if (chartData.pie_chart_data) {
45973
46256
  newChartState.pie_chart_data = chartData.pie_chart_data;
45974
46257
  }
@@ -46017,9 +46300,11 @@ function PieChartComponent({
46017
46300
  startLoadingTimeout,
46018
46301
  clearLoadingTimeout,
46019
46302
  content,
46020
- hasWidgetData
46303
+ hasWidgetData,
46304
+ chartSettings,
46305
+ onConfigUpdate
46021
46306
  }) {
46022
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
46307
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
46023
46308
  const hasCalledRef = useRef(false);
46024
46309
  const labels = ((_b = (_a = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
46025
46310
  const values = ((_d = (_c = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.values) || [];
@@ -46027,6 +46312,10 @@ function PieChartComponent({
46027
46312
  const chartTitle = ((_g = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _g.title) || "";
46028
46313
  const units = ((_h = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _h.units) || "";
46029
46314
  const isEmpty = labels.length === 0 || values.length === 0;
46315
+ useEffect(() => {
46316
+ console.log("[PieChartComponent] chartSettings:", chartSettings);
46317
+ console.log("[PieChartComponent] seriesColors:", chartSettings == null ? void 0 : chartSettings.seriesColors);
46318
+ }, [chartSettings]);
46030
46319
  const handleRefresh = async () => {
46031
46320
  if (query) {
46032
46321
  await clearChat$3(widgetBackendUrl, widgetId);
@@ -46056,24 +46345,49 @@ function PieChartComponent({
46056
46345
  }
46057
46346
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, pieChartState]);
46058
46347
  const backgroundColors = useMemo(() => {
46059
- return shuffleColors(DEFAULT_COLORS$2, labels.length);
46348
+ return shuffleColors(DEFAULT_COLORS$3, labels.length);
46060
46349
  }, [labels.length]);
46350
+ const sortedIndices = useMemo(() => {
46351
+ return labels.map((label, index) => ({ label, index, value: values[index] })).sort((a, b) => a.label.localeCompare(b.label)).map((item) => item.index);
46352
+ }, [labels, values]);
46353
+ const sortedLabels = useMemo(() => {
46354
+ return sortedIndices.map((i) => labels[i]);
46355
+ }, [sortedIndices, labels]);
46356
+ const sortedValues = useMemo(() => {
46357
+ return sortedIndices.map((i) => values[i]);
46358
+ }, [sortedIndices, values]);
46359
+ const colors = useMemo(() => {
46360
+ var _a2, _b2;
46361
+ if ((chartSettings == null ? void 0 : chartSettings.seriesColors) && chartSettings.seriesColors.length > 0) {
46362
+ return chartSettings.seriesColors.slice(0, sortedLabels.length);
46363
+ }
46364
+ return ((_b2 = (_a2 = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.colors) || sortedLabels.map((_, index) => backgroundColors[index % backgroundColors.length]);
46365
+ }, [chartSettings == null ? void 0 : chartSettings.seriesColors, sortedLabels, (_j = (_i = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _i.data) == null ? void 0 : _j.colors]);
46366
+ useEffect(() => {
46367
+ var _a2;
46368
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
46369
+ onConfigUpdate(widgetId, {
46370
+ chartSettings: __spreadProps$7(__spreadValues$9({}, chartSettings), {
46371
+ seriesColors: colors
46372
+ })
46373
+ });
46374
+ }
46375
+ }, [sortedLabels.length, (_k = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _k.length, onConfigUpdate, widgetId, isEmpty]);
46061
46376
  if (isEmpty) {
46062
46377
  return createLoadingComponent$3();
46063
46378
  }
46064
- const colors = ((_j = (_i = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _i.data) == null ? void 0 : _j.colors) || labels.map((_, index) => backgroundColors[index % backgroundColors.length]);
46065
46379
  const transformedData = {
46066
- labels,
46380
+ labels: sortedLabels,
46067
46381
  datasets: [
46068
46382
  {
46069
46383
  label: chartTitle || "Data",
46070
- data: values,
46384
+ data: sortedValues,
46071
46385
  backgroundColor: colors,
46072
46386
  borderWidth: 0
46073
46387
  }
46074
46388
  ]
46075
46389
  };
46076
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units, content });
46390
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units, content, chartSettings });
46077
46391
  }
46078
46392
  function CopilotKitPieChart({
46079
46393
  widget,
@@ -46082,9 +46396,10 @@ function CopilotKitPieChart({
46082
46396
  onResetReady,
46083
46397
  widgetBackendUrl,
46084
46398
  datasetId,
46085
- widgetData
46399
+ widgetData,
46400
+ onConfigUpdate
46086
46401
  }) {
46087
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
46402
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
46088
46403
  const isFirstLoad = (_a = widget.config) == null ? void 0 : _a.isFirstLoad;
46089
46404
  const content = (_b = widget.config) == null ? void 0 : _b.content;
46090
46405
  const widget_data = (_c = widget.widget_data) == null ? void 0 : _c.pie_chart_data;
@@ -46124,7 +46439,7 @@ function CopilotKitPieChart({
46124
46439
  if (apiCallCount >= 30) {
46125
46440
  console.log("API call limit reached for widget:", widget.id);
46126
46441
  setHasTimeoutError(true);
46127
- setChartState((prevState) => __spreadProps$6(__spreadValues$8({}, prevState), {
46442
+ setChartState((prevState) => __spreadProps$7(__spreadValues$9({}, prevState), {
46128
46443
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46129
46444
  }));
46130
46445
  return;
@@ -46224,7 +46539,9 @@ function CopilotKitPieChart({
46224
46539
  widgetId: widget.id,
46225
46540
  startLoadingTimeout,
46226
46541
  clearLoadingTimeout,
46227
- hasWidgetData: !!(((_o = (_n = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _n.labels) == null ? void 0 : _o.length) && ((_q = (_p = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _p.values) == null ? void 0 : _q.length))
46542
+ hasWidgetData: !!(((_o = (_n = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _n.labels) == null ? void 0 : _o.length) && ((_q = (_p = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _p.values) == null ? void 0 : _q.length)),
46543
+ chartSettings: (_r = widget.config) == null ? void 0 : _r.chartSettings,
46544
+ onConfigUpdate
46228
46545
  }
46229
46546
  ) })
46230
46547
  ] });
@@ -46236,7 +46553,8 @@ function PieChartWidget({
46236
46553
  onResetReady,
46237
46554
  widgetIds,
46238
46555
  datasetId,
46239
- widgetData
46556
+ widgetData,
46557
+ onConfigUpdate
46240
46558
  }) {
46241
46559
  var _a, _b;
46242
46560
  const styles = getStyleValues$3((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46260,34 +46578,35 @@ function PieChartWidget({
46260
46578
  styles,
46261
46579
  onResetReady,
46262
46580
  widgetBackendUrl,
46263
- datasetId
46581
+ datasetId,
46582
+ onConfigUpdate
46264
46583
  }
46265
46584
  )
46266
46585
  }
46267
46586
  );
46268
46587
  }
46269
46588
 
46270
- var __defProp$7 = Object.defineProperty;
46271
- var __defProps$5 = Object.defineProperties;
46272
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
46273
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
46274
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
46275
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
46276
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46277
- var __spreadValues$7 = (a, b) => {
46589
+ var __defProp$8 = Object.defineProperty;
46590
+ var __defProps$6 = Object.defineProperties;
46591
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
46592
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
46593
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
46594
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
46595
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46596
+ var __spreadValues$8 = (a, b) => {
46278
46597
  for (var prop in b || (b = {}))
46279
- if (__hasOwnProp$7.call(b, prop))
46280
- __defNormalProp$7(a, prop, b[prop]);
46281
- if (__getOwnPropSymbols$7)
46282
- for (var prop of __getOwnPropSymbols$7(b)) {
46283
- if (__propIsEnum$7.call(b, prop))
46284
- __defNormalProp$7(a, prop, b[prop]);
46598
+ if (__hasOwnProp$8.call(b, prop))
46599
+ __defNormalProp$8(a, prop, b[prop]);
46600
+ if (__getOwnPropSymbols$8)
46601
+ for (var prop of __getOwnPropSymbols$8(b)) {
46602
+ if (__propIsEnum$8.call(b, prop))
46603
+ __defNormalProp$8(a, prop, b[prop]);
46285
46604
  }
46286
46605
  return a;
46287
46606
  };
46288
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
46607
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
46289
46608
  const CHART_REFRESH_TIMEOUT$2 = 3e3;
46290
- const DEFAULT_COLORS$1 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46609
+ const DEFAULT_COLORS$2 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46291
46610
  const clearChat$2 = async (widgetBackendUrl, widgetId) => {
46292
46611
  if (!widgetBackendUrl || !widgetId) return;
46293
46612
  console.log("clearChat called for widgetId:", widgetId);
@@ -46382,7 +46701,7 @@ const parseAndUpdateChartState$2 = (apiResponse, setChartState) => {
46382
46701
  if (parsedState.state) {
46383
46702
  const chartData = parsedState.state;
46384
46703
  setChartState((prevState) => {
46385
- const newChartState = __spreadValues$7({}, prevState);
46704
+ const newChartState = __spreadValues$8({}, prevState);
46386
46705
  if (chartData.series_bar_chart_data) {
46387
46706
  newChartState.series_bar_chart_data = chartData.series_bar_chart_data;
46388
46707
  }
@@ -46432,9 +46751,11 @@ function SeriesBarChartComponent$1({
46432
46751
  startLoadingTimeout,
46433
46752
  clearLoadingTimeout,
46434
46753
  content,
46435
- hasWidgetData
46754
+ hasWidgetData,
46755
+ chartSettings,
46756
+ onConfigUpdate
46436
46757
  }) {
46437
- var _a, _b, _c, _d, _e, _f, _g, _h;
46758
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
46438
46759
  const hasCalledRef = useRef(false);
46439
46760
  const labels = ((_b = (_a = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
46440
46761
  const series = ((_d = (_c = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) || [];
@@ -46472,18 +46793,40 @@ function SeriesBarChartComponent$1({
46472
46793
  }
46473
46794
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, seriesBarChartState]);
46474
46795
  const finalColors = useMemo(() => {
46475
- return shuffleColors(DEFAULT_COLORS$1, series.length);
46796
+ return shuffleColors(DEFAULT_COLORS$2, series.length);
46476
46797
  }, [series.length]);
46798
+ const sortedSeries = useMemo(() => {
46799
+ return [...series].sort(
46800
+ (a, b) => (a.name || "").localeCompare(b.name || "")
46801
+ );
46802
+ }, [series]);
46803
+ const colors = useMemo(() => {
46804
+ return sortedSeries.map((_, index) => finalColors[index % finalColors.length]);
46805
+ }, [sortedSeries, finalColors]);
46806
+ useEffect(() => {
46807
+ var _a2;
46808
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
46809
+ onConfigUpdate(widgetId, {
46810
+ chartSettings: __spreadProps$6(__spreadValues$8({}, chartSettings), {
46811
+ seriesColors: colors
46812
+ })
46813
+ });
46814
+ }
46815
+ }, [series.length, (_i = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _i.length, onConfigUpdate, widgetId, isEmpty]);
46477
46816
  if (isEmpty) {
46478
46817
  return createLoadingComponent$2();
46479
46818
  }
46480
46819
  const transformedData = {
46481
46820
  labels,
46482
- datasets: series.map((seriesItem, index) => ({
46483
- label: seriesItem.name,
46484
- data: seriesItem.values,
46485
- backgroundColor: (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length]
46486
- }))
46821
+ datasets: sortedSeries.map((seriesItem, index) => {
46822
+ var _a2;
46823
+ const color = ((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2[index]) || (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length];
46824
+ return {
46825
+ label: seriesItem.name,
46826
+ data: seriesItem.values,
46827
+ backgroundColor: color
46828
+ };
46829
+ })
46487
46830
  };
46488
46831
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
46489
46832
  SeriesChart,
@@ -46494,7 +46837,8 @@ function SeriesBarChartComponent$1({
46494
46837
  units,
46495
46838
  content,
46496
46839
  x_axis_title,
46497
- y_axis_title
46840
+ y_axis_title,
46841
+ chartSettings
46498
46842
  }
46499
46843
  );
46500
46844
  }
@@ -46505,9 +46849,10 @@ function CopilotKitSeriesBarChart$1({
46505
46849
  onResetReady,
46506
46850
  widgetBackendUrl,
46507
46851
  datasetId,
46508
- widgetData
46852
+ widgetData,
46853
+ onConfigUpdate
46509
46854
  }) {
46510
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
46855
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
46511
46856
  const orientation = ((_a = widget.config) == null ? void 0 : _a.orientation) || "vertical";
46512
46857
  const isFirstLoad = (_b = widget.config) == null ? void 0 : _b.isFirstLoad;
46513
46858
  const content = (_c = widget.config) == null ? void 0 : _c.content;
@@ -46548,7 +46893,7 @@ function CopilotKitSeriesBarChart$1({
46548
46893
  if (apiCallCount >= 30) {
46549
46894
  console.log("API call limit reached for widget:", widget.id);
46550
46895
  setHasTimeoutError(true);
46551
- setChartState((prevState) => __spreadProps$5(__spreadValues$7({}, prevState), {
46896
+ setChartState((prevState) => __spreadProps$6(__spreadValues$8({}, prevState), {
46552
46897
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46553
46898
  }));
46554
46899
  return;
@@ -46649,7 +46994,9 @@ function CopilotKitSeriesBarChart$1({
46649
46994
  widgetId: widget.id,
46650
46995
  startLoadingTimeout,
46651
46996
  clearLoadingTimeout,
46652
- hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length))
46997
+ hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length)),
46998
+ chartSettings: (_s = widget.config) == null ? void 0 : _s.chartSettings,
46999
+ onConfigUpdate
46653
47000
  }
46654
47001
  ) })
46655
47002
  ] });
@@ -46661,7 +47008,8 @@ function SeriesBarChartWidget({
46661
47008
  onResetReady,
46662
47009
  widgetIds,
46663
47010
  datasetId,
46664
- widgetData
47011
+ widgetData,
47012
+ onConfigUpdate
46665
47013
  }) {
46666
47014
  var _a, _b;
46667
47015
  const styles = getStyleValues$2((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46685,34 +47033,35 @@ function SeriesBarChartWidget({
46685
47033
  styles,
46686
47034
  onResetReady,
46687
47035
  widgetBackendUrl,
46688
- datasetId
47036
+ datasetId,
47037
+ onConfigUpdate
46689
47038
  }
46690
47039
  )
46691
47040
  }
46692
47041
  );
46693
47042
  }
46694
47043
 
46695
- var __defProp$6 = Object.defineProperty;
46696
- var __defProps$4 = Object.defineProperties;
46697
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
46698
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
46699
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
46700
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
46701
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46702
- var __spreadValues$6 = (a, b) => {
47044
+ var __defProp$7 = Object.defineProperty;
47045
+ var __defProps$5 = Object.defineProperties;
47046
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
47047
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
47048
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
47049
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
47050
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47051
+ var __spreadValues$7 = (a, b) => {
46703
47052
  for (var prop in b || (b = {}))
46704
- if (__hasOwnProp$6.call(b, prop))
46705
- __defNormalProp$6(a, prop, b[prop]);
46706
- if (__getOwnPropSymbols$6)
46707
- for (var prop of __getOwnPropSymbols$6(b)) {
46708
- if (__propIsEnum$6.call(b, prop))
46709
- __defNormalProp$6(a, prop, b[prop]);
47053
+ if (__hasOwnProp$7.call(b, prop))
47054
+ __defNormalProp$7(a, prop, b[prop]);
47055
+ if (__getOwnPropSymbols$7)
47056
+ for (var prop of __getOwnPropSymbols$7(b)) {
47057
+ if (__propIsEnum$7.call(b, prop))
47058
+ __defNormalProp$7(a, prop, b[prop]);
46710
47059
  }
46711
47060
  return a;
46712
47061
  };
46713
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
47062
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
46714
47063
  const CHART_REFRESH_TIMEOUT$1 = 3e3;
46715
- const DEFAULT_COLORS = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
47064
+ const DEFAULT_COLORS$1 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46716
47065
  const clearChat$1 = async (widgetBackendUrl, widgetId) => {
46717
47066
  if (!widgetBackendUrl || !widgetId) return;
46718
47067
  console.log("clearChat called for widgetId:", widgetId);
@@ -46807,7 +47156,7 @@ const parseAndUpdateChartState$1 = (apiResponse, setChartState) => {
46807
47156
  if (parsedState.state) {
46808
47157
  const chartData = parsedState.state;
46809
47158
  setChartState((prevState) => {
46810
- const newChartState = __spreadValues$6({}, prevState);
47159
+ const newChartState = __spreadValues$7({}, prevState);
46811
47160
  if (chartData.series_bar_chart_data) {
46812
47161
  newChartState.series_bar_chart_data = chartData.series_bar_chart_data;
46813
47162
  }
@@ -46857,9 +47206,11 @@ function SeriesBarChartComponent({
46857
47206
  startLoadingTimeout,
46858
47207
  clearLoadingTimeout,
46859
47208
  content,
46860
- hasWidgetData
47209
+ hasWidgetData,
47210
+ chartSettings,
47211
+ onConfigUpdate
46861
47212
  }) {
46862
- var _a, _b, _c, _d, _e, _f, _g, _h;
47213
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
46863
47214
  const hasCalledRef = useRef(false);
46864
47215
  const labels = ((_b = (_a = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
46865
47216
  const series = ((_d = (_c = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) || [];
@@ -46897,24 +47248,43 @@ function SeriesBarChartComponent({
46897
47248
  }
46898
47249
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, seriesBarChartState]);
46899
47250
  const finalColors = useMemo(() => {
46900
- return shuffleColors(DEFAULT_COLORS, series.length);
47251
+ return shuffleColors(DEFAULT_COLORS$1, series.length);
46901
47252
  }, [series.length]);
47253
+ const sortedSeries = useMemo(() => {
47254
+ return [...series].sort(
47255
+ (a, b) => (a.name || "").localeCompare(b.name || "")
47256
+ );
47257
+ }, [series]);
47258
+ const colors = useMemo(() => {
47259
+ return sortedSeries.map((_, index) => finalColors[index % finalColors.length]);
47260
+ }, [sortedSeries, finalColors]);
47261
+ useEffect(() => {
47262
+ var _a2;
47263
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
47264
+ onConfigUpdate(widgetId, {
47265
+ chartSettings: __spreadProps$5(__spreadValues$7({}, chartSettings), {
47266
+ seriesColors: colors
47267
+ })
47268
+ });
47269
+ }
47270
+ }, [series.length, (_i = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _i.length, onConfigUpdate, widgetId, isEmpty]);
46902
47271
  if (isEmpty) {
46903
47272
  return createLoadingComponent$1();
46904
47273
  }
46905
47274
  const transformedData = {
46906
47275
  labels,
46907
- datasets: series.map((seriesItem, index) => {
46908
- const color = (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length];
47276
+ datasets: sortedSeries.map((seriesItem, index) => {
47277
+ var _a2, _b2, _c2;
47278
+ const color = ((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2[index]) || (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length];
46909
47279
  return {
46910
47280
  label: seriesItem.name,
46911
47281
  data: seriesItem.values,
46912
47282
  borderColor: color,
46913
47283
  backgroundColor: color + "26",
46914
47284
  // 15% opacity for subtle fill under curve
46915
- borderWidth: 2.5,
47285
+ borderWidth: (_b2 = chartSettings == null ? void 0 : chartSettings.lineWidth) != null ? _b2 : 2.5,
46916
47286
  fill: false,
46917
- pointRadius: 4,
47287
+ pointRadius: (_c2 = chartSettings == null ? void 0 : chartSettings.pointRadius) != null ? _c2 : 4,
46918
47288
  pointHoverRadius: 6,
46919
47289
  pointBackgroundColor: color,
46920
47290
  pointBorderColor: "#ffffff",
@@ -46931,7 +47301,8 @@ function SeriesBarChartComponent({
46931
47301
  units,
46932
47302
  content,
46933
47303
  x_axis_title,
46934
- y_axis_title
47304
+ y_axis_title,
47305
+ chartSettings
46935
47306
  }
46936
47307
  );
46937
47308
  }
@@ -46942,9 +47313,10 @@ function CopilotKitSeriesBarChart({
46942
47313
  onResetReady,
46943
47314
  widgetBackendUrl,
46944
47315
  datasetId,
46945
- widgetData
47316
+ widgetData,
47317
+ onConfigUpdate
46946
47318
  }) {
46947
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
47319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
46948
47320
  const orientation = ((_a = widget.config) == null ? void 0 : _a.orientation) || "vertical";
46949
47321
  const isFirstLoad = (_b = widget.config) == null ? void 0 : _b.isFirstLoad;
46950
47322
  const content = (_c = widget.config) == null ? void 0 : _c.content;
@@ -46985,7 +47357,7 @@ function CopilotKitSeriesBarChart({
46985
47357
  if (apiCallCount >= 30) {
46986
47358
  console.log("API call limit reached for widget:", widget.id);
46987
47359
  setHasTimeoutError(true);
46988
- setChartState((prevState) => __spreadProps$4(__spreadValues$6({}, prevState), {
47360
+ setChartState((prevState) => __spreadProps$5(__spreadValues$7({}, prevState), {
46989
47361
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46990
47362
  }));
46991
47363
  return;
@@ -47086,7 +47458,9 @@ function CopilotKitSeriesBarChart({
47086
47458
  widgetId: widget.id,
47087
47459
  startLoadingTimeout,
47088
47460
  clearLoadingTimeout,
47089
- hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length))
47461
+ hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length)),
47462
+ chartSettings: (_s = widget.config) == null ? void 0 : _s.chartSettings,
47463
+ onConfigUpdate
47090
47464
  }
47091
47465
  ) })
47092
47466
  ] });
@@ -47098,7 +47472,8 @@ function SeriesLineChartWidget({
47098
47472
  onResetReady,
47099
47473
  widgetIds,
47100
47474
  datasetId,
47101
- widgetData
47475
+ widgetData,
47476
+ onConfigUpdate
47102
47477
  }) {
47103
47478
  var _a, _b;
47104
47479
  const styles = getStyleValues$1((_a = widget.config) == null ? void 0 : _a.styles);
@@ -47122,32 +47497,33 @@ function SeriesLineChartWidget({
47122
47497
  styles,
47123
47498
  onResetReady,
47124
47499
  widgetBackendUrl,
47125
- datasetId
47500
+ datasetId,
47501
+ onConfigUpdate
47126
47502
  }
47127
47503
  )
47128
47504
  }
47129
47505
  );
47130
47506
  }
47131
47507
 
47132
- var __defProp$5 = Object.defineProperty;
47133
- var __defProps$3 = Object.defineProperties;
47134
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
47135
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
47136
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
47137
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
47138
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47139
- var __spreadValues$5 = (a, b) => {
47508
+ var __defProp$6 = Object.defineProperty;
47509
+ var __defProps$4 = Object.defineProperties;
47510
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
47511
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
47512
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
47513
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
47514
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47515
+ var __spreadValues$6 = (a, b) => {
47140
47516
  for (var prop in b || (b = {}))
47141
- if (__hasOwnProp$5.call(b, prop))
47142
- __defNormalProp$5(a, prop, b[prop]);
47143
- if (__getOwnPropSymbols$5)
47144
- for (var prop of __getOwnPropSymbols$5(b)) {
47145
- if (__propIsEnum$5.call(b, prop))
47146
- __defNormalProp$5(a, prop, b[prop]);
47517
+ if (__hasOwnProp$6.call(b, prop))
47518
+ __defNormalProp$6(a, prop, b[prop]);
47519
+ if (__getOwnPropSymbols$6)
47520
+ for (var prop of __getOwnPropSymbols$6(b)) {
47521
+ if (__propIsEnum$6.call(b, prop))
47522
+ __defNormalProp$6(a, prop, b[prop]);
47147
47523
  }
47148
47524
  return a;
47149
47525
  };
47150
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
47526
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
47151
47527
  const CHART_REFRESH_TIMEOUT = 3e3;
47152
47528
  const clearChat = async (widgetBackendUrl, widgetId) => {
47153
47529
  if (!widgetBackendUrl || !widgetId) return;
@@ -47234,7 +47610,7 @@ const parseAndUpdateChartState = (apiResponse, setChartState) => {
47234
47610
  if (parsedState.state) {
47235
47611
  const chartData = parsedState.state;
47236
47612
  setChartState((prevState) => {
47237
- const newChartState = __spreadValues$5({}, prevState);
47613
+ const newChartState = __spreadValues$6({}, prevState);
47238
47614
  if (chartData.matrix_grid_data) {
47239
47615
  newChartState.matrix_grid_data = chartData.matrix_grid_data;
47240
47616
  }
@@ -47381,7 +47757,7 @@ function CopilotKitDataGrid({
47381
47757
  if (apiCallCount >= 30) {
47382
47758
  console.log("API call limit reached for widget:", widget.id);
47383
47759
  setHasTimeoutError(true);
47384
- setChartState((prevState) => __spreadProps$3(__spreadValues$5({}, prevState), {
47760
+ setChartState((prevState) => __spreadProps$4(__spreadValues$6({}, prevState), {
47385
47761
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
47386
47762
  }));
47387
47763
  return;
@@ -47593,7 +47969,8 @@ function WidgetRenderer({
47593
47969
  widgetBackendUrl,
47594
47970
  onResetReady,
47595
47971
  widgetIds,
47596
- datasetId
47972
+ datasetId,
47973
+ onConfigUpdate
47597
47974
  }
47598
47975
  ) : widget.config.agentType === "Series Bar Chart Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47599
47976
  SeriesBarChartWidget,
@@ -47603,7 +47980,8 @@ function WidgetRenderer({
47603
47980
  widgetBackendUrl,
47604
47981
  onResetReady,
47605
47982
  widgetIds,
47606
- datasetId
47983
+ datasetId,
47984
+ onConfigUpdate
47607
47985
  }
47608
47986
  ) : widget.config.agentType === "Series Line Chart Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47609
47987
  SeriesLineChartWidget,
@@ -47613,7 +47991,8 @@ function WidgetRenderer({
47613
47991
  widgetBackendUrl,
47614
47992
  onResetReady,
47615
47993
  widgetIds,
47616
- datasetId
47994
+ datasetId,
47995
+ onConfigUpdate
47617
47996
  }
47618
47997
  ) : widget.config.agentType === "Data Grid Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47619
47998
  DatagridWidget,
@@ -47646,39 +48025,39 @@ function WidgetRenderer({
47646
48025
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${(widget == null ? void 0 : widget.type) === "text" ? "" : "h-full"}`, children: renderWidget() });
47647
48026
  }
47648
48027
 
47649
- var __defProp$4 = Object.defineProperty;
47650
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
47651
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
47652
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
47653
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47654
- var __spreadValues$4 = (a, b) => {
48028
+ var __defProp$5 = Object.defineProperty;
48029
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
48030
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
48031
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
48032
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
48033
+ var __spreadValues$5 = (a, b) => {
47655
48034
  for (var prop in b || (b = {}))
47656
- if (__hasOwnProp$4.call(b, prop))
47657
- __defNormalProp$4(a, prop, b[prop]);
47658
- if (__getOwnPropSymbols$4)
47659
- for (var prop of __getOwnPropSymbols$4(b)) {
47660
- if (__propIsEnum$4.call(b, prop))
47661
- __defNormalProp$4(a, prop, b[prop]);
48035
+ if (__hasOwnProp$5.call(b, prop))
48036
+ __defNormalProp$5(a, prop, b[prop]);
48037
+ if (__getOwnPropSymbols$5)
48038
+ for (var prop of __getOwnPropSymbols$5(b)) {
48039
+ if (__propIsEnum$5.call(b, prop))
48040
+ __defNormalProp$5(a, prop, b[prop]);
47662
48041
  }
47663
48042
  return a;
47664
48043
  };
47665
- var __objRest$1 = (source, exclude) => {
48044
+ var __objRest$2 = (source, exclude) => {
47666
48045
  var target = {};
47667
48046
  for (var prop in source)
47668
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
48047
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
47669
48048
  target[prop] = source[prop];
47670
- if (source != null && __getOwnPropSymbols$4)
47671
- for (var prop of __getOwnPropSymbols$4(source)) {
47672
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
48049
+ if (source != null && __getOwnPropSymbols$5)
48050
+ for (var prop of __getOwnPropSymbols$5(source)) {
48051
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
47673
48052
  target[prop] = source[prop];
47674
48053
  }
47675
48054
  return target;
47676
48055
  };
47677
48056
  const Textarea = React.forwardRef((_a, ref) => {
47678
- var _b = _a, { className } = _b, props = __objRest$1(_b, ["className"]);
48057
+ var _b = _a, { className } = _b, props = __objRest$2(_b, ["className"]);
47679
48058
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
47680
48059
  "textarea",
47681
- __spreadValues$4({
48060
+ __spreadValues$5({
47682
48061
  className: cn(
47683
48062
  "flex min-h-[120px] w-full rounded-md border border-gray-300 bg-transparent px-3 py-2 text-base ring-offset-gray-300 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
47684
48063
  className
@@ -47799,6 +48178,57 @@ function Modal({
47799
48178
  );
47800
48179
  }
47801
48180
 
48181
+ var __defProp$4 = Object.defineProperty;
48182
+ var __defProps$3 = Object.defineProperties;
48183
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
48184
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
48185
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
48186
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
48187
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
48188
+ var __spreadValues$4 = (a, b) => {
48189
+ for (var prop in b || (b = {}))
48190
+ if (__hasOwnProp$4.call(b, prop))
48191
+ __defNormalProp$4(a, prop, b[prop]);
48192
+ if (__getOwnPropSymbols$4)
48193
+ for (var prop of __getOwnPropSymbols$4(b)) {
48194
+ if (__propIsEnum$4.call(b, prop))
48195
+ __defNormalProp$4(a, prop, b[prop]);
48196
+ }
48197
+ return a;
48198
+ };
48199
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
48200
+ var __objRest$1 = (source, exclude) => {
48201
+ var target = {};
48202
+ for (var prop in source)
48203
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
48204
+ target[prop] = source[prop];
48205
+ if (source != null && __getOwnPropSymbols$4)
48206
+ for (var prop of __getOwnPropSymbols$4(source)) {
48207
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
48208
+ target[prop] = source[prop];
48209
+ }
48210
+ return target;
48211
+ };
48212
+ const Slider = React.forwardRef((_a, ref) => {
48213
+ var _b = _a, { className } = _b, props = __objRest$1(_b, ["className"]);
48214
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
48215
+ SliderPrimitive.Root,
48216
+ __spreadProps$3(__spreadValues$4({
48217
+ ref,
48218
+ className: cn(
48219
+ "relative flex w-full touch-none select-none items-center",
48220
+ className
48221
+ )
48222
+ }, props), {
48223
+ children: [
48224
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
48225
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
48226
+ ]
48227
+ })
48228
+ );
48229
+ });
48230
+ Slider.displayName = SliderPrimitive.Root.displayName;
48231
+
47802
48232
  var __defProp$3 = Object.defineProperty;
47803
48233
  var __defProps$2 = Object.defineProperties;
47804
48234
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
@@ -47818,9 +48248,63 @@ var __spreadValues$3 = (a, b) => {
47818
48248
  return a;
47819
48249
  };
47820
48250
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
48251
+ const isChartWidget = (agentType) => {
48252
+ if (!agentType) return false;
48253
+ return agentType === "Pie Chart Agent" || agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent" || agentType === "Bar Chart Agent" || agentType === "Series Bar Chart Agent";
48254
+ };
48255
+ const isLineChart = (agentType) => {
48256
+ if (!agentType) return false;
48257
+ return agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent";
48258
+ };
48259
+ const DEFAULT_COLORS = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
48260
+ const getSeriesNames = (widget) => {
48261
+ var _a, _b, _c, _d;
48262
+ const data = widget == null ? void 0 : widget.widget_data;
48263
+ if (!data) return [];
48264
+ if (((_b = (_a = data == null ? void 0 : data.pie_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) && Array.isArray(data.pie_chart_data.data.labels)) {
48265
+ return data.pie_chart_data.data.labels.sort();
48266
+ }
48267
+ if (((_d = (_c = data == null ? void 0 : data.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) && Array.isArray(data.series_bar_chart_data.data.series)) {
48268
+ return data.series_bar_chart_data.data.series.map((item) => item.name || item.label || "").filter((name) => name !== "").sort();
48269
+ }
48270
+ if (Array.isArray(data)) {
48271
+ const names = /* @__PURE__ */ new Set();
48272
+ data.forEach((item) => {
48273
+ if (item.series_name) names.add(item.series_name);
48274
+ if (item.label) names.add(item.label);
48275
+ });
48276
+ return Array.from(names).sort();
48277
+ }
48278
+ return [];
48279
+ };
48280
+ const getDefaultSeriesColors = (widget) => {
48281
+ var _a, _b, _c, _d;
48282
+ const data = widget == null ? void 0 : widget.widget_data;
48283
+ if (!data) return [];
48284
+ if (((_b = (_a = data == null ? void 0 : data.pie_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) && Array.isArray(data.pie_chart_data.data.labels)) {
48285
+ const labels = data.pie_chart_data.data.labels;
48286
+ return shuffleColors(DEFAULT_COLORS, labels.length);
48287
+ }
48288
+ if (((_d = (_c = data == null ? void 0 : data.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) && Array.isArray(data.series_bar_chart_data.data.series)) {
48289
+ const series = data.series_bar_chart_data.data.series;
48290
+ return shuffleColors(DEFAULT_COLORS, series.length);
48291
+ }
48292
+ if (Array.isArray(data)) {
48293
+ const series = /* @__PURE__ */ new Set();
48294
+ data.forEach((item) => {
48295
+ if (item.series_name) series.add(item.series_name);
48296
+ if (item.label) series.add(item.label);
48297
+ });
48298
+ const seriesArray = Array.from(series).sort();
48299
+ return shuffleColors(DEFAULT_COLORS, seriesArray.length);
48300
+ }
48301
+ return [];
48302
+ };
47821
48303
  function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onClose, onSubmit }) {
47822
- var _a;
48304
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
47823
48305
  const agentType = (_a = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _a.agentType;
48306
+ const isChart = isChartWidget(agentType);
48307
+ const isLine = isLineChart(agentType);
47824
48308
  const [query, setQuery] = useState("");
47825
48309
  const [displayText, setDisplayText] = useState("");
47826
48310
  const [blockType, setBlockType] = useState("");
@@ -47828,13 +48312,42 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47828
48312
  const [divider, setDivider] = useState("no");
47829
48313
  const [showLabels, setShowLabels] = useState(false);
47830
48314
  const [styles, setStyles] = useState("");
48315
+ const [chartSettings, setChartSettings] = useState({
48316
+ showLegend: true,
48317
+ legendBoxSize: 16,
48318
+ legendFontSize: 13,
48319
+ lineWidth: 2.5,
48320
+ lineTension: 0.3,
48321
+ pointRadius: 4,
48322
+ showLabels: false,
48323
+ seriesColors: [],
48324
+ dataLabelsFontSize: 12,
48325
+ showTitle: true,
48326
+ titleText: "",
48327
+ titleFontSize: 16,
48328
+ xAxisTitleFontSize: 13,
48329
+ yAxisTitleFontSize: 13,
48330
+ xAxisTickFontSize: 12,
48331
+ yAxisTickFontSize: 12,
48332
+ tooltipFontSize: 12
48333
+ });
48334
+ const seriesNames = getSeriesNames(editingWidget);
48335
+ const defaultSeriesColors = getDefaultSeriesColors(editingWidget);
48336
+ const colorCount = seriesNames.length || ((_b = chartSettings.seriesColors) == null ? void 0 : _b.length) || defaultSeriesColors.length || 0;
48337
+ const displaySeriesNames = seriesNames.length > 0 ? seriesNames : Array.from({ length: colorCount }, (_, i) => `Series ${i + 1}`);
48338
+ useEffect(() => {
48339
+ console.log("[EditWidgetDialog] Series names:", seriesNames);
48340
+ console.log("[EditWidgetDialog] Default colors:", defaultSeriesColors);
48341
+ console.log("[EditWidgetDialog] Display series names:", displaySeriesNames);
48342
+ }, [seriesNames, defaultSeriesColors, displaySeriesNames]);
47831
48343
  useEffect(() => {
47832
48344
  setQuery(initialText);
47833
48345
  }, [initialText]);
47834
48346
  useEffect(() => {
47835
- var _a2, _b;
48347
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q, _r, _s, _t;
47836
48348
  const content = (_a2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _a2.content;
47837
- const cssStyles = (_b = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _b.styles;
48349
+ const cssStyles = (_b2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _b2.styles;
48350
+ const savedChartSettings = (_c2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _c2.chartSettings;
47838
48351
  const text = content == null ? void 0 : content.displayText;
47839
48352
  if (text == null ? void 0 : text.length) {
47840
48353
  setDisplayText(text);
@@ -47855,63 +48368,114 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47855
48368
  if (hasShowLabel !== void 0) {
47856
48369
  setShowLabels(hasShowLabel);
47857
48370
  }
48371
+ if (savedChartSettings) {
48372
+ setChartSettings({
48373
+ showLegend: (_d2 = savedChartSettings.showLegend) != null ? _d2 : true,
48374
+ legendBoxSize: (_e2 = savedChartSettings.legendBoxSize) != null ? _e2 : 16,
48375
+ legendFontSize: (_f2 = savedChartSettings.legendFontSize) != null ? _f2 : 13,
48376
+ lineWidth: (_g2 = savedChartSettings.lineWidth) != null ? _g2 : 2.5,
48377
+ lineTension: (_h2 = savedChartSettings.lineTension) != null ? _h2 : 0.3,
48378
+ pointRadius: (_i2 = savedChartSettings.pointRadius) != null ? _i2 : 4,
48379
+ showLabels: (_j2 = savedChartSettings.showLabels) != null ? _j2 : false,
48380
+ seriesColors: (_k2 = savedChartSettings.seriesColors) != null ? _k2 : defaultSeriesColors,
48381
+ dataLabelsFontSize: (_l2 = savedChartSettings.dataLabelsFontSize) != null ? _l2 : 12,
48382
+ showTitle: (_m2 = savedChartSettings.showTitle) != null ? _m2 : true,
48383
+ titleText: (_n2 = savedChartSettings.titleText) != null ? _n2 : "",
48384
+ titleFontSize: (_o2 = savedChartSettings.titleFontSize) != null ? _o2 : 16,
48385
+ xAxisTitleFontSize: (_p2 = savedChartSettings.xAxisTitleFontSize) != null ? _p2 : 13,
48386
+ yAxisTitleFontSize: (_q = savedChartSettings.yAxisTitleFontSize) != null ? _q : 13,
48387
+ xAxisTickFontSize: (_r = savedChartSettings.xAxisTickFontSize) != null ? _r : 12,
48388
+ yAxisTickFontSize: (_s = savedChartSettings.yAxisTickFontSize) != null ? _s : 12,
48389
+ tooltipFontSize: (_t = savedChartSettings.tooltipFontSize) != null ? _t : 12
48390
+ });
48391
+ } else {
48392
+ setChartSettings({
48393
+ showLegend: true,
48394
+ legendBoxSize: 16,
48395
+ legendFontSize: 13,
48396
+ lineWidth: 2.5,
48397
+ lineTension: 0.3,
48398
+ pointRadius: 4,
48399
+ showLabels: hasShowLabel != null ? hasShowLabel : false,
48400
+ seriesColors: defaultSeriesColors,
48401
+ dataLabelsFontSize: 12,
48402
+ showTitle: true,
48403
+ titleText: "",
48404
+ titleFontSize: 16,
48405
+ xAxisTitleFontSize: 13,
48406
+ yAxisTitleFontSize: 13,
48407
+ xAxisTickFontSize: 12,
48408
+ yAxisTickFontSize: 12,
48409
+ tooltipFontSize: 12
48410
+ });
48411
+ }
47858
48412
  }, [editingWidget]);
47859
48413
  const handleSubmit = () => {
48414
+ var _a2;
47860
48415
  if (onSubmit && query.trim()) {
47861
- onSubmit(query, showLabels);
48416
+ if (isChart) {
48417
+ onSubmit(query, (_a2 = chartSettings.showLabels) != null ? _a2 : false, chartSettings);
48418
+ } else {
48419
+ onSubmit(query, showLabels);
48420
+ }
47862
48421
  }
47863
48422
  if (editingWidget.type === "text") {
47864
48423
  const widgetId = editingWidget == null ? void 0 : editingWidget.id;
47865
- setWidgets && setWidgets((prev) => prev.map((w) => {
47866
- if (w.id === widgetId) {
47867
- return __spreadProps$2(__spreadValues$3({}, w), {
47868
- config: __spreadProps$2(__spreadValues$3({}, w.config), {
47869
- content: __spreadProps$2(__spreadValues$3({}, w.config.content), {
47870
- displayText,
47871
- blockType,
47872
- divider
47873
- }),
47874
- styles: __spreadValues$3(__spreadValues$3({}, w.config.styles), alignment && alignment.length > 0 ? { textAlign: alignment } : {})
47875
- })
47876
- });
47877
- }
47878
- return w;
47879
- }));
48424
+ setWidgets && setWidgets(
48425
+ (prev) => prev.map((w) => {
48426
+ if (w.id === widgetId) {
48427
+ return __spreadProps$2(__spreadValues$3({}, w), {
48428
+ config: __spreadProps$2(__spreadValues$3({}, w.config), {
48429
+ content: __spreadProps$2(__spreadValues$3({}, w.config.content), {
48430
+ displayText,
48431
+ blockType,
48432
+ divider
48433
+ }),
48434
+ styles: __spreadValues$3(__spreadValues$3({}, w.config.styles), alignment && alignment.length > 0 ? { textAlign: alignment } : {})
48435
+ })
48436
+ });
48437
+ }
48438
+ return w;
48439
+ })
48440
+ );
47880
48441
  onClose && onClose();
47881
48442
  }
47882
48443
  };
47883
48444
  if (!isOpen) return null;
47884
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
48445
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
47885
48446
  Modal,
47886
48447
  {
47887
48448
  isOpen,
47888
48449
  onClose,
47889
48450
  title: "Edit Widget",
47890
- size: "lg",
48451
+ size: "xl",
47891
48452
  noOverflowHidden: true,
47892
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
47893
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-700", children: "Customize the widget\u2019s appearance" }),
47894
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pt-7", children: [
47895
- (agentType === "Pie Chart Agent" || agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent" || agentType === "Bar Chart Agent" || agentType === "Series Bar Chart Agent") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 mb-4", children: [
47896
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Data Labels:" }),
47897
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47898
- Select,
47899
- {
47900
- value: showLabels ? "yes" : "no",
47901
- onValueChange: (value) => setShowLabels(value === "yes"),
47902
- children: [
47903
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Visible data labels?" }) }),
47904
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47905
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
47906
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
47907
- ] })
47908
- ]
47909
- }
47910
- )
47911
- ] }),
47912
- (editingWidget == null ? void 0 : editingWidget.type) === "text" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-5", children: [
47913
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47914
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Display text:" }),
48453
+ children: [
48454
+ /* @__PURE__ */ jsxRuntimeExports.jsx("style", { children: `
48455
+ .dialog-scrollable::-webkit-scrollbar {
48456
+ width: 6px;
48457
+ }
48458
+ .dialog-scrollable::-webkit-scrollbar-track {
48459
+ background: #f1f5f9;
48460
+ border-radius: 3px;
48461
+ }
48462
+ .dialog-scrollable::-webkit-scrollbar-thumb {
48463
+ background: #cbd5e1;
48464
+ border-radius: 3px;
48465
+ }
48466
+ .dialog-scrollable::-webkit-scrollbar-thumb:hover {
48467
+ background: #94a3b8;
48468
+ }
48469
+ .dialog-scrollable {
48470
+ scrollbar-width: thin;
48471
+ scrollbar-color: #cbd5e1 #f1f5f9;
48472
+ }
48473
+ ` }),
48474
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-[calc(100vh-260px)] bg-white rounded-lg", children: [
48475
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-6 py-4 border-b border-gray-200 flex-shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700 font-medium", children: "Customize your widget settings" }) }),
48476
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto dialog-scrollable px-6 py-4 flex flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", children: (editingWidget == null ? void 0 : editingWidget.type) === "text" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-5", children: [
48477
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48478
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Display text" }),
47915
48479
  /* @__PURE__ */ jsxRuntimeExports.jsx(
47916
48480
  Input,
47917
48481
  {
@@ -47921,88 +48485,463 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47921
48485
  }
47922
48486
  )
47923
48487
  ] }),
47924
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47925
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Block type:" }),
47926
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47927
- Select,
47928
- {
47929
- value: blockType,
47930
- onValueChange: (value) => setBlockType(value),
47931
- children: [
47932
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
47933
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47934
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }),
47935
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }),
47936
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }),
47937
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })
47938
- ] })
47939
- ]
47940
- }
47941
- )
48488
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48489
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Block type" }),
48490
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: blockType, onValueChange: (value) => setBlockType(value), children: [
48491
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
48492
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48493
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }),
48494
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }),
48495
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }),
48496
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })
48497
+ ] })
48498
+ ] })
47942
48499
  ] }),
47943
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47944
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Align:" }),
47945
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47946
- Select,
47947
- {
47948
- value: alignment,
47949
- onValueChange: (value) => setAlignment(value),
47950
- children: [
47951
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
47952
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47953
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }),
47954
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }),
47955
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }),
47956
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })
47957
- ] })
47958
- ]
47959
- }
47960
- )
48500
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48501
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Alignment" }),
48502
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: alignment, onValueChange: (value) => setAlignment(value), children: [
48503
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select alignment" }) }),
48504
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48505
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }),
48506
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }),
48507
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }),
48508
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })
48509
+ ] })
48510
+ ] })
47961
48511
  ] }),
47962
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47963
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Divider:" }),
47964
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47965
- Select,
48512
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48513
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Divider" }),
48514
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: divider, onValueChange: (value) => setDivider(value), children: [
48515
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }),
48516
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48517
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }),
48518
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })
48519
+ ] })
48520
+ ] })
48521
+ ] })
48522
+ ] }) : isChart ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
48523
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48524
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Query" }),
48525
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
48526
+ Textarea,
47966
48527
  {
47967
- value: divider,
47968
- onValueChange: (value) => setDivider(value),
47969
- children: [
47970
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }),
47971
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47972
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }),
47973
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })
47974
- ] })
47975
- ]
48528
+ className: "w-full p-2 min-h-[120px]",
48529
+ value: query,
48530
+ onChange: (e) => {
48531
+ var _a2;
48532
+ return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
48533
+ }
47976
48534
  }
47977
- )
47978
- ] }),
47979
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47980
- "button",
47981
- {
47982
- onClick: handleSubmit,
47983
- className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2",
47984
- children: "Submit"
47985
- }
47986
- ) })
47987
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
47988
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47989
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Query:" }),
47990
- /* @__PURE__ */ jsxRuntimeExports.jsx(Textarea, { className: "w-full p-2", value: query, onChange: (e) => {
47991
- var _a2;
47992
- return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
47993
- } })
48535
+ ) })
47994
48536
  ] }),
47995
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end pt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47996
- "button",
48537
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
48538
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48539
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Legend" }),
48540
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48541
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48542
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Legend" }) }),
48543
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48544
+ Select,
48545
+ {
48546
+ value: chartSettings.showLegend !== false ? "yes" : "no",
48547
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48548
+ showLegend: value === "yes"
48549
+ })),
48550
+ children: [
48551
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show legend?" }) }),
48552
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48553
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48554
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48555
+ ] })
48556
+ ]
48557
+ }
48558
+ )
48559
+ ] }),
48560
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48561
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48562
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Box Size" }),
48563
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48564
+ chartSettings.legendBoxSize,
48565
+ "px"
48566
+ ] })
48567
+ ] }),
48568
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48569
+ Slider,
48570
+ {
48571
+ min: 8,
48572
+ max: 32,
48573
+ step: 1,
48574
+ value: [(_c = chartSettings.legendBoxSize) != null ? _c : 16],
48575
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48576
+ legendBoxSize: value[0]
48577
+ })),
48578
+ className: "w-full"
48579
+ }
48580
+ )
48581
+ ] }),
48582
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48583
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48584
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48585
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48586
+ chartSettings.legendFontSize,
48587
+ "px"
48588
+ ] })
48589
+ ] }),
48590
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48591
+ Slider,
48592
+ {
48593
+ min: 10,
48594
+ max: 18,
48595
+ step: 1,
48596
+ value: [(_d = chartSettings.legendFontSize) != null ? _d : 13],
48597
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48598
+ legendFontSize: value[0]
48599
+ })),
48600
+ className: "w-full"
48601
+ }
48602
+ )
48603
+ ] })
48604
+ ] })
48605
+ ] }),
48606
+ displaySeriesNames.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48607
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Series Colors" }),
48608
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-3", children: displaySeriesNames.map((seriesName, index) => {
48609
+ var _a2;
48610
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
48611
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium flex-1 truncate", children: seriesName }),
48612
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48613
+ "input",
48614
+ {
48615
+ type: "color",
48616
+ value: ((_a2 = chartSettings.seriesColors) == null ? void 0 : _a2[index]) || defaultSeriesColors[index] || "#3B82F6",
48617
+ onChange: (e) => {
48618
+ const newColors = [...chartSettings.seriesColors || []];
48619
+ newColors[index] = e.target.value;
48620
+ setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48621
+ seriesColors: newColors
48622
+ }));
48623
+ },
48624
+ className: "w-10 h-10 rounded cursor-pointer border border-gray-300"
48625
+ }
48626
+ )
48627
+ ] }, index);
48628
+ }) })
48629
+ ] }),
48630
+ isLine && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48631
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Line Style" }),
48632
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48633
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48634
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48635
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Line Width" }),
48636
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-600", children: chartSettings.lineWidth })
48637
+ ] }),
48638
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48639
+ Slider,
48640
+ {
48641
+ min: 1,
48642
+ max: 5,
48643
+ step: 0.5,
48644
+ value: [(_e = chartSettings.lineWidth) != null ? _e : 2.5],
48645
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48646
+ lineWidth: value[0]
48647
+ })),
48648
+ className: "w-full"
48649
+ }
48650
+ )
48651
+ ] }),
48652
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48653
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48654
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Tension" }),
48655
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-600", children: ((_f = chartSettings.lineTension) != null ? _f : 0.3).toFixed(2) })
48656
+ ] }),
48657
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48658
+ Slider,
48659
+ {
48660
+ min: 0,
48661
+ max: 0.8,
48662
+ step: 0.05,
48663
+ value: [(_g = chartSettings.lineTension) != null ? _g : 0.3],
48664
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48665
+ lineTension: value[0]
48666
+ })),
48667
+ className: "w-full"
48668
+ }
48669
+ )
48670
+ ] }),
48671
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48672
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48673
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Point Size" }),
48674
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48675
+ chartSettings.pointRadius,
48676
+ "px"
48677
+ ] })
48678
+ ] }),
48679
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48680
+ Slider,
48681
+ {
48682
+ min: 0,
48683
+ max: 8,
48684
+ step: 0.5,
48685
+ value: [(_h = chartSettings.pointRadius) != null ? _h : 4],
48686
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48687
+ pointRadius: value[0]
48688
+ })),
48689
+ className: "w-full"
48690
+ }
48691
+ )
48692
+ ] })
48693
+ ] })
48694
+ ] }),
48695
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48696
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Chart Title" }),
48697
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48698
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48699
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Title" }) }),
48700
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48701
+ Select,
48702
+ {
48703
+ value: chartSettings.showTitle !== false ? "yes" : "no",
48704
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48705
+ showTitle: value === "yes"
48706
+ })),
48707
+ children: [
48708
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show title?" }) }),
48709
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48710
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48711
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48712
+ ] })
48713
+ ]
48714
+ }
48715
+ )
48716
+ ] }),
48717
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48718
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Title Text" }) }),
48719
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48720
+ "input",
48721
+ {
48722
+ type: "text",
48723
+ placeholder: "Enter custom title (optional)",
48724
+ value: (_i = chartSettings.titleText) != null ? _i : "",
48725
+ onChange: (e) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48726
+ titleText: e.target.value
48727
+ })),
48728
+ className: "w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
48729
+ }
48730
+ )
48731
+ ] }),
48732
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48733
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48734
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48735
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48736
+ chartSettings.titleFontSize,
48737
+ "px"
48738
+ ] })
48739
+ ] }),
48740
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48741
+ Slider,
48742
+ {
48743
+ min: 12,
48744
+ max: 28,
48745
+ step: 1,
48746
+ value: [(_j = chartSettings.titleFontSize) != null ? _j : 16],
48747
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48748
+ titleFontSize: value[0]
48749
+ })),
48750
+ className: "w-full"
48751
+ }
48752
+ )
48753
+ ] })
48754
+ ] })
48755
+ ] }),
48756
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48757
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Data Labels" }),
48758
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48759
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48760
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Labels" }) }),
48761
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48762
+ Select,
48763
+ {
48764
+ value: chartSettings.showLabels ? "yes" : "no",
48765
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48766
+ showLabels: value === "yes"
48767
+ })),
48768
+ children: [
48769
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show data labels?" }) }),
48770
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48771
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48772
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48773
+ ] })
48774
+ ]
48775
+ }
48776
+ )
48777
+ ] }),
48778
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48779
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48780
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48781
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48782
+ chartSettings.dataLabelsFontSize,
48783
+ "px"
48784
+ ] })
48785
+ ] }),
48786
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48787
+ Slider,
48788
+ {
48789
+ min: 10,
48790
+ max: 18,
48791
+ step: 1,
48792
+ value: [(_k = chartSettings.dataLabelsFontSize) != null ? _k : 12],
48793
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48794
+ dataLabelsFontSize: value[0]
48795
+ })),
48796
+ className: "w-full"
48797
+ }
48798
+ )
48799
+ ] })
48800
+ ] })
48801
+ ] }),
48802
+ (agentType === "Series Bar Chart Agent" || agentType === "Bar Chart Agent" || agentType === "Series Line Chart Agent" || agentType === "Line Chart Agent") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48803
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Axes" }),
48804
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48805
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48806
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48807
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "X-Axis Title Font Size" }),
48808
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48809
+ chartSettings.xAxisTitleFontSize,
48810
+ "px"
48811
+ ] })
48812
+ ] }),
48813
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48814
+ Slider,
48815
+ {
48816
+ min: 10,
48817
+ max: 18,
48818
+ step: 1,
48819
+ value: [(_l = chartSettings.xAxisTitleFontSize) != null ? _l : 13],
48820
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48821
+ xAxisTitleFontSize: value[0]
48822
+ })),
48823
+ className: "w-full"
48824
+ }
48825
+ )
48826
+ ] }),
48827
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48828
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48829
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "X-Axis Tick Font Size" }),
48830
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48831
+ chartSettings.xAxisTickFontSize,
48832
+ "px"
48833
+ ] })
48834
+ ] }),
48835
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48836
+ Slider,
48837
+ {
48838
+ min: 10,
48839
+ max: 14,
48840
+ step: 1,
48841
+ value: [(_m = chartSettings.xAxisTickFontSize) != null ? _m : 12],
48842
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48843
+ xAxisTickFontSize: value[0]
48844
+ })),
48845
+ className: "w-full"
48846
+ }
48847
+ )
48848
+ ] }),
48849
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48850
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48851
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Y-Axis Title Font Size" }),
48852
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48853
+ chartSettings.yAxisTitleFontSize,
48854
+ "px"
48855
+ ] })
48856
+ ] }),
48857
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48858
+ Slider,
48859
+ {
48860
+ min: 10,
48861
+ max: 18,
48862
+ step: 1,
48863
+ value: [(_n = chartSettings.yAxisTitleFontSize) != null ? _n : 13],
48864
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48865
+ yAxisTitleFontSize: value[0]
48866
+ })),
48867
+ className: "w-full"
48868
+ }
48869
+ )
48870
+ ] }),
48871
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48872
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48873
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Y-Axis Tick Font Size" }),
48874
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48875
+ chartSettings.yAxisTickFontSize,
48876
+ "px"
48877
+ ] })
48878
+ ] }),
48879
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48880
+ Slider,
48881
+ {
48882
+ min: 10,
48883
+ max: 14,
48884
+ step: 1,
48885
+ value: [(_o = chartSettings.yAxisTickFontSize) != null ? _o : 12],
48886
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48887
+ yAxisTickFontSize: value[0]
48888
+ })),
48889
+ className: "w-full"
48890
+ }
48891
+ )
48892
+ ] })
48893
+ ] })
48894
+ ] }),
48895
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
48896
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Tooltip" }),
48897
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48898
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48899
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48900
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48901
+ chartSettings.tooltipFontSize,
48902
+ "px"
48903
+ ] })
48904
+ ] }),
48905
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48906
+ Slider,
48907
+ {
48908
+ min: 10,
48909
+ max: 16,
48910
+ step: 1,
48911
+ value: [(_p = chartSettings.tooltipFontSize) != null ? _p : 12],
48912
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48913
+ tooltipFontSize: value[0]
48914
+ })),
48915
+ className: "w-full"
48916
+ }
48917
+ )
48918
+ ] }) })
48919
+ ] })
48920
+ ] })
48921
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48922
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Query" }),
48923
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48924
+ Textarea,
47997
48925
  {
47998
- onClick: handleSubmit,
47999
- className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2",
48000
- children: "Submit"
48926
+ className: "w-full p-2 min-h-[120px]",
48927
+ value: query,
48928
+ onChange: (e) => {
48929
+ var _a2;
48930
+ return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
48931
+ }
48001
48932
  }
48002
- ) })
48003
- ] })
48933
+ )
48934
+ ] }) }) }) }),
48935
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 px-6 py-4 border-t border-gray-200 bg-gradient-to-b from-white to-gray-50 flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
48936
+ "button",
48937
+ {
48938
+ onClick: handleSubmit,
48939
+ className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary text-primary-foreground hover:bg-primary/80 focus:ring-primary px-6 py-2 text-sm flex items-center gap-2",
48940
+ children: "Submit"
48941
+ }
48942
+ ) })
48004
48943
  ] })
48005
- ] })
48944
+ ]
48006
48945
  }
48007
48946
  );
48008
48947
  }
@@ -48506,20 +49445,52 @@ function WidgetDashboard({
48506
49445
  };
48507
49446
  const onClickSettings = (widget) => {
48508
49447
  var _a;
49448
+ const currentWidget = widgets.find((w) => w.id === widget.id) || widget;
48509
49449
  setShowEditModal(true);
48510
- setEditingWidget(widget);
48511
- let query = (_a = widget == null ? void 0 : widget.config) == null ? void 0 : _a.query;
49450
+ setEditingWidget(currentWidget);
49451
+ let query = (_a = currentWidget == null ? void 0 : currentWidget.config) == null ? void 0 : _a.query;
48512
49452
  if (query) {
48513
49453
  setEditInitialQuery(query);
48514
49454
  } else {
48515
49455
  setEditInitialQuery("");
48516
49456
  }
48517
49457
  };
48518
- const handleEditSubmit = async (newQuery, showLabels) => {
49458
+ const saveWidgetConfigToBackend = useCallback(
49459
+ debounce$1(async (widget) => {
49460
+ try {
49461
+ const widgetService = new WidgetService();
49462
+ await widgetService.saveWidget(widget);
49463
+ console.log(`[WidgetDashboard] Widget ${widget.id} config saved to backend`);
49464
+ } catch (error) {
49465
+ console.error(`[WidgetDashboard] Failed to save widget config:`, error);
49466
+ }
49467
+ }, 1e3),
49468
+ []
49469
+ );
49470
+ const handleConfigUpdate = (widgetId, config) => {
49471
+ setWidgets((prevWidgets) => {
49472
+ const updatedWidgets = prevWidgets.map(
49473
+ (w) => w.id === widgetId ? __spreadProps$1(__spreadValues$1({}, w), {
49474
+ config: __spreadValues$1(__spreadValues$1({}, w.config), config)
49475
+ }) : w
49476
+ );
49477
+ const updatedWidget = updatedWidgets.find((w) => w.id === widgetId);
49478
+ if (updatedWidget) {
49479
+ saveWidgetConfigToBackend(updatedWidget);
49480
+ }
49481
+ return updatedWidgets;
49482
+ });
49483
+ };
49484
+ const handleEditSubmit = async (newQuery, showLabels, chartSettings) => {
48519
49485
  var _a, _b;
48520
49486
  if (!editingWidget) return;
48521
49487
  const updatedWidgets = widgets.map(
48522
- (w) => w.id === editingWidget.id ? __spreadProps$1(__spreadValues$1({}, w), { config: __spreadProps$1(__spreadValues$1({}, w.config), { query: newQuery, content: __spreadProps$1(__spreadValues$1({}, w.config.content), { showLabels }) }) }) : w
49488
+ (w) => w.id === editingWidget.id ? __spreadProps$1(__spreadValues$1({}, w), {
49489
+ config: __spreadValues$1(__spreadProps$1(__spreadValues$1({}, w.config), {
49490
+ query: newQuery,
49491
+ content: __spreadProps$1(__spreadValues$1({}, w.config.content), { showLabels })
49492
+ }), chartSettings && { chartSettings })
49493
+ }) : w
48523
49494
  );
48524
49495
  setWidgets(updatedWidgets);
48525
49496
  setShowEditModal(false);
@@ -48609,6 +49580,11 @@ function WidgetDashboard({
48609
49580
  setTimeout(() => pollForSqlQuery(), 2e3);
48610
49581
  }
48611
49582
  }
49583
+ try {
49584
+ await stableSaveLayout();
49585
+ } catch (error) {
49586
+ console.error("Failed to save widget configuration:", error);
49587
+ }
48612
49588
  };
48613
49589
  const handleResetReady = useCallback((widgetId, resetFn) => {
48614
49590
  setWidgetResetFunctions((prev) => {
@@ -48646,6 +49622,7 @@ function WidgetDashboard({
48646
49622
  }
48647
49623
  };
48648
49624
  const loadData = useCallback(async () => {
49625
+ var _a;
48649
49626
  if (!pageId) {
48650
49627
  setIsLoading(false);
48651
49628
  return;
@@ -48666,6 +49643,12 @@ function WidgetDashboard({
48666
49643
  setPageData(data);
48667
49644
  setWidgets(data.widgets || []);
48668
49645
  setDatasetId(data == null ? void 0 : data.dataset_id);
49646
+ (_a = data.widgets) == null ? void 0 : _a.forEach((w) => {
49647
+ var _a2;
49648
+ if ((_a2 = w.config) == null ? void 0 : _a2.chartSettings) {
49649
+ console.log(`[WidgetDashboard] Widget ${w.id} has chartSettings:`, w.config.chartSettings);
49650
+ }
49651
+ });
48669
49652
  } catch (err) {
48670
49653
  console.error("Error loading page data:", err);
48671
49654
  } finally {
@@ -48711,6 +49694,23 @@ function WidgetDashboard({
48711
49694
  const newAgentWidgetIds = widgets.filter((w) => w.type === "agent" && !originalWidgetIdsRef.current.has(w.id)).map((w) => w.id);
48712
49695
  const hasFilterWidget = widgets.some((w) => w.type === "filters");
48713
49696
  try {
49697
+ const widgetsToSave = widgets.map((widget) => __spreadProps$1(__spreadValues$1({}, widget), {
49698
+ config: __spreadProps$1(__spreadValues$1({}, widget.config), {
49699
+ isFirstLoad: false
49700
+ }),
49701
+ position: {
49702
+ x: widget.position_x,
49703
+ y: widget.position_y,
49704
+ width: widget.width,
49705
+ height: widget.height
49706
+ }
49707
+ }));
49708
+ widgetsToSave.forEach((w) => {
49709
+ var _a;
49710
+ if ((_a = w.config) == null ? void 0 : _a.chartSettings) {
49711
+ console.log(`[WidgetDashboard] Saving widget ${w.id} with chartSettings:`, w.config.chartSettings);
49712
+ }
49713
+ });
48714
49714
  const response = await fetch(getApiUrl(`/api/pages/${pageId}`), {
48715
49715
  method: "PUT",
48716
49716
  headers: {
@@ -48719,17 +49719,7 @@ function WidgetDashboard({
48719
49719
  body: JSON.stringify(__spreadProps$1(__spreadValues$1({
48720
49720
  id: pageId
48721
49721
  }, pageData), {
48722
- widgets: widgets.map((widget) => __spreadProps$1(__spreadValues$1({}, widget), {
48723
- config: __spreadProps$1(__spreadValues$1({}, widget.config), {
48724
- isFirstLoad: false
48725
- }),
48726
- position: {
48727
- x: widget.position_x,
48728
- y: widget.position_y,
48729
- width: widget.width,
48730
- height: widget.height
48731
- }
48732
- }))
49722
+ widgets: widgetsToSave
48733
49723
  }))
48734
49724
  });
48735
49725
  if (!response.ok) {
@@ -49173,7 +50163,7 @@ function WidgetDashboard({
49173
50163
  const badgeInfo = filterStatus ? getFilterStatusBadge(filterStatus.status) : null;
49174
50164
  const isFocusMode = focusWidgetId && w.id === focusWidgetId;
49175
50165
  const widgetBaseStyles = "rounded-xl border-2 border-gray-300 !bg-white";
49176
- const widgetHoverStyles = "hover:border-primary-500 hover:shadow-lg transition-all duration-200 cursor-pointer";
50166
+ const widgetHoverStyles = isEditing ? "hover:border-primary-500 hover:shadow-lg transition-all duration-200 cursor-pointer" : "";
49177
50167
  const widgetShadow = "shadow-[0_4px_12px_-2px_rgba(0,0,0,0.2)]";
49178
50168
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-widget-id": w.id, className: `${w.type === "text" || w.type === "spacer" ? `${((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.content) == null ? void 0 : _b.divider) === "yes" && "border-b border-gray-300"} ${isEditing ? `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles}` : "flex items-center"}` : `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles} p-4 ${isEditing ? "pb-14" : "pb-5"}`} ${isFocusMode ? "h-full" : ""} relative overflow-hidden`, children: [
49179
50169
  w.type === "agent" && badgeInfo && !isApplyingFilters && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 right-2 z-10", title: (filterStatus == null ? void 0 : filterStatus.reason) || (filterStatus == null ? void 0 : filterStatus.error) || "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, { variant: badgeInfo.variant, className: "text-[10px] px-2 py-0.5 gap-1", children: [
@@ -49202,7 +50192,7 @@ function WidgetDashboard({
49202
50192
  w.type !== "spacer" && w.type !== "chatbot" && /* @__PURE__ */ jsxRuntimeExports.jsx(Edit, { onClick: () => onClickSettings && onClickSettings(w), className: "w-5 h-5 text-gray-600" })
49203
50193
  ] })
49204
50194
  ] }),
49205
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${(w == null ? void 0 : w.type) === "text" || (w == null ? void 0 : w.type) === "spacer" ? `${isEditing ? "px-4" : ""}` : "h-full"} w-full relative`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter((widget) => widget.type !== "chatbot").map((widget) => widget.id), datasetId, pageId, onApplyFilters, isEditing, dashboardName: ((_c = pageData == null ? void 0 : pageData.basic) == null ? void 0 : _c.title) || (pageData == null ? void 0 : pageData.name) || (pageData == null ? void 0 : pageData.title), onClearChat: handleClearChat, isClearing: clearingChatWidget }) })
50195
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${(w == null ? void 0 : w.type) === "text" || (w == null ? void 0 : w.type) === "spacer" ? `${isEditing ? "px-4" : ""}` : "h-full"} w-full relative`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter((widget) => widget.type !== "chatbot").map((widget) => widget.id), datasetId, pageId, onApplyFilters, isEditing, dashboardName: ((_c = pageData == null ? void 0 : pageData.basic) == null ? void 0 : _c.title) || (pageData == null ? void 0 : pageData.name) || (pageData == null ? void 0 : pageData.title), onClearChat: handleClearChat, isClearing: clearingChatWidget, onConfigUpdate: handleConfigUpdate }) })
49206
50196
  ] }, w.id);
49207
50197
  })
49208
50198
  }