@magemetrics/ai 0.0.27 → 0.0.29

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.
@@ -12259,7 +12259,7 @@ class RealtimeClient {
12259
12259
  close: () => {
12260
12260
  this.conn = null;
12261
12261
  }
12262
- }), import("./browser-BwTlMJQO.js").then((R) => R.b).then(({ default: R }) => {
12262
+ }), import("./browser-P0ubu0oY.js").then((R) => R.b).then(({ default: R }) => {
12263
12263
  this.conn = new R(this.endpointURL(), void 0, {
12264
12264
  headers: this.headers
12265
12265
  }), this.setupConnection();
@@ -33117,17 +33117,21 @@ const AnalyzeRequestSchema = z$1.object({
33117
33117
  }).array()
33118
33118
  });
33119
33119
  z$1.object({
33120
- matched_from_descriptions: z$1.number().array(),
33121
- matched_from_values: z$1.number().array()
33120
+ id: z$1.number(),
33121
+ flow_data_id: z$1.number(),
33122
+ created_at: z$1.string(),
33123
+ updated_at: z$1.string(),
33124
+ response_type: z$1.string(),
33125
+ summary: z$1.string()
33122
33126
  });
33123
33127
  z$1.object({
33124
33128
  findings: z$1.object({
33125
33129
  title: z$1.string(),
33126
33130
  value: z$1.string(),
33127
- subtitle_sentiment: z$1.enum(["positive", "negative", "neutral"]),
33128
- subtitle_value: z$1.string(),
33129
- subtitle_description: z$1.string(),
33130
- info_description: z$1.string(),
33131
+ subtitleSentiment: z$1.enum(["positive", "negative", "neutral"]),
33132
+ subtitleValue: z$1.string(),
33133
+ subtitleDescription: z$1.string(),
33134
+ infoDescription: z$1.string(),
33131
33135
  sql: z$1.string()
33132
33136
  }).array()
33133
33137
  });
@@ -33145,24 +33149,13 @@ const VisualizationConfigGenerationSchema = z$1.object({
33145
33149
  created_at: z$1.string(),
33146
33150
  configuration: VisualizationConfigGenerationSchema.shape.plot_configuration,
33147
33151
  data_transformation: VisualizationConfigGenerationSchema.shape.transformation
33148
- });
33149
- z$1.object({
33150
- title: z$1.string(),
33151
- description: z$1.string()
33152
- });
33153
- const FlowSteps = {
33152
+ }), FlowSteps = {
33154
33153
  analyzeRequest: "analyze_request",
33155
33154
  shortlistColumns: "shortlist_columns",
33156
33155
  executeProcedure: "execute_procedure",
33157
- listInsights: "list_insights",
33158
- executeInsights: "execute_insights",
33159
- summarizeKeyFindings: "summarize_insights",
33160
- // TODO: Change reference name in the agentic workflow
33161
- graphProcedure: "visualization_procedure",
33162
- confidenceScore: "confidence_score",
33163
33156
  columnsLineage: "columns_lineage",
33164
- viewGraphs: "visualization_config_generation",
33165
- dashboard: "dashboard"
33157
+ confidenceScore: "confidence_score",
33158
+ summarizeKeyFindings: "summarize_insights"
33166
33159
  };
33167
33160
  var dayjs_min$1 = { exports: {} }, dayjs_min = dayjs_min$1.exports, hasRequiredDayjs_min;
