@bikdotai/bik-component-library 0.0.832-beta.0 → 0.0.832-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
  4. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/MentionPicker.js +11 -4
  6. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  8. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  10. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/utils/toolActions.js +1 -1
  12. package/dist/cjs/components/agent-builder/utils/toolActions.js.map +1 -1
  13. package/dist/cjs/icons/Social/Channels/EmailMarketingV2.js +2 -0
  14. package/dist/cjs/icons/Social/Channels/EmailMarketingV2.js.map +1 -0
  15. package/dist/cjs/icons/Social/Channels/EmailV2.js +2 -0
  16. package/dist/cjs/icons/Social/Channels/EmailV2.js.map +1 -0
  17. package/dist/cjs/icons/Social/Channels/FacebookCommentV2.js +2 -0
  18. package/dist/cjs/icons/Social/Channels/FacebookCommentV2.js.map +1 -0
  19. package/dist/cjs/icons/Social/Channels/FacebookV2.js +2 -0
  20. package/dist/cjs/icons/Social/Channels/FacebookV2.js.map +1 -0
  21. package/dist/cjs/icons/Social/Channels/GmailV2.js +2 -0
  22. package/dist/cjs/icons/Social/Channels/GmailV2.js.map +1 -0
  23. package/dist/cjs/icons/Social/Channels/InstagramCommentV2.js +2 -0
  24. package/dist/cjs/icons/Social/Channels/InstagramCommentV2.js.map +1 -0
  25. package/dist/cjs/icons/Social/Channels/InstagramV2.js +2 -0
  26. package/dist/cjs/icons/Social/Channels/InstagramV2.js.map +1 -0
  27. package/dist/cjs/icons/Social/Channels/MessengerV2.js +2 -0
  28. package/dist/cjs/icons/Social/Channels/MessengerV2.js.map +1 -0
  29. package/dist/cjs/icons/Social/Channels/PhoneV2.js +2 -0
  30. package/dist/cjs/icons/Social/Channels/PhoneV2.js.map +1 -0
  31. package/dist/cjs/icons/Social/Channels/RcsV2.js +2 -0
  32. package/dist/cjs/icons/Social/Channels/RcsV2.js.map +1 -0
  33. package/dist/cjs/icons/Social/Channels/SmsV2.js +2 -0
  34. package/dist/cjs/icons/Social/Channels/SmsV2.js.map +1 -0
  35. package/dist/cjs/icons/Social/Channels/TaskV2.js +2 -0
  36. package/dist/cjs/icons/Social/Channels/TaskV2.js.map +1 -0
  37. package/dist/cjs/icons/Social/Channels/WebpushV2.js +2 -0
  38. package/dist/cjs/icons/Social/Channels/WebpushV2.js.map +1 -0
  39. package/dist/cjs/icons/Social/Channels/WhatsAppCallV2.js +2 -0
  40. package/dist/cjs/icons/Social/Channels/WhatsAppCallV2.js.map +1 -0
  41. package/dist/cjs/icons/Social/Channels/WhatsAppV2.js +2 -0
  42. package/dist/cjs/icons/Social/Channels/WhatsAppV2.js.map +1 -0
  43. package/dist/cjs/icons/index.js +1 -1
  44. package/dist/esm/components/agent-builder/AgentBuilder.js +91 -87
  45. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  46. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +25 -1
  47. package/dist/esm/components/agent-builder/components/MentionField.js +56 -44
  48. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
  49. package/dist/esm/components/agent-builder/components/MentionPicker.js +135 -116
  50. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  51. package/dist/esm/components/agent-builder/constants/tools.d.ts +25 -1
  52. package/dist/esm/components/agent-builder/constants/tools.js +20 -12
  53. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  54. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +10 -0
  55. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +129 -123
  56. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  57. package/dist/esm/components/agent-builder/utils/toolActions.d.ts +1 -1
  58. package/dist/esm/components/agent-builder/utils/toolActions.js +13 -9
  59. package/dist/esm/components/agent-builder/utils/toolActions.js.map +1 -1
  60. package/dist/esm/icons/Social/Channels/EmailMarketingV2.d.ts +6 -0
  61. package/dist/esm/icons/Social/Channels/EmailMarketingV2.js +41 -0
  62. package/dist/esm/icons/Social/Channels/EmailMarketingV2.js.map +1 -0
  63. package/dist/esm/icons/Social/Channels/EmailV2.d.ts +6 -0
  64. package/dist/esm/icons/Social/Channels/EmailV2.js +30 -0
  65. package/dist/esm/icons/Social/Channels/EmailV2.js.map +1 -0
  66. package/dist/esm/icons/Social/Channels/FacebookCommentV2.d.ts +6 -0
  67. package/dist/esm/icons/Social/Channels/FacebookCommentV2.js +53 -0
  68. package/dist/esm/icons/Social/Channels/FacebookCommentV2.js.map +1 -0
  69. package/dist/esm/icons/Social/Channels/FacebookV2.d.ts +6 -0
  70. package/dist/esm/icons/Social/Channels/FacebookV2.js +28 -0
  71. package/dist/esm/icons/Social/Channels/FacebookV2.js.map +1 -0
  72. package/dist/esm/icons/Social/Channels/GmailV2.d.ts +6 -0
  73. package/dist/esm/icons/Social/Channels/GmailV2.js +30 -0
  74. package/dist/esm/icons/Social/Channels/GmailV2.js.map +1 -0
  75. package/dist/esm/icons/Social/Channels/InstagramCommentV2.d.ts +6 -0
  76. package/dist/esm/icons/Social/Channels/InstagramCommentV2.js +53 -0
  77. package/dist/esm/icons/Social/Channels/InstagramCommentV2.js.map +1 -0
  78. package/dist/esm/icons/Social/Channels/InstagramV2.d.ts +6 -0
  79. package/dist/esm/icons/Social/Channels/InstagramV2.js +39 -0
  80. package/dist/esm/icons/Social/Channels/InstagramV2.js.map +1 -0
  81. package/dist/esm/icons/Social/Channels/MessengerV2.d.ts +6 -0
  82. package/dist/esm/icons/Social/Channels/MessengerV2.js +28 -0
  83. package/dist/esm/icons/Social/Channels/MessengerV2.js.map +1 -0
  84. package/dist/esm/icons/Social/Channels/PhoneV2.d.ts +6 -0
  85. package/dist/esm/icons/Social/Channels/PhoneV2.js +30 -0
  86. package/dist/esm/icons/Social/Channels/PhoneV2.js.map +1 -0
  87. package/dist/esm/icons/Social/Channels/RcsV2.d.ts +6 -0
  88. package/dist/esm/icons/Social/Channels/RcsV2.js +30 -0
  89. package/dist/esm/icons/Social/Channels/RcsV2.js.map +1 -0
  90. package/dist/esm/icons/Social/Channels/SmsV2.d.ts +6 -0
  91. package/dist/esm/icons/Social/Channels/SmsV2.js +30 -0
  92. package/dist/esm/icons/Social/Channels/SmsV2.js.map +1 -0
  93. package/dist/esm/icons/Social/Channels/TaskV2.d.ts +6 -0
  94. package/dist/esm/icons/Social/Channels/TaskV2.js +37 -0
  95. package/dist/esm/icons/Social/Channels/TaskV2.js.map +1 -0
  96. package/dist/esm/icons/Social/Channels/WebpushV2.d.ts +6 -0
  97. package/dist/esm/icons/Social/Channels/WebpushV2.js +39 -0
  98. package/dist/esm/icons/Social/Channels/WebpushV2.js.map +1 -0
  99. package/dist/esm/icons/Social/Channels/WhatsAppCallV2.d.ts +6 -0
  100. package/dist/esm/icons/Social/Channels/WhatsAppCallV2.js +46 -0
  101. package/dist/esm/icons/Social/Channels/WhatsAppCallV2.js.map +1 -0
  102. package/dist/esm/icons/Social/Channels/WhatsAppV2.d.ts +6 -0
  103. package/dist/esm/icons/Social/Channels/WhatsAppV2.js +30 -0
  104. package/dist/esm/icons/Social/Channels/WhatsAppV2.js.map +1 -0
  105. package/dist/esm/icons/Social/Channels/index.d.ts +15 -0
  106. package/dist/esm/icons/index.d.ts +25 -25
  107. package/dist/esm/icons/index.js +484 -454
  108. package/dist/esm/icons/index.js.map +1 -1
  109. package/package.json +1 -1