33168
33161
  function requireDayjs_min() {
@@ -43434,7 +43427,7 @@ const defaultProps$s = {}, ModalCloseButton = factory((C, R) => {
43434
43427
  });
43435
43428
  ModalCloseButton.classes = classes$b;
43436
43429
  ModalCloseButton.displayName = "@mantine/core/ModalCloseButton";
43437
- const defaultProps$r = {}, ModalContent = factory((C, R) => {
43430
+ const defaultProps$r = {}, ModalContent$1 = factory((C, R) => {
43438
43431
  const M = useProps("ModalContent", defaultProps$r, C), { classNames: D, className: F, style: H, styles: U, vars: q, children: G, __hidden: Z, ...Y } = M, Q = useModalContext(), J = Q.scrollAreaComponent || NativeScrollArea;
43439
43432
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
43440
43433
  ModalBaseContent,
@@ -43458,8 +43451,8 @@ const defaultProps$r = {}, ModalContent = factory((C, R) => {
43458
43451
  }
43459
43452
  );
43460
43453
  });
43461
- ModalContent.classes = classes$b;
43462
- ModalContent.displayName = "@mantine/core/ModalContent";
43454
+ ModalContent$1.classes = classes$b;
43455
+ ModalContent$1.displayName = "@mantine/core/ModalContent";
43463
43456
  const defaultProps$q = {}, ModalHeader = factory((C, R) => {
43464
43457
  const M = useProps("ModalHeader", defaultProps$q, C), { classNames: D, className: F, style: H, styles: U, vars: q, ...G } = M, Z = useModalContext();
43465
43458
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -43634,7 +43627,7 @@ const defaultProps$m = {
43634
43627
  }
43635
43628
  ),
43636
43629
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
43637
- ModalContent,
43630
+ ModalContent$1,
43638
43631
  {
43639
43632
  radius: G,
43640
43633
  __hidden: te && Y && Z ? Y !== te.currentId : !1,
@@ -43655,7 +43648,7 @@ Modal.classes = classes$b;
43655
43648
  Modal.displayName = "@mantine/core/Modal";
43656
43649
  Modal.Root = ModalRoot;
43657
43650
  Modal.Overlay = ModalOverlay;
43658
- Modal.Content = ModalContent;
43651
+ Modal.Content = ModalContent$1;
43659
43652
  Modal.Body = ModalBody;
43660
43653
  Modal.Header = ModalHeader;
43661
43654
  Modal.Title = ModalTitle;
@@ -47431,6 +47424,7 @@ const SuccessVersion$4 = z$1.object({
47431
47424
  status: z$1.literal("success"),
47432
47425
  public: z$1.object({}),
47433
47426
  private: z$1.object({
47427
+ message: z$1.string().optional(),
47434
47428
  columns: z$1.object({
47435
47429
  id: z$1.number(),
47436
47430
  name: z$1.string(),
@@ -47490,6 +47484,7 @@ const SuccessVersion$4 = z$1.object({
47490
47484
  status: z$1.literal("success"),
47491
47485
  public: z$1.object({}),
47492
47486
  private: z$1.object({
47487
+ message: z$1.string().optional(),
47493
47488
  columns: z$1.object({
47494
47489
  id: z$1.number(),
47495
47490
  name: z$1.string(),
@@ -55942,7 +55937,7 @@ const InsightsMessage = ({ children: C, tagText: R, isActive: M, ...D }) => {
55942
55937
  "data-active": M,
55943
55938
  "data-hovered": F,
55944
55939
  sx: () => ({
55945
- background: "white",
55940
+ background: "var(--mantine-color-white)",
55946
55941
  "&[data-hovered=true]": {
55947
55942
  background: "var(--mantine-color-mageWhisper-10)"
55948
55943
  },
@@ -56227,6 +56222,42 @@ const InsightsMessage = ({ children: C, tagText: R, isActive: M, ...D }) => {
56227
56222
  }
56228
56223
  }
56229
56224
  }
56225
+ }), RetrieveFlow = createRoute({
56226
+ method: "get",
56227
+ path: "/api/v1/flows/{flowId}",
56228
+ operationId: "retrieveFlow",
56229
+ request: {
56230
+ headers: SupabaseHeaderSchema,
56231
+ params: FlowIdParam
56232
+ },
56233
+ responses: {
56234
+ 200: {
56235
+ description: "The flow with its steps",
56236
+ content: {
56237
+ "application/json": {
56238
+ schema: FlowSchema
56239
+ }
56240
+ }
56241
+ },
56242
+ 404: {
56243
+ content: {
56244
+ "application/json": {
56245
+ schema: z$1.object({ error: z$1.string() })
56246
+ }
56247
+ },
56248
+ description: "Unable to retrieve flow with this id"
56249
+ },
56250
+ 500: {
56251
+ description: "Something wrong happened",
56252
+ content: {
56253
+ "application/json": {
56254
+ schema: z$1.object({
56255
+ error: z$1.string()
56256
+ })
56257
+ }
56258
+ }
56259
+ }
56260
+ }
56230
56261
  }), End2EndApiResponseSchema = z$1.discriminatedUnion("status", [
56231
56262
  z$1.object({
56232
56263
  status: z$1.literal("error"),
@@ -56248,7 +56279,7 @@ const InsightsMessage = ({ children: C, tagText: R, isActive: M, ...D }) => {
56248
56279
  "application/json": {
56249
56280
  schema: z$1.object({
56250
56281
  userQuery: z$1.string(),
56251
- runVisualizations: z$1.boolean().optional().default(!0),
56282
+ runVisualizations: z$1.boolean().optional().default(!1),
56252
56283
  runKeyFindings: z$1.boolean().optional().default(!0)
56253
56284
  })
56254
56285
  }
@@ -56279,33 +56310,7 @@ const InsightsMessage = ({ children: C, tagText: R, isActive: M, ...D }) => {
56279
56310
  U.length > 0 && (F.filter = U);
56280
56311
  }
56281
56312
  return F;
56282
- }, flowQueryOptions = (C) => ({
56283
- queryKey: ["flow", { flowId: C }],
56284
- queryFn: async () => {
56285
- if (!C || !supabase) return null;
56286
- const { data: R, error: M } = await supabase.from("flows").select("*, flow_steps(*)").eq("id", C).order("created_at", {
56287
- referencedTable: "flow_steps",
56288
- ascending: !0
56289
- }).single();
56290
- if (M)
56291
- throw new Error(M.message);
56292
- return FlowSchema.parse(R);
56293
- }
56294
- }), useFlow = (C) => useQuery({
56295
- ...flowQueryOptions(C),
56296
- enabled: !!C,
56297
- refetchIntervalInBackground: !1,
56298
- refetchInterval: (R) => {
56299
- var G;
56300
- if (!((G = R.state.data) != null && G.flow_steps.length))
56301
- return 1e3;
56302
- const D = R.state.data.flow_steps, F = Object.values(FlowSteps);
56303
- if (D.some((Z) => Z.status === "failed")) return;
56304
- const U = D.filter((Z) => Z.status === "completed").map((Z) => Z.name);
56305
- if (!F.every((Z) => U.includes(Z)))
56306
- return 1e3;
56307
- }
56308
- }), useStartFlow = (C) => useMutation({
56313
+ }, useStartFlow = (C) => useMutation({
56309
56314
  mutationFn: async (R) => {
56310
56315
  const M = await withAuthTokens(supabase), { data: D } = await client.POST(RunEnd2EndFlowRoute.path, {
56311
56316
  params: { ...M },
@@ -56425,31 +56430,13 @@ const InsightsMessage = ({ children: C, tagText: R, isActive: M, ...D }) => {
56425
56430
  getNextPageParam: (D, F) => D.length < R ? null : F.length,
56426
56431
  refetchOnWindowFocus: !1,
56427
56432
  placeholderData: keepPreviousData
56428
- }), useFirstFlowDataId = (C) => {
56429
- const R = useContextReady();
56430
- return useQuery({
56431
- queryKey: ["firstFlowDataId", { flowId: C }],
56432
- staleTime: 1 / 0,
56433
- enabled: R,
56434
- queryFn: async () => {
56435
- const M = await (supabase == null ? void 0 : supabase.from("flow_data").select("id").eq("flow_id", C).order("created_at", { ascending: !0 }).limit(1).maybeSingle());
56436
- if (!M)
56437
- throw new Error("No flow data found");
56438
- const { data: D, error: F } = M;
56439
- if (F)
56440
- throw new Error(
56441
- `Failed to fetch first flow_data_id for flow ${C}`
56442
- );
56443
- return D == null ? void 0 : D.id;
56444
- }
56445
- });
56446
- }, recentFlowsQueryOptions = (C) => ({
56433
+ }), recentFlowsQueryOptions = (C) => ({
56447
56434
  queryKey: ["recentFlows", C],
56448
56435
  queryFn: async () => {
56449
56436
  if (!supabase) return [];
56450
56437
  const { data: R, error: M } = await supabase.from("flows").select("*, flow_steps(*)").order("created_at", {
56451
56438
  ascending: !1
56452
- }).limit(10);
56439
+ }).limit(C || 10);
56453
56440
  if (M)
56454
56441
  throw new Error(M.message);
56455
56442
  return R.map((D) => FlowSchema.parse(D));
@@ -79246,7 +79233,7 @@ const MotionStack$1 = motion.create(Stack), AnimatedBox = ({ children: C }) => /
79246
79233
  border: "1px solid var(--mantine-color-mageGunmetal-1)"
79247
79234
  },
79248
79235
  '& [data-active="true"]': {
79249
- backgroundColor: "white",
79236
+ backgroundColor: "var(--mantine-color-white)",
79250
79237
  borderBottom: 0
79251
79238
  }
79252
79239
  }),
@@ -79280,7 +79267,7 @@ const MotionStack$1 = motion.create(Stack), AnimatedBox = ({ children: C }) => /
79280
79267
  overflow: "hidden",
79281
79268
  display: "flex",
79282
79269
  flexDirection: "column",
79283
- backgroundColor: "white",
79270
+ backgroundColor: "var(--mantine-color-white)",
79284
79271
  border: "1px solid var(--mantine-color-mageGunmetal-1)",
79285
79272
  borderTop: 0,
79286
79273
  borderBottomLeftRadius: "var(--mantine-radius-md)",
@@ -79310,7 +79297,7 @@ const MotionStack$1 = motion.create(Stack), AnimatedBox = ({ children: C }) => /
79310
79297
  overflow: "hidden",
79311
79298
  display: "flex",
79312
79299
  flexDirection: "column",
79313
- backgroundColor: "white",
79300
+ backgroundColor: "var(--mantine-color-white)",
79314
79301
  border: "1px solid var(--mantine-color-mageGunmetal-1)",
79315
79302
  borderTop: 0,
79316
79303
  borderBottomLeftRadius: "var(--mantine-radius-md)",
@@ -85425,7 +85412,7 @@ const TableBody$1 = ({ table: C, virtualizer: R, ...M }) => {
85425
85412
  {
85426
85413
  h: `${q.size}px`,
85427
85414
  style: {
85428
- backgroundColor: q.index % 2 === 0 ? "var(--table-striped-color)" : "white",
85415
+ backgroundColor: q.index % 2 === 0 ? "var(--table-striped-color)" : "var(--mantine-color-white)",
85429
85416
  overflow: "hidden"
85430
85417
  },
85431
85418
  children: Z.getVisibleCells().map((Y) => /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -94131,7 +94118,7 @@ const Dagre = /* @__PURE__ */ getDefaultExportFromCjs(dagreExports), getLayouted
94131
94118
  }) }, D.id)) }), CellContent$1 = ({ formattedValue: { display: C } }) => C === "empty" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { span: !0, ff: "heading", c: "dimmed", size: "sm", truncate: "end", children: "empty" }) : C, sortingFn = (C, R, M) => {
94132
94119
  const D = C.getValue(M), F = R.getValue(M), H = isFormattedData(D) ? D.sortValue : null, U = isFormattedData(F) ? F.sortValue : null;
94133
94120
  return H === null && U === null ? 0 : H === null ? -1 : U === null ? 1 : H instanceof Date && U instanceof Date ? H.getTime() - U.getTime() : typeof H == "number" && typeof U == "number" ? H - U : String(H).localeCompare(String(U));
94134
- }, columnHelper$1 = createColumnHelper(), formatColumnName = (C) => C.split("_").map((D) => D.length === 0 ? "" : D.charAt(0).toUpperCase() + D.slice(1)).join(" "), InfiniteTable = ({ dataColumns: C, virtualizer: R, data: M, tableRef: D, explainability: F }) => {
94121
+ }, columnHelper$1 = createColumnHelper(), formatColumnName$1 = (C) => C.split("_").map((D) => D.length === 0 ? "" : D.charAt(0).toUpperCase() + D.slice(1)).join(" "), InfiniteTable = ({ dataColumns: C, virtualizer: R, data: M, tableRef: D, explainability: F }) => {
94135
94122
  const H = reactExports.useMemo(() => M ? M.map((G) => {
94136
94123
  const Z = {};
94137
94124
  for (const [Y, Q] of Object.entries(G))
@@ -94141,7 +94128,7 @@ const Dagre = /* @__PURE__ */ getDefaultExportFromCjs(dagreExports), getLayouted
94141
94128
  ({ name: G }) => columnHelper$1.accessor(G, {
94142
94129
  minSize: 100,
94143
94130
  maxSize: 200,
94144
- header: () => formatColumnName(G),
94131
+ header: () => formatColumnName$1(G),
94145
94132
  cell: (Z) => /* @__PURE__ */ jsxRuntimeExports.jsx(CellContent$1, { formattedValue: Z.getValue() }),
94146
94133
  sortingFn
94147
94134
  })
@@ -95024,7 +95011,360 @@ const DataReportContent = ({
95024
95011
  ]
95025
95012
  }
95026
95013
  );
95027
- }, TableBody = ({ table: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1.Tbody, { ...R, children: C.getRowModel().rows.map((M) => /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1.Tr, { children: M.getVisibleCells().map((D) => /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1.Td, { maw: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { span: !0, ff: "monospace", size: "sm", truncate: "end", children: flexRender(D.column.columnDef.cell, D.getContext()) }) }, D.id)) }, M.id)) }), TemplateNode = ({
95014
+ }, t = Symbol.for("@ts-pattern/matcher"), e = Symbol.for("@ts-pattern/isVariadic"), n = "@ts-pattern/anonymous-select-key", r = (C) => !!(C && typeof C == "object"), i = (C) => C && !!C[t], o = (C, R, M) => {
95015
+ if (i(C)) {
95016
+ const D = C[t](), { matched: F, selections: H } = D.match(R);
95017
+ return F && H && Object.keys(H).forEach((U) => M(U, H[U])), F;
95018
+ }
95019
+ if (r(C)) {
95020
+ if (!r(R)) return !1;
95021
+ if (Array.isArray(C)) {
95022
+ if (!Array.isArray(R)) return !1;
95023
+ let D = [], F = [], H = [];
95024
+ for (const U of C.keys()) {
95025
+ const q = C[U];
95026
+ i(q) && q[e] ? H.push(q) : H.length ? F.push(q) : D.push(q);
95027
+ }
95028
+ if (H.length) {
95029
+ if (H.length > 1) throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
95030
+ if (R.length < D.length + F.length) return !1;
95031
+ const U = R.slice(0, D.length), q = F.length === 0 ? [] : R.slice(-F.length), G = R.slice(D.length, F.length === 0 ? 1 / 0 : -F.length);
95032
+ return D.every((Z, Y) => o(Z, U[Y], M)) && F.every((Z, Y) => o(Z, q[Y], M)) && (H.length === 0 || o(H[0], G, M));
95033
+ }
95034
+ return C.length === R.length && C.every((U, q) => o(U, R[q], M));
95035
+ }
95036
+ return Reflect.ownKeys(C).every((D) => {
95037
+ const F = C[D];
95038
+ return (D in R || i(H = F) && H[t]().matcherType === "optional") && o(F, R[D], M);
95039
+ var H;
95040
+ });
95041
+ }
95042
+ return Object.is(R, C);
95043
+ }, s = (C) => {
95044
+ var R, M, D;
95045
+ return r(C) ? i(C) ? (R = (M = (D = C[t]()).getSelectionKeys) == null ? void 0 : M.call(D)) != null ? R : [] : Array.isArray(C) ? c(C, s) : c(Object.values(C), s) : [];
95046
+ }, c = (C, R) => C.reduce((M, D) => M.concat(R(D)), []);
95047
+ function a(...C) {
95048
+ if (C.length === 1) {
95049
+ const [R] = C;
95050
+ return (M) => o(R, M, () => {
95051
+ });
95052
+ }
95053
+ if (C.length === 2) {
95054
+ const [R, M] = C;
95055
+ return o(R, M, () => {
95056
+ });
95057
+ }
95058
+ throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${C.length}.`);
95059
+ }
95060
+ function u(C) {
95061
+ return Object.assign(C, { optional: () => h(C), and: (R) => m(C, R), or: (R) => d(C, R), select: (R) => R === void 0 ? y(C) : y(R, C) });
95062
+ }
95063
+ function l(C) {
95064
+ return Object.assign(((R) => Object.assign(R, { [Symbol.iterator]() {
95065
+ let M = 0;
95066
+ const D = [{ value: Object.assign(R, { [e]: !0 }), done: !1 }, { done: !0, value: void 0 }];
95067
+ return { next: () => {
95068
+ var F;
95069
+ return (F = D[M++]) != null ? F : D.at(-1);
95070
+ } };
95071
+ } }))(C), { optional: () => l(h(C)), select: (R) => l(R === void 0 ? y(C) : y(R, C)) });
95072
+ }
95073
+ function h(C) {
95074
+ return u({ [t]: () => ({ match: (R) => {
95075
+ let M = {};
95076
+ const D = (F, H) => {
95077
+ M[F] = H;
95078
+ };
95079
+ return R === void 0 ? (s(C).forEach((F) => D(F, void 0)), { matched: !0, selections: M }) : { matched: o(C, R, D), selections: M };
95080
+ }, getSelectionKeys: () => s(C), matcherType: "optional" }) });
95081
+ }
95082
+ const f = (C, R) => {
95083
+ for (const M of C) if (!R(M)) return !1;
95084
+ return !0;
95085
+ }, g = (C, R) => {
95086
+ for (const [M, D] of C.entries()) if (!R(D, M)) return !1;
95087
+ return !0;
95088
+ };
95089
+ function m(...C) {
95090
+ return u({ [t]: () => ({ match: (R) => {
95091
+ let M = {};
95092
+ const D = (F, H) => {
95093
+ M[F] = H;
95094
+ };
95095
+ return { matched: C.every((F) => o(F, R, D)), selections: M };
95096
+ }, getSelectionKeys: () => c(C, s), matcherType: "and" }) });
95097
+ }
95098
+ function d(...C) {
95099
+ return u({ [t]: () => ({ match: (R) => {
95100
+ let M = {};
95101
+ const D = (F, H) => {
95102
+ M[F] = H;
95103
+ };
95104
+ return c(C, s).forEach((F) => D(F, void 0)), { matched: C.some((F) => o(F, R, D)), selections: M };
95105
+ }, getSelectionKeys: () => c(C, s), matcherType: "or" }) });
95106
+ }
95107
+ function p(C) {
95108
+ return { [t]: () => ({ match: (R) => ({ matched: !!C(R) }) }) };
95109
+ }
95110
+ function y(...C) {
95111
+ const R = typeof C[0] == "string" ? C[0] : void 0, M = C.length === 2 ? C[1] : typeof C[0] == "string" ? void 0 : C[0];
95112
+ return u({ [t]: () => ({ match: (D) => {
95113
+ let F = { [R ?? n]: D };
95114
+ return { matched: M === void 0 || o(M, D, (H, U) => {
95115
+ F[H] = U;
95116
+ }), selections: F };
95117
+ }, getSelectionKeys: () => [R ?? n].concat(M === void 0 ? [] : s(M)) }) });
95118
+ }
95119
+ function v(C) {
95120
+ return typeof C == "number";
95121
+ }
95122
+ function b(C) {
95123
+ return typeof C == "string";
95124
+ }
95125
+ function w(C) {
95126
+ return typeof C == "bigint";
95127
+ }
95128
+ const S = u(p(function(C) {
95129
+ return !0;
95130
+ })), O = S, j = (C) => Object.assign(u(C), { startsWith: (R) => {
95131
+ return j(m(C, (M = R, p((D) => b(D) && D.startsWith(M)))));
95132
+ var M;
95133
+ }, endsWith: (R) => {
95134
+ return j(m(C, (M = R, p((D) => b(D) && D.endsWith(M)))));
95135
+ var M;
95136
+ }, minLength: (R) => j(m(C, ((M) => p((D) => b(D) && D.length >= M))(R))), length: (R) => j(m(C, ((M) => p((D) => b(D) && D.length === M))(R))), maxLength: (R) => j(m(C, ((M) => p((D) => b(D) && D.length <= M))(R))), includes: (R) => {
95137
+ return j(m(C, (M = R, p((D) => b(D) && D.includes(M)))));
95138
+ var M;
95139
+ }, regex: (R) => {
95140
+ return j(m(C, (M = R, p((D) => b(D) && !!D.match(M)))));
95141
+ var M;
95142
+ } }), K = j(p(b)), x = (C) => Object.assign(u(C), { between: (R, M) => x(m(C, ((D, F) => p((H) => v(H) && D <= H && F >= H))(R, M))), lt: (R) => x(m(C, ((M) => p((D) => v(D) && D < M))(R))), gt: (R) => x(m(C, ((M) => p((D) => v(D) && D > M))(R))), lte: (R) => x(m(C, ((M) => p((D) => v(D) && D <= M))(R))), gte: (R) => x(m(C, ((M) => p((D) => v(D) && D >= M))(R))), int: () => x(m(C, p((R) => v(R) && Number.isInteger(R)))), finite: () => x(m(C, p((R) => v(R) && Number.isFinite(R)))), positive: () => x(m(C, p((R) => v(R) && R > 0))), negative: () => x(m(C, p((R) => v(R) && R < 0))) }), E = x(p(v)), A = (C) => Object.assign(u(C), { between: (R, M) => A(m(C, ((D, F) => p((H) => w(H) && D <= H && F >= H))(R, M))), lt: (R) => A(m(C, ((M) => p((D) => w(D) && D < M))(R))), gt: (R) => A(m(C, ((M) => p((D) => w(D) && D > M))(R))), lte: (R) => A(m(C, ((M) => p((D) => w(D) && D <= M))(R))), gte: (R) => A(m(C, ((M) => p((D) => w(D) && D >= M))(R))), positive: () => A(m(C, p((R) => w(R) && R > 0))), negative: () => A(m(C, p((R) => w(R) && R < 0))) }), P = A(p(w)), T = u(p(function(C) {
95143
+ return typeof C == "boolean";
95144
+ })), B = u(p(function(C) {
95145
+ return typeof C == "symbol";
95146
+ })), _ = u(p(function(C) {
95147
+ return C == null;
95148
+ })), k = u(p(function(C) {
95149
+ return C != null;
95150
+ }));
95151
+ var N = { __proto__: null, matcher: t, optional: h, array: function(...C) {
95152
+ return l({ [t]: () => ({ match: (R) => {
95153
+ if (!Array.isArray(R)) return { matched: !1 };
95154
+ if (C.length === 0) return { matched: !0 };
95155
+ const M = C[0];
95156
+ let D = {};
95157
+ if (R.length === 0) return s(M).forEach((H) => {
95158
+ D[H] = [];
95159
+ }), { matched: !0, selections: D };
95160
+ const F = (H, U) => {
95161
+ D[H] = (D[H] || []).concat([U]);
95162
+ };
95163
+ return { matched: R.every((H) => o(M, H, F)), selections: D };
95164
+ }, getSelectionKeys: () => C.length === 0 ? [] : s(C[0]) }) });
95165
+ }, set: function(...C) {
95166
+ return u({ [t]: () => ({ match: (R) => {
95167
+ if (!(R instanceof Set)) return { matched: !1 };
95168
+ let M = {};
95169
+ if (R.size === 0) return { matched: !0, selections: M };
95170
+ if (C.length === 0) return { matched: !0 };
95171
+ const D = (H, U) => {
95172
+ M[H] = (M[H] || []).concat([U]);
95173
+ }, F = C[0];
95174
+ return { matched: f(R, (H) => o(F, H, D)), selections: M };
95175
+ }, getSelectionKeys: () => C.length === 0 ? [] : s(C[0]) }) });
95176
+ }, map: function(...C) {
95177
+ return u({ [t]: () => ({ match: (R) => {
95178
+ if (!(R instanceof Map)) return { matched: !1 };
95179
+ let M = {};
95180
+ if (R.size === 0) return { matched: !0, selections: M };
95181
+ const D = (q, G) => {
95182
+ M[q] = (M[q] || []).concat([G]);
95183
+ };
95184
+ if (C.length === 0) return { matched: !0 };
95185
+ var F;
95186
+ if (C.length === 1) throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(F = C[0]) == null ? void 0 : F.toString()}`);
95187
+ const [H, U] = C;
95188
+ return { matched: g(R, (q, G) => {
95189
+ const Z = o(H, G, D), Y = o(U, q, D);
95190
+ return Z && Y;
95191
+ }), selections: M };
95192
+ }, getSelectionKeys: () => C.length === 0 ? [] : [...s(C[0]), ...s(C[1])] }) });
95193
+ }, intersection: m, union: d, not: function(C) {
95194
+ return u({ [t]: () => ({ match: (R) => ({ matched: !o(C, R, () => {
95195
+ }) }), getSelectionKeys: () => [], matcherType: "not" }) });
95196
+ }, when: p, select: y, any: S, _: O, string: K, number: E, bigint: P, boolean: T, symbol: B, nullish: _, nonNullable: k, instanceOf: function(C) {
95197
+ return u(p(/* @__PURE__ */ function(R) {
95198
+ return (M) => M instanceof R;
95199
+ }(C)));
95200
+ }, shape: function(C) {
95201
+ return u(p(a(C)));
95202
+ } };
95203
+ class W extends Error {
95204
+ constructor(R) {
95205
+ let M;
95206
+ try {
95207
+ M = JSON.stringify(R);
95208
+ } catch {
95209
+ M = R;
95210
+ }
95211
+ super(`Pattern matching error: no pattern matches value ${M}`), this.input = void 0, this.input = R;
95212
+ }
95213
+ }
95214
+ const $ = { matched: !1, value: void 0 };
95215
+ function z(C) {
95216
+ return new I(C, $);
95217
+ }
95218
+ class I {
95219
+ constructor(R, M) {
95220
+ this.input = void 0, this.state = void 0, this.input = R, this.state = M;
95221
+ }
95222
+ with(...R) {
95223
+ if (this.state.matched) return this;
95224
+ const M = R[R.length - 1], D = [R[0]];
95225
+ let F;
95226
+ R.length === 3 && typeof R[1] == "function" ? F = R[1] : R.length > 2 && D.push(...R.slice(1, R.length - 1));
95227
+ let H = !1, U = {};
95228
+ const q = (Z, Y) => {
95229
+ H = !0, U[Z] = Y;
95230
+ }, G = !D.some((Z) => o(Z, this.input, q)) || F && !F(this.input) ? $ : { matched: !0, value: M(H ? n in U ? U[n] : U : this.input, this.input) };
95231
+ return new I(this.input, G);
95232
+ }
95233
+ when(R, M) {
95234
+ if (this.state.matched) return this;
95235
+ const D = !!R(this.input);
95236
+ return new I(this.input, D ? { matched: !0, value: M(this.input, this.input) } : $);
95237
+ }
95238
+ otherwise(R) {
95239
+ return this.state.matched ? this.state.value : R(this.input);
95240
+ }
95241
+ exhaustive(R = L) {
95242
+ return this.state.matched ? this.state.value : R(this.input);
95243
+ }
95244
+ run() {
95245
+ return this.exhaustive();
95246
+ }
95247
+ returnType() {
95248
+ return this;
95249
+ }
95250
+ }
95251
+ function L(C) {
95252
+ throw new W(C);
95253
+ }
95254
+ const ArtifactPaper = ({ text: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
95255
+ Paper,
95256
+ {
95257
+ withBorder: !0,
95258
+ style: { borderColor: "mageGunmetal.9" },
95259
+ px: "sm",
95260
+ py: 6,
95261
+ ...R,
95262
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "md", fw: 400, truncate: "end", style: { textAlign: "left" }, children: C })
95263
+ }
95264
+ ), GenericError = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { children: "Something went wrong. Please try again later." }), GenericLoading = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { children: "Loading..." }), useTemporaryMessage = (C) => {
95265
+ const [R, M] = reactExports.useState(C), D = reactExports.useRef(!0), F = reactExports.useRef(!1);
95266
+ return reactExports.useEffect(() => {
95267
+ D.current ? D.current = !1 : C && !F.current && (F.current = !0, setTimeout(() => {
95268
+ M(!0);
95269
+ }, 2e3));
95270
+ }, [C]), R;
95271
+ }, flowQueryOptions = (C) => ({
95272
+ queryKey: ["flows", { flowId: C }],
95273
+ queryFn: async () => {
95274
+ if (!C || !supabase) return null;
95275
+ const R = await withAuthTokens(supabase), { data: M, error: D } = await client.GET(RetrieveFlow.path, {
95276
+ params: {
95277
+ ...R,
95278
+ path: { flowId: C }
95279
+ }
95280
+ });
95281
+ if (D)
95282
+ throw new Error(D.error);
95283
+ return M;
95284
+ }
95285
+ }), STEP_NAMES = Object.values(FlowSteps), useFlow = (C) => useQuery({
95286
+ ...flowQueryOptions(C),
95287
+ enabled: !!C,
95288
+ refetchIntervalInBackground: !1,
95289
+ refetchInterval: (R) => {
95290
+ var q;
95291
+ if (!((q = R.state.data) != null && q.flow_steps.length))
95292
+ return 1e3;
95293
+ const D = R.state.data.flow_steps;
95294
+ if (D.some((G) => G.status === "failed")) return;
95295
+ const H = D.filter((G) => G.status === "completed").map((G) => G.name);
95296
+ if (!STEP_NAMES.every((G) => H.includes(G)))
95297
+ return 1e3;
95298
+ }
95299
+ }), useFirstFlowDataId = (C) => {
95300
+ const R = useContextReady();
95301
+ return useQuery({
95302
+ queryKey: ["firstFlowDataId", { flowId: C }],
95303
+ staleTime: 1 / 0,
95304
+ enabled: R,
95305
+ queryFn: async () => {
95306
+ const M = await (supabase == null ? void 0 : supabase.from("flow_data").select("id").eq("flow_id", C).order("created_at", { ascending: !0 }).limit(1).maybeSingle());
95307
+ if (!M)
95308
+ throw new Error("No flow data found");
95309
+ const { data: D, error: F } = M;
95310
+ if (F)
95311
+ throw new Error(
95312
+ `Failed to fetch first flow_data_id for flow ${C}`
95313
+ );
95314
+ return D == null ? void 0 : D.id;
95315
+ }
95316
+ });
95317
+ }, Step = ({
95318
+ title: C,
95319
+ children: R,
95320
+ value: M,
95321
+ rightSection: D,
95322
+ isLast: F,
95323
+ disabled: H
95324
+ }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
95325
+ Accordion.Item,
95326
+ {
95327
+ value: M,
95328
+ styles: {
95329
+ item: {
95330
+ borderBottom: F ? "none" : ""
95331
+ }
95332
+ },
95333
+ children: [
95334
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
95335
+ Accordion.Control,
95336
+ {
95337
+ h: 65,
95338
+ disabled: H,
95339
+ sx: () => ({
95340
+ "&:hover": {
95341
+ backgroundColor: "transparent"
95342
+ }
95343
+ }),
95344
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Group, { align: "center", justify: "space-between", children: [
95345
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Title$1, { tt: "uppercase", size: "lg", fw: 600, children: C }),
95346
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { maw: 300, children: !!D && D })
95347
+ ] })
95348
+ }
95349
+ ),
95350
+ R && /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion.Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { px: "md", children: R }) })
95351
+ ]
95352
+ }
95353
+ ), AnimatedStep = ({
95354
+ children: C,
95355
+ ...R
95356
+ }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
95357
+ motion.span,
95358
+ {
95359
+ initial: { opacity: 0, y: 15 },
95360
+ animate: { opacity: 1, y: 0 },
95361
+ exit: { opacity: 0, y: -15 },
95362
+ transition: { duration: 0.3, ease: "easeInOut" },
95363
+ style: { minWidth: 0, textWrap: "nowrap" },
95364
+ ...R,
95365
+ children: C
95366
+ }
95367
+ ), TableBody = ({ table: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1.Tbody, { ...R, children: C.getRowModel().rows.map((M) => /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1.Tr, { children: M.getVisibleCells().map((D) => /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1.Td, { maw: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { span: !0, ff: "monospace", size: "sm", truncate: "end", children: flexRender(D.column.columnDef.cell, D.getContext()) }) }, D.id)) }, M.id)) }), TemplateNode = ({
95028
95368
  title: C,
95029
95369
  data: { explanation: R }
95030
95370
  }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -95270,7 +95610,7 @@ const DataReportContent = ({
95270
95610
  H.id
95271
95611
  );
95272
95612
  }) }, F.id)) });
95273
- }, MAX_CELL_CHAR_LENGTH = 35, CellContent = ({ formattedValue: { display: C } }) => C === "empty" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { c: "dimmed", size: "sm", truncate: "end", children: "empty" }) : C && C.length > MAX_CELL_CHAR_LENGTH ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { multiline: !0, maw: "25rem", label: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { truncate: "end", children: C }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { truncate: "end", children: C }), columnHelper = createColumnHelper(), Table = ({
95613
+ }, MAX_CELL_CHAR_LENGTH = 35, CellContent = ({ formattedValue: { display: C } }) => C === "empty" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { c: "dimmed", size: "sm", truncate: "end", children: "empty" }) : C && C.length > MAX_CELL_CHAR_LENGTH ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { multiline: !0, maw: "25rem", label: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { truncate: "end", children: C }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { truncate: "end", children: C }), columnHelper = createColumnHelper(), formatColumnName = (C) => C.split("_").map((D) => D.length === 0 ? "" : D.charAt(0).toUpperCase() + D.slice(1)).join(" "), Table = ({
95274
95614
  flowId: C,
95275
95615
  dataColumns: R,
95276
95616
  data: M,
@@ -95290,6 +95630,7 @@ const DataReportContent = ({
95290
95630
  return ce;
95291
95631
  }) : [], [M]), ne = reactExports.useMemo(() => R && R.length > 0 ? R.map(
95292
95632
  ({ name: se }) => columnHelper.accessor(se, {
95633
+ header: () => formatColumnName(se),
95293
95634
  cell: (ce) => /* @__PURE__ */ jsxRuntimeExports.jsx(CellContent, { formattedValue: ce.getValue() })
95294
95635
  })
95295
95636
  ) : [], [R]), oe = useReactTable({
@@ -95454,314 +95795,7 @@ const DataReportContent = ({
95454
95795
  U ? dayjs(U).startOf("hour").format("DD MMM. YYYY, [at] ha") : "Loading..."
95455
95796
  ] })
95456
95797
  ] });