@@ -1,34 +1,34 @@
1
1
  import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
2
  import { useState as l, useCallback as t } from "react";
3
- import { COLORS as ae } from "../../constants/Theme.js";
4
- import { BuilderRoot as re, Main as ie, Rail as se, Content as le, ContentCard as de, StepScroll as ce } from "./AgentBuilder.styled.js";
5
- import { AgentBuilderFooter as ue } from "./components/AgentBuilderFooter.js";
6
- import { AgentBuilderTopBar as ge } from "./components/AgentBuilderTopBar.js";
7
- import { DiscardModal as fe } from "./components/DiscardModal.js";
8
- import { GoLiveModal as he } from "./components/GoLiveModal.js";
9
- import { StepRail as me } from "./components/StepRail.js";
10
- import { UndoToast as pe } from "./components/UndoToast.js";
11
- import { AgentBuilderProvider as ve, useAgentBuilderContext as Se } from "./context/AgentBuilderContext.js";
12
- import { Step1About as be } from "./steps/Step1About.js";
13
- import { Step2WhenItStepsIn as Ce } from "./steps/Step2WhenItStepsIn.js";
14
- import { Step3HowItResponds as Ae } from "./steps/Step3HowItResponds.js";
15
- import { Step4HandoverRules as Le } from "./steps/Step4HandoverRules.js";
16
- import { Spinner as De } from "../spinner/Spinner.js";
17
- const Te = () => {
18
- const { activeStep: d } = Se();
3
+ import { COLORS as ie } from "../../constants/Theme.js";
4
+ import { BuilderRoot as se, Main as le, Rail as de, Content as ce, ContentCard as ue, StepScroll as ge } from "./AgentBuilder.styled.js";
5
+ import { AgentBuilderFooter as fe } from "./components/AgentBuilderFooter.js";
6
+ import { AgentBuilderTopBar as he } from "./components/AgentBuilderTopBar.js";
7
+ import { DiscardModal as me } from "./components/DiscardModal.js";
8
+ import { GoLiveModal as pe } from "./components/GoLiveModal.js";
9
+ import { StepRail as ve } from "./components/StepRail.js";
10
+ import { UndoToast as Se } from "./components/UndoToast.js";
11
+ import { AgentBuilderProvider as be, useAgentBuilderContext as Ce } from "./context/AgentBuilderContext.js";
12
+ import { Step1About as Ae } from "./steps/Step1About.js";
13
+ import { Step2WhenItStepsIn as Le } from "./steps/Step2WhenItStepsIn.js";
14
+ import { Step3HowItResponds as De } from "./steps/Step3HowItResponds.js";
15
+ import { Step4HandoverRules as Te } from "./steps/Step4HandoverRules.js";
16
+ import { Spinner as ye } from "../spinner/Spinner.js";
17
+ const Be = () => {
18
+ const { activeStep: d } = Ce();
19
19
  switch (d) {
20
20
  case "about":
21
- return /* @__PURE__ */ o(be, {});
21
+ return /* @__PURE__ */ o(Ae, {});
22
22
  case "trigger":
23
- return /* @__PURE__ */ o(Ce, {});
23
+ return /* @__PURE__ */ o(Le, {});
24
24
  case "response":
25
- return /* @__PURE__ */ o(Ae, {});
25
+ return /* @__PURE__ */ o(De, {});
26
26
  case "handover":
27
- return /* @__PURE__ */ o(Le, {});
27
+ return /* @__PURE__ */ o(Te, {});
28
28
  default:
29
29
  return null;
30
30
  }
31
- }, ye = (d) => {
31
+ }, Ge = (d) => {
32
32
  const {
33
33
  config: G,
34
34
  onChange: p,
@@ -40,46 +40,48 @@ const Te = () => {
40
40
  onTestAgent: g,
41
41
  onGoToDashboard: f,
42
42
  onCreateSubAgent: i,
43
- onFetchSubAgent: P,
44
- onUpdateSubAgent: I,
43
+ onFetchSubAgent: I,
44
+ onUpdateSubAgent: P,
45
45
  onImproveSubAgent: w,
46
46
  onImproveToolInstructions: M,
47
- ...k
47
+ onConnectIntegration: k,
48
+ ...R
48
49
  } = d, {
49
50
  value: h,
50
- activeStep: R,
51
- availableTools: x,
52
- availableSubAgents: j,
53
- availableIntents: H = [],
54
- availableModels: F = [],
55
- configToolTemplates: N,
56
- validation: O,
57
- applicationType: U,
58
- charLimits: z,
51
+ activeStep: x,
52
+ availableTools: j,
53
+ availableSubAgents: H,
54
+ availableIntents: F = [],
55
+ availableModels: N = [],
56
+ configToolTemplates: O,
57
+ integrationStatus: U,
58
+ validation: z,
59
+ applicationType: E,
60
+ charLimits: W,
59
61
  isSaving: b,
60
62
  isPublishing: C,
61
- isLoading: E,
62
- footerHint: W = "Changes don’t affect customers until you go live",
63
- disableStepNavigation: $,
63
+ isLoading: $,
64
+ footerHint: q = "Changes don’t affect customers until you go live",
65
+ disableStepNavigation: J,
64
66
  debugLog: A
65
- } = G, [q, a] = l(null), [L, D] = l(!1), [J, s] = l(!1), [T, y] = l(!1), e = t(
66
- (n, ...te) => {
67
- A && console.log(`[AgentBuilder] ${n}`, ...te);
67
+ } = G, [K, a] = l(null), [L, D] = l(!1), [Q, s] = l(!1), [T, y] = l(!1), e = t(
68
+ (n, ...re) => {
69
+ A && console.log(`[AgentBuilder] ${n}`, ...re);
68
70
  },
69
71
  [A]
70
- ), K = t(
72
+ ), V = t(
71
73
  (n) => {
72
74
  e("onChange", n), p(n);
73
75
  },
74
76
  [e, p]
75
- ), Q = t(
77
+ ), X = t(
76
78
  (n) => {
77
79
  e("onStepChange", n), c?.(n);
78
80
  },
79
81
  [e, c]
80
- ), V = t(() => (e("onSaveDraft"), r()), [e, r]), X = t(() => (e("onPublish"), S()), [e, S]), Y = t(() => {
82
+ ), Y = t(() => (e("onSaveDraft"), r()), [e, r]), Z = t(() => (e("onPublish"), S()), [e, S]), _ = t(() => {
81
83
  e("onBack"), s(!0);
82
- }, [e]), Z = t(() => {
84
+ }, [e]), ee = t(() => {
83
85
  e("onDiscardAndLeave"), s(!1), v();
84
86
  }, [e, v]), B = t(async () => {
85
87
  e("onSaveDraftAndLeave");
@@ -93,16 +95,16 @@ const Te = () => {
93
95
  }
94
96
  }
95
97
  s(!1), u?.();
96
- }, [e, r, u]), _ = t(() => {
98
+ }, [e, r, u]), ne = t(() => {
97
99
  e("onTestAgent"), g?.();
98
- }, [e, g]), ee = t(() => {
100
+ }, [e, g]), oe = t(() => {
99
101
  e("onGoToDashboard"), f?.();
100
- }, [e, f]), ne = t(
102
+ }, [e, f]), te = t(
101
103
  (n) => (e("onCreateSubAgent", n), i ? i(n) : Promise.reject(new Error("onCreateSubAgent not provided"))),
102
104
  [e, i]
103
- ), oe = async () => {
105
+ ), ae = async () => {
104
106
  e("onGoLiveConfirm");
105
- const n = X();
107
+ const n = Z();
106
108
  if (n && typeof n.then == "function") {
107
109
  D(!0);
108
110
  try {
@@ -114,40 +116,42 @@ const Te = () => {
114
116
  a("success");
115
117
  };
116
118
  return /* @__PURE__ */ o(
117
- ve,
119
+ be,
118
120
  {
119
121
  value: h,
120
- onChange: K,
121
- activeStep: R,
122
- onStepChange: c ? Q : void 0,
123
- availableTools: x,
124
- availableSubAgents: j,
125
- availableIntents: H,
126
- availableModels: F,
127
- configToolTemplates: N,
128
- validation: O,
129
- applicationType: U,
130
- charLimits: z,
131
- disableStepNavigation: $,
132
- onCreateSubAgent: i ? ne : void 0,
133
- onFetchSubAgent: P,
134
- onUpdateSubAgent: I,
122
+ onChange: V,
123
+ activeStep: x,
124
+ onStepChange: c ? X : void 0,
125
+ availableTools: j,
126
+ availableSubAgents: H,
127
+ availableIntents: F,
128
+ availableModels: N,
129
+ configToolTemplates: O,
130
+ integrationStatus: U,
131
+ onConnectIntegration: k,
132
+ validation: z,
133
+ applicationType: E,
134
+ charLimits: W,
135
+ disableStepNavigation: J,
136
+ onCreateSubAgent: i ? te : void 0,
137
+ onFetchSubAgent: I,
138
+ onUpdateSubAgent: P,
135
139
  onImproveSubAgent: w,
136
140
  onImproveToolInstructions: M,
137
- children: /* @__PURE__ */ m(re, { "data-test": k["data-test"] ?? "agent-builder", children: [
141
+ children: /* @__PURE__ */ m(se, { "data-test": R["data-test"] ?? "agent-builder", children: [
138
142
  /* @__PURE__ */ o(
139
- ge,
143
+ he,
140
144
  {
141
145
  name: h.name,
142
146
  status: h.status,
143
- onBack: u ? Y : void 0,
147
+ onBack: u ? _ : void 0,
144
148
  onSaveDraft: B,
145
149
  isSaving: b || T
146
150
  }
147
151
  ),
148
- /* @__PURE__ */ m(ie, { children: [
149
- /* @__PURE__ */ o(se, { children: /* @__PURE__ */ o(me, {}) }),
150
- /* @__PURE__ */ o(le, { children: E ? /* @__PURE__ */ o(
152
+ /* @__PURE__ */ m(le, { children: [
153
+ /* @__PURE__ */ o(de, { children: /* @__PURE__ */ o(ve, {}) }),
154
+ /* @__PURE__ */ o(ce, { children: $ ? /* @__PURE__ */ o(
151
155
  "div",
152
156
  {
153
157
  style: {
@@ -156,15 +160,15 @@ const Te = () => {
156
160
  justifyContent: "center",
157
161
  height: "100%"
158
162
  },
159
- children: /* @__PURE__ */ o(De, { size: "large", color: ae.stroke.brand })
163
+ children: /* @__PURE__ */ o(ye, { size: "large", color: ie.stroke.brand })
160
164
  }
161
- ) : /* @__PURE__ */ m(de, { children: [
162
- /* @__PURE__ */ o(ce, { children: /* @__PURE__ */ o(Te, {}) }),
165
+ ) : /* @__PURE__ */ m(ue, { children: [
166
+ /* @__PURE__ */ o(ge, { children: /* @__PURE__ */ o(Be, {}) }),
163
167
  /* @__PURE__ */ o(
164
- ue,
168
+ fe,
165
169
  {
166
- footerHint: W,
167
- onTestAgent: g ? _ : void 0,
170
+ footerHint: q,
171
+ onTestAgent: g ? ne : void 0,
168
172
  onGoLive: () => {
169
173
  e("onGoLive"), a("confirm");
170
174
  },
@@ -174,35 +178,35 @@ const Te = () => {
174
178
  ] }) })
175
179
  ] }),
176
180
  /* @__PURE__ */ o(
177
- he,
181
+ pe,
178
182
  {
179
- mode: q,
183
+ mode: K,
180
184
  onClose: () => a(null),
181
- onConfirm: oe,
185
+ onConfirm: ae,
182
186
  onSaveDraft: () => {
183
- a(null), V();
187
+ a(null), Y();
184
188
  },
185
- onGoToDashboard: f ? ee : void 0,
189
+ onGoToDashboard: f ? oe : void 0,
186
190
  isPublishing: C || L
187
191
  }
188
192
  ),
189
193
  /* @__PURE__ */ o(
190
- fe,
194
+ me,
191
195
  {
192
- open: J,
196
+ open: Q,
193
197
  onClose: () => s(!1),
194
- onDiscard: Z,
198
+ onDiscard: ee,
195
199
  onSaveDraft: B,
196
200
  isSaving: b || T
197
201
  }
198
202
  ),
199
- /* @__PURE__ */ o(pe, {})
203
+ /* @__PURE__ */ o(Se, {})
200
204
  ] })
201
205
  }
202
206
  );
203
207
  };
204
- ye.displayName = "AgentBuilder";
208
+ Ge.displayName = "AgentBuilder";
205
209
  export {
206
- ye as AgentBuilder
210
+ Ge as AgentBuilder
207
211
  };
208
212
  //# sourceMappingURL=AgentBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(() => {\n\t\tlogAction('onTestAgent');\n\t\tonTestAgent?.();\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => setModalMode(null)}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+BAAQE,IAAA,EAAW;AAAA,IACpB,KAAK;AACJ,+BAAQC,IAAA,EAAm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,YACb,UAAU3B,KAAYa;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBoC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEA3E,GAAa,cAAc;"}
1
+ {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tonConnectIntegration,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(() => {\n\t\tlogAction('onTestAgent');\n\t\tonTestAgent?.();\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => setModalMode(null)}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAwB,MAAM;AAC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BzC,IAAkBgD,KAAsB;AAAA,YACzD,cAAc7B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAAyB;AAAA,UAACc;AAAA,UAAA;AAAA,YACA,MAAMrC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,UAAU3B,KAAYa;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBoC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEA7E,GAAa,cAAc;"}
@@ -1,6 +1,7 @@
1
1
  import { AgentConfig, AgentHandoverConfig, AgentToolDoc, IntentOption, ModelOption, StepKey, StepValidation, SubAgentRef, Trigger } from '@bikdotai/bik-models/ai-agents';
2
2
  import { ApplicationType } from '@bikdotai/bik-models/growth';
3
3
  import { AgentCharLimits } from './constants/charLimits';
4
+ import { ConfigToolKey, ToolSource } from './constants/tools';
4
5
  /**
5
6
  * Agent DATA models live in `@bikdotai/bik-models/ai-agents`. The library uses a
6
7
  * few friendlier aliases for its UI:
@@ -94,6 +95,13 @@ export interface CatalogTool {
94
95
  configurable: boolean;
95
96
  /** Blank template form; present only when configurable. */
96
97
  params?: ParamsBlob;
98
+ /**
99
+ * Backend-derived (read-only): true when this tool is backed by a third-party
100
+ * integration the store must connect before use (today: `send_slack_message`).
101
+ * The consumer combines this with the store's connection status to gate the
102
+ * picker's "Connect" affordance.
103
+ */
104
+ integration?: boolean;
97
105
  }
98
106
  /** A per-store configured tool instance (`list-agent-tools` / `create-tool`). */
99
107
  export interface CustomTool {
@@ -121,7 +129,7 @@ export interface CustomTool {
121
129
  * how the consumer persists it). Rest API is deliberately NOT here: it keeps its
122
130
  * own bespoke drawer.
123
131
  */
124
- export type ConfigToolKey = 'send_email' | 'send_slack_message';
132
+ export type { ConfigToolKey };
125
133
  /**
126
134
  * A configured instance of a shared-drawer tool (email / Slack). The form is
127
135
  * DYNAMIC — its fields are the backend template (`CatalogTool.params`) for
@@ -178,6 +186,15 @@ export interface AgentBuilderConfig {
178
186
  * only ever come from the backend.
179
187
  */
180
188
  configToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;
189
+ /**
190
+ * Per-source integration connection state, keyed by {@link ToolSource}. Map a
191
+ * source to `false` (e.g. `{ slack: false }`) to make the `@` picker show a
192
+ * "Connect" row for it instead of drilling in; `true`/absent renders normally.
193
+ * The consumer computes this from the backend `CatalogTool.integration` flag +
194
+ * the store's connection status, and drives the connect flow via
195
+ * {@link AgentBuilderProps.onConnectIntegration}.
196
+ */
197
+ integrationStatus?: Partial<Record<ToolSource, boolean>>;
181
198
  /** Host application context the merchant runs in (e.g. ApplicationType.MANIFEST). */
182
199
  applicationType?: ApplicationType;
183
200
  /** Optional consumer-supplied validity; merged over the builder's derived validity. */
@@ -257,6 +274,13 @@ export interface AgentBuilderProps {
257
274
  * hide the button in both drawers.
258
275
  */
259
276
  onImproveToolInstructions?: (text: string) => Promise<string>;
277
+ /**
278
+ * Open the consumer's connect flow for an unconnected integration source (the
279
+ * picker's "Connect" row — see {@link AgentBuilderConfig.integrationStatus}).
280
+ * The consumer drives all connect / status APIs; on success it should refresh
281
+ * `integrationStatus` so the source unblocks.
282
+ */
283
+ onConnectIntegration?: (source: ToolSource) => void;
260
284
  /** Test id applied to the builder root for e2e/component tests. */
261
285
  'data-test'?: string;
262
286
  }
@@ -1,39 +1,41 @@
1
- import { jsx as h } from "react/jsx-runtime";
2
- import { useMemo as c, useCallback as u } from "react";
3
- import { useAgentBuilderContext as q } from "../context/AgentBuilderContext.js";
4
- import { buildAgentMentionItems as R, appTypeLabel as j, buildCustomToolMentionItems as k } from "../utils/mentionSerialization.js";
5
- import { buildToolActions as B } from "../utils/toolActions.js";
6
- import { MentionEditor as E } from "./MentionEditor.js";
7
- const H = ({
1
+ import { jsx as R } from "react/jsx-runtime";
2
+ import { useMemo as p, useCallback as g } from "react";
3
+ import { useAgentBuilderContext as j } from "../context/AgentBuilderContext.js";
4
+ import { buildAgentMentionItems as k, appTypeLabel as B, buildCustomToolMentionItems as E } from "../utils/mentionSerialization.js";
5
+ import { buildToolActions as L } from "../utils/toolActions.js";
6
+ import { MentionEditor as w } from "./MentionEditor.js";
7
+ const N = ({
8
8
  fieldKey: o,
9
- label: p,
10
- placeholder: g,
11
- maxLength: T,
12
- minHeight: b,
13
- ...A
9
+ label: T,
10
+ placeholder: b,
11
+ maxLength: A,
12
+ minHeight: d,
13
+ ...C
14
14
  }) => {
15
15
  const {
16
16
  value: t,
17
- patch: d,
17
+ patch: M,
18
18
  addReference: s,
19
19
  availableTools: n,
20
20
  availableSubAgents: i,
21
21
  applicationType: r,
22
- mentionResetKey: M,
22
+ mentionResetKey: f,
23
23
  registerMentionField: a,
24
- notifyMentionFocus: C,
25
- onCreateSubAgent: f,
26
- requestCreateSubAgent: v,
24
+ notifyMentionFocus: S,
25
+ onCreateSubAgent: v,
26
+ requestCreateSubAgent: I,
27
27
  requestToolAction: l,
28
- configToolTemplates: m
29
- } = q(), S = c(
28
+ configToolTemplates: c,
29
+ integrationStatus: m,
30
+ onConnectIntegration: u
31
+ } = j(), F = p(
30
32
  () => [
31
- ...R(
33
+ ...k(
32
34
  n,
33
35
  i,
34
- j(r)
36
+ B(r)
35
37
  ),
36
- ...k(t.configTools, t.restApiTools)
38
+ ...E(t.configTools, t.restApiTools)
37
39
  ],
38
40
  [
39
41
  n,
@@ -42,38 +44,48 @@ const H = ({
42
44
  t.configTools,
43
45
  t.restApiTools
44
46
  ]
45
- ), F = c(
46
- () => B(m, l),
47
- [l, m]
48
- ), I = u(
47
+ ), x = p(
48
+ () => L(
49
+ c,
50
+ l,
51
+ m,
52
+ u
53
+ ),
54
+ [
55
+ l,
56
+ c,
57
+ m,
58
+ u
59
+ ]
60
+ ), $ = g(
49
61
  (e) => a(o, e),
50
62
  [a, o]
51
- ), x = u(
52
- (e, $) => s(e, $),
63
+ ), h = g(
64
+ (e, q) => s(e, q),
53
65
  [s]
54
66
  );
55
- return /* @__PURE__ */ h(
56
- E,
67
+ return /* @__PURE__ */ R(
68
+ w,
57
69
  {
58
- label: p,
70
+ label: T,
59
71
  value: t[o] ?? "",
60
- onChange: (e) => d({ [o]: e }),
61
- maxLength: T,
62
- placeholder: g,
63
- minHeight: b,
64
- resetKey: `${t.id}:${o}:${M}`,
65
- mentionItems: S,
72
+ onChange: (e) => M({ [o]: e }),
73
+ maxLength: A,
74
+ placeholder: b,
75
+ minHeight: d,
76
+ resetKey: `${t.id}:${o}:${f}`,
77
+ mentionItems: F,
66
78
  tools: n,
67
- onMentionSelect: x,
68
- onFocus: () => C(o),
69
- registerInsert: I,
70
- onCreateSubAgent: f ? v : void 0,
71
- toolActions: F,
72
- "data-test": A["data-test"]
79
+ onMentionSelect: h,
80
+ onFocus: () => S(o),
81
+ registerInsert: $,
82
+ onCreateSubAgent: v ? I : void 0,
83
+ toolActions: x,
84
+ "data-test": C["data-test"]
73
85
  }
74
86
  );
75
87
  };
76
88
  export {
77
- H as MentionField
89
+ N as MentionField
78
90
  };
79
91
  //# sourceMappingURL=MentionField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MentionField.js","sources":["../../../../../src/components/agent-builder/components/MentionField.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { AgentValue } from '../AgentBuilder.model';\nimport { ToolAction } from '../constants/tools';\nimport {\n\tMentionFieldKey,\n\tuseAgentBuilderContext,\n} from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n} from '../utils/mentionSerialization';\nimport { buildToolActions } from '../utils/toolActions';\nimport { MentionEditor } from './MentionEditor';\n\ninterface MentionFieldProps {\n\t/** Which AgentValue field this editor reads / writes. */\n\tfieldKey: MentionFieldKey;\n\tlabel: string;\n\tplaceholder?: string;\n\tmaxLength: number;\n\tminHeight?: string;\n\t'data-test'?: string;\n}\n\n/**\n * Context-bound {@link MentionEditor} for the builder's Step-3 Instructions /\n * Guardrails. Both `@` tools and sub-agents are offered; the field registers its\n * insert + focus with the context so side-panel adds drop a chip into whichever\n * field was last focused, and remounts on `mentionResetKey`.\n */\nexport const MentionField: React.FC<MentionFieldProps> = ({\n\tfieldKey,\n\tlabel,\n\tplaceholder,\n\tmaxLength,\n\tminHeight,\n\t...rest\n}) => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\taddReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tapplicationType,\n\t\tmentionResetKey,\n\t\tregisterMentionField,\n\t\tnotifyMentionFocus,\n\t\tonCreateSubAgent,\n\t\trequestCreateSubAgent,\n\t\trequestToolAction,\n\t\tconfigToolTemplates,\n\t} = useAgentBuilderContext();\n\n\t// Catalog tools + sub-agents, PLUS the inline custom tools (Rest API / email /\n\t// Slack) so their `{{tool:<id>}}` tokens rehydrate as chips on remount — they\n\t// live on the value, not in `availableTools`.\n\tconst mentionItems = useMemo(\n\t\t() => [\n\t\t\t...buildAgentMentionItems(\n\t\t\t\tavailableTools,\n\t\t\t\tavailableSubAgents,\n\t\t\t\tappTypeLabel(applicationType),\n\t\t\t),\n\t\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t\t],\n\t\t[\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tapplicationType,\n\t\t\tvalue.configTools,\n\t\t\tvalue.restApiTools,\n\t\t],\n\t);\n\n\t// Built-in tool actions (Rest API / email / Slack) shown in the `@` picker's\n\t// Tools view — picking one opens its drawer (Step 3) instead of inserting text.\n\t// The shared email / Slack forms are backend-driven: each is offered only when\n\t// its template was provided.\n\tconst toolActions = useMemo<ToolAction[]>(\n\t\t() => buildToolActions(configToolTemplates, requestToolAction),\n\t\t[requestToolAction, configToolTemplates],\n\t);\n\n\tconst registerInsert = useCallback(\n\t\t(fn: Parameters<typeof registerMentionField>[1]) =>\n\t\t\tregisterMentionField(fieldKey, fn),\n\t\t[registerMentionField, fieldKey],\n\t);\n\n\t// Route through the context's ref-backed `addReference`: BikEditor captures\n\t// this handler at mount, so reading `value.tools` here would keep only the last\n\t// pick. `addReference` always appends against the latest lists.\n\tconst onMentionSelect = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => addReference(kind, id),\n\t\t[addReference],\n\t);\n\n\treturn (\n\t\t<MentionEditor\n\t\t\tlabel={label}\n\t\t\tvalue={(value[fieldKey] as string | undefined) ?? ''}\n\t\t\tonChange={(text) => patch({ [fieldKey]: text } as Partial<AgentValue>)}\n\t\t\tmaxLength={maxLength}\n\t\t\tplaceholder={placeholder}\n\t\t\tminHeight={minHeight}\n\t\t\tresetKey={`${value.id}:${fieldKey}:${mentionResetKey}`}\n\t\t\tmentionItems={mentionItems}\n\t\t\ttools={availableTools}\n\t\t\tonMentionSelect={onMentionSelect}\n\t\t\tonFocus={() => notifyMentionFocus(fieldKey)}\n\t\t\tregisterInsert={registerInsert}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? requestCreateSubAgent : undefined}\n\t\t\ttoolActions={toolActions}\n\t\t\tdata-test={rest['data-test']}\n\t\t/>\n\t);\n};\n"],"names":["MentionField","fieldKey","label","placeholder","maxLength","minHeight","rest","value","patch","addReference","availableTools","availableSubAgents","applicationType","mentionResetKey","registerMentionField","notifyMentionFocus","onCreateSubAgent","requestCreateSubAgent","requestToolAction","configToolTemplates","useAgentBuilderContext","mentionItems","useMemo","buildAgentMentionItems","appTypeLabel","buildCustomToolMentionItems","toolActions","buildToolActions","registerInsert","useCallback","fn","onMentionSelect","kind","id","jsx","MentionEditor","text"],"mappings":";;;;;;AA+BO,MAAMA,IAA4C,CAAC;AAAA,EACzD,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAM;AAAA,IACL,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;A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;AAAA,MACA,kBAAkBZ,IAAmBC,IAAwB;AAAA,MAC7D,aAAAS;AAAA,MACA,aAAWpB,EAAK,WAAW;AAAA,IAAA;AAAA,EAAA;AAG9B;"}
1
+ {"version":3,"file":"MentionField.js","sources":["../../../../../src/components/agent-builder/components/MentionField.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { AgentValue } from '../AgentBuilder.model';\nimport { ToolAction } from '../constants/tools';\nimport {\n\tMentionFieldKey,\n\tuseAgentBuilderContext,\n} from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n} from '../utils/mentionSerialization';\nimport { buildToolActions } from '../utils/toolActions';\nimport { MentionEditor } from './MentionEditor';\n\ninterface MentionFieldProps {\n\t/** Which AgentValue field this editor reads / writes. */\n\tfieldKey: MentionFieldKey;\n\tlabel: string;\n\tplaceholder?: string;\n\tmaxLength: number;\n\tminHeight?: string;\n\t'data-test'?: string;\n}\n\n/**\n * Context-bound {@link MentionEditor} for the builder's Step-3 Instructions /\n * Guardrails. Both `@` tools and sub-agents are offered; the field registers its\n * insert + focus with the context so side-panel adds drop a chip into whichever\n * field was last focused, and remounts on `mentionResetKey`.\n */\nexport const MentionField: React.FC<MentionFieldProps> = ({\n\tfieldKey,\n\tlabel,\n\tplaceholder,\n\tmaxLength,\n\tminHeight,\n\t...rest\n}) => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\taddReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tapplicationType,\n\t\tmentionResetKey,\n\t\tregisterMentionField,\n\t\tnotifyMentionFocus,\n\t\tonCreateSubAgent,\n\t\trequestCreateSubAgent,\n\t\trequestToolAction,\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t} = useAgentBuilderContext();\n\n\t// Catalog tools + sub-agents, PLUS the inline custom tools (Rest API / email /\n\t// Slack) so their `{{tool:<id>}}` tokens rehydrate as chips on remount — they\n\t// live on the value, not in `availableTools`.\n\tconst mentionItems = useMemo(\n\t\t() => [\n\t\t\t...buildAgentMentionItems(\n\t\t\t\tavailableTools,\n\t\t\t\tavailableSubAgents,\n\t\t\t\tappTypeLabel(applicationType),\n\t\t\t),\n\t\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t\t],\n\t\t[\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tapplicationType,\n\t\t\tvalue.configTools,\n\t\t\tvalue.restApiTools,\n\t\t],\n\t);\n\n\t// Built-in tool actions (Rest API / email / Slack) shown in the `@` picker's\n\t// Tools view — picking one opens its drawer (Step 3) instead of inserting text.\n\t// The shared email / Slack forms are backend-driven: each is offered only when\n\t// its template was provided.\n\tconst toolActions = useMemo<ToolAction[]>(\n\t\t() =>\n\t\t\tbuildToolActions(\n\t\t\t\tconfigToolTemplates,\n\t\t\t\trequestToolAction,\n\t\t\t\tintegrationStatus,\n\t\t\t\tonConnectIntegration,\n\t\t\t),\n\t\t[\n\t\t\trequestToolAction,\n\t\t\tconfigToolTemplates,\n\t\t\tintegrationStatus,\n\t\t\tonConnectIntegration,\n\t\t],\n\t);\n\n\tconst registerInsert = useCallback(\n\t\t(fn: Parameters<typeof registerMentionField>[1]) =>\n\t\t\tregisterMentionField(fieldKey, fn),\n\t\t[registerMentionField, fieldKey],\n\t);\n\n\t// Route through the context's ref-backed `addReference`: BikEditor captures\n\t// this handler at mount, so reading `value.tools` here would keep only the last\n\t// pick. `addReference` always appends against the latest lists.\n\tconst onMentionSelect = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => addReference(kind, id),\n\t\t[addReference],\n\t);\n\n\treturn (\n\t\t<MentionEditor\n\t\t\tlabel={label}\n\t\t\tvalue={(value[fieldKey] as string | undefined) ?? ''}\n\t\t\tonChange={(text) => patch({ [fieldKey]: text } as Partial<AgentValue>)}\n\t\t\tmaxLength={maxLength}\n\t\t\tplaceholder={placeholder}\n\t\t\tminHeight={minHeight}\n\t\t\tresetKey={`${value.id}:${fieldKey}:${mentionResetKey}`}\n\t\t\tmentionItems={mentionItems}\n\t\t\ttools={availableTools}\n\t\t\tonMentionSelect={onMentionSelect}\n\t\t\tonFocus={() => notifyMentionFocus(fieldKey)}\n\t\t\tregisterInsert={registerInsert}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? requestCreateSubAgent : undefined}\n\t\t\ttoolActions={toolActions}\n\t\t\tdata-test={rest['data-test']}\n\t\t/>\n\t);\n};\n"],"names":["MentionField","fieldKey","label","placeholder","maxLength","minHeight","rest","value","patch","addReference","availableTools","availableSubAgents","applicationType","mentionResetKey","registerMentionField","notifyMentionFocus","onCreateSubAgent","requestCreateSubAgent","requestToolAction","configToolTemplates","integrationStatus","onConnectIntegration","useAgentBuilderContext","mentionItems","useMemo","buildAgentMentionItems","appTypeLabel","buildCustomToolMentionItems","toolActions","buildToolActions","registerInsert","useCallback","fn","onMentionSelect","kind","id","jsx","MentionEditor","text"],"mappings":";;;;;;AA+BO,MAAMA,IAA4C,CAAC;AAAA,EACzD,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAAM;AACL,QAAM;AAAA,IACL,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,sBAAAC;AAAA,EAAA,IACGC,EAAA,GAKEC,IAAeC;AAAA,IACpB,MAAM;AAAA,MACL,GAAGC;AAAA,QACFf;AAAA,QACAC;AAAA,QACAe,EAAad,CAAe;AAAA,MAAA;AAAA,MAE7B,GAAGe,EAA4Bp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