95457
- }, t = Symbol.for("@ts-pattern/matcher"), e = Symbol.for("@ts-pattern/isVariadic"), n = "@ts-pattern/anonymous-select-key", r = (C) => !!(C && typeof C == "object"), i = (C) => C && !!C[t], o = (C, R, M) => {
95458
- if (i(C)) {
95459
- const D = C[t](), { matched: F, selections: H } = D.match(R);
95460
- return F && H && Object.keys(H).forEach((U) => M(U, H[U])), F;
95461
- }
95462
- if (r(C)) {
95463
- if (!r(R)) return !1;
95464
- if (Array.isArray(C)) {
95465
- if (!Array.isArray(R)) return !1;
95466
- let D = [], F = [], H = [];
95467
- for (const U of C.keys()) {
95468
- const q = C[U];
95469
- i(q) && q[e] ? H.push(q) : H.length ? F.push(q) : D.push(q);
95470
- }
95471
- if (H.length) {
95472
- if (H.length > 1) throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
95473
- if (R.length < D.length + F.length) return !1;
95474
- const U = R.slice(0, D.length), q = F.length === 0 ? [] : R.slice(-F.length), G = R.slice(D.length, F.length === 0 ? 1 / 0 : -F.length);
95475
- return D.every((Z, Y) => o(Z, U[Y], M)) && F.every((Z, Y) => o(Z, q[Y], M)) && (H.length === 0 || o(H[0], G, M));
95476
- }
95477
- return C.length === R.length && C.every((U, q) => o(U, R[q], M));
95478
- }
95479
- return Reflect.ownKeys(C).every((D) => {
95480
- const F = C[D];
95481
- return (D in R || i(H = F) && H[t]().matcherType === "optional") && o(F, R[D], M);
95482
- var H;
95483
- });
95484
- }
95485
- return Object.is(R, C);
95486
- }, s = (C) => {
95487
- var R, M, D;
95488
- return r(C) ? i(C) ? (R = (M = (D = C[t]()).getSelectionKeys) == null ? void 0 : M.call(D)) != null ? R : [] : Array.isArray(C) ? c(C, s) : c(Object.values(C), s) : [];
95489
- }, c = (C, R) => C.reduce((M, D) => M.concat(R(D)), []);
95490
- function a(...C) {
95491
- if (C.length === 1) {
95492
- const [R] = C;
95493
- return (M) => o(R, M, () => {
95494
- });
95495
- }
95496
- if (C.length === 2) {
95497
- const [R, M] = C;
95498
- return o(R, M, () => {
95499
- });
95500
- }
95501
- throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${C.length}.`);
95502
- }
95503
- function u(C) {
95504
- return Object.assign(C, { optional: () => h(C), and: (R) => m(C, R), or: (R) => d(C, R), select: (R) => R === void 0 ? y(C) : y(R, C) });
95505
- }
95506
- function l(C) {
95507
- return Object.assign(((R) => Object.assign(R, { [Symbol.iterator]() {
95508
- let M = 0;
95509
- const D = [{ value: Object.assign(R, { [e]: !0 }), done: !1 }, { done: !0, value: void 0 }];
95510
- return { next: () => {
95511
- var F;
95512
- return (F = D[M++]) != null ? F : D.at(-1);
95513
- } };
95514
- } }))(C), { optional: () => l(h(C)), select: (R) => l(R === void 0 ? y(C) : y(R, C)) });
95515
- }
95516
- function h(C) {
95517
- return u({ [t]: () => ({ match: (R) => {
95518
- let M = {};
95519
- const D = (F, H) => {
95520
- M[F] = H;
95521
- };
95522
- return R === void 0 ? (s(C).forEach((F) => D(F, void 0)), { matched: !0, selections: M }) : { matched: o(C, R, D), selections: M };
95523
- }, getSelectionKeys: () => s(C), matcherType: "optional" }) });
95524
- }
95525
- const f = (C, R) => {
95526
- for (const M of C) if (!R(M)) return !1;
95527
- return !0;
95528
- }, g = (C, R) => {
95529
- for (const [M, D] of C.entries()) if (!R(D, M)) return !1;
95530
- return !0;
95531
- };
95532
- function m(...C) {
95533
- return u({ [t]: () => ({ match: (R) => {
95534
- let M = {};
95535
- const D = (F, H) => {
95536
- M[F] = H;
95537
- };
95538
- return { matched: C.every((F) => o(F, R, D)), selections: M };
95539
- }, getSelectionKeys: () => c(C, s), matcherType: "and" }) });
95540
- }
95541
- function d(...C) {
95542
- return u({ [t]: () => ({ match: (R) => {
95543
- let M = {};
95544
- const D = (F, H) => {
95545
- M[F] = H;
95546
- };
95547
- return c(C, s).forEach((F) => D(F, void 0)), { matched: C.some((F) => o(F, R, D)), selections: M };
95548
- }, getSelectionKeys: () => c(C, s), matcherType: "or" }) });
95549
- }
95550
- function p(C) {
95551
- return { [t]: () => ({ match: (R) => ({ matched: !!C(R) }) }) };
95552
- }
95553
- function y(...C) {
95554
- const R = typeof C[0] == "string" ? C[0] : void 0, M = C.length === 2 ? C[1] : typeof C[0] == "string" ? void 0 : C[0];
95555
- return u({ [t]: () => ({ match: (D) => {
95556
- let F = { [R ?? n]: D };
95557
- return { matched: M === void 0 || o(M, D, (H, U) => {
95558
- F[H] = U;
95559
- }), selections: F };
95560
- }, getSelectionKeys: () => [R ?? n].concat(M === void 0 ? [] : s(M)) }) });
95561
- }
95562
- function v(C) {
95563
- return typeof C == "number";
95564
- }
95565
- function b(C) {
95566
- return typeof C == "string";
95567
- }
95568
- function w(C) {
95569
- return typeof C == "bigint";
95570
- }
95571
- const S = u(p(function(C) {
95572
- return !0;
95573
- })), O = S, j = (C) => Object.assign(u(C), { startsWith: (R) => {
95574
- return j(m(C, (M = R, p((D) => b(D) && D.startsWith(M)))));
95575
- var M;
95576
- }, endsWith: (R) => {
95577
- return j(m(C, (M = R, p((D) => b(D) && D.endsWith(M)))));
95578
- var M;
95579
- }, minLength: (R) => j(m(C, ((M) => p((D) => b(D) && D.length >= M))(R))), length: (R) => j(m(C, ((M) => p((D) => b(D) && D.length === M))(R))), maxLength: (R) => j(m(C, ((M) => p((D) => b(D) && D.length <= M))(R))), includes: (R) => {
95580
- return j(m(C, (M = R, p((D) => b(D) && D.includes(M)))));
95581
- var M;
95582
- }, regex: (R) => {
95583
- return j(m(C, (M = R, p((D) => b(D) && !!D.match(M)))));
95584
- var M;
95585
- } }), K = j(p(b)), x = (C) => Object.assign(u(C), { between: (R, M) => x(m(C, ((D, F) => p((H) => v(H) && D <= H && F >= H))(R, M))), lt: (R) => x(m(C, ((M) => p((D) => v(D) && D < M))(R))), gt: (R) => x(m(C, ((M) => p((D) => v(D) && D > M))(R))), lte: (R) => x(m(C, ((M) => p((D) => v(D) && D <= M))(R))), gte: (R) => x(m(C, ((M) => p((D) => v(D) && D >= M))(R))), int: () => x(m(C, p((R) => v(R) && Number.isInteger(R)))), finite: () => x(m(C, p((R) => v(R) && Number.isFinite(R)))), positive: () => x(m(C, p((R) => v(R) && R > 0))), negative: () => x(m(C, p((R) => v(R) && R < 0))) }), E = x(p(v)), A = (C) => Object.assign(u(C), { between: (R, M) => A(m(C, ((D, F) => p((H) => w(H) && D <= H && F >= H))(R, M))), lt: (R) => A(m(C, ((M) => p((D) => w(D) && D < M))(R))), gt: (R) => A(m(C, ((M) => p((D) => w(D) && D > M))(R))), lte: (R) => A(m(C, ((M) => p((D) => w(D) && D <= M))(R))), gte: (R) => A(m(C, ((M) => p((D) => w(D) && D >= M))(R))), positive: () => A(m(C, p((R) => w(R) && R > 0))), negative: () => A(m(C, p((R) => w(R) && R < 0))) }), P = A(p(w)), T = u(p(function(C) {
95586
- return typeof C == "boolean";
95587
- })), B = u(p(function(C) {
95588
- return typeof C == "symbol";
95589
- })), _ = u(p(function(C) {
95590
- return C == null;
95591
- })), k = u(p(function(C) {
95592
- return C != null;
95593
- }));
95594
- var N = { __proto__: null, matcher: t, optional: h, array: function(...C) {
95595
- return l({ [t]: () => ({ match: (R) => {
95596
- if (!Array.isArray(R)) return { matched: !1 };
95597
- if (C.length === 0) return { matched: !0 };
95598
- const M = C[0];
95599
- let D = {};
95600
- if (R.length === 0) return s(M).forEach((H) => {
95601
- D[H] = [];
95602
- }), { matched: !0, selections: D };
95603
- const F = (H, U) => {
95604
- D[H] = (D[H] || []).concat([U]);
95605
- };
95606
- return { matched: R.every((H) => o(M, H, F)), selections: D };
95607
- }, getSelectionKeys: () => C.length === 0 ? [] : s(C[0]) }) });
95608
- }, set: function(...C) {
95609
- return u({ [t]: () => ({ match: (R) => {
95610
- if (!(R instanceof Set)) return { matched: !1 };
95611
- let M = {};
95612
- if (R.size === 0) return { matched: !0, selections: M };
95613
- if (C.length === 0) return { matched: !0 };
95614
- const D = (H, U) => {
95615
- M[H] = (M[H] || []).concat([U]);
95616
- }, F = C[0];
95617
- return { matched: f(R, (H) => o(F, H, D)), selections: M };
95618
- }, getSelectionKeys: () => C.length === 0 ? [] : s(C[0]) }) });
95619
- }, map: function(...C) {
95620
- return u({ [t]: () => ({ match: (R) => {
95621
- if (!(R instanceof Map)) return { matched: !1 };
95622
- let M = {};
95623
- if (R.size === 0) return { matched: !0, selections: M };
95624
- const D = (q, G) => {
95625
- M[q] = (M[q] || []).concat([G]);
95626
- };
95627
- if (C.length === 0) return { matched: !0 };
95628
- var F;
95629
- if (C.length === 1) throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(F = C[0]) == null ? void 0 : F.toString()}`);
95630
- const [H, U] = C;
95631
- return { matched: g(R, (q, G) => {
95632
- const Z = o(H, G, D), Y = o(U, q, D);
95633
- return Z && Y;
95634
- }), selections: M };
95635
- }, getSelectionKeys: () => C.length === 0 ? [] : [...s(C[0]), ...s(C[1])] }) });
95636
- }, intersection: m, union: d, not: function(C) {
95637
- return u({ [t]: () => ({ match: (R) => ({ matched: !o(C, R, () => {
95638
- }) }), getSelectionKeys: () => [], matcherType: "not" }) });
95639
- }, when: p, select: y, any: S, _: O, string: K, number: E, bigint: P, boolean: T, symbol: B, nullish: _, nonNullable: k, instanceOf: function(C) {
95640
- return u(p(/* @__PURE__ */ function(R) {
95641
- return (M) => M instanceof R;
95642
- }(C)));
95643
- }, shape: function(C) {
95644
- return u(p(a(C)));
95645
- } };
95646
- class W extends Error {
95647
- constructor(R) {
95648
- let M;
95649
- try {
95650
- M = JSON.stringify(R);
95651
- } catch {
95652
- M = R;
95653
- }
95654
- super(`Pattern matching error: no pattern matches value ${M}`), this.input = void 0, this.input = R;
95655
- }
95656
- }
95657
- const $ = { matched: !1, value: void 0 };
95658
- function z(C) {
95659
- return new I(C, $);
95660
- }
95661
- class I {
95662
- constructor(R, M) {
95663
- this.input = void 0, this.state = void 0, this.input = R, this.state = M;
95664
- }
95665
- with(...R) {
95666
- if (this.state.matched) return this;
95667
- const M = R[R.length - 1], D = [R[0]];
95668
- let F;
95669
- R.length === 3 && typeof R[1] == "function" ? F = R[1] : R.length > 2 && D.push(...R.slice(1, R.length - 1));
95670
- let H = !1, U = {};
95671
- const q = (Z, Y) => {
95672
- H = !0, U[Z] = Y;
95673
- }, G = !D.some((Z) => o(Z, this.input, q)) || F && !F(this.input) ? $ : { matched: !0, value: M(H ? n in U ? U[n] : U : this.input, this.input) };
95674
- return new I(this.input, G);
95675
- }
95676
- when(R, M) {
95677
- if (this.state.matched) return this;
95678
- const D = !!R(this.input);
95679
- return new I(this.input, D ? { matched: !0, value: M(this.input, this.input) } : $);
95680
- }
95681
- otherwise(R) {
95682
- return this.state.matched ? this.state.value : R(this.input);
95683
- }
95684
- exhaustive(R = L) {
95685
- return this.state.matched ? this.state.value : R(this.input);
95686
- }
95687
- run() {
95688
- return this.exhaustive();
95689
- }
95690
- returnType() {
95691
- return this;
95692
- }
95693
- }
95694
- function L(C) {
95695
- throw new W(C);
95696
- }
95697
- const ArtifactPaper = ({ text: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
95698
- Paper,
95699
- {
95700
- withBorder: !0,
95701
- style: { borderColor: "mageGunmetal.9" },
95702
- px: "sm",
95703
- py: 6,
95704
- ...R,
95705
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "md", fw: 400, truncate: "end", style: { textAlign: "left" }, children: C })
95706
- }
95707
- ), GenericError = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { children: "Something went wrong. Please try again later." }), GenericLoading = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { children: "Loading..." }), useTemporaryMessage = (C) => {
95708
- const [R, M] = reactExports.useState(C), D = reactExports.useRef(!0), F = reactExports.useRef(!1);
95709
- return reactExports.useEffect(() => {
95710
- D.current ? D.current = !1 : C && !F.current && (F.current = !0, setTimeout(() => {
95711
- M(!0);
95712
- }, 2e3));
95713
- }, [C]), R;
95714
- }, Step = ({
95715
- title: C,
95716
- children: R,
95717
- value: M,
95718
- rightSection: D,
95719
- isLast: F,
95720
- disabled: H
95721
- }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
95722
- Accordion.Item,
95723
- {
95724
- value: M,
95725
- styles: {
95726
- item: {
95727
- borderBottom: F ? "none" : ""
95728
- }
95729
- },
95730
- children: [
95731
- /* @__PURE__ */ jsxRuntimeExports.jsx(
95732
- Accordion.Control,
95733
- {
95734
- h: 65,
95735
- disabled: H,
95736
- sx: () => ({
95737
- "&:hover": {
95738
- backgroundColor: "transparent"
95739
- }
95740
- }),
95741
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Group, { align: "center", justify: "space-between", children: [
95742
- /* @__PURE__ */ jsxRuntimeExports.jsx(Title$1, { tt: "uppercase", size: "lg", fw: 600, children: C }),
95743
- /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { maw: 300, children: !!D && D })
95744
- ] })
95745
- }
95746
- ),
95747
- R && /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion.Panel, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { px: "md", children: R }) })
95748
- ]
95749
- }
95750
- ), AnimatedStep = ({
95751
- children: C,
95752
- ...R
95753
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
95754
- motion.span,
95755
- {
95756
- initial: { opacity: 0, y: 15 },
95757
- animate: { opacity: 1, y: 0 },
95758
- exit: { opacity: 0, y: -15 },
95759
- transition: { duration: 0.3, ease: "easeInOut" },
95760
- style: { minWidth: 0, textWrap: "nowrap" },
95761
- ...R,
95762
- children: C
95763
- }
95764
- ), useDataStepRenderer = (C) => {
95798
+ }, useDataStepRenderer = (C) => {
95765
95799
  var Z, Y;
95766
95800
  const R = useFlow(C), M = (Z = R.data) == null ? void 0 : Z.flow_steps.find(
95767
95801
  (Q) => Q.name === FlowSteps.shortlistColumns
@@ -95881,10 +95915,10 @@ const ArtifactPaper = ({ text: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.j
95881
95915
  }
95882
95916
  );
95883
95917
  }, AnalyzeRequestRunning = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { children: "We're getting clear on your needs..." }), useStepRenderer = (C) => {
95884
- var G, Z;
95885
- const R = useFlow(C), M = (G = R.data) == null ? void 0 : G.flow_steps.find(
95886
- (Y) => Y.name === FlowSteps.analyzeRequest
95887
- ), D = (M == null ? void 0 : M.status) === "completed", F = useTemporaryMessage(D), H = reactExports.useMemo(() => z(M).with(void 0, () => ({
95918
+ var Z, Y;
95919
+ const R = useFlow(C), M = useMediaQuery(`(max-width: ${em(750)})`), D = (Z = R.data) == null ? void 0 : Z.flow_steps.find(
95920
+ (Q) => Q.name === FlowSteps.analyzeRequest
95921
+ ), F = (D == null ? void 0 : D.status) === "completed", H = useTemporaryMessage(F), U = reactExports.useMemo(() => z(D).with(void 0, () => ({
95888
95922
  rightSection: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedStep, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { children: "Your request" }) }, "tasks-0"),
95889
95923
  content: /* @__PURE__ */ jsxRuntimeExports.jsx(AnalyzeRequestRunning, {})
95890
95924
  })).with({ status: "running" }, () => ({
@@ -95894,12 +95928,12 @@ const ArtifactPaper = ({ text: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.j
95894
95928
  rightSection: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedStep, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { children: "?" }) }, "tasks-2"),
95895
95929
  content: /* @__PURE__ */ jsxRuntimeExports.jsx(GenericError, {})
95896
95930
  })).with({ status: "completed" }, () => {
95897
- var Y, Q;
95931
+ var Q, J;
95898
95932
  return {
95899
- rightSection: F ? /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedStep, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { multiline: !0, w: 350, label: ((Y = R.data) == null ? void 0 : Y.request) || "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
95933
+ rightSection: H ? /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedStep, { children: !M && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { multiline: !0, w: 350, label: ((Q = R.data) == null ? void 0 : Q.request) || "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
95900
95934
  ArtifactPaper,
95901
95935
  {
95902
- text: ((Q = R.data) == null ? void 0 : Q.request) || "",
95936
+ text: ((J = R.data) == null ? void 0 : J.request) || "",
95903
95937
  withBorder: !1
95904
95938
  }
95905
95939
  ) }) }, "tasks-3") : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedStep, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
@@ -95916,10 +95950,10 @@ const ArtifactPaper = ({ text: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.j
95916
95950
  }
95917
95951
  )
95918
95952
  ] }) }, "data-done"),
95919
- content: /* @__PURE__ */ jsxRuntimeExports.jsx(AnalyzeRequestCompleted, { step: M })
95953
+ content: /* @__PURE__ */ jsxRuntimeExports.jsx(AnalyzeRequestCompleted, { step: D })
95920
95954
  };
95921
- }).otherwise(() => null), [M, (Z = R.data) == null ? void 0 : Z.request, F]), U = !!M, q = !M || M.status === "running";
95922
- return { currentStep: H, highlight: U, isLoading: q, allCompleted: D };
95955
+ }).otherwise(() => null), [D, (Y = R.data) == null ? void 0 : Y.request, M, H]), q = !!D, G = !D || D.status === "running";
95956
+ return { currentStep: U, highlight: q, isLoading: G, allCompleted: F };
95923
95957
  }, TaskStep = ({
95924
95958
  isOpened: C,
95925
95959
  flowId: R
@@ -96133,24 +96167,22 @@ const ArtifactPaper = ({ text: C, ...R }) => /* @__PURE__ */ jsxRuntimeExports.j
96133
96167
  }), useRecommendations = () => useQuery(recommendationsQueryOptions()), DEFAULT_EVENTS = ["mousedown", "touchstart"], useShadowClickOutside = (C, R, M) => {
96134
96168
  const D = reactExports.useRef(null);
96135
96169
  return reactExports.useEffect(() => {
96136
- const F = (U) => {
96137
- var Y;
96138
- const { target: q } = U ?? {}, G = (Y = D.current) == null ? void 0 : Y.getRootNode(), Z = G instanceof ShadowRoot;
96170
+ const F = new AbortController(), H = (G) => {
96171
+ var J;
96172
+ const { target: Z } = G ?? {}, Y = (J = D.current) == null ? void 0 : J.getRootNode(), Q = Y instanceof ShadowRoot;
96139
96173
  if (Array.isArray(M)) {
96140
- const Q = (q == null ? void 0 : q.hasAttribute("data-ignore-outside-clicks")) || !document.body.contains(q) && q.tagName !== "HTML", J = U.composedPath();
96141
- M.every((ie) => ie ? !J.includes(ie) : !0) && !Q && C();
96174
+ const te = (Z == null ? void 0 : Z.hasAttribute("data-ignore-outside-clicks")) || !document.body.contains(Z) && Z.tagName !== "HTML", ie = G.composedPath();
96175
+ M.every((oe) => oe ? !ie.includes(oe) : !0) && !te && C();
96142
96176
  } else if (D.current)
96143
- if (Z) {
96144
- const Q = U.composedPath(), J = Q.includes(G), te = Q.includes(D.current);
96145
- (!J || J && !te) && C();
96146
- } else D.current.contains(q) || C();
96147
- }, H = { capture: !0, passive: !0 };
96177
+ if (Q) {
96178
+ const te = G.composedPath(), ie = te.includes(Y), ne = te.includes(D.current);
96179
+ (!ie || ie && !ne) && C();
96180
+ } else D.current.contains(Z) || C();
96181
+ }, U = { capture: !0, passive: !0, signal: F.signal };
96148
96182
  return DEFAULT_EVENTS.forEach(
96149
- (U) => document.addEventListener(U, F, H)
96183
+ (G) => document.addEventListener(G, H, U)
96150
96184
  ), () => {
96151
- DEFAULT_EVENTS.forEach(
96152
- (U) => document.removeEventListener(U, F, H)
96153
- );
96185
+ F.abort();
96154
96186
  };
96155
96187
  }, [D, C, M, R]), D;
96156
96188
  };
@@ -96786,17 +96818,14 @@ function PiFile(C) {
96786
96818
  return GenIcon({ attr: { viewBox: "0 0 256 256", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z" }, child: [] }] })(C);
96787
96819
  }
96788
96820
  const TextSkeleton = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { height: 24 }), RecentDashboardsDropdown = () => {
96789
- const C = useRecentFlows(), [R, M] = reactExports.useState(!1), D = useSetAtom(flowIdAtom), F = reactExports.useMemo(() => {
96790
- var U;
96791
- return (U = C.data) == null ? void 0 : U.slice(0, 5);
96792
- }, [C.data]), H = R ? "#DADADA" : "var(--mantine-color-body)";
96793
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
96821
+ const { data: C, status: R } = useRecentFlows(5), [M, D] = reactExports.useState(!1), F = useSetAtom(flowIdAtom), H = M ? "#DADADA" : "var(--mantine-color-body)";
96822
+ return !C || C.length == 0 ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(
96794
96823
  Popover,
96795
96824
  {
96796
96825
  withinPortal: !1,
96797
96826
  width: 350,
96798
- opened: R,
96799
- onChange: M,
96827
+ opened: M,
96828
+ onChange: D,
96800
96829
  position: "top-start",
96801
96830
  offset: { mainAxis: -1, crossAxis: 0 },
96802
96831
  styles: {
@@ -96811,7 +96840,7 @@ const TextSkeleton = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { hei
96811
96840
  Group,
96812
96841
  {
96813
96842
  gap: 4,
96814
- onClick: () => M((U) => !U),
96843
+ onClick: () => D((U) => !U),
96815
96844
  style: {
96816
96845
  cursor: "pointer",
96817
96846
  userSelect: "none",
@@ -96834,7 +96863,7 @@ const TextSkeleton = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { hei
96834
96863
  size: 18,
96835
96864
  color: "var(--mantine-color-mageGunmetal-1)",
96836
96865
  style: {
96837
- transform: R ? "rotate(-180deg)" : "",
96866
+ transform: M ? "rotate(-180deg)" : "",
96838
96867
  transition: "all 0.2s"
96839
96868
  }
96840
96869
  }
@@ -96842,12 +96871,12 @@ const TextSkeleton = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { hei
96842
96871
  ]
96843
96872
  }
96844
96873
  ) }),
96845
- /* @__PURE__ */ jsxRuntimeExports.jsx(Popover.Dropdown, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Stack, { gap: 2, align: "stretch", children: C.status === "success" ? F == null ? void 0 : F.map((U) => /* @__PURE__ */ jsxRuntimeExports.jsx(
96874
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Popover.Dropdown, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Stack, { gap: 2, align: "stretch", children: R === "success" ? C.map((U) => /* @__PURE__ */ jsxRuntimeExports.jsx(
96846
96875
  Button,
96847
96876
  {
96848
96877
  component: "a",
96849
96878
  onClick: (q) => {
96850
- q.preventDefault(), D(U.id);
96879
+ q.preventDefault(), F(U.id);
96851
96880
  },
96852
96881
  size: "compact-md",
96853
96882
  leftSection: /* @__PURE__ */ jsxRuntimeExports.jsx(PiFile, { size: 14 }),
@@ -96868,6 +96897,7 @@ const TextSkeleton = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { hei
96868
96897
  {
96869
96898
  size: "sm",
96870
96899
  fw: 400,
96900
+ c: "black",
96871
96901
  style: {
96872
96902
  textOverflow: "ellipsis",
96873
96903
  overflow: "hidden",
@@ -96913,6 +96943,9 @@ const TextSkeleton = () => /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { hei
96913
96943
  borderColor: "var(--mantine-primary-color-1)",
96914
96944
  "&::before": {
96915
96945
  opacity: 1
96946
+ },
96947
+ "&::after": {
96948
+ opacity: 0
96916
96949
  }
96917
96950
  },
96918
96951
  "&::after": {
@@ -96968,18 +97001,18 @@ ${M}`);
96968
97001
  ] }) }), Recommendations = ({
96969
97002
  startFlow: C
96970
97003
  }) => {
96971
- const { data: R, status: M } = useRecommendations(), D = reactExports.useMemo(() => R == null ? void 0 : R.slice(0, 3), [R]);
97004
+ const { data: R, status: M } = useRecommendations(), D = useMediaQuery(`(max-width: ${em(750)})`), F = reactExports.useMemo(() => R == null ? void 0 : R.slice(0, 3), [R]);
96972
97005
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { flex: 1, children: [
96973
97006
  /* @__PURE__ */ jsxRuntimeExports.jsx(Title$1, { size: "md", fw: 600, tt: "uppercase", children: "Recommendations based on your data" }),
96974
- /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { wrap: "nowrap", align: "stretch", children: M === "success" ? D == null ? void 0 : D.map((F) => /* @__PURE__ */ jsxRuntimeExports.jsx(
97007
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { wrap: "nowrap", align: "stretch", gap: D ? "xs" : "md", children: M === "success" ? F == null ? void 0 : F.map((H) => /* @__PURE__ */ jsxRuntimeExports.jsx(
96975
97008
  Recommendation,
96976
97009
  {
96977
97010
  startFlow: C,
96978
- starter: F.starter,
96979
- explanation: F.explanation,
96980
- type: F.type
97011
+ starter: H.starter,
97012
+ explanation: H.explanation,
97013
+ type: H.type
96981
97014
  },
96982
- F.starter
97015
+ H.starter
96983
97016
  )) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
96984
97017
  /* @__PURE__ */ jsxRuntimeExports.jsx(RecommendationSkeleton, {}),
96985
97018
  /* @__PURE__ */ jsxRuntimeExports.jsx(RecommendationSkeleton, {}),
@@ -96988,22 +97021,21 @@ ${M}`);
96988
97021
  ] });
96989
97022
  }, MotionStack = motion.create(Stack), MotionModal = motion.create(Modal.Root), ControlledMageMetricsModal = ({
96990
97023
  children: C,
96991
- visible: R,
96992
- onClose: M
97024
+ onClose: R
96993
97025
  }) => {
96994
- const { classes: D } = useModalStyles();
97026
+ const { classes: M } = useModalStyles();
96995
97027
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
96996
97028
  MotionModal,
96997
97029
  {
96998
- opened: R,
97030
+ opened: !0,
96999
97031
  closeOnEscape: !0,
97000
97032
  fullScreen: !0,
97001
- onClose: M,
97033
+ onClose: R,
97002
97034
  transitionProps: { transition: "fade", duration: 200 },
97003
97035
  removeScrollProps: {
97004
97036
  enabled: !1
97005
97037
  },
97006
- className: D.centered,
97038
+ className: M.centered,
97007
97039
  styles: {
97008
97040
  content: {
97009
97041
  display: "flex",
@@ -97041,23 +97073,22 @@ ${M}`);
97041
97073
  ]
97042
97074
  }
97043
97075
  );
97044
- }, StartModal = ({
97076
+ }, ModalContent = ({
97045
97077
  showRecentDashboards: C,
97046
97078
  showRecommendations: R,
97047
- ...M
97079
+ onClose: M
97048
97080
  }) => {
97049
- const [D, F] = reactExports.useState(!1), H = useContextReady(), { classes: U } = useFlowTrackerStyles({}), q = useSetAtom(flowIdAtom), { mutate: G } = useStartFlow({
97081
+ const [D, F] = reactExports.useState(!1), H = useContextReady(), { classes: U } = useFlowTrackerStyles({}), q = useMediaQuery(`(max-width: ${em(750)})`), G = useSetAtom(flowIdAtom), { mutate: Z } = useStartFlow({
97050
97082
  onSuccess: (se) => {
97051
- q(se.flowId);
97083
+ G(se.flowId);
97052
97084
  }
97053
- }), Z = useQueryClient();
97085
+ }), Y = useQueryClient();
97054
97086
  reactExports.useEffect(() => {
97055
- H && (C && Z.prefetchQuery(recentFlowsQueryOptions()), R && Z.prefetchQuery(recommendationsQueryOptions()));
97056
- }, [H, R, C, Z]);
97057
- const Y = useShadowClickOutside(() => {
97058
- var se;
97059
- F(!1), (se = M.onClose) == null || se.call(M);
97060
- }), Q = useForm({
97087
+ H && (C && Y.prefetchQuery(recentFlowsQueryOptions()), R && Y.prefetchQuery(recommendationsQueryOptions()));
97088
+ }, [H, R, C, Y]);
97089
+ const Q = useShadowClickOutside(() => {
97090
+ F(!1), M == null || M();
97091
+ }), J = useForm({
97061
97092
  initialValues: {
97062
97093
  userQuery: ""
97063
97094
  },
@@ -97066,24 +97097,25 @@ ${M}`);
97066
97097
  userQuery: z$1.string().nonempty("Please type in a request")
97067
97098
  })
97068
97099
  )
97069
- }), J = (se) => {
97070
- G(se.trim());
97071
- }, te = reactExports.useMemo(
97072
- () => Q.values.userQuery.length > 30 || /[\r\n]/.test(Q.values.userQuery) ? Q.values.userQuery.slice(0, 30).replace(/[\r\n]/g, " ") + "…" : Q.values.userQuery,
97073
- [Q.values.userQuery]
97074
- ), ie = D && R, ne = D && C, oe = /* @__PURE__ */ jsxRuntimeExports.jsx(
97100
+ }), te = (se) => {
97101
+ Z(se.trim());
97102
+ }, ie = reactExports.useMemo(
97103
+ () => J.values.userQuery.length > 30 || /[\r\n]/.test(J.values.userQuery) ? J.values.userQuery.slice(0, 30).replace(/[\r\n]/g, " ") + "…" : J.values.userQuery,
97104
+ [J.values.userQuery]
97105
+ ), ne = D && R, oe = D && C;
97106
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
97075
97107
  MotionStack,
97076
97108
  {
97077
97109
  flex: 1,
97078
- w: 600,
97110
+ w: q ? "95%" : 600,
97079
97111
  justify: "flex-end",
97080
97112
  style: { alignSelf: "center" },
97081
97113
  initial: "hidden",
97082
97114
  animate: "visible",
97083
97115
  exit: "hidden",
97084
97116
  variants: overlayVariants,
97085
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { pb: "md", ref: Y, children: [
97086
- ie && /* @__PURE__ */ jsxRuntimeExports.jsx(
97117
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { pb: "md", ref: Q, children: [
97118
+ ne && /* @__PURE__ */ jsxRuntimeExports.jsx(
97087
97119
  Paper,
97088
97120
  {
97089
97121
  component: motion.div,
@@ -97099,7 +97131,7 @@ ${M}`);
97099
97131
  shadow: "lg",
97100
97132
  radius: "md",
97101
97133
  style: { overflow: "hidden", originY: 1 },
97102
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Recommendations, { startFlow: J })
97134
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Recommendations, { startFlow: te })
97103
97135
  }
97104
97136
  ),
97105
97137
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -97127,7 +97159,7 @@ ${M}`);
97127
97159
  gap: D ? "xs" : "lg",
97128
97160
  direction: D ? "column" : "row",
97129
97161
  children: [
97130
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Group, { justify: "space-between", children: [
97162
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Group, { justify: "space-between", gap: q ? "xs" : "md", children: [
97131
97163
  /* @__PURE__ */ jsxRuntimeExports.jsx(
97132
97164
  Title$1,
97133
97165
  {
@@ -97139,13 +97171,13 @@ ${M}`);
97139
97171
  children: "Ask your data about"
97140
97172
  }
97141
97173
  ),
97142
- ne && /* @__PURE__ */ jsxRuntimeExports.jsx(RecentDashboardsDropdown, {})
97174
+ oe && /* @__PURE__ */ jsxRuntimeExports.jsx(RecentDashboardsDropdown, {})
97143
97175
  ] }),
97144
97176
  /* @__PURE__ */ jsxRuntimeExports.jsx(
97145
97177
  "form",
97146
97178
  {
97147
- onSubmit: Q.onSubmit(
97148
- (se) => J(se.userQuery)
97179
+ onSubmit: J.onSubmit(
97180
+ (se) => te(se.userQuery)
97149
97181
  ),
97150
97182
  style: { flex: "1" },
97151
97183
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -97169,16 +97201,16 @@ ${M}`);
97169
97201
  }
97170
97202
  },
97171
97203
  rightSectionWidth: 28,
97172
- ...Q.getInputProps("userQuery"),
97173
- value: D ? Q.values.userQuery : te,
97204
+ ...J.getInputProps("userQuery"),
97205
+ value: D ? J.values.userQuery : ie,
97174
97206
  onFocus: () => {
97175
97207
  F(!0);
97176
97208
  },
97177
97209
  onKeyDown: (se) => {
97178
- se.key === "Enter" && !se.shiftKey && (se.preventDefault(), Q.onSubmit((ce) => J(ce.userQuery))());
97210
+ se.key === "Enter" && !se.shiftKey && (se.preventDefault(), J.onSubmit((ce) => te(ce.userQuery))());
97179
97211
  }
97180
97212
  },
97181
- Q.key("userQuery")
97213
+ J.key("userQuery")
97182
97214
  )
97183
97215
  }
97184
97216
  )
@@ -97193,8 +97225,25 @@ ${M}`);
97193
97225
  },
97194
97226
  "request-form"
97195
97227
  );
97196
- return M.onClose != null && M.visible != null ? /* @__PURE__ */ jsxRuntimeExports.jsx(ControlledMageMetricsModal, { visible: M.visible, onClose: M.onClose, children: oe }) : oe;
97197
- }, defaultColors = {
97228
+ }, StartModal = ({
97229
+ showRecentDashboards: C,
97230
+ showRecommendations: R,
97231
+ onClose: M
97232
+ }) => M != null ? /* @__PURE__ */ jsxRuntimeExports.jsx(ControlledMageMetricsModal, { onClose: M, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
97233
+ ModalContent,
97234
+ {
97235
+ showRecentDashboards: C,
97236
+ showRecommendations: R,
97237
+ onClose: M
97238
+ }
97239
+ ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
97240
+ ModalContent,
97241
+ {
97242
+ showRecentDashboards: C,
97243
+ showRecommendations: R,
97244
+ onClose: M
97245
+ }
97246
+ ), defaultColors = {
97198
97247
  mageMagenta: [
97199
97248
  "#EED4EB",
97200
97249
  // 0
@@ -97282,87 +97331,92 @@ ${M}`);
97282
97331
  // 11
97283
97332
  ],
97284
97333
  mageWhisper: [...colorsTuple("#FCFDFD"), "#F7F8F8"]
97285
- }, theme = (C, R) => ({
97286
- cursorType: "pointer",
97287
- colors: R ? {
97288
- mageGunmetal: R.darkAccent,
97289
- mageMagenta: R.primary,
97290
- mageRuby: R.secondary,
97291
- mageWhisper: R.lightAccent
97292
- } : defaultColors,
97293
- white: "var(--mantine-color-mageWhisper-6)",
97294
- black: "var(--mantine-color-mageGunmetal-6)",
97295
- primaryColor: "mageGunmetal",
97296
- fontFamily: "'Bitter Variable', serif",
97297
- fontFamilyMonospace: '"Source Code Pro Variable", monospace',
97298
- headings: { fontFamily: "'Source Sans 3 Variable', sans-serif" },
97299
- other: {
97300
- ctaPrimaryFill: "linear-gradient(180deg, var(--mantine-color-mageGunmetal-6) 0%, var(--mantine-color-mageGunmetal-8) 100%)",
97301
- ctaPrimaryFillDarken: "linear-gradient(180deg, var(--mantine-color-mageGunmetal-7) 0%, var(--mantine-color-mageGunmetal-9) 100%)",
97302
- ctaSuccessFill: "linear-gradient(180deg, #179949 0%, #117035 100%)",
97303
- whiteGradient: "linear-gradient(180deg, var(--mantine-color-mageWhisper-0) 0%, var(--mantine-color-mageGunmetal-0) 100%)",
97304
- rubyGradient: "linear-gradient(91deg, var(--mantine-color-mageRuby-7) 3.36%, var(--mantine-color-mageMagenta-7) 94.28%)",
97305
- rubyShadow: `0px 0px 7px 2px ${alpha$2("var(--mantine-color-mageRuby-7)", 0.3)}`
97306
- },
97307
- components: {
97308
- Tooltip: {
97309
- styles: {
97310
- tooltip: {
97311
- fontFamily: "'Source Sans 3 Variable'",
97312
- fontSize: "var(--mantine-font-size-md)",
97313
- color: "var(--mantine-color-mageWhisper-6)",
97314
- backgroundColor: "var(--mantine-color-mageGunmetal-8)",
97315
- padding: "var(--mantine-spacing-xs) var(--mantine-spacing-sm)",
97316
- lineHeight: 1.8
97317
- }
97318
- }
97334
+ }, theme = (C, R) => {
97335
+ var M, D, F;
97336
+ return {
97337
+ cursorType: "pointer",
97338
+ colors: R ? {
97339
+ mageGunmetal: R.primary,
97340
+ mageMagenta: R.darkAccent,
97341
+ mageRuby: R.secondary,
97342
+ mageWhisper: R.lightAccent
97343
+ } : defaultColors,
97344
+ white: "var(--mantine-color-mageWhisper-6)",
97345
+ black: R ? "black" : "var(--mantine-color-mageGunmetal-6)",
97346
+ primaryColor: "mageGunmetal",
97347
+ fontFamily: ((M = R == null ? void 0 : R.fonts) == null ? void 0 : M.body) || "'Bitter Variable', serif",
97348
+ fontFamilyMonospace: ((D = R == null ? void 0 : R.fonts) == null ? void 0 : D.monospace) || '"Source Code Pro Variable", monospace',
97349
+ headings: {
97350
+ fontFamily: ((F = R == null ? void 0 : R.fonts) == null ? void 0 : F.heading) || "'Source Sans 3 Variable', sans-serif"
97319
97351
  },
97320
- Text: {
97321
- styles: {
97322
- root: {
97323
- fontFamily: "'Bitter Variable'"
97324
- }
97325
- }
97352
+ other: {
97353
+ ctaPrimaryFill: "linear-gradient(180deg, var(--mantine-color-mageGunmetal-6) 0%, var(--mantine-color-mageGunmetal-8) 100%)",
97354
+ ctaPrimaryFillDarken: "linear-gradient(180deg, var(--mantine-color-mageGunmetal-7) 0%, var(--mantine-color-mageGunmetal-9) 100%)",
97355
+ ctaSuccessFill: "linear-gradient(180deg, #179949 0%, #117035 100%)",
97356
+ whiteGradient: "linear-gradient(180deg, var(--mantine-color-mageWhisper-0) 0%, var(--mantine-color-mageGunmetal-0) 100%)",
97357
+ rubyGradient: "linear-gradient(91deg, var(--mantine-color-mageRuby-7) 3.36%, var(--mantine-color-mageMagenta-7) 94.28%)",
97358
+ rubyShadow: `0px 0px 7px 2px ${alpha$2("var(--mantine-color-mageRuby-7)", 0.3)}`
97326
97359
  },
97327
- Badge: {
97328
- styles: {
97329
- root: {
97330
- fontFamily: "'Source Sans 3 Variable'"
97360
+ components: {
97361
+ Tooltip: {
97362
+ styles: {
97363
+ tooltip: {
97364
+ fontFamily: "'Source Sans 3 Variable'",
97365
+ fontSize: "var(--mantine-font-size-md)",
97366
+ color: "var(--mantine-color-mageWhisper-6)",
97367
+ backgroundColor: "var(--mantine-color-mageGunmetal-8)",
97368
+ padding: "var(--mantine-spacing-xs) var(--mantine-spacing-sm)",
97369
+ lineHeight: 1.8
97370
+ }
97331
97371
  }
97332
- }
97333
- },
97334
- Button: {
97335
- styles: {
97336
- root: {
97337
- fontFamily: "'Source Sans 3 Variable'"
97372
+ },
97373
+ Text: {
97374
+ styles: {
97375
+ root: {
97376
+ fontFamily: "'Bitter Variable'"
97377
+ }
97338
97378
  }
97339
- }
97340
- },
97341
- Portal: {
97342
- defaultProps: {
97343
- target: C
97344
- }
97345
- },
97346
- ScrollArea: {
97347
- defaultProps: {
97348
- offsetScrollbars: "present"
97349
- }
97350
- },
97351
- Select: {
97352
- styles: {
97353
- root: {
97354
- fontFamily: "'Source Sans 3 Variable'"
97355
- },
97356
- input: {
97357
- fontFamily: "'Source Sans 3 Variable'"
97358
- },
97359
- section: {
97360
- fontFamily: "'Source Sans 3 Variable'"
97379
+ },
97380
+ Badge: {
97381
+ styles: {
97382
+ root: {
97383
+ fontFamily: "'Source Sans 3 Variable'"
97384
+ }
97385
+ }
97386
+ },
97387
+ Button: {
97388
+ styles: {
97389
+ root: {
97390
+ fontFamily: "'Source Sans 3 Variable'"
97391
+ }
97392
+ }
97393
+ },
97394
+ Portal: {
97395
+ defaultProps: {
97396
+ target: C
97397
+ }
97398
+ },
97399
+ ScrollArea: {
97400
+ defaultProps: {
97401
+ offsetScrollbars: "present"
97402
+ }
97403
+ },
97404
+ Select: {
97405
+ styles: {
97406
+ root: {
97407
+ fontFamily: "'Source Sans 3 Variable'"
97408
+ },
97409
+ input: {
97410
+ fontFamily: "'Source Sans 3 Variable'"
97411
+ },
97412
+ section: {
97413
+ fontFamily: "'Source Sans 3 Variable'"
97414
+ }
97361
97415
  }
97362
97416
  }
97363
97417
  }
97364
- }
97365
- }), cssResolver = (C) => ({
97418
+ };
97419
+ }, cssResolver = (C) => ({
97366
97420
  variables: {
97367
97421
  "--mantine-color-ctaPrimaryFill": C.other.ctaPrimaryFill,
97368
97422
  "--mantine-color-ctaPrimaryFillDarken": C.other.ctaPrimaryFillDarken,
@@ -97373,7 +97427,7 @@ ${M}`);
97373
97427
  },
97374
97428
  light: {},
97375
97429
  dark: {}
97376
- }), Wrapper = ({ children: C, root: R, themeColors: M }) => {
97430
+ }), Wrapper = ({ children: C, root: R, theme: M }) => {
97377
97431
  const D = reactExports.useMemo(
97378
97432
  () => theme(R, M),
97379
97433
  [R, M]
@@ -97410,7 +97464,7 @@ ${M}`);
97410
97464
  externalJWT: R,
97411
97465
  apiUrl: M,
97412
97466
  children: D,
97413
- themeColors: F,
97467
+ theme: F,
97414
97468
  display: H = "block"
97415
97469
  }) => {
97416
97470
  const U = reactExports.useRef(null), [q, G] = reactExports.useState(!1);
@@ -97447,60 +97501,57 @@ ${M}`);
97447
97501
  apiKey: C,
97448
97502
  externalJWT: R,
97449
97503
  apiUrl: M,
97450
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Wrapper, { root: U.current, themeColors: F, children: D })
97504
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Wrapper, { root: U.current, theme: F, children: D })
97451
97505
  }
97452
97506
  ) }) : null
97453
97507
  ] });
97454
97508
  }, InnerModal = ({
97455
- persist: C,
97456
- visible: R,
97457
- onClose: M,
97458
- showRecentDashboards: D,
97459
- showRecommendations: F
97509
+ onClose: C,
97510
+ showRecentDashboards: R,
97511
+ showRecommendations: M
97460
97512
  }) => {
97461
- const H = useAtomValue(flowIdAtom), U = useAtomValue(activeModalAtom), q = useSetAtom(persistenceAtom);
97462
- reactExports.useEffect(() => {
97463
- q(C);
97464
- }, [C, q]);
97465
- const G = !!H, Z = G && U === "flow", Y = G && U === "exploreData", Q = !(Z || Y);
97513
+ const D = useAtomValue(flowIdAtom), F = useAtomValue(activeModalAtom), H = !!D, U = H && F === "flow", q = H && F === "exploreData", G = !(U || q);
97466
97514
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(AnimatePresence, { mode: "wait", children: [
97467
- Y && /* @__PURE__ */ jsxRuntimeExports.jsx(ExploreDataModal, {}),
97468
- Z && /* @__PURE__ */ jsxRuntimeExports.jsx(FlowModal, {}),
97469
- Q && /* @__PURE__ */ jsxRuntimeExports.jsx(
97515
+ q && /* @__PURE__ */ jsxRuntimeExports.jsx(ExploreDataModal, {}),
97516
+ U && /* @__PURE__ */ jsxRuntimeExports.jsx(FlowModal, {}),
97517
+ G && /* @__PURE__ */ jsxRuntimeExports.jsx(
97470
97518
  StartModal,
97471
97519
  {
97472
- showRecentDashboards: D !== void 0 ? D : !1,
97473
- showRecommendations: F !== void 0 ? F : !1,
97474
- visible: R,
97475
- onClose: M
97520
+ showRecentDashboards: R !== void 0 ? R : !1,
97521
+ showRecommendations: M !== void 0 ? M : !1,
97522
+ onClose: C
97476
97523
  }
97477
97524
  )
97478
- ] }, H);
97525
+ ] }, D);
97479
97526
  }, MainModal = ({
97480
97527
  apiKey: C,
97481
97528
  externalJWT: R,
97482
97529
  apiUrl: M,
97483
- persist: D = "none",
97484
- modal: F = void 0,
97485
- startOptions: H = void 0,
97486
- themeColors: U = void 0
97530
+ display: D = "contents",
97531
+ persist: F = "none",
97532
+ modal: H = void 0,
97533
+ startOptions: U = void 0,
97534
+ theme: q = void 0
97487
97535
  }) => {
97488
- const q = (F == null ? void 0 : F.visible) === !0 || F == null;
97536
+ const G = useSetAtom(persistenceAtom);
97537
+ reactExports.useEffect(() => {
97538
+ G(F);
97539
+ }, [F, G]);
97540
+ const Z = (H == null ? void 0 : H.visible) === !0 || H === void 0;
97489
97541
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
97490
97542
  AppWrapper,
97491
97543
  {
97492
97544
  apiKey: C,
97493
97545
  externalJWT: R,
97494
97546
  apiUrl: M,
97495
- themeColors: U,
97496
- children: q && /* @__PURE__ */ jsxRuntimeExports.jsx(
97547
+ theme: q,
97548
+ display: D,
97549
+ children: Z && /* @__PURE__ */ jsxRuntimeExports.jsx(
97497
97550
  InnerModal,
97498
97551
  {
97499
- persist: D,
97500
- visible: q,
97501
- onClose: F == null ? void 0 : F.onClose,
97502
- showRecentDashboards: H == null ? void 0 : H.showRecentDashboards,
97503
- showRecommendations: H == null ? void 0 : H.showRecommendations
97552
+ onClose: H == null ? void 0 : H.onClose,
97553
+ showRecentDashboards: U == null ? void 0 : U.showRecentDashboards,
97554
+ showRecommendations: U == null ? void 0 : U.showRecommendations
97504
97555
  }
97505
97556
  )
97506
97557
  }
@@ -97521,6 +97572,7 @@ ${M}`);
97521
97572
  customElements.get("magemetrics-ai") || customElements.define("magemetrics-ai", MagemetricsAI);
97522
97573
  };
97523
97574
  export {
97575
+ colorsTuple as a,
97524
97576
  createMagemetrics as c,
97525
97577
  getDefaultExportFromCjs as g,
97526
97578
  logout as l